[SM-Commit] GIT changes to test-1.14 sorcery by Jaka Kranjc (059d4e63b03ffa2db704a9e326db34c0d64df962)

Jaka Kranjc scm at sourcemage.org
Sat Apr 12 06:19:34 EDT 2008


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

 ChangeLog                           |   41 +++++++++++++
 etc/sorcery/roots                   |   14 ++--
 etc/sorcery/version                 |    2 
 var/lib/sorcery/modules/libapi      |  106 +++++++++++++++++++++++++++++++++---
 var/lib/sorcery/modules/libcodex    |    9 +--
 var/lib/sorcery/modules/libdepends  |   14 ++--
 var/lib/sorcery/modules/libgpg      |   20 ++++++
 var/lib/sorcery/modules/libgrimoire |    1 
 var/lib/sorcery/modules/libsorcery  |   53 +++++++-----------
 var/lib/sorcery/modules/libstate    |   24 ++++++++
 var/lib/sorcery/sustained           |    9 ++-
 11 files changed, 235 insertions(+), 58 deletions(-)

New commits:
commit 059d4e63b03ffa2db704a9e326db34c0d64df962
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    1.14.1-rc1

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

    libsorcery:
          made log_list also echo castfs logs
          rewrote clean_logs to be more slick and as a result a lot faster (12x here)
    
    (cherry-picked from commit f34a7301742ee11126f817d2b8f5371251a9c5b4)

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

    libsorcery: rewrote log_list to conform with sorcery standards and be 50
          times faster
    
    (cherry-picked from commit 766cfd7e1d2a88c26e013ff25d267e367e479149)

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

        * libgpg: fixed gpg_verify_grimoire not liking versioned grimoires  #13461
    
    (cherry-picked from commit 90183dbe60efd77eaaae6ac3e4dfdfdfc74cdee5)

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

        * sustained: added some missing basesystem entries and removed the now
          nonexistant util-linux-crypto
    
    (cherry-picked from commit 47d6f1d68b3525d540bb47b73ea93523d9fadb0e)

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

    libapi: fixed #9676 using a slightly modified comment from the real code
    
    (cherry-picked from commit 6cd5f2bb10add820ef15b9efe7ce44b2e6d0e98a)

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

    libstate: added a toggle_depends_status for toggling dependencies on/off
        * libdepends: fixed private_recast_optionals. It never worked. #14411
    
    todo: make private_recast_optionals work with providers
    and use toggle_depends_status in cleanse
    
    (cherry-picked from commit ebdb6e6e72bafda6ae3f063a36ce461638e4f486)

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

    libgrimoire: dereference the deaddir in rm_source_dir #14399
    
    (cherry-picked from commit c8d8ebe1c190d29bfa25dfe647d89ef17f5670c3)

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

    libgpg: nicely quit verify_grimoire_tree for alien grimoire trees #14398
    
    (cherry-picked from commit 800a06242a71d918ac90aa3e968e05c1ef9029e8)

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

    fixed real_show_up_depends showing false positives
    example: gaze depends perl 1 would also say that git depends on perl-error
    
    (cherry-picked from commit 1b1a6aebbb6b350bf5ffb041d9531590fef87543)

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

    fixed private_upward_depends matching spells too loosely
    
    (cherry-picked from commit c8fa0d622fd156b54d8b2b815ad3ba4150988747)

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

    fixed the check if spell is held in real_sub_depends and improved the msg
    
    (cherry-picked from commit b9a9dcedb8e589ab058598d11699a565b31f05ec)

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

    roots: honor environment variables #13263 and improve sourcing #14304
    
    (cherry-picked from commit 08aa7a5dae442230ba22c874099095c93e2679dc)

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

    fixed ENTERED typo in codex_clear_current_spell and two comments
    
    (cherry-picked from commit fa32307cfd3a6ec35ca82ce072933906472453b3)

