[SM-Commit] GIT changes to test-1.13 sorcery by Jaka Kranjc (1f1c53e9904862af40bc8390b9477f2292322114)

Jaka Kranjc scm at sourcemage.org
Thu Nov 8 13:38:31 EST 2007


GIT changes to test-1.13 sorcery by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 ChangeLog                                     |   18 +++++++++
 etc/sorcery/version                           |    2 -
 var/lib/sorcery/modules/libcodex              |    6 +--
 var/lib/sorcery/modules/libdepends            |   29 ++++-----------
 var/lib/sorcery/modules/libmisc               |   50 +++++++++++++++++++-------
 var/lib/sorcery/modules/url_handlers/url_http |    2 -
 6 files changed, 68 insertions(+), 39 deletions(-)

New commits:
commit 1f1c53e9904862af40bc8390b9477f2292322114
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    1.13-rc3

commit c6f0ecf9b47dd5a9a54806278d0a6a941522727b
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    libdepends: fixed some more quoting regressions since stable. Should
                eliminate some bad provider query defaults

commit 1cbddd6dfcbd9e09c8fb36d44e1d1d318a499829
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    fixed a regression in private_add_depends, probably fixes #13735

commit 51023db18bee29e590e71e7b4ed16a3aa4a17a28
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    fix url_ftp_verify #13001

commit b467f5d31c148cbe1af67d426a5b837fdd9a8b6f
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    moved the load_libcompat call before the sourcing of DETAILS
    in codex_set_current_spell

commit 261977c3eb66948f5911b71816ba0ad9bc348c47
Author: Andrew Stitt <a at t.armory.com>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    fix bug 9836, allow select_list to show more items like
    select_provider does

diff --git a/ChangeLog b/ChangeLog
index f4cd9ac..f3b2cbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-10-30 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libdepends: fixed some more quoting regressions since stable. Should
+	  eliminate some bad provider query defaults
+
+2007-08-11 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libcodex: moved the load_libcompat call before the sourcing of DETAILS in
+	  codex_set_current_spell. This way fallbacks can be used there as well,
+	  which will among other things help a bit with #13883
+	* libdepends: fixed a regression in private_add_depends;
+	  probably fixes #13735
+
+2007-08-09 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* url_handlers/url_http: fix url_ftp_verify to not pass a deprecated wget
+	  option. Now it works again. #13001
+
 2006-08-18 Andrew Stitt <astitt at sourcemage.org>
 	* libstate, libapi: add is_depends_enabled, bug 12949
 
@@ -300,6 +315,9 @@
 	  in dependency queries, bug 10073
 	* scribbler: fix bug 10056, missing backquote on a message,
 	  patch from Eric Sandall.
+	* libmisc, libdepends: factor out common code from select_list and
+	  select_provider, use a hash instead of an array in select_list to
+	  fix bug 9836.
 
 2005-11-04 Andrew Stitt <astitt at sourcemage.org>
 	* libsummon: dont use leapforward url for tree downloads, bug 10062
