Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Andrew Stitt (67a49e545c10aaf32b22c6ab055ec58f731a73cc)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Andrew Stitt <scm AT mail.sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Andrew Stitt (67a49e545c10aaf32b22c6ab055ec58f731a73cc)
  • Date: Sun, 21 Jan 2007 13:21:30 -0600

GIT changes to master sorcery by Andrew Stitt <astitt AT sourcemage.org>:

ChangeLog | 11 --
etc/sorcery/config | 6 -
usr/sbin/cast | 38 ++++---
usr/sbin/delve | 26 ++---
usr/sbin/dispel | 34 +++---
usr/sbin/gaze | 2
usr/sbin/scribe | 2
usr/sbin/sorcery | 64 +-----------
var/lib/sorcery/modules/build_api/api1 | 16 +--
var/lib/sorcery/modules/build_api/api2 | 28 ++---
var/lib/sorcery/modules/build_api/common | 16 +--
var/lib/sorcery/modules/dl_handlers/dl_tla | 2
var/lib/sorcery/modules/dl_handlers/dl_wget | 6 -
var/lib/sorcery/modules/libapi | 139
+++++++++++++---------------
var/lib/sorcery/modules/libcast | 12 +-
var/lib/sorcery/modules/libcodex | 24 ++--
var/lib/sorcery/modules/libcrossinstall | 10 +-
var/lib/sorcery/modules/libdebug | 59 -----------
var/lib/sorcery/modules/libdepends | 55 +++++------
var/lib/sorcery/modules/libdepengine | 16 +--
var/lib/sorcery/modules/libdispel | 10 +-
var/lib/sorcery/modules/libdownload | 7 -
var/lib/sorcery/modules/libgrimoire | 15 +--
var/lib/sorcery/modules/libhash | 6 -
var/lib/sorcery/modules/liblock | 22 ++--
var/lib/sorcery/modules/libmisc | 70 ++++++++++----
var/lib/sorcery/modules/libresurrect | 26 ++---
var/lib/sorcery/modules/libscreen | 30 +++---
var/lib/sorcery/modules/libsorcery | 38 +++----
var/lib/sorcery/modules/libstate | 26 ++---
var/lib/sorcery/modules/libsummon | 4
var/lib/sorcery/modules/libtablet | 2
var/lib/sorcery/modules/libtrack | 16 +--
var/lib/sorcery/modules/libtriggers | 8 -
var/lib/sorcery/modules/libunpack | 50 +++++-----
var/lib/sorcery/modules/liburl | 22 ++--
36 files changed, 413 insertions(+), 505 deletions(-)

New commits:
commit 67a49e545c10aaf32b22c6ab055ec58f731a73cc
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <astitt AT sourcemage.org>

revert -- please do this in a branch first. 1.14 doesnt need any more
de-stablizing changes at the moment. This can go in 1.15