diff --git a/ChangeLog b/ChangeLog
index be8781e..ce155f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2008-04-11 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	  times faster; made it also echo castfs logs and echo absolute paths
+	  rewrote clean_logs to be more slick and as a result a lot faster
+
+2008-04-11 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libsorcery: rewrote log_list to conform with sorcery standards and be 50
+	  times faster
+
+2008-04-10 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* sustained: added some missing basesystem entries and removed the now
+	  nonexistant util-linux-crypto
+	* libgpg: fixed gpg_verify_grimoire not liking versioned grimoires #13461
+
+2008-04-02 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libapi: fixed #9676 using a slightly modified comment from the real code
+
+2008-03-31 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	  added a toggle_depends_status for toggling dependencies on/off
+	* libdepends: fixed private_recast_optionals. It never worked. #14411
+
+2008-03-30 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libgrimoire: dereference the deaddir in rm_source_dir #14399
+
+2008-03-28 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libgpg: nicely quit verify_grimoire_tree for alien grimoire trees #14398
+
+2008-03-26 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	  fixed real_show_up_depends showing false positives
+
+2008-03-26 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	  fixed private_upward_depends matching spells too loosely
+
+2008-03-26 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	  fixed the check if spell is held in real_sub_depends and improved the msg
+
+2008-03-25 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* roots: honor environment variables #13263 and improve sourcing #14304
+
+2008-03-24 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	  fixed ENTERED typo in codex_clear_current_spell and two comments
+
 2008-03-24 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* cast, cleanse, alter, summon, scribe, scribbler, ...: changed $0 to
 	  respective name, so sorcery can be debugged with bashdb properly and
diff --git a/etc/sorcery/roots b/etc/sorcery/roots
index b09ba2e..d7c9488 100755
--- a/etc/sorcery/roots
+++ b/etc/sorcery/roots
@@ -1,8 +1,10 @@
-          INSTALL_ROOT=""
-            STATE_ROOT=""
-            TRACK_ROOT=""
-            CODEX_ROOT="/var/lib/sorcery/codex"
-         INSTALL_CACHE=/var/cache/sorcery
+          INSTALL_ROOT="$INSTALL_ROOT"
+            STATE_ROOT="$STATE_ROOT"
+            TRACK_ROOT="$TRACK_ROOT"
+            CODEX_ROOT="${CODEX_ROOT:-/var/lib/sorcery/codex}"
+         INSTALL_CACHE="${INSTALL_CACHE:-/var/cache/sorcery}"
 
-test -e $LOCAL_ROOTS_CONFIG && . $LOCAL_ROOTS_CONFIG
+if [[ -e $LOCAL_ROOTS_CONFIG ]]; then
+  . $LOCAL_ROOTS_CONFIG
+fi
 