diff --git a/etc/sorcery/version b/etc/sorcery/version
index b1ea829..e2747ff 100644
--- a/etc/sorcery/version
+++ b/etc/sorcery/version
@@ -1 +1 @@
-1.13.7-rc2
+1.13.7-rc3
diff --git a/var/lib/sorcery/modules/libcodex b/var/lib/sorcery/modules/libcodex
index 0854733..07e7e95 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -630,14 +630,14 @@ function codex_set_current_spell()  {
   [[ -x $GRIMOIRE/API_VERSION ]] && . $GRIMOIRE/API_VERSION
   [[ -x $SECTION_DIRECTORY/API_VERSION ]] && . $SECTION_DIRECTORY/API_VERSION
 
+  # load compatibility functions needed for any stage of cast
+  load_libcompat
+
   debug "libcodex" "sourcing DETAILS"
   persistent_load
   .  $SPELL_DIRECTORY/DETAILS 1>/dev/null 2>&1
   persistent_clear
 
-  # load compatibility functions needed for any stage of cast
-  load_libcompat
-
   # set a default build api if there isn't one already
   # this isn't strictly necessary as other code should be able to handle the
   # lack of this variable, but I want to play it safe.
diff --git a/var/lib/sorcery/modules/libdepends b/var/lib/sorcery/modules/libdepends
index b46b194..5de0593 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -678,14 +678,14 @@ function work_depends_provider()
   # check if theres an abandoned answer, but only if its still a provider
   if [[ ! $default ]] && [ -e $ABANDONED_DEPENDS/$SPELL ] ; then
     tmp=$(search_depends_status $ABANDONED_DEPENDS/$SPELL "$SPELL" ".*($1)"|awk -F: '{print $2;exit}')
-    [[ $tmp ]] && echo $CANDIDATES|grep -x -q "$tmp" && default=$tmp
+    [[ $tmp ]] && echo "$CANDIDATES" | grep -x -q "$tmp" && default=$tmp
   fi
 
   # check if theres a default provider
   if [[ ! $default ]]; then
     explode "$(search_default_provider $DEFAULT_PROVIDERS ".*" "$1")" ":" "status"
     tmp=${status[0]}
-    [[ $tmp ]] && echo $CANDIDATES|grep -x -q "$tmp" && default=$tmp
+    [[ $tmp ]] && echo "$CANDIDATES" | grep -x -q "$tmp" && default=$tmp
   fi
 
   # check if we've already answered this question
@@ -771,7 +771,7 @@ function work_optional_depends_provider()
   # check if theres an abandoned answer, but only if its still a provider
   if [[ ! $default ]] && [ -e $ABANDONED_DEPENDS/$SPELL ] ; then
     tmp=$(search_depends_status $ABANDONED_DEPENDS/$SPELL "$SPELL" ".*($1)"|awk -F: '{print $2;exit}')
-    [[ $tmp ]] && echo $CANDIDATES|grep -x -q "$tmp" && default=$tmp
+    [[ $tmp ]] && echo "$CANDIDATES"|grep -x -q "$tmp" && default=$tmp
   fi
 
   # check if theres a default provider
@@ -788,7 +788,7 @@ function work_optional_depends_provider()
         # if the user said "on" use the default rather than none
         # unless theres something wrong with the provider they chose 
         # in which case fall back to none
-        [[ $tmp ]] && echo $CANDIDATES|grep -x -q "$tmp" &&
+        [[ $tmp ]] && echo "$CANDIDATES" | grep -x -q "$tmp" &&
         default=$tmp || default=none
       else
         default=none
@@ -943,7 +943,7 @@ function select_provider()
     shift 3
 
     local each default_char=0 stuff=()
-    local char answer spell
+    local char
 
     # we can only read one character so use every one we can, I dont expect
     # there to be more than 62 providers
@@ -975,22 +975,9 @@ function select_provider()
       let i++
     done
 
-    message -n "\n${QUERY_COLOR}Which one do you want? " \
-               "[$default_char]$DEFAULT_COLOR "
-    read   -t  $PROMPT_DELAY  -n  1 answer 
-    [[ $answer ]] || answer=$default_char
-    spell="$(hash_get CHAR_TO_SPELL $answer)"
-
-    while [[ ! $spell ]] ; do
-      message -n "\n${QUERY_COLOR}Which one do you want? " \
-                 "[$default_char]$DEFAULT_COLOR "
-      read   -t  $PROMPT_DELAY  -n  1 answer 
-      [[ $answer ]] || answer=$default_char
-      spell=$(hash_get CHAR_TO_SPELL $answer)
-    done
-    echo
+    local msg="\n${QUERY_COLOR}Which one do you want? [$default_char]$DEFAULT_COLOR "
+    select_list_sub "$returnvar" CHAR_TO_SPELL "$msg" "$default_char"
     hash_unset CHAR_TO_SPELL
-    eval $returnvar=\"$spell\"
 }
 
 #---------------------------------------------------------------------
