Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (9379b403235df8da3ccc4e13e68baceb16e6f77e)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (9379b403235df8da3ccc4e13e68baceb16e6f77e)
  • Date: Mon, 22 Dec 2014 16:50:22 -0600

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

var/lib/sorcery/modules/libcodex | 42
+++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 15 deletions(-)

New commits:
commit 9379b403235df8da3ccc4e13e68baceb16e6f77e
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

libcodex: Faster indexing of versions

diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index 03727a8..07e2624 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -960,21 +960,33 @@ function codex_create_keyword_cache () { (
## Multiversioned spells will a dummy entry. Persistent
## variables are ignored.
#---------------------------------------------------------------------
-function codex_create_version_cache () { (
- grimoire="$1"
-
- for file in $(codex_find_in_grimoire "$grimoire" DETAILS); do
- codex_get_spell_paths ${file%/DETAILS}
- source "$file" &> /dev/null
- if [[ $(grep -c "^[[:space:]]*VERSION=" "$file") == 1 ]]; then
- echo "$SPELL ${VERSION:-0} ${PATCHLEVEL:-0} ${SECURITY_PATCH:-0}
${UPDATED:-0}"
- else
- # multiversioned or unusually formatted spell - add a dummy entry
- echo "$SPELL multiversioned"
- fi
- unset SPELL VERSION PATCHLEVEL SECURITY_PATCH UPDATED
- done | sort > $grimoire/$VERSION_INDEX_FILE
-) }
+function codex_create_version_cache () {
+ xargs < <(codex_find_in_grimoire "$1" DETAILS) \
+ awk -F"[\"'= ]+" '
+ function p(v) { return v in f ? f[v] : 0 }
+ { sub(/^[\t ]+/, "") }
+ /^cat[^0-9A-Za-z]/ {
+ print p("VERSION"), p("PATCHLEVEL"), p("SECURITY_PATCH"),
+ p("UPDATED")
+ split("", f)
+ nextfile
+ }
+ $1 == "SPELL" {
+ printf "%s ", $2
+ next
+ }
+ $1 == "VERSION" && "VERSION" in f {
+ print "multiversioned"
+ split("", f)
+ nextfile
+ }
+ $1 == "VERSION" && $2 ~ /^\$/ {
+ f[$1] = "scm"
+ next
+ }
+ { f[$1] = $2 }
+ ' | sort > "$1/$VERSION_INDEX_FILE"
+}

#---------------------------------------------------------------------
## @param servicename



  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (9379b403235df8da3ccc4e13e68baceb16e6f77e), Ismael Luceno, 12/22/2014

Archive powered by MHonArc 2.6.24.

Top of Page