diff --git a/etc/sorcery/version b/etc/sorcery/version
index 850e742..29a1349 100644
--- a/etc/sorcery/version
+++ b/etc/sorcery/version
@@ -1 +1 @@
-1.14.0
+1.14.1-rc1
diff --git a/var/lib/sorcery/modules/libapi b/var/lib/sorcery/modules/libapi
index e1d8e30..be17e81 100755
--- a/var/lib/sorcery/modules/libapi
+++ b/var/lib/sorcery/modules/libapi
@@ -435,7 +435,7 @@ function devoke_installwatch () {
 #---------------------------------------------------------------------
 ## @Type API
 ## @See <@function var.lib.sorcery.modules.libtrack.html,real_devoke_stage_root> for more details.
-## Stops using installwatch
+## Stops using stage root
 #---------------------------------------------------------------------
 function devoke_stage_root () {
     debug "libapi" "devoke_stage_root - $*"
@@ -613,7 +613,7 @@ function invoke_installwatch () {
 #---------------------------------------------------------------------
 ## @Type API
 ## @See <@function var.lib.sorcery.modules.libtrack.html,real_invoke_stage_root> for more details.
-## Starts using installwatch
+## Starts using stage root
 #---------------------------------------------------------------------
 function invoke_stage_root () {
     debug "libapi" "invoke_stage_root - $*"
@@ -909,8 +909,8 @@ function persistent_read () {
 ## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_prepare_install> for more details.
 ## Prepares to install the spell.  Writes the boost lock file.  If the
 ## spell is installed already, the libraries are saved with
-## save_libraries() and the spell is dispelled.  Usually called from
-## the BUILD sript of a spell.
+## save_libraries(), the binaries with save_binaries() and the spell is
+## dispelled.  Usually called from the BUILD script of a spell.
 ##
 #---------------------------------------------------------------------
 function prepare_install () {
@@ -1131,6 +1131,8 @@ function uncompress () {
 ## as well as untar'ing the file if appropriate and if the MD5
 ## matches.
 ## Note: zip is a special case because it doesn't work with streams.
+## Note: This function is deprecated and kept for spells that still
+##       use the old verification methods (MD5[0]=).
 ##
 #---------------------------------------------------------------------
 function unpack () {
@@ -1144,8 +1146,100 @@ function unpack () {
 ## @See <@function var.lib.sorcery.modules.libunpack.html,real_unpack_file> for more details.
 ##
 ## unpack_file takes the SOURCE suffix and figures out if it is supposed
-## to md5 or gpg/hash check it -- then it does its dirty work and runs
-## unpack, unpack_gpg, or unpack_hash depending upon the circumstances.
+## to hash or gpg check it -- then it does its dirty work and runs unpack_hash
+## or unpack_gpg depending upon the circumstances.  That's the only argument it
+## takes and needs: '' '2' '3', etc.  It is run in default_pre_build for the
+## null argument only.  Custom unpacking still requires a custom PRE_BUILD.
+##
+## valid formats: vendor-provided gpg, guru-provided gpg, any
+## hash-algorithm provided by gpg (currently md5, sha1, sha256, sha384,
+## sha512, ripemd160
+##
+##           SOURCE=blah
+##          SOURCE2=blah.asc
+##       SOURCE_URL=http://blah.com/$SOURCE
+##      SOURCE2_URL=http://blah.com/$SOURCE2
+##       SOURCE_GPG=blah.gpg:$SOURCE2:UPSTREAM_KEY
+##   SOURCE2_IGNORE=signature # for auditing purposes
+##
+##           SOURCE=blah
+##       SOURCE_URL=http://blah.com/$SOURCE
+##       SOURCE_GPG=swoolley.gpg:$SOURCE.asc:WORKS_FOR_ME
+##
+##           SOURCE=blah
+##       SOURCE_URL=http://blah.com/$SOURCE
+##           MD5[0]=d41d8cd98f00b204e9800998ecf8427e
+##
+##           SOURCE=blah
+##       SOURCE_URL=http://blah.com/$SOURCE
+##       SOURCE_HASH=md5:d41d8cd98f00b204e9800998ecf8427e:WORKS_FOR_ME
+##
+## In GPG mode:
+##   Validates the verification level (the third parameter) and the
+##   hash algorithm against user defined lists.
+##   It finds the public key and signature using locate_spell_file,
+##   Then it validates it at the beginning.
+##   see unpack_gpg()
+##
+## In HASH mode:
+##   Validates the verification level (the third parameter) and the
+##   hash algorithm against user defined lists.
+##   It uses gpg to calculate the hash value except for md5 and sha1, which
+##   coreutils provides.
+##   see unpack_hash()
+##
+## In IGNORE mode:
+##   It checks for the following text:
+##     volatile (for cvs/svn/any-other-scm)
+##     unversioned (the source file changes frequently, but not a direct scm)
+##     signature (for gnupg signatures)
+##   as reasons for ignoring the source code validation.  Signatures
+##   are silently ignored.  Everything else respects MD5SUM_DL.
+##   see unpack_ignore
+##
+## Otherwise, it falls back to MISSING mode, see unpack_missing
+## (or for now)
+## Otherwise, it falls back to old uncompressed md5sum check with MD5[n].
+##   see real_unpack()
+##
+## The default verification level is "WORKS_FOR_ME"
+##
+## Verification levels are, these indicate how much effort was put into
+## validating the integrity of the source from the upstream vendor.
+##   WORKS_FOR_ME No verification was done.
+##   UPSTREAM_HASH Checked the upstream hash file
+##   UPSTREAM_KEY Checked upstream (gpg) key, signature matched, but the
+##                key was not validated
+##   ESTABLISHED_UPSTREAM_KEY Upstream key was not validated against
+##                            multiple independent sources, but has been
+##                            in use for several years
+##   VERIFIED_UPSTREAM_KEY Upstream key id was verified against multiple
+##                         independent sources.
+##   ID_CHECK_UPSTREAM_KEY Key was verified in person with a photo id check.
+##
+## Also if you want to include more than one signature, hash, etc, just put
+## a 2, 3, 4, etc on the end of the variable like so:
+##   SOURCE2_HASH2=...
+##
+## For cascading, currently it will still ask abort questions: a no abort
+## will make it fail over all cascades; a yes abort will have it skip to
+## the next cascades.  Missing binaries or other failures like that (error 200
+## below) will silently fail over to the next check.  The cascade order is:
+##  GPG, HASH, IGNORE, MISSING
+##
+## The cascade setup allows you to place a higher bit checksum earlier
+## in the cascade and even if the binary doesn't work it will just print
+## out an abort query which can be said no to and it will continue to
+## fail over to the lower bit checksum that should be available in
+## coreutils (like sha1/md5).  That's if you're not using gpg, which is
+## preferred.  If multiple hashes are included of different ciphers, the
+## user can abort on either that go bad, so it can be considered a
+## security increase to have more than one, but only if the harder cipher
+## is first in the cascade order, as the first successful hash match will
+## go ahead and prompt an untarball.  It may change later, but for now we
+## think the first successful match skipping the rest is least intrusive, and
+## I'd need to add an interface element to let the user choose to run all
+## checks on a single source.
 ##
 #---------------------------------------------------------------------
 function unpack_file () {
diff --git a/var/lib/sorcery/modules/libcodex b/var/lib/sorcery/modules/libcodex
index d01eb85..44793be 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -576,14 +576,14 @@ function codex_get_spell_section_name() {
 
 #---------------------------------------------------------------------
 ##
-## @Globals GRIMOIRE SECTION SECTION_DIRECTORY SPELL SPELL_DIRECTORY SCRIPT_DIRECTORY SPELL_DESCRIPTION VERSION SHORT UPDATED SOURCE WEB_SITE ENTERRED MAINTAINER MD5 LICENSE
+## @Globals GRIMOIRE SECTION SECTION_DIRECTORY SPELL SPELL_DIRECTORY SCRIPT_DIRECTORY SPELL_DESCRIPTION VERSION SHORT UPDATED SOURCE WEB_SITE ENTERED MAINTAINER MD5 LICENSE
 ## Unets all these global variables.
 ##
 #---------------------------------------------------------------------
 function codex_clear_current_spell()  {
   unset GRIMOIRE SECTION SECTION_DIRECTORY SPELL  \
   SPELL_DIRECTORY SCRIPT_DIRECTORY SPELL_DESCRIPTION \
-  VERSION SHORT UPDATED SOURCE WEB_SITE ENTERRED MAINTAINER \
+  VERSION SHORT UPDATED SOURCE WEB_SITE ENTERED MAINTAINER \
   MD5 LICENSE BUILD_API SECURITY_PATCH PATCHLEVEL
 }
 
@@ -591,7 +591,7 @@ function codex_clear_current_spell()  {
 ## @param spell directory
 ## @Globals All vars set in a spell
 ## Sets the GRIMOIRE, SECTION, SECTION_DIRECTORY, SPELL_DIRECTORY,
-## SCRIPT_DIRECTORY, and SPELL_DESCRIPTION global variables for the
+## SCRIPT_DIRECTORY global variables for the
 ## given spell directory.
 ##
 ## Assumes the directory passed in is a valid spell directory.
@@ -675,8 +675,7 @@ function codex_get_spell_paths() {
 #---------------------------------------------------------------------
 ## @param spell name
 ## Sets the GRIMOIRE, SECTION, SECTION_DIRECTORY, SPELL_DIRECTORY,
-## SCRIPT_DIRECTORY, and SPELL_DESCRIPTION global variables for the
-## given spell name.
+## SCRIPT_DIRECTORY global variables for the given spell name.
 ##
 ## @return 1 if the given name is not a spell.
 ##
diff --git a/var/lib/sorcery/modules/libdepends b/var/lib/sorcery/modules/libdepends
index 4524432..44f5a1f 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -562,7 +562,7 @@ function private_upward_depends() {
     # and/or move the weird pattern into library functions...
     # (afrayedknot 2005-10-02)
     lock_file "$DEPENDS_STATUS"
-    tmp=$(grep "^.*:$1\(([^:]*)\)\?" $DEPENDS_STATUS|cut -f1 -d:|tr "\n" " ")
+    tmp=$(grep "^.*:$1\(([^:]*)\)\?:" $DEPENDS_STATUS|cut -f1 -d:|tr "\n" " ")
     unlock_file "$DEPENDS_STATUS"
     local j k each
     let j=${#NEW_UP_DEPENDS[*]}
@@ -597,9 +597,11 @@ function private_recast_optionals() {
         fi
       fi
       if [[ $enabled ]] ; then
-        NEW_UP_DEPENDS[$j]=$each
+        NEW_UP_DEPENDS[$j]=$spell
         let j++
-        remove_depends_status $DEPENDS_STATUS $each "${1}\(([^:]*)\)\?"
+        # toggle the dependency, so the user doesn't get requeried
+        toggle_depends_status $DEPENDS_STATUS $spell $1
+        spells=( ${spells[*]} $spell )
       fi
     done
   fi
@@ -1349,12 +1351,12 @@ function real_sub_depends() {
 
   # if didnt return above, then we know the sub-depends is not on the system
   # so the spell must be (re)cast, check to see if we're allowed to do that
-  if ! echo "$PRETEND_NOT_INSTALLED" | grep -x -q "$1"  &&
+  if ! real_list_find "$PRETEND_NOT_INSTALLED" $sub_dependee &&
      spell_held $sub_dependee; then
     # spell is held and not explicitly requested, so we cant recast the
     # spell with the sub-depends requested
     message "${PROBLEM_COLOR}Sub-depends requested on" \
-            "a held spell${DEFAULT_COLOR}"
+            "a held spell: $SPELL_COLOR$sub_dependee$DEFAULT_COLOR"
     return 1
   fi
 
@@ -1601,7 +1603,7 @@ function real_show_up_depends()
     if [[ "$type" == "verbose" ]] ; then
       lock_file "$DEPENDS_STATUS"
       show_up_depends_sub "$1"|while read line; do
-        grep "$line" "$DEPENDS_STATUS"
+        grep "$line:" "$DEPENDS_STATUS"
       done
       unlock_file "$DEPENDS_STATUS"
     else
diff --git a/var/lib/sorcery/modules/libgpg b/var/lib/sorcery/modules/libgpg
index 682d1cf..7373daf 100755
--- a/var/lib/sorcery/modules/libgpg
+++ b/var/lib/sorcery/modules/libgpg
@@ -130,7 +130,16 @@ function gpg_verify_grimoire() {
 
   local SOURCE=$(basename $FILENAME)
 
-  test -z $BRANCH && BRANCH=${SOURCE%%.*}
+  if [[ -z $BRANCH ]]; then
+    # deduce the name of the branch from the tarball (stable-rc-0.19.tar.bg2)
+    # asumes double extension (like .tar.gz)
+    # asumes no numbers preceded by a dash in the name
+    # asumes dash as the delimiter between the name and the optional version
+    # asumes version starts with a number
+    BRANCH=${SOURCE%.*}
+    BRANCH=${BRANCH%.*}
+    BRANCH=${BRANCH%-[0-9]*}
+  fi
 
   local gpg_pub_key=$(gpg_get_grimoire_key $BRANCH)
   if test -z $gpg_pub_key && test -f $gpg_pub_key ; then
@@ -150,6 +159,15 @@ function verify_grimoire_tree() {
     return 253
   fi
 
+  if ! list_find "$GPG_GRIMOIRE_LIST" $grimoire_name &> /dev/null; then
+    message "${MESSAGE_COLOR}The grimoire (tree)" \
+            "${SPELL_COLOR}$grimoire_name" \
+            "${MESSAGE_COLOR}is not an official grimoire and for such" \
+            "${PROBLEM_COLOR}there is no verification method!$DEFAULT_COLOR"
+    query "Continue anyway?" y
+    return $?
+  fi
+
   local gpg_pub_key=$(gpg_get_grimoire_key $grimoire_name)
   if test -z $gpg_pub_key && test -f $gpg_pub_key ; then
     message "No keyring found! (maybe you need to cast sorcery-pubkeys?)"
diff --git a/var/lib/sorcery/modules/libgrimoire b/var/lib/sorcery/modules/libgrimoire
index 968527a..a6594df 100755
--- a/var/lib/sorcery/modules/libgrimoire
+++ b/var/lib/sorcery/modules/libgrimoire
@@ -64,6 +64,7 @@ function real_rm_source_dir() {
 
   DEAD_DIR=$1
   DEAD_DIR=${DEAD_DIR:-$SOURCE_DIRECTORY}
+  DEAD_DIR=$(readlink -f "$DEAD_DIR")
 
   debug  "libgrimoire" "Running rm_source_dir() on $DEAD_DIR"
 
diff --git a/var/lib/sorcery/modules/libsorcery b/var/lib/sorcery/modules/libsorcery
index 73c886a..3c080f5 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -1166,14 +1166,16 @@ function fix_installed_spells()  {
 ##
 #---------------------------------------------------------------------
 function log_list()  {
-
-  for  LINE  in  `all_spell_status`;  do
-    SPELL=`echo  $LINE  |  cut  -d  :  -f1`
-      VER=`echo  $LINE  |  cut  -d  :  -f4`
-    echo  "$SPELL-$VER"
-    echo  "$SPELL-$VER$EXTENSION"
-  done
-
+  local spell version
+  while read spell version; do
+    # the install and md5sum logs are not compressed
+    echo "$INSTALL_LOGS/$spell-$version"
+    echo "$MD5SUM_LOGS/$spell-$version"
+    # the compile and castfs log usually are compressed
+    # FIXME $EXTENSION may be the wrong one if the user changed it
+    echo "$COMPILE_LOGS/$spell-$version$EXTENSION"
+    echo "$COMPILE_LOGS/$spell-$version.castfs.dbglog$EXTENSION"
+  done < <(all_spell_status | cut -d: -f1,4 --output-delimiter=" ")
 }
 
 
@@ -1183,36 +1185,23 @@ function log_list()  {
 ##
 #---------------------------------------------------------------------
 function clean_logs()  {
-
-  message "${CHECK_COLOR}Cleaning log files... ${DEFAULT_COLOR} "
-
   debug  "libsorcery" "Running clean_logs()"
+  local file
 
-  LOGS=`log_list`
-
-  for  FILE  in  `ls  $INSTALL_LOGS`;  do
-    if  !  echo  -e  "$LOGS"  |  grep  -q  "^$FILE$";  then
-      message  "Removing stale log  :  $INSTALL_LOGS/$FILE "
-      rm                               $INSTALL_LOGS/$FILE
-    fi
-  done
-
-  for  FILE  in  `ls  $COMPILE_LOGS`;  do
-    if  !  echo  -e  "$LOGS"  |  grep  -q  "^$FILE$";  then
-      message  "Removing stale log  :  $COMPILE_LOGS/$FILE "
-      rm                               $COMPILE_LOGS/$FILE
-    fi
-  done
+  message "${CHECK_COLOR}Cleaning log files...$DEFAULT_COLOR"
 
-  for  FILE  in  `ls  $MD5SUM_LOGS`;  do
-    if  !  echo  -e  "$LOGS"  |  grep  -q  "^$FILE$";  then
-      message  "Removing stale log  :  $MD5SUM_LOGS/$FILE "
-      rm                               $MD5SUM_LOGS/$FILE
-    fi
+  {
+    # don't try to delete logs of installed spells, as they may not exist
+    # tee duplicates the output, so uniq will filter them out
+    log_list | tee /dev/stdout
+    find $INSTALL_LOGS $MD5SUM_LOGS $COMPILE_LOGS -type f
+  } | sort | uniq -u |
+  while read file; do
+    message "Removing stale log: $file"
+    rm "$file"
   done
 }
 
-
 #---------------------------------------------------------------------
 ##
 ## Updates the activity log.
diff --git a/var/lib/sorcery/modules/libstate b/var/lib/sorcery/modules/libstate
index dafec00..12ed59a 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -225,6 +225,30 @@ function remove_depends_status()
 }
 
 #---------------------------------------------------------------------
+## Toggle optional and suggested dependencies on/off
+##
+## @param depends file
+## @param spell
+## @param dependency
+##
+#---------------------------------------------------------------------
+function toggle_depends_status() {
+  local depends_status=$1
+  shift
+
+  local spell dependency
+  esc_str "$1" spell; esc_str "$2" dependency
+
+  local t_status
+  lock_start_transaction "$depends_status" t_status
+  awk -F ':' -v OFS=':' \
+    '/^'$spell:$dependency'(\([^:]*\))?:(on|off):(optional|suggest):/ \
+      { if ($3 == "on") $3 = "off"; else $3 = "on"; }
+    { print; }' $depends_status > $t_status
+  lock_commit_transaction "$depends_status"
+}
+
+#---------------------------------------------------------------------
 ## Sets up the uncommitted depends file. If the name isn't
 ## found in the hash table create it. If the file already exists
 ## move it to the abandoned depends directory and start with a new one.
diff --git a/var/lib/sorcery/sustained b/var/lib/sorcery/sustained
index af4f5ea..d35b8b2 100755
--- a/var/lib/sorcery/sustained
+++ b/var/lib/sorcery/sustained
@@ -4,6 +4,7 @@ bzip2
 coreutils
 cpio
 dialog
+diffutils
 e2fsprogs
 file
 findutils
@@ -11,11 +12,16 @@ gawk
 gcc
 gettext
 glibc
+gnupg
 grep
 gzip
+iana-etc
+ifupdown
 init.d
 installwatch
 less
+locale
+make
 module-init-tools
 nano
 ncurses
@@ -26,12 +32,13 @@ readline
 sed
 shadow
 simpleinit-msb
+smgl-archspecs
+smgl-fhs
 smgl-strip
 smgl-prelink
 tar
 texinfo
 unzip
 util-linux
-util-linux-crypto
 wget
 zlib



More information about the SM-Commit mailing list