@@ -1152,7 +1139,7 @@ function private_add_depends()
   # force implied basesystem dependency in the depends tree
   if [[ $FORCE_BASESYSTEM_DEPENDS == on ]] &&
      [[ $SPELL != basesystem ]] &&
-     ! echo $base_deps|grep -x -q "$SPELL"; then
+     ! echo "$base_deps"|grep -x -q "$SPELL"; then
     hash_append "$CAST_HASH" "$SPELL" "basesystem"
     hash_append "$BACK_CAST_HASH" "basesystem" "$SPELL"
   fi
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 613cd66..b53d421 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -472,7 +472,7 @@ function iterate()
 }
 
 #---------------------------------------------------------------------
-## @param return_var (must not be i, foo, temp, returnvar, or default)
+## @param return_var (must not be i, foo, temp, returnvar, stuff or default)
 ## @param default choice
 ## @param elements, ..
 ## 
@@ -486,26 +486,50 @@ function select_list()
     local foo temp number
     local returnvar=$1
     local default=$2
+    local stuff=()
+
     shift 2
+    hash_unset select_list_hash
+    # see note in select_provider
+    stuff=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
+    
     let i=0
     for foo in "$@"; do
-        message "\t$DEFAULT_COLOR($i)  $SPELL_COLOR$foo$DEFAULT_COLOR"
-        temp[$i]="$foo"
+        message "\t$DEFAULT_COLOR(${stuff[$i]})  $SPELL_COLOR$foo$DEFAULT_COLOR"
+        hash_put select_list_hash "${stuff[$i]}" "$foo"
         let i++
     done
 
-    message -n "\n${QUERY_COLOR}Which one do you want? [$default]$DEFAULT_COLOR "
-    read   -t  $PROMPT_DELAY  -n  1  number
-    if [[ ! $number ]] ; then number=$default; fi
-    while [[ $number != [0-9]* ]] || (( $number >= $i )) ; do
-        message -n "\n${QUERY_COLOR}Which one do you want? [$default]$DEFAULT_COLOR "
-        read -n 1 number
-        if [[ ! $number ]] ; then number=$default; fi
-    done
+    local msg="\n${QUERY_COLOR}Which one do you want? [$default]$DEFAULT_COLOR "
+    select_list_sub "$returnvar" select_list_hash "$msg" "$default"
+    hash_unset select_list_hash
+}
 
-    echo
+#---------------------------------------------------------------------
+## Common code for select_list and select_provider
+## The user should have already printed out the menu, this handles
+## getting a valid answer from the user.
+## @param name of return value
+## @param name of hash table mapping answers to results
+## @param message to print out for the query
+## @param default answer
+#---------------------------------------------------------------------
+function select_list_sub() {
+  local returnvar=$1
+  local hashname=$2
+  local msgstr=$3
+  local default=$4
 
-    eval $returnvar=\"${temp[$number]}\"
+  local result
+
+  while [[ ! $result ]] ; do
+    message -n "$msgstr"
+    read   -t  $PROMPT_DELAY  -n  1  answer
+    [[ $answer ]] || answer=$default
+    result="$(hash_get $hashname $answer)"
+  done
+  echo
+  eval $returnvar=\"$result\"
 }
 
 #---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/url_handlers/url_http b/var/lib/sorcery/modules/url_handlers/url_http
index ad99515..617d706 100755
--- a/var/lib/sorcery/modules/url_handlers/url_http
+++ b/var/lib/sorcery/modules/url_handlers/url_http
@@ -89,7 +89,7 @@ function url_ftp_verify() {
   if  [  -n  "$URL"  ];  then
     local  FILENAME=`basename $URL`
     local  DIRECTORY=`dirname $URL`
-    local  OUTPUT=`wget --passive-ftp -t 1 -T 30 -O - --spider -nr "$DIRECTORY/" 2>&1`
+    local  OUTPUT=`wget --passive-ftp -t 1 -T 30 -O - --spider -S "$DIRECTORY/" 2>&1`
 
     if  echo  $OUTPUT  |  grep  -q  "$FILENAME";  then
       rm  -f  .listing



More information about the SM-Commit mailing list