diff --git a/ChangeLog b/ChangeLog
index 8f70a98..8ef72c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,3 @@
-2007-10-20 Paul Mahon <pmahon AT sourcemage.org>
- *libmisc: redirect some errors to stderr for bug 13380
-
-2007-01-13 Paul Mahon <pmahon AT sourcemage.org>
- * libdebug: creation of module for handlind debugging stuff, bug 9379
- * modules, scripts: change all calls to debug() to use $STD_DEBUG*
- * sorcery: add configuration menus for new debugging features, bug
9514
-
-2007-01-07 Paul Mahon <pmahon AT sourcemage.org>
- * sorcery: Fix spelling, bug 13170
-
2007-01-01 David Brown <dmlb2000 AT gmail.com>
* delve: empty install root since that's handled by transfer stage
* libstage: forgot a prepended INSTALL_ROOT on directory
diff --git a/etc/sorcery/config b/etc/sorcery/config
index 88eac7c..71faa4b 100755
--- a/etc/sorcery/config
+++ b/etc/sorcery/config
@@ -57,8 +57,7 @@ FORCE_BASESYSTEM_DEPENDS=${FORCE_BASESYS
FILEPROG=${FILEPROG:=file}
DIALOGPROG=${DIALOGPROG:=dialog}

- SORCERY_DEBUG=${SORCERY_DEBUG:=/dev/null}
- SORCERY_DEBUG_FILTER=${SORCERY_DEBUG_FILTER:=libhash libapi liblock}
+ DEBUG=${DEBUG:=/dev/null}

CROSS_INSTALL=${CROSS_INSTALL:=off}

@@ -187,9 +186,6 @@ CASTFS_DEBUG_LEVEL=255
# this makes appending the sorcery path idempotent
[ -z ${PATH##*$SORCERY_PATH*} ] || export PATH="$PATH:$SORCERY_PATH"

-# initialize the debugging variables
-init_debugging
-
optimize
umask $UMASK >/dev/null
# this fixes breakage with multiply nested triggers, if/when we dont use
diff --git a/usr/sbin/cast b/usr/sbin/cast
index cd35621..37f97be 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -209,7 +209,7 @@ function get_option() {
#---------------------------------------------------------------------
function cast_spell() { (

- $STD_SORCERY_DEBUG "Casting spell [$SPELL]"
+ debug "cast" "Casting spell [$SPELL]"
set_term_title "Casting spell [$SPELL]"

run_details
@@ -307,7 +307,7 @@ function cast_spell() { (
#---------------------------------------------------------------------
function pass_one() {
# This pass does configuration and dependency identification.
- $STD_SORCERY_DEBUG_HEAD
+ debug "cast" "Starting pass_one()"

echo -n "Computing previously installed dependencies..."
compute_installed_depends "dep_f_hash"
@@ -379,7 +379,7 @@ function pass_one() {
hash_put dep_f_hash $i "$(hash_get to_cast $i)"
done

- $STD_SORCERY_DEBUG "pass_one, done with SPELLS=$SPELLS"
+ debug "cast" "pass_one, done with SPELLS=$SPELLS"

}

@@ -398,7 +398,7 @@ function pass_one() {
function pass_two() {
# This pass downloads required sources.
# And starts the make process
- $STD_SORCERY_DEBUG_HEAD
+ debug "cast" "Starting pass_two()"

unset_details

@@ -436,7 +436,7 @@ function pass_two() {
) &
fi

- $STD_SORCERY_DEBUG "Starting stage four make."
+ debug "cast" "Starting stage four make."

(
CAST_PASS="four"
@@ -485,7 +485,7 @@ function pass_two() {
## If in screen mode it also execs a tail to the summon window
#---------------------------------------------------------------------
function pass_three() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "cast" "pass_three - $*"
unset CAST_PASS
trap exit INT TERM
local SPELL=$1
@@ -555,7 +555,7 @@ function pass_three() {
#---------------------------------------------------------------------
function pass_four() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "cast" "pass_four - $*"
local do_resurrect=no
local VERSION
unset CAST_PASS
@@ -603,7 +603,7 @@ function pass_four() {
#---------------------------------------------------------------------
function pass_five() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "cast" "Function : pass_five"

# must exist or we get problems with checks here.
touch $SUCCESS_LIST
@@ -612,9 +612,9 @@ function pass_five() {
touch $CHECK_TRIGGERS_FAILURE
touch $CONFLICT_LIST

- $STD_SORCERY_DEBUG "SUCCESS LIST is : `cat $SUCCESS_LIST 2>/dev/null`"
- $STD_SORCERY_DEBUG "FAILED LIST is : `cat $FAILED_LIST 2>/dev/null`"
- $STD_SORCERY_DEBUG "CONFLICT LIST is : `cat $CONFLICT_LIST 2>/dev/null`"
+ debug "pass_five" "SUCCESS LIST is : `cat $SUCCESS_LIST 2>/dev/null`"
+ debug "pass_five" "FAILED LIST is : `cat $FAILED_LIST 2>/dev/null`"
+ debug "pass_five" "CONFLICT LIST is : `cat $CONFLICT_LIST 2>/dev/null`"

if [ -s $SUCCESS_LIST ] ; then

@@ -708,7 +708,7 @@ function pass_five() {
return 1
fi
fi
- $STD_SORCERY_DEBUG "End of pass_five"
+ debug "cast" "End of pass_five"

}

@@ -720,11 +720,13 @@ function pass_five() {
#---------------------------------------------------------------------
function pass_zero() {

- $STD_SORCERY_DEBUG_HEAD
- $STD_SORCERY_DEBUG "SPELLS = $SPELLS"
+ debug "cast" "Starting pass_zero()"
+ debug "pass_zero" "Starting passes 1,2,3,4 with : '$*'"
+ debug "pass_zero" " and with spells : '$SPELLS'"
export CAST_PASS="one"; pass_one $* &&
export CAST_PASS="two"; pass_two $SPELLS
#pass_three and _four are run via pass_two
+ debug "pass_zero" "Starting pass 5 with: '$@'"
export CAST_PASS="five"; pass_five "$@"


@@ -766,7 +768,7 @@ function cast_cleanup() {
## according to CAST_PASS
#---------------------------------------------------------------------
function main() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "cast" "main() - $*"
local T_SPELLS
process_parameters "$@"
SPELLS=`strip_parameters "$@"`
@@ -879,7 +881,7 @@ else
[[ $SCREEN == on ]]
then
export SCREEN=$SCREEN_OVERRIDE
- $STD_SORCERY_DEBUG "Turning $SCREEN_OVERRIDE screen mode"
+ debug "cast" "Turning $SCREEN_OVERRIDE screen mode"
fi

# If screen mode is on, but we aren't in screen, start a new session
@@ -901,7 +903,7 @@ else
[[ $SCREEN_NAME ]] &&
[[ ! $SCREEN_INITIALIZED ]]
then
- $STD_SORCERY_DEBUG "Initializing screen windows"
+ debug "cast" "Initializing screen windows"
screen_name_window "$SCREEN_NAME" $SCREEN_MAIN_WIN "Main"

# Start debugging window if debugging is on and not set to /dev*
@@ -936,7 +938,7 @@ else
exit $rc
fi

-$STD_SORCERY_DEBUG "exiting..."
+debug "cast" "exiting..."

#---------------------------------------------------------------------
##=back
diff --git a/usr/sbin/delve b/usr/sbin/delve
index 5848df7..c459a64 100755
--- a/usr/sbin/delve
+++ b/usr/sbin/delve
@@ -126,19 +126,19 @@ function delve_is_valid_step() {
}

function delve_pre_build() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step PRE_BUILD 1 2 || return 1
run_pre_build
}

function delve_config_loc() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step config_loc 1 2 || return 1
run_config_loc
}

function delve_build() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step BUILD 1 2 || return 1
delve_log_helper
(
@@ -148,7 +148,7 @@ function delve_build() {
}

function delve_pre_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step PRE_INSTALL 2 || return 1
delve_log_helper
(
@@ -158,7 +158,7 @@ function delve_pre_install() {
}

function delve_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"

delve_is_valid_step INSTALL 2 || return 1
delve_log_helper
@@ -193,7 +193,7 @@ function delve_install() {
}

function delve_install_extras() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"

delve_is_valid_step INSTALL_EXTRAS 2 || return 1
delve_log_helper
@@ -227,7 +227,7 @@ function delve_install_extras() {
}

function delve_post_build() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"

delve_is_valid_step POST_BUILD 1 || return 1
delve_log_helper
@@ -243,7 +243,7 @@ function delve_post_build() {
}

function delve_post_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step POST_INSTALL 1 2 || return 1
delve_log_helper
(
@@ -253,7 +253,7 @@ function delve_post_install() {
}

function delve_transfer() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step TRANSFER 2 || return 1
delve_log_helper
(
@@ -263,7 +263,7 @@ function delve_transfer() {
}

function delve_final() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step FINAL 2 || return 1
delve_log_helper
devoke_installwatch &&
@@ -276,13 +276,13 @@ function delve_final() {
}

function delve_triggers() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
delve_is_valid_step TRIGGERS 1 2 || return 1
run_triggers
}

function delve_spell_success() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
SUCCESS_LIST=/dev/null
cd /
delve_log_helper
@@ -290,7 +290,7 @@ function delve_spell_success() {
}

function delve_spell_failure() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "delve" "Running $FUNCNAME"
FAILED_LIST=/dev/null
delve_log_helper
run_spell_failure 2
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index c1ccafa..860f8fc 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -313,13 +313,13 @@ function dispel_children() {
# this assumes list_add remains idempotent, which it is
list_add our_children $(hash_get down_deps $spell)
done
- $STD_SORCERY_DEBUG "children of $1 -> $our_children"
+ debug "children of $1 -> $our_children"

local is_orphan
local orphan_list non_orphan_list
for child in $our_children; do
if [[ $(hash_get ALL_DISPELS $child) == "yes" ]] ; then
- $STD_SORCERY_DEBUG "someone depends on $child but it was already
removed"
+ debug "someone depends on $child but it was already removed"
continue
fi
# determine if this child is becomming an orphan or not
@@ -339,9 +339,9 @@ function dispel_children() {

local removed_children
for child in $orphan_list; do
- $STD_SORCERY_DEBUG "looking at $child:"
- $STD_SORCERY_DEBUG "parents: $(hash_get up_deps $child)"
- $STD_SORCERY_DEBUG "children: $(hash_get down_deps $child)"
+ debug dispel "looking at $child:"
+ debug dispel "parents: $(hash_get up_deps $child)"
+ debug "children: $(hash_get down_deps $child)"
if dispel_child_query "$child" "is an orphan" \
"Would you like to dispel it" \
"${ORPHAN_DEFAULT}" ; then
@@ -350,9 +350,9 @@ function dispel_children() {
fi
done
for child in $non_orphan_list; do
- $STD_SORCERY_DEBUG "looking at $child:"
- $STD_SORCERY_DEBUG "parents: $(hash_get up_deps $child)"
- $STD_SORCERY_DEBUG "children: $(hash_get down_deps $child)"
+ debug "looking at $child:"
+ debug "parents: $(hash_get up_deps $child)"
+ debug "children: $(hash_get down_deps $child)"
if dispel_child_query "$child" "is not an orphan" \
"Would you like to dispel it" \
"${NONORPHAN_DEFAULT}" ; then
@@ -436,7 +436,7 @@ function dispel_parent_query() {
## remove spell from the downward tree
#---------------------------------------------------------------------
function remove_from_dep_trees() {
- $STD_SORCERY_DEBUG_HEAD
+ debug dispel "$FUNCNAME $@"
local spell=$1
local down_dep_hash=$2
local up_dep_hash=$3
@@ -466,7 +466,7 @@ function get_borked_parents() {
local parent
# get the spells that depend on us
for parent in $(hash_get $up_dep_hash $spell); do
- $STD_SORCERY_DEBUG "hash_append $3 $parent $spell"
+ debug dispel "hash_append $3 $parent $spell"
hash_append $3 $parent $spell
done
}
@@ -501,9 +501,9 @@ function dispel_depends_engine() {
while [[ $new_children ]] ; do
curr_children=$new_children
unset new_children
- $STD_SORCERY_DEBUG "in with $curr_children"
+ debug dispel "in with $curr_children"
dispel_children "$curr_children" new_children
- $STD_SORCERY_DEBUG "out with $new_children"
+ debug dispel "out with $new_children"
list_add CURR_SPELLS $new_children
for SPELL in $curr_children; do
remove_from_dep_trees $SPELL down_deps up_deps
@@ -606,12 +606,12 @@ function dispel_depends_engine() {
fi
done
if [[ $NEW_CASTS ]] ; then
- $STD_SORCERY_DEBUG "cast -c $NEW_CASTS"
+ debug dispel "cast -c $NEW_CASTS"
cast -c $NEW_CASTS
fi
fi
- $STD_SORCERY_DEBUG "NEW_DISPELS: $NEW_DISPELS"
- $STD_SORCERY_DEBUG "eval $2=\"$NEW_DISPELS\""
+ debug dispel "NEW_DISPELS: $NEW_DISPELS"
+ debug dispel "eval $2=\"$NEW_DISPELS\""
eval "$2=\"$NEW_DISPELS\""

return ${DISPEL_EXIT_STATUS:-0}
@@ -639,11 +639,11 @@ function main() {
fi
if [[ $DO_DEPENDS ]] ; then
while [[ $SPELLS ]] ; do
- $STD_SORCERY_DEBUG "recomputing depends tree"
+ debug dispel "recomputing depends tree"
compute_installed_depends down_deps all
compute_reverse_installed_depends up_deps all
dispel_depends_engine "$SPELLS" SPELLS
- $STD_SORCERY_DEBUG "SPELLS $SPELLS"
+ debug dispel "SPELLS $SPELLS"
done
else
for SPELL in $SPELLS; do
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index 5c722b2..fa91f42 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -821,7 +821,7 @@ function any_voyeur()
local FILE=`find /tmp/liblock-0 -maxdepth 1 -mindepth 1 -name "cast.*" |
sed "s/.*\/cast\.//" | head -n 1`
[ $FILE ] || return 1
- $STD_SORCERY_DEBUG "Looking at spell \"$FILE\""
+ debug "voyeur" "Looking at spell \"$FILE\""
nice -n +20 \
tail $(find /tmp/sorcery/cast/ -name $FILE.compile.log )\
--follow=name --pid=$(ls "/tmp/liblock-0/cast.$FILE") 2>/dev/null
diff --git a/usr/sbin/scribe b/usr/sbin/scribe
index 30f3069..047d63a 100755
--- a/usr/sbin/scribe
+++ b/usr/sbin/scribe
@@ -451,7 +451,7 @@ function scribe_reindex() {
fi
paths="$paths $grimoire"
done
- $STD_SORCERY_DEBUG "reindex: paths = \"$paths\""
+ debug "scribe" "reindex: paths = \"$paths\""

message -n "Reindexing spell list... "
codex_create_cache $paths
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index f3d3aa4..767b12b 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -723,7 +723,7 @@ optimize_architecture() {

architecture_menu() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "sorcery" "architecture_menu()"
local SPECFILE
local LIST CPUNAME specname
local specname CPUNAME
@@ -744,12 +744,12 @@ architecture_menu() {
for specname in $(hash_get_table_fields archspec_hash|sort); do
CPUNAME=""
SPECFILE=$(hash_get archspec_hash $specname) &&
- $STD_SORCERY_DEBUG "$specname found at $SPECFILE"
+ debug "sorcery" "architecture_menu() - $specname found at $SPECFILE"
CPUNAME=$( . $SPECFILE && echo $CPUNAME ) &&
LIST="$LIST $specname \"$CPUNAME\" \"$CPUNAME\""
done
hash_reset archspec_hash
- $STD_SORCERY_DEBUG "Dialog options are $LIST"
+ debug "sorcery" "architecture_menu() - Dialog options are $LIST"

local ARCH_TITLE="$2"
local ARCH_HELP="Please select a microprocessor category"
@@ -776,7 +776,7 @@ architecture_menu() {
# remove spurious ""
NEW_ARCH=`echo "${NEW_ARCH}" | sed -e 's/^"//' -e 's/"$//'`

- $STD_SORCERY_DEBUG "NEW_ARCH='$NEW_ARCH'"
+ debug "sorcery" "architecture_menu() - NEW_ARCH='$NEW_ARCH'"

modify_local_config "$1" "${NEW_ARCH}"
fi
@@ -816,7 +816,7 @@ optimization_menu(){
then

OPTIMIZATIONS=`echo ${OPTIMIZATIONS} | tr '\n' ' '`
- $STD_SORCERY_DEBUG "OPTIMIZATIONS='${OPTIMIZATIONS}'"
+ debug "sorcery" "optimization_menu() - OPTIMIZATIONS='${OPTIMIZATIONS}'"

modify_local_config "OPTIMIZATIONS" "$OPTIMIZATIONS"

@@ -1481,7 +1481,6 @@ sorcery_devel_settings() {

local D_HELP="Set the debugging file for normal debugging."
local S_HELP="Turn on Super Debug. You probably don't want to do this."
- local F_HELP="Selectivly disable output of debugging messages."

while

@@ -1494,7 +1493,6 @@ sorcery_devel_settings() {
"" \
0 0 0 \
"D" "Debug file" "$D_HELP" \
- "F" "Filter messages" "$F_HELP" \
"S" "Super debugging toggle" "$S_HELP"'`
do

@@ -1502,8 +1500,7 @@ sorcery_devel_settings() {

D) TEXT="Note: if you turn this on, don't forget to empty the log file
occasionaly.\nWhat file do you want the debugging logged to?"
FILE=`eval $DIALOG --ok-label "Commit" --inputbox \"$TEXT\" 0 0
\"$DEBUG\"` &&
- modify_local_config "SORCERY_DEBUG" "$FILE" ;;
- F) sorcery_debug_filter ;;
+ modify_local_config "DEBUG" "$FILE" ;;
S) TEXT="Note: You don't want to do this probably. Don't forget to
2>/root/debug.out.\nDo you want super debugging on?"
TOGGLE=`eval $DIALOG --yesno \"$TEXT\" 0 0` &&
( modify_local_config "SUPER_DEBUG" "on" ; modify_local_config "set"
"-x" "command" ) ||
@@ -1515,55 +1512,6 @@ sorcery_devel_settings() {

}

-sorcery_debug_filter() {
-set -x
- local i
- local CHECKLIST=`make_debug_checklist`
-
- local DEVEL_TITLE="Select common debug topics to filter"
- local DEVEL_HELP="[ ]=displayed [X]=surpressed"
-
- if OUTLIST=`eval $DIALOG ' --title "$DEVEL_TITLE" \
- --ok-label "Commit" \
- --separate-output \
- --checklist \
- "$DEVEL_HELP" \
- 0 0 0 \
- '$CHECKLIST`
- then
- # The space on the end is there on purpose, so an empty list won't give
an
- # empty string, so default values will not be used
- modify_local_config "SORCERY_DEBUG_FILTER" "$OUTLIST "
- fi
-set +x
-}
-
-make_debug_checklist() {
- local VAR
- array=()
-
- find $SGL_LIBRARY_MODULES -type f -name 'lib*' -printf %f\\n | sort |
- while read LINE ; do
- VAR=SORCERY_DEBUG_${LINE}
- echo -en "\"${LINE}\""
- echo -en "\t\"${LINE}\""
- if [[ ${!VAR} == "n" ]] ; then
- echo -e "\t\"on\""
- else
- echo -e "\t\"off\""
- fi
- done
-
- # There's an extra special variable for turning on and off
- # function entry messages at once
- echo -en "\"ENTRY\"\t\"Function Entry\"\t"
- if [[ $SORCERY_ENTRY_DEBUG == "n" ]] ; then
- echo -e "\t\"on\""
- else
- echo -e "\t\"off\""
- fi
-
-}

feature_menu() {

diff --git a/var/lib/sorcery/modules/build_api/api1
b/var/lib/sorcery/modules/build_api/api1
index eabfb5d..f345d4b 100755
--- a/var/lib/sorcery/modules/build_api/api1
+++ b/var/lib/sorcery/modules/build_api/api1
@@ -23,7 +23,7 @@
## a spell for BUILD_API 1.
#---------------------------------------------------------------------
function run_build_spell() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "run_build_spell"
C_LOG=$TMP_DIR/$SPELL.compile.log
C_FIFO=/dev/stdout
STAGED_INSTALL=off
@@ -82,7 +82,7 @@ function run_build_spell() {
#---------------------------------------------------------------------
function run_pre_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "run_pre_build()"
message "${MESSAGE_COLOR}Building" \
"${SPELL_COLOR}${SPELL}" \
"${DEFAULT_COLOR}"
@@ -102,7 +102,7 @@ function run_pre_build() {
#---------------------------------------------------------------------
function run_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "Starting run_build()"

echo "Compile log for $SPELL $VERSION Built on `date -u`" > $C_LOG
echo "Using gcc version: `gcc -dumpversion`" >> $C_LOG
@@ -144,7 +144,7 @@ function run_build() {
#---------------------------------------------------------------------
function run_post_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "Starting run_post_build()"
run_spell_file POST_BUILD post_build

# Lock made in prepare_install
@@ -160,7 +160,7 @@ function run_post_build() {
#---------------------------------------------------------------------
function run_post_install() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "Starting run_post_install()"
run_spell_file INSTALL install
}

@@ -172,7 +172,7 @@ function run_post_install() {
#---------------------------------------------------------------------
function real_default_sorcery_pre_build() {

- $STD_SORCERY_DEBUG SOURCE=$SOURCE SOURCE_DIRECTORY=$SOURCE_DIRECTORY"
+ debug "build_api/api1" "Starting real_default_sorcery_pre_build() -
SOURCE=$SOURCE SOURCE_DIRECTORY=$SOURCE_DIRECTORY"
mk_source_dir $SOURCE_DIRECTORY &&
unpack_file

@@ -199,7 +199,7 @@ function real_default_sorcery_pre_build(
#---------------------------------------------------------------------
function real_default_sorcery_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "Starting real_default_sorcery_build()"
OPTS="$OPTS --build=${BUILD}"
#If this switches are used, they _may_ stop distcc and ccache from working
# for some spells (bug 3798)
@@ -228,7 +228,7 @@ function real_default_sorcery_build() {
#---------------------------------------------------------------------
function real_default_sorcery_post_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api1" "Starting real_default_sorcery_post_build()"

install_xinetd
install_initd
diff --git a/var/lib/sorcery/modules/build_api/api2
b/var/lib/sorcery/modules/build_api/api2
index 6807352..831a025 100755
--- a/var/lib/sorcery/modules/build_api/api2
+++ b/var/lib/sorcery/modules/build_api/api2
@@ -24,7 +24,7 @@
## a spell for BUILD_API 2.
#---------------------------------------------------------------------
function run_build_spell() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "run_build_spell"

local CHROOT_CHECK=""

@@ -112,7 +112,7 @@ function run_build_spell() {
#---------------------------------------------------------------------
function run_pre_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "run_pre_build()"
message "${MESSAGE_COLOR}Building" \
"${SPELL_COLOR}${SPELL}" \
"${DEFAULT_COLOR}"
@@ -133,7 +133,7 @@ function run_pre_build() {
#---------------------------------------------------------------------
function run_build() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting run_compile()"

echo "Compile log for $SPELL $VERSION Built on `date -u`" > $C_LOG
echo "Using gcc version: `gcc -dumpversion`" >> $C_LOG
@@ -169,7 +169,7 @@ function run_build() {
## run_build finished, then runs PRE_INSTALL or default_pre_install
#---------------------------------------------------------------------
function run_pre_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting run_pre_install()"

if [ -f $S_PWD ] ; then
cd "`cat $S_PWD`"
@@ -193,7 +193,7 @@ function run_pre_install() {
## stage root properly
#---------------------------------------------------------------------
function run_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting run_install()"
if [ -f $S_PWD ] ; then
cd "`cat $S_PWD`"
elif [ -d $SOURCE_DIRECTORY ] ; then
@@ -214,7 +214,7 @@ function run_install() {

function run_install_extras() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting run_install_extras()"
run_spell_file INSTALL_EXTRAS install_extras
}

@@ -228,7 +228,7 @@ function run_install_extras() {
## stage root properly
#---------------------------------------------------------------------
function run_post_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting run_post_install()"
persistent_load &&
if [[ $STAGED_INSTALL != off ]]
then
@@ -258,7 +258,7 @@ function run_transfer() {
#---------------------------------------------------------------------
function run_final() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting run_final()"
run_spell_file FINAL final
}

@@ -270,7 +270,7 @@ function run_final() {
#---------------------------------------------------------------------
function real_default_sorcery_pre_build() {

- $STD_SORCERY_DEBUG "SOURCE=$SOURCE SOURCE_DIRECTORY=$SOURCE_DIRECTORY"
+ debug "libgrimoire" "default_pre_build() - SOURCE=$SOURCE
SOURCE_DIRECTORY=$SOURCE_DIRECTORY"
mk_source_dir $SOURCE_DIRECTORY &&
unpack_file

@@ -292,7 +292,7 @@ function real_default_sorcery_pre_build(
##
#---------------------------------------------------------------------
function real_default_sorcery_build() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "real_default_sorcery_build"

OPTS="$OPTS --build=${BUILD}"
#If these switches are used, they _may_ stop distcc and ccache from working
@@ -320,7 +320,7 @@ function real_default_sorcery_build() {
##
#---------------------------------------------------------------------
function real_default_sorcery_pre_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting real_default_sorcery_pre_install"
prepare_install
}

@@ -334,7 +334,7 @@ function real_default_sorcery_pre_instal
##
#---------------------------------------------------------------------
function real_default_sorcery_install() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting real_default_sorcery_install"
make install
}

@@ -348,7 +348,7 @@ function real_default_sorcery_install()
#---------------------------------------------------------------------
function real_default_sorcery_install_extras() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting real_default_sorcery_post_install"
install_xinetd
install_initd
install_pam_confs
@@ -363,7 +363,7 @@ function real_default_sorcery_install_ex

function real_default_sorcery_transfer() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "build_api/api2" "Starting real_default_sorcery_post_install"
transfer_staged_spell
}

diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index c521018..5086c03 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -24,7 +24,7 @@
# checks for a security file
# returns 0 if spell should be cast, 1 otherwise
function run_security() {
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "build_api/common" "Starting run_security() on $SPELL"
if [ -f $SCRIPT_DIRECTORY/SECURITY ]; then
echo -e "${SPELL_COLOR}${SPELL}:${DEFAULT_COLOR}"
tee -a $SECURITY_LOG < $SCRIPT_DIRECTORY/SECURITY
@@ -49,7 +49,7 @@ function run_security() {
## asks the user if they want to edit the custom options
#---------------------------------------------------------------------
function run_config_loc () {
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "build_api/common" "Starting run_config_loc() on $SPELL"
pushd . > /dev/null # may have been somewhere else
[ -d "$SOURCE_DIRECTORY" ] &&
cd $SOURCE_DIRECTORY # we need to be in here for this function to
work
@@ -113,7 +113,7 @@ function run_config_loc () {
#---------------------------------------------------------------------
function real_prepare_install() { (

- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libgrimoire" "Running prepare_install() on $SPELL"

message "${MESSAGE_COLOR}Preparing to install" \
"${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}"
@@ -168,7 +168,7 @@ function real_gather_docs() { (

if [ "$GATHER_DOCS" == "on" ]; then

- $STD_SORCERY_DEBUG "SPELL = $SPELL" "DOCS=$DOCS"
+ debug "libgrimoire" "Running gather_docs() on $SPELL DOCS=$DOCS"

DEST_DIR=$DOCUMENT_DIRECTORY/$SPELL
mkdir -p $DEST_DIR
@@ -203,7 +203,7 @@ function real_gather_docs() { (
#---------------------------------------------------------------------
function install_pam_confs() {

- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libgrimoire" "Running install_pam_confs() on $SPELL"

if [ -d "$SCRIPT_DIRECTORY/pam.d" ]; then
cd "$SCRIPT_DIRECTORY/pam.d"
@@ -225,7 +225,7 @@ function install_pam_confs() {
## This is intended to be overridable at some point
#---------------------------------------------------------------------
function run_spell_success() {
- $STD_SORCERY_DEBUG "cast of $SPELL-$VERSION was successful"
+ debug "build_api/common" "cast of $SPELL-$VERSION was successful"

local INST_LOG="$INSTALL_LOGS/$SPELL-$VERSION"
local MD5_LOG="$MD5SUM_LOGS/$SPELL-$VERSION"
@@ -244,7 +244,7 @@ function run_spell_success() {
pop_install_queue "$SPELL"

# update depends info
- $STD_SORCERY_DEBUG "Merging depends info"
+ debug "build_api/common" "Merging depends info"

local t_DEPENDS_STATUS=$(lock_start_transaction $DEPENDS_STATUS)
# none of the old values are valid, only the new, uncommitted values are
@@ -338,7 +338,7 @@ function run_spell_success() {
## This is intended to be overridable at some point
#---------------------------------------------------------------------
function run_spell_failure() {
- $STD_SORCERY_DEBUG "cast of $SPELL-$VERSION failed"
+ debug "build_api/common" "cast of $SPELL-$VERSION failed"
local rc=$1

sound FAILURE
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_tla
b/var/lib/sorcery/modules/dl_handlers/dl_tla
index fc987da..2e7372b 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_tla
+++ b/var/lib/sorcery/modules/dl_handlers/dl_tla
@@ -42,7 +42,7 @@ function dl_tla_get() {
continue
}
else
- $STD_SORCERY_DEBUG "archive $TLA_ARCHIVE is already registered"
+ debug "archive $TLA_ARCHIVE is already registered"
fi
if test -d $target; then
pushd $target &>/dev/null &&
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_wget
b/var/lib/sorcery/modules/dl_handlers/dl_wget
index 63efdb1..b69ca19 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_wget
+++ b/var/lib/sorcery/modules/dl_handlers/dl_wget
@@ -21,7 +21,7 @@
#---------------------------------------------------------------------

function dl_wget_get() {
- $STD_SORCERY_DEBUG_HEAD
+ debug libdownload "$FUNCNAME -- $@"
dl_command_check wget || return 254

local target=$1
@@ -60,7 +60,7 @@ function dl_wget_call_wget() {
local FILE=$1
local URL=$2

- $STD_SORCERY_DEBUG_HEAD
+ debug 'dl_wget' "$funcname -- $@"

rm -f $FILE
wget $WGET_OPTIONS "$URL" 2>&1 &&
@@ -118,7 +118,7 @@ function dl_wget_set_options() {
DEREF_SYM="--retr-symlinks"

WGET_OPTIONS="$URL_HTTP_TIMEOUT $URL_HTTP_RETRIES $NO_CACHE $RATE $PASSIVE
$CONTINUE $ONLY_NEWER $DEREF_SYM"
- $STD_SORCERY_DEBUG "wget options: $WGET_OPTIONS"
+ debug 'dl_wget' "wget options: $WGET_OPTIONS"
}
#---------------------------------------------------------------------
##=back
diff --git a/var/lib/sorcery/modules/libapi b/var/lib/sorcery/modules/libapi
index ba68df1..01e9fbe 100755
--- a/var/lib/sorcery/modules/libapi
+++ b/var/lib/sorcery/modules/libapi
@@ -125,8 +125,7 @@
# CAST_PASS download_log IW_LOG SOLO QUIET INSTALL_QUEUE
# OVERRIDE_CFLAGS OVERRIDE_CXXFLAGS OVERRIDE_LDFLAGS NO_OPTIMIZATION_FLAGS
# DOT_PROGRESS VOYEUR_OVERRIDE RECONFIGURE RECAST_DOWN COMPILE RECAST_UP
-# FORCE_DOWNLOAD SILENT FIX SORCERY_DEBUG STD_SORCERY_DEBUG
-# STD_SORCERY_DEBUG_HEAD SEPARATE BASE_URL
+# FORCE_DOWNLOAD SILENT FIX DEBUG SEPARATE BASE_URL
# CAST_HASH BACK_CAST_HASH CANNOT_CAST_HASH uncommitted_hash NEW_DEPENDS
# spell_depends DEPENDS_CONFIG UP_DEPENDS SPELL_CONFIG GRIMOIRE_DIR
# BUILD_API VOYEUR_STDOUT VOYEUR_STDERR C_LOG C_FIFO INST_LOG MD5_LOG
@@ -145,7 +144,7 @@
##
#---------------------------------------------------------------------
function acquire_src() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_acquire_src "$@"
}

@@ -170,7 +169,7 @@ function acquire_src() {
##
#---------------------------------------------------------------------
function config_query () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "config_query - $*"
real_config_query "$@"
}

@@ -192,7 +191,7 @@ function config_query () {
##
#---------------------------------------------------------------------
function config_query_list () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "config_query_list - $*"
real_config_query_list "$@"
}

@@ -233,7 +232,7 @@ function config_query_list () {
##
#---------------------------------------------------------------------
function config_query_option () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "config_query_option - $*"
real_config_query_option "$@"
}

@@ -255,7 +254,7 @@ function config_query_option () {
##
#---------------------------------------------------------------------
function config_query_string () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "config_query_string - $*"
real_config_query_string "$@"
}

@@ -269,7 +268,7 @@ function config_query_string () {
## returns the given spellname if it is installed
#---------------------------------------------------------------------
function conflicts () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "conflicts - $*"
real_conflicts "$@"
}

@@ -301,7 +300,7 @@ function conflicts () {
##
#---------------------------------------------------------------------
function default_sorcery_build () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_build - $*"
real_default_sorcery_build "$@"
}

@@ -313,7 +312,7 @@ function default_sorcery_build () {
##
#---------------------------------------------------------------------
function default_sorcery_download() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_default_sorcery_download "$@"
}

@@ -329,7 +328,7 @@ function default_sorcery_download() {
##
#---------------------------------------------------------------------
function default_sorcery_install () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_install - $*"
real_default_sorcery_install "$@"
}

@@ -340,7 +339,7 @@ function default_sorcery_install () {
## Installs configuration files and documentation.
#---------------------------------------------------------------------
function default_sorcery_install_extras () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_install_extras - $*"
real_default_sorcery_install_extras "$@"
}

@@ -354,7 +353,7 @@ function default_sorcery_install_extras
##
#---------------------------------------------------------------------
function default_sorcery_post_build () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_post_build - $*"
real_default_sorcery_post_build "$@"
}

@@ -366,7 +365,7 @@ function default_sorcery_post_build () {
## installed files can happen
#---------------------------------------------------------------------
function default_sorcery_post_install () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_post_install - $*"
real_default_sorcery_post_install "$@"
}

@@ -378,7 +377,7 @@ function default_sorcery_post_install ()
## transfer_staged_spell
#---------------------------------------------------------------------
function default_sorcery_transfer () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_transfer - $*"
real_default_sorcery_transfer "$@"
}

@@ -389,7 +388,7 @@ function default_sorcery_transfer () {
## Used if no PRE_BUILD script is found for a spell.
#---------------------------------------------------------------------
function default_sorcery_pre_build () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_pre_build - $*"
real_default_sorcery_pre_build "$@"
}

@@ -405,7 +404,7 @@ function default_sorcery_pre_build () {
##
#---------------------------------------------------------------------
function default_sorcery_pre_install () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "default_sorcery_pre_install - $*"
real_default_sorcery_pre_install "$@"
}

@@ -419,7 +418,7 @@ function default_sorcery_pre_install ()
## Denotes that a spell requires another spell to work.
#---------------------------------------------------------------------
function depends () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "depends - $*"
real_depends "$@"
}

@@ -429,7 +428,7 @@ function depends () {
## Stops using installwatch
#---------------------------------------------------------------------
function devoke_installwatch () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "devoke_installwatch - $*"
real_devoke_installwatch "$@"
}

@@ -439,7 +438,7 @@ function devoke_installwatch () {
## Stops using installwatch
#---------------------------------------------------------------------
function devoke_stage_root () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "devoke_stage_root - $*"
real_devoke_stage_root "$@"
}

@@ -455,7 +454,7 @@ function devoke_stage_root () {
##
#---------------------------------------------------------------------
function download_src() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_download_src "$@"
}
#---------------------------------------------------------------------
@@ -477,7 +476,7 @@ function download_src() {
## </pre>
#---------------------------------------------------------------------
function force_depends() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_force_depends "$@"
}

@@ -488,7 +487,7 @@ function force_depends() {
## them as part of the spell
#---------------------------------------------------------------------
function gather_docs() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "gather_docs - $*"
real_gather_docs "$@"
}

@@ -503,7 +502,7 @@ function gather_docs() {
##
#---------------------------------------------------------------------
function get_source_nums() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_get_source_nums "$@"
}

@@ -521,7 +520,7 @@ function get_source_nums() {
## @stdout the provider name(s)
#---------------------------------------------------------------------
function get_spell_provider() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "get_spell_provider - $*"
real_get_spell_provider "$@"
}

@@ -536,7 +535,7 @@ function get_spell_provider() {
##
#---------------------------------------------------------------------
function guess_compressor () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "guess_compressor - $*"
real_guess_compressor "$@"
}

@@ -558,7 +557,7 @@ function guess_compressor () {
## choose what the default will be
#------------------------------------------------------------------------
function handle_changed_config() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "handle_changed_config - $*"
real_handle_changed_config "$@"
}

@@ -571,7 +570,7 @@ function handle_changed_config() {
##
#---------------------------------------------------------------------
function is_depends_enabled() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "is_depends_enabled - $*"
real_is_depends_enabled "$@"
}

@@ -583,7 +582,7 @@ function is_depends_enabled() {
##
#---------------------------------------------------------------------
function installed_version () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "installed_version - $*"
real_installed_version "$@"
}

@@ -597,7 +596,7 @@ function installed_version () {
## Returns the current version of the given spell
#------------------------------------------------------------------------
function install_config_file() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "install_config_file - $*"
real_install_config_file "$@"
}

@@ -607,7 +606,7 @@ function install_config_file() {
## Starts using installwatch
#---------------------------------------------------------------------
function invoke_installwatch () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "invoke_installwatch - $*"
real_invoke_installwatch "$@"
}

@@ -617,7 +616,7 @@ function invoke_installwatch () {
## Starts using installwatch
#---------------------------------------------------------------------
function invoke_stage_root () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "invoke_stage_root - $*"
real_invoke_stage_root "$@"
}

@@ -636,7 +635,7 @@ function invoke_stage_root () {
##
#---------------------------------------------------------------------
function list_remove () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "list_remove - $*"
real_list_remove "$@"
}

@@ -656,7 +655,7 @@ function list_remove () {
##
#---------------------------------------------------------------------
function list_add () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "list_add - $*"
real_list_add "$@"
}

@@ -680,7 +679,7 @@ function list_add () {
##
#---------------------------------------------------------------------
function list_find () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "list_find - $*"
real_list_find "$@"
}

@@ -693,7 +692,7 @@ function list_find () {
##
#---------------------------------------------------------------------
function message () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "message - $*"
real_message "$@"
}

@@ -715,7 +714,7 @@ function message () {
## </pre>
#---------------------------------------------------------------------
function mk_source_dir () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "mk_source_dir - $*"
real_mk_source_dir "$@"
}

@@ -726,7 +725,7 @@ function mk_source_dir () {
##
#---------------------------------------------------------------------
function note_config_file() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "note_config_file - $*"
real_note_config_file "$@"
}

@@ -740,7 +739,7 @@ function note_config_file() {
##
#---------------------------------------------------------------------
function on_cast () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "on_cast - $*"
real_on_cast "$@"
}

@@ -756,7 +755,7 @@ function on_cast () {
##
#---------------------------------------------------------------------
function on_dispel () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "on_dispel - $*"
real_on_dispel "$@"
}

@@ -771,7 +770,7 @@ function on_dispel () {
##
#---------------------------------------------------------------------
function on_pre_cast () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "on_pre_cast - $*"
real_on_pre_cast "$@"
}

@@ -785,7 +784,7 @@ function on_pre_cast () {
##
#---------------------------------------------------------------------
function on_pre_dispel () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "on_pre_dispel - $*"
real_on_pre_dispel "$@"
}

@@ -800,7 +799,7 @@ function on_pre_dispel () {
## Denotes that a spell can use another spell for additional functionality.
#---------------------------------------------------------------------
function optional_depends () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "optional_depends - $*"
real_optional_depends "$@"
}

@@ -816,7 +815,7 @@ function optional_depends () {
##
#---------------------------------------------------------------------
function persistent_add () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "persistent_add - $*"
real_persistent_add "$@"
}

@@ -832,7 +831,7 @@ function persistent_add () {
##
#---------------------------------------------------------------------
function persistent_clear () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "persistent_clear - $*"
real_persistent_clear "$@"
}

@@ -846,7 +845,7 @@ function persistent_clear () {
##
#---------------------------------------------------------------------
function persistent_load () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "persistent_load - $*"
real_persistent_load "$@"
}

@@ -862,7 +861,7 @@ function persistent_load () {
##
#---------------------------------------------------------------------
function persistent_remove () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "persistent_remove - $*"
real_persistent_remove "$@"
}

@@ -878,7 +877,7 @@ function persistent_remove () {
##
#---------------------------------------------------------------------
function persistent_save () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "persistent_save - $*"
real_persistent_save "$@"
}

@@ -897,7 +896,7 @@ function persistent_save () {
##
#---------------------------------------------------------------------
function persistent_read () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "persistent_read - $*"
real_persistent_read "$@"
}

@@ -911,7 +910,7 @@ function persistent_read () {
##
#---------------------------------------------------------------------
function prepare_install () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "prepare_install - $*"
real_prepare_install "$@"
}

@@ -923,7 +922,7 @@ function prepare_install () {
## @return 0 if any provider of $1 is installed
#---------------------------------------------------------------------
function provider_ok() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "provider_ok - $*"
real_provider_ok "$@"
}

@@ -937,7 +936,7 @@ function provider_ok() {
##
#---------------------------------------------------------------------
function rm_source_dir() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "rm_source_dir - $*"
real_rm_source_dir "$@"
}

@@ -957,7 +956,7 @@ function rm_source_dir() {
##
#---------------------------------------------------------------------
function query () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "query - $*"
real_query "$@"
}

@@ -978,7 +977,7 @@ function query () {
##
#---------------------------------------------------------------------
function query_string () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "query_string - $*"
real_query_string "$@"
}

@@ -992,7 +991,7 @@ function query_string () {
## Denotes that a spell requires another spell to work.
#---------------------------------------------------------------------
function runtime_depends () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "runtime_depends - $*"
real_runtime_depends "$@"
}

@@ -1012,7 +1011,7 @@ function runtime_depends () {
##
#---------------------------------------------------------------------
function sedit () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "sedit - $*"
real_sedit "$@"
}

@@ -1026,7 +1025,7 @@ function sedit () {
## @stdout recursively prints out the spell that depend on the specified
spell
#---------------------------------------------------------------------
function show_up_depends() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "spell_ok - $*"
real_show_up_depends "$@"
}

@@ -1038,7 +1037,7 @@ function show_up_depends() {
## @return 0 if the given spell's status is "installed"
#---------------------------------------------------------------------
function spell_installed () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "spell_installed - $*"
real_spell_installed "$@"
}

@@ -1050,7 +1049,7 @@ function spell_installed () {
## @return 0 if the given spell's status is "held"
#---------------------------------------------------------------------
function spell_held() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "spell_held - $*"
real_spell_held "$@"
}

@@ -1062,7 +1061,7 @@ function spell_held() {
## @return 0 if the given spell's status is "installed" or "held"
#---------------------------------------------------------------------
function spell_ok() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "spell_ok - $*"
real_spell_ok "$@"
}

@@ -1074,7 +1073,7 @@ function spell_ok() {
## @return 0 if the given spell's status is "exiled"
#---------------------------------------------------------------------
function spell_exiled() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "spell_ok - $*"
real_spell_exiled "$@"
}

@@ -1085,7 +1084,7 @@ function spell_exiled() {
## @See <@function var.lib.sorcery.modules.libdepends
#---------------------------------------------------------------------
function sub_depends() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "sub_depends - $*"
real_sub_depends "$@"
}

@@ -1100,7 +1099,7 @@ function sub_depends() {
## Denotes that a spell can use another spell for additional functionality.
#---------------------------------------------------------------------
function suggest_depends () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "suggest_depends - $*"
real_suggest_depends "$@"
}

@@ -1114,7 +1113,7 @@ function suggest_depends () {
##
#---------------------------------------------------------------------
function uncompress () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "uncompress - $*"
real_uncompress "$@"
}

@@ -1131,7 +1130,7 @@ function uncompress () {
##
#---------------------------------------------------------------------
function unpack () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "unpack - $*"
real_unpack "$@"
}

@@ -1146,7 +1145,7 @@ function unpack () {
##
#---------------------------------------------------------------------
function unpack_file () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "unpack_file - $*"
real_unpack_file "$@"
}

@@ -1159,7 +1158,7 @@ function unpack_file () {
##
#---------------------------------------------------------------------
function unpack_file_simple() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_unpack_file_simple "$@"
}

@@ -1174,7 +1173,7 @@ function unpack_file_simple() {
##
#---------------------------------------------------------------------
function verify_file () {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "verify_file - $*"
real_verify_file "$@"
}

@@ -1191,7 +1190,7 @@ function verify_file () {
##
#---------------------------------------------------------------------
function up_trigger() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "$FUNCNAME - $*"
real_up_trigger "$@"
}

@@ -1205,7 +1204,7 @@ function up_trigger() {
## to glibc. Installwatch must be running for this to work.
#---------------------------------------------------------------------
function track_manual() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libapi" "track_manual - $*"
real_track_manual "$@"
}

diff --git a/var/lib/sorcery/modules/libcast b/var/lib/sorcery/modules/libcast
index e738f2f..67caf74 100755
--- a/var/lib/sorcery/modules/libcast
+++ b/var/lib/sorcery/modules/libcast
@@ -19,7 +19,7 @@
#---------------------------------------------------------------------
function load_build_api() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libcast" "Starting load_build_api"

source $SGL_LIBRARY_MODULES/build_api/common
case $BUILD_API in
@@ -93,7 +93,7 @@ function prepare_spell_config() {
#---------------------------------------------------------------------
function run_conflicts() {

- $STD_SORCERY_DEBUG_HEAD "on $SPELL"
+ debug "build_api/common" "Starting run_conflicts() on $SPELL"
local ignore_conflict=$1
local each rc

@@ -657,7 +657,7 @@ function create_compile_log() {
#---------------------------------------------------------------------
function view_compile_log() {

- $STD_SORCERY_DEBUG_HEAD "C_LOG=$C_LOG"
+ debug "libcast" "In view_compile_log, C_LOG=$C_LOG"
report $C_LOG "Compile log"
}

@@ -668,7 +668,7 @@ function view_compile_log() {
#---------------------------------------------------------------------
function report_install() {

- $STD_SORCERY_DEBUG_HEAD "INST_LOG=$INST_LOG"
+ debug "libcast" "In report_install, INST_LOG=$INST_LOG"
report $INST_LOG "Install log"

}
@@ -709,7 +709,7 @@ function show_downloading() {

local SPELL=$1
local download_log=$(get_spell_dl_log $SPELL)
- $STD_SORCERY_DEBUG "Started show_downloading() on $SPELL from
$download_log"
+ debug "cast" "Started show_downloading() on $SPELL from $download_log"

# poke around waiting for downloading to start
while ! ( [[ $download_log ]] &&
@@ -725,7 +725,7 @@ function show_downloading() {
done

show_download_progress $download_log
- $STD_SORCERY_DEBUG_HEAD "Out of show_downloading"
+ debug "libcast" "Out of show_downloading"
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index ab8a901..29c2913 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -340,7 +340,7 @@ function codex_set_grimoires() {
##
#---------------------------------------------------------------------
function codex_get_all_grimoires() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "codex_get_all_grimoires()"
echo "${GRIMOIRE_DIR[*]}" | tr '[:blank:]' '\n'
return $?
}
@@ -366,7 +366,7 @@ function codex_find_section_by_name() {

for GRIMOIRE in `codex_get_all_grimoires`; do
if [ -d "$GRIMOIRE/$SECTION_NAME" ] ; then
- $STD_SORCERY_DEBUG "found section $GRIMOIRE/$SECTION_NAME"
+ debug "libcodex" "codex_find_section_by_name() - found section
$GRIMOIRE/$SECTION_NAME"
echo "$GRIMOIRE/$SECTION_NAME"
return 0
fi
@@ -418,7 +418,7 @@ function codex_get_section_names() {
##
#---------------------------------------------------------------------
function codex_get_sections() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "codex_get_sections() - $@"
local GRIMOIRE

while [ $# -gt 0 ] ; do
@@ -486,7 +486,7 @@ function codex_does_spell_exist() {
#---------------------------------------------------------------------
function codex_find_spell_by_name() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "codex_find_spell_by_name - $*"

codex_cache_spell_lookup $1 `codex_get_all_grimoires`

@@ -501,7 +501,7 @@ function codex_find_spell_by_name() {
##
#---------------------------------------------------------------------
function codex_get_spells_in_section() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "codex_get_spells_in_section - $*"
codex_is_canonicalized $1 || return 1
local section=`basename $1`
local index="`dirname $1`/$SPELL_INDEX_FILE"
@@ -599,7 +599,7 @@ function codex_clear_current_spell() {
#---------------------------------------------------------------------
function codex_set_current_spell() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "runing codex_set_current_spell"

codex_clear_current_spell

@@ -609,11 +609,11 @@ function codex_set_current_spell() {
. $SPELL_CONFIG > /dev/null 2> /dev/null
fi

- $STD_SORCERY_DEBUG "looking around for API_VERSION"
+ debug "libcodex" "looking around for API_VERSION"
[[ -x $GRIMOIRE/API_VERSION ]] && . $GRIMOIRE/API_VERSION
[[ -x $SECTION_DIRECTORY/API_VERSION ]] && . $SECTION_DIRECTORY/API_VERSION

- $STD_SORCERY_DEBUG "sourcing DETAILS"
+ debug "libcodex" "sourcing DETAILS"
persistent_load
. $SPELL_DIRECTORY/DETAILS 1>/dev/null 2>&1
persistent_clear
@@ -682,9 +682,9 @@ function codex_get_spell_paths() {
##
#---------------------------------------------------------------------
function codex_set_current_spell_by_name() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "codex_set_current_spell_by_name -- $1"
local SPELL_NAME=`codex_find_spell_by_name "$1"`
- $STD_SORCERY_DEBUG $SPELL_NAME
+ debug "libcodex" $SPELL_NAME

[ -n "$SPELL_NAME" ] && codex_set_current_spell $SPELL_NAME
}
@@ -706,7 +706,7 @@ function codex_cache_spell_lookup() {
local spell="$1"
shift
while [ $# -gt 0 ] ; do
- $STD_SORCERY_DEBUG "looking up $spell in ${1}\\'s cache"
+ debug "libcodex" "looking up $spell in ${1}'s cache"
codex_check_cache $1
SECTION=`grep -m 1 "^$spell " $1/$SPELL_INDEX_FILE | cut -d' ' -f2`
[[ $SECTION ]] && echo "$SECTION/$spell" && return
@@ -742,7 +742,7 @@ function codex_check_cache() {
#---------------------------------------------------------------------
function codex_create_cache() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libcodex" "codex_create_cache - $*"
local list="$*"
[[ $list ]] || list="${GRIMOIRE_DIR[*]}"

diff --git a/var/lib/sorcery/modules/libcrossinstall
b/var/lib/sorcery/modules/libcrossinstall
index ade9b03..cff02cb 100755
--- a/var/lib/sorcery/modules/libcrossinstall
+++ b/var/lib/sorcery/modules/libcrossinstall
@@ -16,7 +16,7 @@
#---------------------------------------------------------------------
function install_root_menu() {

- $STD_SORCERY_DEBUG "cross_install_menu is being built now..."
+ debug "libcrossinstall" "cross_install_menu is being built now..."
local C_HELP="Fill in your own preferred track root location."
local I_HELP="Fill in your own preferred install root location."
local S_HELP="Fill in your own preferred state root location."
@@ -56,7 +56,7 @@ function install_root_menu() {
#---------------------------------------------------------------------
function set_install_cache_menu() {

- $STD_SORCERY_DEBUG "set_install_cache_menu - is starting..."
+ debug "libcrossinstall" "set_install_cache_menu - is starting..."
local PROMPT="Please enter the install cache location where cache tarballs
will be stored"
if NEW_INSTALL_CACHE=`eval $DIALOG ' --ok-label "Commit" \
--inputbox \
@@ -76,7 +76,7 @@ function set_install_cache_menu() {
#---------------------------------------------------------------------
function set_install_root_menu() {

- $STD_SORCERY_DEBUG "set_install_root_menu - is starting..."
+ debug "libcrossinstall" "set_install_root_menu - is starting..."
local PROMPT="Please enter the install root location where you want file
installed"
if NEW_INSTALL_ROOT=`eval $DIALOG ' --ok-label "Commit" \
--inputbox \
@@ -96,7 +96,7 @@ function set_install_root_menu() {
#---------------------------------------------------------------------
function set_state_root_menu() {

- $STD_SORCERY_DEBUG "set_state_root_menu - is starting..."
+ debug "libcrossinstall" "set_state_root_menu - is starting..."
local PROMPT="Please enter location where you want state files to be"
if NEW_STATE_ROOT=`eval $DIALOG ' --ok-label "Commit" \
--inputbox \
@@ -116,7 +116,7 @@ function set_state_root_menu() {
#---------------------------------------------------------------------
function set_track_root_menu() {

- $STD_SORCERY_DEBUG "set_track_root_menu - is starting..."
+ debug "libcrossinstall" "set_track_root_menu - is starting..."
local PROMPT="Please enter the location where you want files tracked
relative to"
if NEW_TRACK_ROOT=`eval $DIALOG ' --ok-label "Commit" \
--inputbox \
diff --git a/var/lib/sorcery/modules/libdebug
b/var/lib/sorcery/modules/libdebug
deleted file mode 100644
index d3f4cf3..0000000
--- a/var/lib/sorcery/modules/libdebug
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-
-#---------------------------------------------------------------------
-## @param type
-## @param message
-##
-## Enters a debug message if the type of debug message != 'n'
-##
-## The 'type' is usually the name of the file the debug statement
-## comes from. i.e. SORCERY_DEBUG_liblock, SORCERY_DEBUG_libsorcery,
-## sorcery_DEBUG_cast etc.
-## The normal way of calling this function is using $STD_SORCERY_DEBUG
-## which adds in the line number and automatically adds the type
-## STD_SORCERY_DEBUG_HEAD also adds the function parameters
-##
-#---------------------------------------------------------------------
-function debug_message() {
- [[ $SORCERY_DEBUG ]] || return 0
-
- local debugVar="SORCERY_DEBUG_${1}"
- local i
- if ! [[ ${!debugVar} ]] ; then
- echo -n "$1($$): " >>$SORCERY_DEBUG
- shift
- for i in "$@" ; do
- echo -n " \"$i\"" >>$SORCERY_DEBUG
- done
- echo >>$SORCERY_DEBUG
- fi
-
- true
-}
-
-function init_debugging() {
- local i
- for i in ${SORCERY_DEBUG_FILTER} ; do
- eval "SORCERY_DEBUG_$i=n"
- done
-
- if [[ $SORCERY_DEBUG ]] && [[ $SORCERY_DEBUG != "/dev/null" ]] && touch
$SORCERY_DEBUG 2>/dev/null ; then
- if [[ $SORCERY_ENTRY_DEBUG != "n" ]] ; then
- # Standard debug line:
- # file "function@line" "all" "args"
- STD_SORCERY_DEBUG_HEAD='eval local _stddbg_file=${BASH_SOURCE[0]} ;
- _stddbg_file=${_stddbg_file##*/};
- debug_message "${_stddbg_file}" "${FUNCNAME[0]}@$LINENO" "$@"'
- else
- STD_SORCERY_DEBUG_HEAD=':'
- fi
- STD_SORCERY_DEBUG='eval local _stddbg_file=${BASH_SOURCE[0]} ;
- _stddbg_file=${_stddbg_file##*/};
- debug_message "${_stddbg_file}" "${FUNCNAME[0]}@$LINENO"'
- else
- STD_SORCERY_DEBUG_HEAD=':'
- STD_SORCERY_DEBUG=':'
- fi
-}
-
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 0608487..a1cb2e9 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -80,7 +80,7 @@ function run_prepare()
{
local SPELL=$1

- $STD_SORCERY_DEBUG "SPELL = $SPELL SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"
+ debug "cast" "run_prepare() - SPELL = $SPELL SCRIPT_DIRECTORY =
$SCRIPT_DIRECTORY"

depends_message "${SPELL}" "preparing environment..."

@@ -119,7 +119,7 @@ function run_other() {
#---------------------------------------------------------------------
function run_configure() {
local SPELL=$1
- $STD_SORCERY_DEBUG_HEAD "SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"
+ debug "cast" "run_configure() - SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"

function run_configure_msg() {
depends_message "${SPELL}" "running configuration..."
@@ -137,7 +137,7 @@ function run_configure() {
#---------------------------------------------------------------------
function run_depends() {
local SPELL=$1
- $STD_SORCERY_DEBUG_HEAD "SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"
+ debug "cast" "run_depends() - SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"

function run_depends_msg() {
depends_message "${SPELL}" "checking dependencies..."
@@ -155,7 +155,7 @@ function run_depends() {
#---------------------------------------------------------------------
function run_up_triggers() {
local SPELL=$1
- $STD_SORCERY_DEBUG_HEAD "SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"
+ debug "cast" "run_up_triggers() - SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"

function run_up_triggers_msg() {
depends_message "${SPELL}" "checking for reverse triggers..."
@@ -255,7 +255,7 @@ function process_sub_depends() {
run_spell_file SUB_DEPENDS sub_depends || return 1
hash_append processed_sub_depends $sub_dependee $sub_depends
else
- $STD_SORCERY_DEBUG "SUB_DEPENDS: $sub_dependee needs to provide
$sub_depends but has already been processed"
+ debug libdepends "SUB_DEPENDS: $sub_dependee needs to provide
$sub_depends but has already been processed"
fi
else
# sub-depends file doesnt exist, something messed up somewhere
@@ -374,7 +374,7 @@ function compute_uninstalled_depends()
# $1=table to place spells in
# $2=table to put problem spells in, $* = root spells

- $STD_SORCERY_DEBUG_HEAD
+ debug "libdepends" "compute_depends of $*"
local CAST_HASH="$1"
local BACK_CAST_HASH="$2"
local CANNOT_CAST_HASH="$3"
@@ -397,7 +397,7 @@ function compute_uninstalled_depends()
private_remove_dependees ${spells[$_idx]}
fi
else
- $STD_SORCERY_DEBUG "already looked at ${spells[$_idx]}, skipping"
+ debug "libdepends" "already looked at ${spells[$_idx]}, skipping"
fi
done
# we no longer need these, no sense in keeping them around
@@ -420,7 +420,7 @@ function compute_uninstalled_depends()
#---------------------------------------------------------------------
function private_run_depends()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "libdepends" "$FUNCNAME - $*"
local SPELL=$1

# special accumulators for the current spell
@@ -476,7 +476,7 @@ function private_run_depends()
private_recast_optionals $SPELL &&
private_add_triggerees &&
private_add_depends ||
- { $STD_SORCERY_DEBUG "$FUNCNAME failed to process $SPELL." ; return 1; }
+ { debug "libdepends" "$FUNCNAME failed to process $SPELL." ; return 1; }
# no point in keeping the file around if its empty...
test -s $spell_depends || rm -f $spell_depends $spell_sub_depends

@@ -874,7 +874,7 @@ function real_suggest_depends() {
function work_depends_provider()
{

- $STD_SORCERY_DEBUG_HEAD
+ debug "libdepends" "$FUNCNAME - $@"
local default tmp installed=no
local status=()

@@ -955,7 +955,7 @@ function work_depends_provider()
#---------------------------------------------------------------------
function work_depends_spell()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "libdepends" "$FUNCNAME - $@"

local failure_ok=$1
local article=$2
@@ -986,7 +986,7 @@ function work_depends_spell()
function work_optional_depends_provider()
{

- $STD_SORCERY_DEBUG_HEAD
+ debug "libdepends" "$FUNCNAME - $@"
local default tmp installed=no
local status=()

@@ -1087,7 +1087,7 @@ function work_optional_depends_provider(
function work_optional_depends_spell()
{

- $STD_SORCERY_DEBUG_HEAD
+ debug "libdepends" "$FUNCNAME - $@"
local default

local failure_ok=$1
@@ -1136,39 +1136,39 @@ function work_optional_depends_spell()

# check for abandoned answers
if [ -e $ABANDONED_DEPENDS/$SPELL ] ; then
- $STD_SORCERY_DEBUG "Checking in abandoned depends"
+ debug "libdepends" "Checking in abandoned depends"
default=$(search_depends_status $ABANDONED_DEPENDS/$SPELL "$SPELL"
"$1"|awk -F: '{print $3;exit}')
fi

# check the defaults file...
# first for explicit $SPELL -> $2
if [[ ! $default ]]; then
- $STD_SORCERY_DEBUG "Checking in default answers"
+ debug "libdepends" "Checking in default answers"
default=$(search_default_depends $DEFAULT_DEPENDS $SPELL $1|awk -F:
'{print $3; exit}')
fi

# then for anything -> $2
if [[ ! $default ]]; then
- $STD_SORCERY_DEBUG "Checking in default answers"
+ debug "libdepends" "Checking in default answers"
default=$(search_default_depends $DEFAULT_DEPENDS "" $1|awk -F: '{print
$3; exit}')
fi

# then for $1 -> anything
if [[ ! $default ]]; then
- $STD_SORCERY_DEBUG "Checking in default answers"
+ debug "libdepends" "Checking in default answers"
default=$(search_default_depends $DEFAULT_DEPENDS $SPELL "" |awk -F:
'{print $3; exit}')
fi

# check the install queue
if [[ ! $default ]]; then
- $STD_SORCERY_DEBUG "Checking in queue"
+ debug "libdepends" "Checking in queue"
#\< and \> match the empty string at the start and end of a word
echo ${spells[@]}|tr " " "\n" | grep -x -q "$1" && default=on
fi

# check if installed/held
if [[ ! $default ]]; then
- $STD_SORCERY_DEBUG "Checking if already installed"
+ debug "libdepends" "Checking if already installed"
spell_ok $1 && default=on
fi

@@ -1309,7 +1309,7 @@ function real_sub_depends() {
if spell_ok $sub_dependee; then
if [[ $(search_sub_depends "$SUB_DEPENDS_STATUS" "$requester" \
"$sub_dependee" "$sub_depends") != "" ]]; then
- $STD_SORCERY_DEBUG "$requester -> $sub_dependee" \
+ debug "libdepends" "$FUNCNAME -- $requester -> $sub_dependee" \
"-> $sub_depends provided by installed spell"
return 0
fi
@@ -1325,7 +1325,7 @@ function real_sub_depends() {
rc=$?
return $rc
) && {
- $STD_SORCERY_DEBUG "adding altruistic sub-depends for $sub_dependee
with $sub_depends from $requester"
+ debug "libdepends" "adding altruistic sub-depends for $sub_dependee
with $sub_depends from $requester"
add_sub_depends "$SUB_DEPENDS_STATUS" "$requester" \
"$sub_dependee" "$sub_depends"
hash_append sub_dep_f_hash $requester $sub_dependee:$sub_depends $'\n'
@@ -1363,8 +1363,7 @@ function real_sub_depends() {
# it'll get re-processed (assuming the caller also did a depends on it)
#---------------------------------------------------------------------
function real_force_depends() {
- $STD_SORCERY_DEBUG_HEAD
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libdepends" "$FUNCNAME - $SPELL - $@"
local check=$(hash_get "depends_looked_at" "$1")

message "${SPELL}" "is forcing a recast of" "${1}"
@@ -1383,8 +1382,7 @@ function real_force_depends() {
#---------------------------------------------------------------------
function private_common_depends()
{
- $STD_SORCERY_DEBUG_HEAD
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libdepends" "$FUNCNAME - $SPELL - $@"
add_depends $spell_depends "$SPELL" "$@"

# runtime and suggested depends have no formal dependency info
@@ -1461,8 +1459,7 @@ function private_add_triggerees() {
#---------------------------------------------------------------------
function private_add_depends()
{
- $STD_SORCERY_DEBUG_HEAD
- $STD_SORCERY_DEBUG "SPELL=$SPELL, NEW_DEPENDS=${NEW_DEPENDS[*]}"
+ debug "libdepends" "$FUNCNAME: SPELL=$SPELL, NEW_DEPENDS=${NEW_DEPENDS[*]}"
hash_append "$CAST_HASH" "$SPELL" "${NEW_DEPENDS[*]}"

for child in ${NEW_DEPENDS[*]}; do
@@ -1552,10 +1549,10 @@ function run_spell_config()
{

SPELL_CONFIG=$DEPENDS_CONFIG/$SPELL
- $STD_SORCERY_DEBUG "DEPENDS_CONFIG=$DEPENDS_CONFIG SPELL=$SPELL,
SPELL_CONFIG=$SPELL_CONFIG DEPENDS_STATUS=$DEPENDS_STATUS"
+ debug "libdepends" "run_spell_config() - DEPENDS_CONFIG=$DEPENDS_CONFIG
SPELL=$SPELL, SPELL_CONFIG=$SPELL_CONFIG DEPENDS_STATUS=$DEPENDS_STATUS"

if [ -x $SPELL_CONFIG ]; then
- $STD_SORCERY_DEBUG "found $SPELL_CONFIG"
+ debug "libdepends" "run_spell_config() - found $SPELL_CONFIG"
. $SPELL_CONFIG
fi
}
diff --git a/var/lib/sorcery/modules/libdepengine
b/var/lib/sorcery/modules/libdepengine
index c3ea819..3d240a5 100755
--- a/var/lib/sorcery/modules/libdepengine
+++ b/var/lib/sorcery/modules/libdepengine
@@ -50,7 +50,7 @@ function depengine_entry_point() {
for spell in $spell_list; do
spell_status=$(dpgn_get_spell_color $spell)
if [[ $spell_status != white ]] ; then
- $STD_SORCERY_DEBUG "already did $spell"
+ debug "libdepengine" "already did $spell"
else
depengine_cast_engine $spell
fi
@@ -113,7 +113,7 @@ function depengine_cast_engine() {
[[ $triggerer == $spell ]] && continue
child_status=$(hash_get state_hash $triggerer)
if [[ $child_status == grey ]] ; then
- $STD_SORCERY_DEBUG "$spell has a $child_status triggerer on
$triggerer!"
+ debug "libdepengine" "$spell has a $child_status triggerer on
$triggerer!"
grey_triggerer=1
break
fi
@@ -159,7 +159,7 @@ function recurse_depends() {
:
;;
black:*)
- $STD_SORCERY_DEBUG "$spell already had a failed dep on $_child"
+ debug libdepengine "$spell already had a failed dep on $_child"
return 1
;;
esac
@@ -181,20 +181,20 @@ function recurse_depends() {
;;
grey)
if [[ $in_trigger != 0 ]] ; then
- $STD_SORCERY_DEBUG "found grey depend from trigger $spell -> $child"
+ debug "libdepengine" "found grey depend from trigger $spell ->
$child"
return 2
else
- $STD_SORCERY_DEBUG "detected a dependency loop $spell -> $child"
+ debug "libdepengine" "detected a dependency loop $spell -> $child"
fi
;;
brown)
- $STD_SORCERY_DEBUG "found brown depend $spell -> $child"
+ debug "libdepengine" "found brown depend $spell -> $child"
;;
black:0)
- $STD_SORCERY_DEBUG "$child already built properly, continuing"
+ debug "libdepengine" "$child already built properly, continuing"
;;
black:*)
- $STD_SORCERY_DEBUG "$child failed, minus_k is $MINUS_K"
+ debug "libdepengine" "$child failed, minus_k is $MINUS_K"
rc=1
[[ $MINUS_K == no ]] && break
;;
diff --git a/var/lib/sorcery/modules/libdispel
b/var/lib/sorcery/modules/libdispel
index 9348cf7..ea078cc 100755
--- a/var/lib/sorcery/modules/libdispel
+++ b/var/lib/sorcery/modules/libdispel
@@ -20,7 +20,7 @@
##
#---------------------------------------------------------------------
function reap_regular_files() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "reap_regular_files()"
local FILE
while read FILE; do
rm -f "$FILE"
@@ -37,14 +37,14 @@ function reap_regular_files() {
##
#---------------------------------------------------------------------
function reap_config_files() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "reap_config_files()"
local FILE
while read FILE; do
[[ $FILE ]] || continue
if [[ $TOTAL_DISPEL ]] ; then
rm -f "$FILE"
elif grep -q "$(md5sum "$FILE" )" "$MD5S"; then
- $STD_SORCERY_DEBUG "$FILE is a config file that hasnt changed,
removing..."
+ debug libdispel "$FILE is a config file that hasnt changed,
removing..."
rm -f "$FILE"
else
reap_modified_file "$FILE"
@@ -106,7 +106,7 @@ function reap_depends() {
function reaper() {
# Example: reaper "$INSTALL_LOG" "$MD5_LOG"

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running reaper() on $1"

if ! [ "$REAP" == "on" ] ||
! [ -f $1 ]; then return
@@ -170,7 +170,7 @@ function reaper() {
function reap_state_files() {
# Example: reaper "$INSTALL_LOG" "$MD5_LOG"

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running reaper() on $1"

local UNIQUE="$$.$RANDOM"
local REAPER_FILES="$TMP_DIR/reaper.$UNIQUE.files"
diff --git a/var/lib/sorcery/modules/libdownload
b/var/lib/sorcery/modules/libdownload
index 1075ef1..953ff06 100755
--- a/var/lib/sorcery/modules/libdownload
+++ b/var/lib/sorcery/modules/libdownload
@@ -86,7 +86,8 @@ function dl_get_bucket() {
dl_${handler}_get "$target" "$url_list" "$hints" "$dl_target" "$dl_type"
rc=$?
if [[ $rc == 0 ]] ; then
- $STD_SORCERY_DEBUG "downloaded $url" "target ${!dl_target}" "type
${!dl_type}"
+ debug "libdownload" "dl_handler -- downloaded $url"
+ eval debug "\$$dl_target \$$dl_type"
return 0
fi
return 1
@@ -112,14 +113,14 @@ function dl_connect() {

[[ $INTERNET_AUTOCONNECT == on ]] || return 0

- $STD_SORCERY_DEBUG_HEAD
+ debug "libdownload" "connect()"

# We agree that while this lock is held, no other script will be
# connecting or disconnecting internet service out from under us
lock_resources internet signon
for interface in $INTERNET_INTERFACES; do
if ifconfig | grep -q "^$interface" ; then
- $STD_SORCERY_DEBUG "connected through $interface"
+ debug "libdownload" "connected through $interface"
unlock_resources internet signon
return
fi
diff --git a/var/lib/sorcery/modules/libgrimoire
b/var/lib/sorcery/modules/libgrimoire
index ace4fa7..e17d365 100755
--- a/var/lib/sorcery/modules/libgrimoire
+++ b/var/lib/sorcery/modules/libgrimoire
@@ -33,8 +33,7 @@
#---------------------------------------------------------------------
function real_mk_source_dir() {

- $STD_SORCERY_DEBUG_HEAD
- $STD_SORCERY_DEBUG "on $SOURCE_DIRECTORY"
+ debug "libgrimoire" "Running mk_source_dir() on $SOURCE_DIRECTORY"

local NEW_DIR=$1
local NEW_DIR=${NEW_DIR:=$SOURCE_DIRECTORY}
@@ -66,7 +65,7 @@ function real_rm_source_dir() {
DEAD_DIR=$1
DEAD_DIR=${DEAD_DIR:-$SOURCE_DIRECTORY}

- $STD_SORCERY_DEBUG "DEAD_DIR = $DEAD_DIR"
+ debug "libgrimoire" "Running rm_source_dir() on $DEAD_DIR"

if [ -n "$DEAD_DIR" ] && [ -d "$DEAD_DIR" ]; then

@@ -81,7 +80,7 @@ function real_rm_source_dir() {
local mountloc=$(echo $line | cut -d' ' -f3)
if echo $mountloc | grep -q "^$DEAD_DIR"
then
- $STD_SORCERY_DEBUG "Unmounting $mount on $mountloc"
+ debug "libgrimoire" "Unmounting $mount on $mountloc"
umount -l $mountloc 2> /dev/null
fi
done
@@ -143,7 +142,7 @@ function make() {
JOBS="1" # Use default of one when MAKE_NJOBS is nonsense.
fi

- $STD_SORCERY_DEBUG "make: running with $JOBS jobs"
+ debug "libgrimoire" "make: running with $JOBS jobs"
$REAL_MAKE -j $JOBS -S "$@"

# Cache the result
@@ -167,7 +166,7 @@ function make() {
## @Stdout file name
#---------------------------------------------------------------------
function install_desktop_files() {
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libgrimoire" "Running install_desktop_files() on $SPELL"
local each file
local target_dir="/usr/share/applications"
local desktop_dir="$SCRIPT_DIRECTORY/desktop"
@@ -177,7 +176,7 @@ function install_desktop_files() {
for each in $(find $desktop_dir -maxdepth 1 -type f); do
file=$(basename $each)
if ! test -f "$target_dir/$file" ; then
- $STD_SORCERY_DEBUG "Installing $file in $target_dir as a desktop file"
+ debug "libgrimoire" "Installing $file in $target_dir as a desktop file"
cp $each $target_dir
fi
done
@@ -218,7 +217,7 @@ function private_installed_version() {
#---------------------------------------------------------------------
function real_conflicts() {

- $STD_SORCERY_DEBUG "Running conflicts() on $1. Default query answer $2."
+ debug "libgrimoire" "Running conflicts() on $1. Default query answer $2."

if spell_installed $1; then
[ "$2" = y ] && echo "$1:y" || echo "$1:n"
diff --git a/var/lib/sorcery/modules/libhash b/var/lib/sorcery/modules/libhash
index 0302643..2b5c35e 100755
--- a/var/lib/sorcery/modules/libhash
+++ b/var/lib/sorcery/modules/libhash
@@ -57,7 +57,7 @@ function hash_build_variable_name() {
local ___TABLE="$1"
local ___FIELD="$2"

-# $STD_SORCERY_DEBUG "TABLE=$___TABLE:FIELD=$___FIELD"
+# debug "libhash" "hash_build_variable_name() -
TABLE=$___TABLE:FIELD=$___FIELD"

___TABLE=${___TABLE//\+/_P_}
___TABLE=${___TABLE//\-/_M_}
@@ -99,7 +99,7 @@ function hash_unbuild_field_name() {
___FIELD=${___FIELD%_*}
# `echo "$1" | sed -n "s/^$2\(.*\)_$/\1/p"`

-# $STD_SORCERY_DEBUG "TABLE=$___TABLE:FIELD=$___FIELD"
+# debug "libhash" "hash_unbuild_field_name() -
TABLE=$___TABLE:FIELD=$___FIELD"

___FIELD=${___FIELD//_P_/\+}
___FIELD=${___FIELD//_M_/\-}
@@ -125,7 +125,7 @@ function hash_put() {
local VARIABLE_NAME
hash_build_variable_name "$1" "$2" VARIABLE_NAME
eval "${VARIABLE_NAME}=\"${3}\""
- $STD_SORCERY_DEBUG "VARIABLE_NAME=$VARIABLE_NAME, data=$3"
+ debug "libhash" "hash_put() - VARIABLE_NAME=$VARIABLE_NAME, data=$3"
}


diff --git a/var/lib/sorcery/modules/liblock b/var/lib/sorcery/modules/liblock
index d9a07b6..82ff964 100755
--- a/var/lib/sorcery/modules/liblock
+++ b/var/lib/sorcery/modules/liblock
@@ -52,7 +52,7 @@ lock_resources()
while ! trylock_resources "$@";
do
local SLEEP=$(( ${RANDOM} % ${MAX_SLEEP} ))
- $STD_SORCERY_DEBUG "process $$ is sleeping ${SLEEP} seconds"
+ debug "lock_resources" "process $$ is sleeping ${SLEEP} seconds"
sleep "${SLEEP}"
done
}
@@ -77,7 +77,7 @@ trylock_resources()
# we replace / with ^
lockfile="${LOCK_DIR}/${lockfile//\//^}"

- $STD_SORCERY_DEBUG "lockfile=${lockfile}"
+ debug "trylock_resources" "lockfile=${lockfile}"

mkdir -p "${LOCK_DIR}"

@@ -165,7 +165,7 @@ clean_resources()
if [ -d "${LOCK_DIR}" ]; then
find "${LOCK_DIR}" -maxdepth 2 -mindepth 2 -name $$ | \
while read file; do
- $STD_SORCERY_DEBUG "removing forgotten lock ${file}"
+ debug "clean_resources" "removing forgotten lock ${file}"
rm -f "${file}" 2>/dev/null &&
rmdir `dirname "${file}"` 2>/dev/null
done
@@ -189,7 +189,7 @@ global_clean_resources()
while read file; do
# check if the process still exist (we use procfs mounted on /proc)
if [ ! -d "${file}" ]; then
- $STD_SORCERY_DEBUG "removing stale lock ${file}"
+ debug "global_clean_resources" "removing stale lock ${file}"
rm -f "${file}" 2>/dev/null &&
rmdir `dirname "${file}"` 2>/dev/null
fi
@@ -212,7 +212,7 @@ global_clean_resources()
#---------------------------------------------------------------------
function lock_file()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "liblock" "$FUNCNAME - $*"
local FILE
lock_resources $(
for FILE in "$@" ; do
@@ -231,7 +231,7 @@ function lock_file()
#---------------------------------------------------------------------
function unlock_file()
{
- $STD_SORCERY_DEBUG
+ debug "liblock" "$FUNCNAME - $*"
local FILE
unlock_resources $(
for FILE in "$@" ; do
@@ -258,7 +258,7 @@ function unlock_file()
#---------------------------------------------------------------------
function lock_start_transaction()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "liblock" "$FUNCNAME - $*"
local i TRANSNAME NUMTRANS RET=""

if lock_file "$@" ; then
@@ -301,7 +301,7 @@ function lock_start_transaction()
#---------------------------------------------------------------------
function lock_commit_transaction()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "liblock" "$FUNCNAME - $*"
local TMP_FILE unlockList=""

lock_file $LOCK_TRANSACTIONS
@@ -346,7 +346,7 @@ function lock_commit_transaction()
#---------------------------------------------------------------------
function lock_kill_transaction()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "liblock" "$FUNCNAME - $*"
local TMP_FILE

lock_file $LOCK_TRANSACTIONS
@@ -483,7 +483,7 @@ function counter_clean() {
#---------------------------------------------------------------------
SYNCHRONIZE='
__llSYNCH_LINE=$LINENO
- $STD_SORCERY_DEBUG "+++ in synch code"
+ debug "liblock" "+++ in synch code"
lock_resources "lockfunction" "${FUNCNAME}/${__llSYNCH_LINE}"'

#---------------------------------------------------------------------
@@ -493,7 +493,7 @@ SYNCHRONIZE='
##
#---------------------------------------------------------------------
UNSYNCHRONIZE='
- $STD_SORCERY_DEBUG "+++ in unsynch code"
+ debug "liblock" "+++ in unsynch code"
unlock_resources "lockfunction" "${FUNCNAME}/${__llSYNCH_LINE}"
unset __llSYNCH_LINE'

diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 86ebe80..a43f9c0 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -101,7 +101,7 @@ function isalpha() {
#---------------------------------------------------------------------
function real_query() { (

- $STD_SORCERY_DEBUG_HEAD
+ debug "libmisc" "Running query() with the following arguments: '$1' and
'$2'"

while true ; do

@@ -137,7 +137,8 @@ function real_query() { (
##
#---------------------------------------------------------------------
function real_query_string () {
- $STD_SORCERY_DEBUG_HEAD
+
+ debug "libmisc" "Running question() with the following arguments: '$1'
and '$2'"

local RESPONSE=""
local RETURN=0
@@ -183,6 +184,34 @@ function real_message() {
}

#---------------------------------------------------------------------
+## @param type
+## @param message
+##
+## Enters a debug message if the type of debug message != 'no'
+##
+## The 'type' is usually the name of the file the debug statement
+## comes from. i.e. DEBUG_liblock, DEBUG_libsorcery, DEBUG_cast etc.
+##
+#---------------------------------------------------------------------
+function debug() {
+
+ [[ $DEBUG ]] || return 0
+
+ local debugVar="DEBUG_${1}"
+ local i
+ if [[ ${!debugVar} != "no" ]] ; then
+ echo -n "$1($$): " >>$DEBUG
+ shift
+ for i in "$@" ; do
+ echo -n " \"$i\"" >>$DEBUG
+ done
+ echo >>$DEBUG
+ fi
+
+ true
+}
+
+#---------------------------------------------------------------------
## @Stdout progress spinner
## Displays progress spinner like the one in fsck.
##
@@ -207,7 +236,7 @@ function progress_spinner() {
##</pre>
#---------------------------------------------------------------------
function progress_bar() {
- $STD_SORCERY_DEBUG_HEAD
+debug "libmisc" "progress_bar - $*"
local percent i len num_dash

if [[ $1 == -dot ]] ; then
@@ -300,9 +329,9 @@ function sound() {
on) SOUND_FILE=$SOUND_DIRECTORY/$SOUND_THEME/$1
if [ -e $SOUND_FILE ]; then
( cd / ; play $SOUND_FILE 2>/dev/null & )
- $STD_SORCERY_DEBUG "Playing $SOUND_FILE"
+ debug "libmisc" "Playing $SOUND_FILE"
else
- $STD_SORCERY_DEBUG "Error playing $SOUND_FILE: no such file"
+ debug "libmisc" "Error playing $SOUND_FILE: no such file"
fi
;;
esac
@@ -415,7 +444,7 @@ function get_dirnames() {
#----------------------------------------------------------------------
function iterate()
{ # $1=callback+args, $2=separator, $3=(opt)string
-# $STD_SORCERY_DEBUG_HEAD
+# debug "libmisc" "iterate - $@"

[ $# -lt 2 ] && return 2

@@ -439,11 +468,11 @@ function iterate()
eval "$func \"$token\""
[[ $BREAK ]] && break
done
-# $STD_SORCERY_DEBUG "leftover token: $token"
+# debug "leftover token: $token"
fi

returnValue=$?
- [[ $BREAK ]] && $STD_SORCERY_DEBUG "iterate - I was BREAKed."
+ [[ $BREAK ]] && debug "libmisc" "iterate - I was BREAKed."
unset BREAK
return $returnValue
}
@@ -1049,7 +1078,7 @@ function remove_files_and_dirs() {
## @param name of the script needing the tmp dir
#---------------------------------------------------------------------
function mk_tmp_dirs() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "$FUNCNAME" "Making tmp dirs for $$"
local SCRIPT_NAME=$1 STATS tmp
SCRIPT_NAME=${SCRIPT_NAME:-misc}

@@ -1062,7 +1091,7 @@ function mk_tmp_dirs() {
tmp=$(ls -ld $BASE_DIR 2>/dev/null|awk '{printf "%s:%s:%s\n" ,$1,$3,$4; }')
if [[ "$tmp" != "drwxr-xr-x:root:root" ]] ; then
test -d $BASE_DIR &&
- message "$BASE_DIR has unknown permissions and ownership, replacing it"
>&2
+ message "$BASE_DIR has unknown permissions and ownership, replacing it"
2>/dev/null
rm -rf $BASE_DIR
install -d -o root -g root -m 755 "$BASE_DIR" &&
chmod a-s "$BASE_DIR" # work around installer bug where /tmp is suid/sgid
@@ -1089,7 +1118,7 @@ function mk_tmp_dirs() {


if [ -e $FULL_DIR ] ; then
- message "Looks like you had an old $SCRIPT_NAME on PID $$. Cleaning it
out..." >&2
+ echo "Looks like you had an old $SCRIPT_NAME on PID $$. Cleaning it
out..." 2>/dev/null
rm -rf $FULL_DIR
fi

@@ -1203,8 +1232,7 @@ function is_sorcery_var() {
CAST_PASS download_log IW_LOG OPTS SOLO QUIET INSTALL_QUEUE \
OVERRIDE_CFLAGS OVERRIDE_CXXFLAGS OVERRIDE_LDFLAGS NO_OPTIMIZATION_FLAGS \
DOT_PROGRESS VOYEUR_OVERRIDE RECONFIGURE RECAST_DOWN COMPILE RECAST_UP \
- FORCE_DOWNLOAD SOURCE_CACHE SILENT FIX SORCERY_DEBUG
STD_SORCERY_DEBUG_HEAD \
- STD_SORCERY_DEBUG SEPARATE BASE_URL \
+ FORCE_DOWNLOAD SOURCE_CACHE SILENT FIX DEBUG SEPARATE BASE_URL \
CAST_HASH BACK_CAST_HASH CANNOT_CAST_HASH uncommitted_hash NEW_DEPENDS \
spell_depends DEPENDS_CONFIG UP_DEPENDS SPELL_CONFIG GRIMOIRE_DIR \
SCRIPT_DIRECTORY SECTION_DIRECTORY GRIMOIRE SPELL_DIRECTORY SECTION \
@@ -1254,7 +1282,7 @@ function complain_sorcery_var() {
#-------------------------------------------------------------------
function set_architecture() {

- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
local specdir
local i j
unset SPECFILE
@@ -1268,7 +1296,7 @@ function set_architecture() {
[[ $CROSS_INSTALL == on ]] &&
[[ $TARGET ]]
then
- $STD_SORCERY_DEBUG "using cross-install's target arch"
+ debug "libmisc" "set_architecture: using cross-install's target arch"
arch=${arch:-$TARGET}
fi

@@ -1295,7 +1323,7 @@ function set_architecture() {
message "${PROBLEM_COLOR}Cannot find arch spec for $arch!"
return 1
fi
- $STD_SORCERY_DEBUG "SPECFILE=$SPECFILE"
+ debug "libmisc" "set_architecture: SPECFILE=$SPECFILE"

# turn the path into an array, but remove $specdir from the start first
unset SMGL_COMPAT_ARCHS
@@ -1320,11 +1348,11 @@ function set_architecture() {
## to override a bunch of functions which have already been defined.
#---------------------------------------------------------------------
function define_functions() {
- $STD_SORCERY_DEBUG_HEAD
local funcName
local funcContent="$1"
shift
for funcName in $* ; do
+ debug "libmisc" "define_functions - redefining $funcName"
eval "function $funcName () { \
$funcContent \
}"
@@ -1443,6 +1471,14 @@ function envar_prepend_path()
fi
}

+
+# Standard debug line:
+# file "function@line" "all" "args"
+STD_DEBUG='eval local _stddbg_file=${BASH_SOURCE[0]} ;
+ _stddbg_file=${_stddbg_file##*/};
+ debug "${_stddbg_file}" "${FUNCNAME[0]}@$LINENO" "$@"'
+
+
#---------------------------------------------------------------------
## @License
##
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index 0d4cf43..b74a6d1 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -16,7 +16,7 @@
## test -f $INSTALL_CACHE/$SPELL-$VERSION-$HOST.tar.bz2
#---------------------------------------------------------------------
function can_resurrect() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libresurrect" "can_resurrect - $*"
local SPELL=$1
local VERSION=$2

@@ -24,7 +24,7 @@ function can_resurrect() {
local file=$INSTALL_CACHE/$SPELL-$VERSION-$HOST.tar$EXTENSION &&
test -f $file &&
echo $file &&
- $STD_SORCERY_DEBUG "I am able to resurrect." &&
+ debug "libresurrect" "I am able to resurrect." &&
return 0
}

@@ -69,7 +69,7 @@ function can_resurrect() {
# FIXME: some of the informative message calls might work better as debug
messages
#------------------------------------------------------------------------
function resurrect() { (
- $STD_SORCERY_DEBUG_HEAD
+ debug "libresurrect" "resurrect - $*"
local SPELL=$1
local VERSION=$2

@@ -79,7 +79,7 @@ function resurrect() { (
}

if [[ ! $VERSION ]] ; then
- $STD_SORCERY_DEBUG "No spell version passed in"
+ debug libresurrect "No spell version passed in"
return 1
fi

@@ -104,7 +104,7 @@ function resurrect() { (

mkdir -p $BUILD_DIRECTORY &&
mk_source_dir $RESURRECT_DIR || {
- $STD_SORCERY_DEBUG "Failed to make $RESURRECT_DIR"
+ debug "libresurrect" "Failed to make $RESURRECT_DIR"
resurrect_fail
return 1
}
@@ -192,7 +192,7 @@ function resurrect() { (
tablet_find_resurrect_dir $SPELL OLD_TABLET_DIR
local TMP_VERSION=$VERSION
if [[ $OLD_TABLET_DIR ]] && test -d $OLD_TABLET_DIR ; then
- $STD_SORCERY_DEBUG "loading tablet at $OLD_TABLET_DIR"
+ debug "libresurrect" "loading tablet at $OLD_TABLET_DIR"
tablet_set_spell $SPELL $OLD_TABLET_DIR || {
message "something is wrong with $OLD_TABLET_DIR"
returrect_fail
@@ -203,7 +203,7 @@ function resurrect() { (
tablet_get_section_filter "$OLD_TABLET_DIR" configs
GRIMOIRE_CONFIG_FILTER
else
unset $OLD_TABLET_DIR
- $STD_SORCERY_DEBUG "no tablet"
+ debug "libresurrect" "no tablet"
codex_set_current_spell_by_name $SPELL
SPELL_CONFIG_FILTER=$SCRIPT_DIRECTORY/configs
SECTION_CONFIG_FILTER=$SECTION_DIRECTORY/configs
@@ -310,7 +310,7 @@ function resurrect_sub() {
# 10) if theres a PRE_RESURRECT run it or fail/rollback
if test -x $SCRIPT_DIRECTORY/PRE_RESURRECT ; then
. $SCRIPT_DIRECTORY/PRE_RESURRECT || {
- $STD_SORCERY_DEBUG "PRE_RESURRECT failed"
+ debug "libresurrect" "PRE_RESURRECT failed"
resurrect_fail 1
return 1
}
@@ -332,7 +332,7 @@ function resurrect_sub() {
test -h ".$line" && echo .$line ||
test -d ".$line" || echo .$line
done | sort | tar -cT - | tar -xvf - -C ${INSTALL_ROOT:-/} || {
- $STD_SORCERY_DEBUG "Failed to install regular files"
+ debug "libresurrect" "Failed to install regular files"
resurrect_fail 1
return 1
}
@@ -344,7 +344,7 @@ function resurrect_sub() {

local res_fail=0 BREAK
function resurrect_install_conf_sub() {
- $STD_SORCERY_DEBUG "resurrect_install_conf_sub -- $@"
+ debug libresurrect "resurrect_install_conf_sub -- $@"
test -d ".$1" ||
internal_install_config_file ".$1" "${INSTALL_ROOT}${1}" $savetime \
"$OLD_MD5_LOG" || {
@@ -355,7 +355,7 @@ function resurrect_sub() {
iterate resurrect_install_conf_sub $'\n' "$(<$NEW_DATA_F_C)"

[[ $res_fail == 0 ]] || {
- $STD_SORCERY_DEBUG "Failed to install config files"
+ debug "libresurrect" "Failed to install config files"
resurrect_fail 1
return 1
}
@@ -442,7 +442,7 @@ function internal_install_config_file()
local savetime=$3
local md5_log=$4

- $STD_SORCERY_DEBUG_HEAD
+ debug libresurrect "$FUNCNAME -- $@"
# if its a symlink, just copy, someday maybe we should figure
# out where it points to and so something, but thats too annoying
if test -h "$from" ; then
@@ -589,7 +589,7 @@ function resurrect_success() {
ln $COMPILE_LOG -sf $new_tablet/logs/compile
find $new_tablet > $TMP_INSTALL_LOG_STATE # relative to STATE_ROOT
else
- $STD_SORCERY_DEBUG "WARNING: unable to make tablet for $SPELL, oh well"
+ debug "libresurrect" "WARNING: unable to make tablet for $SPELL, oh
well"
fi
fi

diff --git a/var/lib/sorcery/modules/libscreen
b/var/lib/sorcery/modules/libscreen
index 516d375..db635e5 100755
--- a/var/lib/sorcery/modules/libscreen
+++ b/var/lib/sorcery/modules/libscreen
@@ -19,7 +19,7 @@ function screen_quick_intro() {
## arguments.
#-----
function screen_start() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
local name="$1"
local screen
shift
@@ -38,7 +38,7 @@ function screen_start() {
## The .!!| args to exec were determined by trial and error. ::: didn't work.
#-----
function screen_command() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
local name="$1"
shift
screen -x "$name" -X exec '.!!|' echo "$@"
@@ -62,7 +62,7 @@ function screen_command() {
## They are actualy window numbers in disguise
#-----
function screen_new_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
local screen_name="$1"
local win_num="$2"
local win_name="$3"
@@ -80,7 +80,7 @@ function screen_new_window() {
## Default escape code is ^A.
#-----
function screen_attach() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -r "$1" $SCREEN_KEY &
}

@@ -89,7 +89,7 @@ function screen_attach() {
## Detaches the named screen session from the tty.
#-----
function screen_detach() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -X detach
}

@@ -100,7 +100,7 @@ function screen_detach() {
## closed
#-----
function screen_kill_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -p "$2" -X kill
sleep $SCREEN_ANTI_RACE_SLEEP
screen_notify "$1" "$2 ended"
@@ -114,7 +114,7 @@ function screen_kill_window() {
## Give an existing window a new name
#-----
function screen_name_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -p "$2" -X title "$3"
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -125,7 +125,7 @@ function screen_name_window() {
## There are race conditions aplenty if you're not careful
#-----
function screen_name_curr_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -X title "$2"
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -136,7 +136,7 @@ function screen_name_curr_window() {
## Notify the user of something happening using the status bar
#-----
function screen_notify() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -X echo "$@"
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -148,7 +148,7 @@ function screen_notify() {
## in the window.
#-----
function screen_monitor_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -p "$2" -X monitor on
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -159,7 +159,7 @@ function screen_monitor_window() {
## Stops a window from being monitored
#-----
function screen_unmonitor_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -p "$2" -X monitor off
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -170,7 +170,7 @@ function screen_unmonitor_window() {
## Changes the window the user sees
#-----
function screen_switch_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -X select "$2"
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -180,7 +180,7 @@ function screen_switch_window() {
## Ends the screen session. Should end all processes running in the screen.
#-----
function screen_quit() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -X quit
}

@@ -192,7 +192,7 @@ function screen_quit() {
## If something is already at that number, it swaps them
#-----
function screen_move_window() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -p "$2" -X number "$3"
sleep $SCREEN_ANTI_RACE_SLEEP
}
@@ -203,7 +203,7 @@ function screen_move_window() {
## Sets the time screen shows messages for
#-----
function screen_set_msgwait() {
- $STD_SORCERY_DEBUG_HEAD
+ $STD_DEBUG
screen -x "$1" -X msgwait $2
sleep $SCREEN_ANTI_RACE_SLEEP
}
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index f218ebe..b37ddb4 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -22,7 +22,7 @@ function update_sorcery_scripts() {

local BRANCH=$1

- $STD_SORCERY_DEBUG "sorcery-$BRANCH"
+ debug "libsorcery" "update_sorcery_scripts() (sorcery-$BRANCH)"

{
#This section is to make sure that all sorcery dependencies are cast
@@ -182,7 +182,7 @@ function report() {

if [ "$VIEW_REPORTS" == "on" ]; then

- $STD_SORCERY_DEBUG "Prompting to view $2 for $SPELL"
+ debug "libsorcery" "Prompting to view $2 for $SPELL"

VIEW_PROMPT="View $2 for
${SPELL_COLOR}${SPELL}-${VERSION_COLOR}${VERSION}${DEFAULT_COLOR}?"
sound REPORT
@@ -190,7 +190,7 @@ function report() {
fi

if [ "$MAIL_REPORTS" == "on" ]; then
- $STD_SORCERY_DEBUG "Mailing report ($2) for $SPELL to $SORCERER"
+ debug "libsorcery" "Mailing report ($2) for $SPELL to $SORCERER"
date -u |
mail -s "Sorcery Report : $HOSTNAME : $2 for $SPELL-$VERSION" \
-a $1 $SORCERER 2>/dev/null
@@ -212,7 +212,7 @@ function guess_filename() {

FILENAME=$1

- $STD_SORCERY_DEBUG "FILENAME = $FILENAME"
+ debug "libsorcery" "Running guess_filename() on $FILENAME"

BASENAME=`echo $FILENAME |
sed "s/\.tar\.gz$//" |
@@ -250,7 +250,7 @@ function save_libraries() {
then return
fi

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running save_libraries()"

OLD_LIBS=$SOURCE_DIRECTORY/old.libraries
mkdir -p $OLD_LIBS
@@ -308,7 +308,7 @@ function save_binaries() {
then return
fi

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running save_binaries()"

OLD_BINS=$SOURCE_DIRECTORY/old.binaries
mkdir -p $OLD_BINS
@@ -371,7 +371,7 @@ function release_saved_libraries() {
#---------------------------------------------------------------------
function spell_recover() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running spell_recover()"

message "${MESSAGE_COLOR}Aborting dispel of ${SPELL_COLOR}${SPELL}" \
"${MESSAGE_COLOR} and recovering${DEFAULT_COLOR}"
@@ -415,7 +415,7 @@ function spell_recover() {
#---------------------------------------------------------------------
function find_section() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running find_section() on $1"

codex_get_spell_section_name $1

@@ -594,13 +594,13 @@ function filter_generic() {
local grimoire_filter section_filter spell_filter spell_dir
if [[ $spell_from == "codex" ]]
then
- $STD_SORCERY_DEBUG "filter_generic codex at : $SCRIPT_DIRECTORY "
+ debug libsorcery "filter_generic codex at : $SCRIPT_DIRECTORY "
grimoire_filter=$GRIMOIRE/$filter_name
section_filter=$SECTION_DIRECTORY/$filter_name
spell_filter=$SCRIPT_DIRECTORY/$filter_name
else
if tablet_find_spell_dir $SPELL spell_dir &>/dev/null; then
- $STD_SORCERY_DEBUG "filter_generic tablet at : $spell_dir "
+ debug libsorcery "filter_generic tablet at : $spell_dir "
tablet_get_spell_filter "$spell_dir" "$filter_name" spell_filter
&>/dev/null
tablet_get_section_filter "$spell_dir" "$filter_name" section_filter
&>/dev/null
tablet_get_grimoire_filter "$spell_dir" "$filter_name" grimoire_filter
&>/dev/null
@@ -757,7 +757,7 @@ function push_remove_queue() {
##
#---------------------------------------------------------------------
function optimize() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "In optimize()"

unset CFLAGS CXXFLAGS LDFLAGS CPPFLAGS
unset COMBRELOC FAST PRELINK RISKY SMALL SPEEDY STRIP TINY
@@ -771,12 +771,12 @@ function optimize() {
export CPPFLAGS="$OVERRIDE_CPPFLAGS"
else
set_architecture
- $STD_SORCERY_DEBUG "ARCHITECTURE='${ARCHITECTURE}'"
- $STD_SORCERY_DEBUG "TARGET='${TARGET}'"
- $STD_SORCERY_DEBUG "OPTIMIZATIONS='${OPTIMIZATIONS}'"
+ debug "ARCHITECTURE='${ARCHITECTURE}'"
+ debug "libsorcery" "TARGET='${TARGET}'"
+ debug "libsorcery" "OPTIMIZATIONS='${OPTIMIZATIONS}'"
BUILD=${HOST}

- $STD_SORCERY_DEBUG "BUILD is $BUILD, HOST is $HOST"
+ debug "libsorcery" "BUILD is $BUILD, HOST is $HOST"

CFLAGS="$CFLAGS -pipe"
for PARAM in $OPTIMIZATIONS; do
@@ -1176,7 +1176,7 @@ function clean_logs() {

message "${CHECK_COLOR}Cleaning log files... ${DEFAULT_COLOR} "

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running clean_logs()"

LOGS=`log_list`

@@ -1230,7 +1230,7 @@ function activity_log() { (
##
#---------------------------------------------------------------------
function run_details() {
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libsorcery" "starting run_details for $SPELL"
if ! codex_set_current_spell_by_name $SPELL; then
local GRIMOIRES=`codex_get_all_grimoires`
message "${PROBLEM_COLOR}Unable to find spell" \
@@ -1279,7 +1279,7 @@ function unset_details() {
#---------------------------------------------------------------------
function boost() {

- $STD_SORCERY_DEBUG "Running boost() on $SPELL THIS IS DEPRECIATED"
+ debug "libsorcery" "Running boost() on $SPELL THIS IS DEPRECIATED"
echo "Running boost() on $SPELL THIS IS DEPRECIATED, please contact the
spell's maintainer and ask them to remove this call"
true
}
@@ -1394,7 +1394,7 @@ function generate_keep_list() {
#---------------------------------------------------------------------
function prune() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libsorcery" "Running prune()"
local NO_KEEP
local NUM_NO_KEEP=0

diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 92bc2f0..0fb6af7 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -25,7 +25,7 @@
#---------------------------------------------------------------------
function add_depends()
{ # $1=depends file $2=spell, $3=depends, $4=on/off, $5=optional/required,
$6=on arg, $7=off arg
- $STD_SORCERY_DEBUG_HEAD
+ debug "libstate" "add_depends() - $*"

#already here for some reason
search_depends_status_exact "$@" >/dev/null && return 0
@@ -76,7 +76,7 @@ function search_depends_status_exact()

local a1 a2 a3 a4 a5 a6
a1=`esc_str "$1"` ; a2=`esc_str "$2"` ; a3=`esc_str "$3"` ; a4=`esc_str
"$4"`; a5=`esc_str "$5"`; a6=`esc_str "$6"`
- $STD_SORCERY_DEBUG "search_depends_status_exact: [$a1:$a2:$a3:$a4:$a5:$a6]"
+ debug "libstate" "search_depends_status_exact: [$a1:$a2:$a3:$a4:$a5:$a6]"
grep "^$a1:$a2:$a3:$a4:$a5:$a6$" $depends_status

}
@@ -164,7 +164,7 @@ function get_depends_options()
}

local START="$(esc_str $1)"
- $STD_SORCERY_DEBUG "get_depends_options() - START=$START"
+ debug "libstate" "get_depends_options() - START=$START"
awk -F ':' -v start=$START "{ if (\$1 == start) if (\$3 == \"on\") OPTS =
OPTS \" \" \$5; else OPTS = OPTS \" \" \$6; } END { print OPTS; }"
$depends_status 2> /dev/null
}

@@ -366,7 +366,7 @@ function remove_sub_depends() {
##
#---------------------------------------------------------------------
function add_default_depends() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libstate" "add_default_depends() - $*"

#already here
search_default_depends "$@" >/dev/null && return 0
@@ -443,7 +443,7 @@ function search_default_depends() {
a1=`esc_str "$1"` ; a2=`esc_str "$2"` ; a3=`esc_str "$3"`
a3=${a3:-.*}

- $STD_SORCERY_DEBUG "search_default_depends: [$a1:$a2:$a3]"
+ debug "libstate" "search_default_depends: [$a1:$a2:$a3]"
grep "^$a1:$a2:$a3$" $default_depends
}

@@ -459,7 +459,7 @@ function search_default_depends() {
##
#---------------------------------------------------------------------
function add_default_provider() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libstate" "add_default_depends() - $*"

#already here
search_default_provider "$@" >/dev/null && return 0
@@ -711,7 +711,7 @@ function remove_spell_status()
##
#---------------------------------------------------------------------
function remove_spell() {
- $STD_SORCERY_DEBUG "Running remove_spell() on $1"
+ debug "libsorcery" "Running remove_spell() on $1"
remove_spell_status $1
if [ -n "$EXILE" ]; then
add_spell_status $1 "exiled" "0.0"
@@ -848,7 +848,7 @@ function get_all_spells_with_status () {
##
#---------------------------------------------------------------------
function modify_local_config() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libstate" "modify_local_config() - $*"
modify_config $LOCAL_CONFIG "$@"
}

@@ -866,12 +866,12 @@ function modify_local_config() {
#---------------------------------------------------------------------
function modify_config() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libstate" "modify_config() - $*"
local FILE=$1
shift;

if ! [[ $1 ]]; then
- $STD_SORCERY_DEBUG "Warning: No name given for config option."
+ debug "libstate" "modify_config() - Warning: No name given for config
option."
return 1
fi

@@ -908,7 +908,7 @@ function modify_config() {
TEMP="$TEMP "
done

- $STD_SORCERY_DEBUG "entering new value $VARIABLE $seperator $@ into $tFILE"
+ debug "libstate" "modify_config() - entering new value $VARIABLE
$seperator $@ into $tFILE"
# put new value and justification in
echo "${TEMP}${1}${separator}\"$2\"" >> $tFILE

@@ -928,12 +928,12 @@ function modify_config() {
#---------------------------------------------------------------------
function remove_config() {

- $STD_SORCERY_DEBUG_HEAD
+ debug "libstate" "remove_config() - $*"
local FILE=$1
shift;

if ! [[ $1 ]]; then
- $STD_SORCERY_DEBUG "Warning: No name given for config option."
+ debug "libstate" "remove_config() - Warning: No name given for config
option."
return 1
fi

diff --git a/var/lib/sorcery/modules/libsummon
b/var/lib/sorcery/modules/libsummon
index bfaa8c9..0ba7356 100755
--- a/var/lib/sorcery/modules/libsummon
+++ b/var/lib/sorcery/modules/libsummon
@@ -33,7 +33,7 @@ function summon_spell() {
if [ -n "${SPELL}" ] && lock_resources "summon" "${SPELL}"; then
#local dl_dir=/tmp/sorcery/summon/${SPELL:-none}
local dl_dir=$TMP_DIR/${SPELL:-none}
- $STD_SORCERY_DEBUG "dl_dir is $dl_dir"
+ debug "libsummon" "dl_dir is $dl_dir"
mkdir -p $dl_dir && pushd $dl_dir &>/dev/null &&

# run in a subshell rather than try to unset_details
@@ -397,7 +397,7 @@ function unpack_for_update() {
if test -f $SOURCE_CACHE/$target && ! list_find "$hints" no_update; then
unpack_file_simple $target || return 1
if ! test -d "$_new_target" ; then
- $STD_SORCERY_DEBUG "unpacked $target but to somewhere strange"
+ debug "libsummon" "unpacked $target but to somewhere strange"
fi
fi
else
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index 1e09f58..1caa2b5 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -687,7 +687,7 @@ function tablet_check_repair_file() {
message "$tablet_file\nwith repair file \n$repair_file"
cp $repair_file $tablet_file
else
- $STD_SORCERY_DEBUG "Tablet Repair: not replacing $tablet_file with
$repair_file ($repair, $codex_md5, $tablet_md5)"
+ debug libtablet "Tablet Repair: not replacing $tablet_file with
$repair_file ($repair, $codex_md5, $tablet_md5)"
fi
}

diff --git a/var/lib/sorcery/modules/libtrack
b/var/lib/sorcery/modules/libtrack
index b433edb..c6e2169 100755
--- a/var/lib/sorcery/modules/libtrack
+++ b/var/lib/sorcery/modules/libtrack
@@ -175,7 +175,7 @@ function parse_iw() {
##
#---------------------------------------------------------------------
function create_install_log() {
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libtrack" "$FUNCNAME on $SPELL"
local INPUT=$1
local OUTPUT=$2

@@ -209,14 +209,14 @@ function create_install_log() {
function create_md5list() {
local INPUT=$1
local OUTPUT=$2
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libtrack" "$FUNCNAME on $SPELL"

[[ $__MODIFIED_FILES ]] || export
__MODIFIED_FILES="$TMP_DIR/modified_files"
touch $__MODIFIED_FILES
filter "$__MODIFIED_FILES" < $INPUT | while read LINE ; do
- $STD_SORCERY_DEBUG "Checking file $LINE"
+ debug "libtrack" "Checking file $LINE"
if [ -f "$LINE" ] ; then
- $STD_SORCERY_DEBUG "Running md5 on $LINE"
+ debug "libtrack" "Running md5 on $LINE"
md5sum "$LINE"
fi
done 2>/dev/null > $OUTPUT
@@ -280,12 +280,12 @@ function check_if_modified() {
#---------------------------------------------------------------------
function create_cache_archive() {

- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libtrack" "$FUNCNAME on $SPELL"
if [ "$ARCHIVE" == "off" ]; then
- $STD_SORCERY_DEBUG "ARCHIVE=$ARCHIVE, aborting archival."
+ debug "libtrack" "$FUNCNAME - ARCHIVE=$ARCHIVE, aborting archival."
return
fi
- $STD_SORCERY_DEBUG "ARCHIVE=$ARCHIVE, archiving."
+ debug "libtrack" "$FUNCNAME - ARCHIVE=$ARCHIVE, archiving."
local input=$1
local CACHE=$2
local CACHE_COMP=$3
@@ -506,7 +506,7 @@ function make_safe_dir() { (
RANDOM=$(date "+%N")
TMP_SSF=$TMP_DIR/$RANDOM
sleep .1
- $STD_SORCERY_DEBUG "safe dir collision on $TMP_SSF"
+ debug "libtrack" "safe dir collision on $TMP_SSF"
done
echo $TMP_SSF
return 0
diff --git a/var/lib/sorcery/modules/libtriggers
b/var/lib/sorcery/modules/libtriggers
index d133c97..50a3c73 100755
--- a/var/lib/sorcery/modules/libtriggers
+++ b/var/lib/sorcery/modules/libtriggers
@@ -16,7 +16,7 @@
## executable, runs it.
#---------------------------------------------------------------------
function run_triggers() {
- $STD_SORCERY_DEBUG "SPELL = $SPELL"
+ debug "libtriggers" "Starting run_triggers() on $SPELL"

run_spell_file TRIGGERS triggers

@@ -31,7 +31,7 @@ function run_triggers() {
#---------------------------------------------------------------------
function remove_triggers ()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "libtriggers" "remove_triggers - $*"

[ -f $TRIGGER_LIST ] || return 0
tTRIGGER_LIST=`lock_start_transaction $TRIGGER_LIST`
@@ -54,7 +54,7 @@ function remove_triggers ()
#---------------------------------------------------------------------
function trigger ()
{
- $STD_SORCERY_DEBUG_HEAD
+ debug "libtriggers" "trigger - $*"

local spell TRIGGER action
action=$1
@@ -101,7 +101,7 @@ function get_run_script_triggers() {
function set_trigger ()
{ #1==trigger to set, $2==spell that triggers it, $3=action,
$4==(optional)spell this is for

- $STD_SORCERY_DEBUG_HEAD
+ debug "libtriggers" "set_trigger - $*"

local str spell
[[ $4 ]] || [[ $SPELL ]] || return 1
diff --git a/var/lib/sorcery/modules/libunpack
b/var/lib/sorcery/modules/libunpack
index db9815f..4202ee7 100755
--- a/var/lib/sorcery/modules/libunpack
+++ b/var/lib/sorcery/modules/libunpack
@@ -120,7 +120,7 @@
##
#---------------------------------------------------------------------
function real_unpack_file() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "real_unpack_file - $*"

local FILENUM="$1"
local SVAR="SOURCE${FILENUM}"
@@ -128,13 +128,13 @@ function real_unpack_file() {
real_verify_file "$@"
rc=$?
case "$rc" in
- 200) $STD_SORCERY_DEBUG "unable to verify $SVAR ${!SVAR}" ;;
+ 200) debug "libunpack" "unable to verify $SVAR ${!SVAR}" ;;
1) return 1 ;; # verification failed
0) uncompress_unpack ${!SVAR}; return $? ;;
esac

if false; then # <------ here's the switch to disable oldworld -------
- $STD_SORCERY_DEBUG "falling back to missing verification"
+ debug "libgrimoire" "falling back to missing verification"
unpack_missing "${!SVAR}"
rc="$?"
case "$rc" in
@@ -142,7 +142,7 @@ function real_unpack_file() {
*) return "$rc" ;;
esac
else
- $STD_SORCERY_DEBUG "falling back to regular MD5[]"
+ debug "libgrimoire" "falling back to regular MD5[]"
local MD5NUM="$([ -z "$FILENUM" ] && echo 0 || echo "$(($FILENUM - 1))")"
real_unpack "${!SVAR}" "${MD5[$MD5NUM]}"
fi
@@ -157,14 +157,14 @@ function real_unpack_file() {
## system.
#---------------------------------------------------------------------
function real_verify_file() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libunpack" "real_verify_file - $*"

local FILENUM="$1"
local SVAR="SOURCE${FILENUM}"

local crypto_func
for crypto_func in GPG HASH IGNORE; do
- $STD_SORCERY_DEBUG "checking $crypto_func verification"
+ debug "libgrimoire" "checking $crypto_func verification"

local AVAR="SOURCE${FILENUM}_${crypto_func}"
[[ -n ${!AVAR} ]] || continue
@@ -175,7 +175,7 @@ function real_verify_file() {
rc="$?"

case "$rc" in
- 200) $STD_SORCERY_DEBUG "unable to verify $AVAR with $crypto_func" ;;
+ 200) debug "libgrimoire" "unable to verify $AVAR with $crypto_func" ;;
*) return $rc ;;
esac

@@ -195,7 +195,7 @@ function real_verify_file() {
##
#---------------------------------------------------------------------
function uncompress_core() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "uncompress_core - $*"

case "$2" in
bzip2) bzip2 -cdf "$1" ;;
@@ -221,7 +221,7 @@ function uncompress_core() {
##
#---------------------------------------------------------------------
function unpack_core() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "unpack_core - $*"

case "$2" in
bzip2|gzip|compress*|tar)
@@ -253,7 +253,7 @@ function real_guess_compressor() {
local COMPRESSOR="$(echo "$OUTPUT" | cut -d ' ' -f1)"
[ "$COMPRESSOR" = "GNU" -o "$COMPRESSOR" = "POSIX" ] &&
COMPRESSOR="$(echo "$OUTPUT" | cut -d ' ' -f2)"
- $STD_SORCERY_DEBUG "guess_compressor() - guessed $1 compressor
<$COMPRESSOR>"
+ debug "libgrimoire" "guess_compressor() - guessed $1 compressor
<$COMPRESSOR>"
echo "$COMPRESSOR"
}

@@ -276,7 +276,7 @@ function real_uncompress() { uncompress_
##
#---------------------------------------------------------------------
function unpack_spell_required() {
- $STD_SORCERY_DEBUG "Running unpack_spell_required -- $1"
+ debug "libgrimoire" "Running unpack_spell_required -- $1"

local x
if ! spell_ok "$1" && ! smgl_which $2 x &> /dev/null; then
@@ -372,7 +372,7 @@ function is_allowed_hash() {
##
#---------------------------------------------------------------------
function unpack_gpg() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "Running unpack_gpg -- $*"

local FILENAME="$( guess_filename "$SOURCE_CACHE/$1" )"
local PFNAME="$( echo "$2" | cut -d: -f1 )"
@@ -430,7 +430,7 @@ function unpack_gpg() {
##
#---------------------------------------------------------------------
function unpack_hash() {
- $STD_SORCERY_DEBUG "Running unpack_hash() on $1"
+ debug "libgrimoire" "Running unpack_hash() on $1"

local FILENAME="$( guess_filename "$SOURCE_CACHE/$1" )"
local ALGORITHM="$( echo "$2" | cut -d: -f1 )"
@@ -536,7 +536,7 @@ function unpack_file_user_query() {
##
#---------------------------------------------------------------------
function unpack_ignore() {
- $STD_SORCERY_DEBUG "Running unpack_ignore() on $1"
+ debug "libgrimoire" "Running unpack_ignore() on $1"

REASON="$2"

@@ -570,7 +570,7 @@ ask_risky|ask_ignore) query "Abort?" "n
##
#---------------------------------------------------------------------
function unpack_missing() {
- $STD_SORCERY_DEBUG "Running unpack_missing() on $1"
+ debug "libgrimoire" "Running unpack_missing() on $1"

message "${PROBLEM_COLOR}Missing check for source file $1!${DEFAULT_COLOR}"

@@ -598,7 +598,7 @@ function unpack_missing() {
##
#---------------------------------------------------------------------
function uncompress_unpack() {
- $STD_SORCERY_DEBUG "Running uncompress_unpack() on $1"
+ debug "libgrimoire" "Running uncompress_unpack() on $1"

FILENAME="$( guess_filename "$SOURCE_CACHE/$1" )" &&
COMPRESSOR="$( guess_compressor "$FILENAME" )"
@@ -636,7 +636,7 @@ function real_unpack_file_simple() { unc
##
#---------------------------------------------------------------------
function locate_spell_file() {
- $STD_SORCERY_DEBUG "Running locate_spell_file() $2 on $1"
+ debug "libgrimoire" "Running locate_spell_file() $2 on $1"

# checks in any case
[ -f "$SPELL_DIRECTORY/$1" ] && echo "$SPELL_DIRECTORY/$1" && return 0
@@ -670,7 +670,7 @@ function locate_spell_file() {
##
#---------------------------------------------------------------------
function real_unpack() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "Running unpack -- $*"

message "${MESSAGE_COLOR}Unpacking source file ${SPELL_COLOR}${1}" \
"${DEFAULT_COLOR}${MESSAGE_COLOR}for spell${SPELL_COLOR}" \
@@ -759,7 +759,7 @@ ask_risky|ask_ignore) query "Abort?" "n
##
#---------------------------------------------------------------------
function uncompress_md5() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "uncompress_md5 - $*"

# This is here so Duff's super debugging info doesn't screw the next step
up
set +x
@@ -792,29 +792,29 @@ function uncompress_md5() {
##
#---------------------------------------------------------------------
function md5_tar_check() {
- $STD_SORCERY_DEBUG_HEAD
+ debug "libgrimoire" "md5_tar_check() - Checking MD5 sum"

local md5

#Do the md5
md5="$(md5sum /dev/stdin | awk '{print $1}')"
- $STD_SORCERY_DEBUG "MD5 of tarball is $md5."
- $STD_SORCERY_DEBUG "argument received is $1."
+ debug "libgrimoire" "md5_tar_check() - MD5 of tarball is $md5."
+ debug "libgrimoire" "md5_tar_check() - argument received is $1."

#See if they match
if [[ $1 == $md5 ]] ; then
- $STD_SORCERY_DEBUG "MD5 Sum Success ( $1 == $md5 )"
+ debug "libgrimoire" "md5_tar_check() - MD5 Sum Success ( $1 == $md5 )"
return 0
fi

#See of we need to md5sum it at all
if [[ ${MD5SUM_DL:-on} == off ]] || ! [[ $1 ]] ; then
- $STD_SORCERY_DEBUG "Skipping check"
+ debug "libgrimoire" "md5_tar_check() - Skipping check"
return 0
fi

#If we get here, the md5's don't match, but should.
- $STD_SORCERY_DEBUG "bad md5"
+ debug "libgrimoire" "md5_tar_check() - bad md5"
return 1

}
diff --git a/var/lib/sorcery/modules/liburl b/var/lib/sorcery/modules/liburl
index 4538968..bda5293 100755
--- a/var/lib/sorcery/modules/liburl
+++ b/var/lib/sorcery/modules/liburl
@@ -111,7 +111,7 @@ function url_download_expand_sort() {

local url expanded_urls sorted_urls

- $STD_SORCERY_DEBUG_HEAD
+ debug "liburl" "$FUNCNAME -- $@"
# you can't expect me to download something without urls...
[ -z "$url_list" ] && return 255

@@ -127,7 +127,7 @@ function url_download_expand_sort() {
# limit the number of expanded urls, only the linux kernel reaches this
# limit and doing netselect on that many urls is absurd
expanded_urls=$(echo "$expanded_urls"|head -n 50)
- $STD_SORCERY_DEBUG "expanded urls $expanded_urls"
+ debug "liburl" "expanded urls $expanded_urls"
# sort urls
url_sort_urls sorted_urls "$expanded_urls"
if ! [[ "$sorted_urls" ]] ; then
@@ -136,7 +136,7 @@ function url_download_expand_sort() {
fi
# shorten the list to a manageable amount
sorted_urls=$(echo "$sorted_urls"|head -n 10)
- $STD_SORCERY_DEBUG "sorted urls $sorted_urls"
+ debug "liburl" "sorted urls $sorted_urls"
url_download "$1" "$sorted_urls" "$3" "$4" "$5"
}

@@ -168,7 +168,7 @@ function url_download() {

local url

- $STD_SORCERY_DEBUG_HEAD
+ debug "liburl" "$FUNCNAME -- $@"

# you can't expect me to download something without urls...
[ -z "$url_list" ] && return 255
@@ -203,7 +203,7 @@ function url_download() {
"$hints" "$udl_target" "$udl_type"
rc=$?
if [[ $rc == 0 ]] ; then
- $STD_SORCERY_DEBUG "downloaded $url $udl_r_target $udl_r_type"
+ debug "liburl" "url_download -- downloaded $url $udl_r_target
$udl_r_type"
return 0
fi
done
@@ -283,7 +283,7 @@ function url_rank() {
local finalList url_speed
local tmp_url tmp_prefix tmp_hostname tmp_list

- $STD_SORCERY_DEBUG "unsorted list: $*"
+ debug "liburl" "unsorted list: $*"

urlList="$@"

@@ -305,7 +305,7 @@ function url_rank() {

for tmp_prefix in $(hash_get_table_fields url_div_hash) ; do
tmp_list=$(hash_get url_div_hash $tmp_prefix)
- $STD_SORCERY_DEBUG "urls are $tmp_list"
+ debug liburl "urls are $tmp_list"
# the awk command turns netselect output like this:
# 69 url1
# 234 url2
@@ -323,11 +323,11 @@ function url_rank() {
# expand back in sorted order

sortedList=$(echo ${url_speed[@]})
- $STD_SORCERY_DEBUG "Ordered list pre-sanity check is $sortedList"
+ debug "liburl" "Ordered list pre-sanity check is $sortedList"

# if all sites are ICMP Unreachable, return the unsorted list instead of
null.
if [[ -z "$sortedList" ]] ; then
- $STD_SORCERY_DEBUG "Failed to expand list"
+ debug "liburl" "Failed to expand list"
echo "$urlList"
return
fi
@@ -341,10 +341,10 @@ function url_rank() {

# just in case something failed along the way just return what we had
if [[ -z "$sortedList" ]] ; then
- $STD_SORCERY_DEBUG "Ordering failed somewhere, giving back original
input"
+ debug "liburl" "Ordering failed somewhere, giving back original input"
echo "$urlList"
else
- $STD_SORCERY_DEBUG "Ordered URLs: $sortedList"
+ debug "liburl" "Ordered URLs: $sortedList"
echo "$sortedList"
fi
}



  • [SM-Commit] GIT changes to master sorcery by Andrew Stitt (67a49e545c10aaf32b22c6ab055ec58f731a73cc), Andrew Stitt, 01/21/2007

Archive powered by MHonArc 2.6.24.

Top of Page