Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (4db5017f94ac7a985367ee6aec5332e185d5d1d6)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (4db5017f94ac7a985367ee6aec5332e185d5d1d6)
  • Date: Mon, 1 Sep 2008 07:19:32 -0500

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 9 ++++
usr/sbin/cast | 8 ++--
var/lib/sorcery/modules/build_api/common | 57
++++++++++++++++++++++---------
var/lib/sorcery/modules/libcast | 1
var/lib/sorcery/modules/libsorcery | 21 ++++-------
var/lib/sorcery/modules/libspell | 4 ++
var/lib/sorcery/modules/libsummon | 2 -
7 files changed, 71 insertions(+), 31 deletions(-)

New commits:
commit 4db5017f94ac7a985367ee6aec5332e185d5d1d6
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libsorcery: modified verify_sources and verify_source, so it prints
the correct error and simplified verify_source

commit 805dfa6dc60fb742b4ed4a83cabe8096e5b089d4
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

common: simplified run_security

commit 2c78d73a85a500a71251fe34234eceab80c5e5ff
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* cast, libspell, libsorcery, libcast, libsummon: fixed bug #2209
display the reason for spell failure. Now the end summary will show
the phase the spell failed in; this info is added to the activity
log
aswell (before only two types of failures were explained)

diff --git a/ChangeLog b/ChangeLog
index 18e0c9a..e0b76df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-01 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * cast, libspell, libsorcery, libcast, libsummon: fixed bug #2209
+ display the reason for spell failure. Now the end summary will show
+ the phase the spell failed in; this info is added to the activity
log
+ aswell (before only two types of failures were explained)
+ * common: simplified run_security
+ * libsorcery: modified verify_sources and verify_source, so it prints
+ the correct error and simplified verify_source
+
2008-08-30 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* cast: don't compute SPELLS twice in main

diff --git a/usr/sbin/cast b/usr/sbin/cast
index 05b7855..8602134 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -699,14 +699,16 @@ function pass_five() {
# install queue.
#
if [ -s $FAILED_LIST ] ; then
-
+ local failure_reason_log=$CAST_BACKUPDIR/failure_reason_log
message "${DEFAULT_COLOR}"
message "${MESSAGE_COLOR}Spells that encountered problems:"
message "---------------------------------${PROBLEM_COLOR}"

- for item in `cat $FAILED_LIST 2>/dev/null`; do
+ while read item; do
+ grep -s "^$item " $failure_reason_log ||
message "$item"
- done | column
+ done < $FAILED_LIST | column
+ rm -f $failure_reason_log

set_term_title "Casting failed."
message "${DEFAULT_COLOR}"
diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index 4d181ba..368997b 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -25,22 +25,19 @@
#---------------------------------------------------------------------
function run_security() {
debug "build_api/common" "Starting run_security() on $SPELL"
- if [ -f $SCRIPT_DIRECTORY/SECURITY ]; then
- echo -e "${SPELL_COLOR}${SPELL}:${DEFAULT_COLOR}"
+ local rc=0
+ if [[ -f $SCRIPT_DIRECTORY/SECURITY ]]; then
+ message "${SPELL_COLOR}${SPELL}:${DEFAULT_COLOR}"
tee -a $SECURITY_LOG < $SCRIPT_DIRECTORY/SECURITY
- if [ `grep critical $SCRIPT_DIRECTORY/SECURITY` ]; then
- if query "${RED}SECURITY CRITICAL:${QUERY_COLOR} Do you still want
to cast ${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}?" "n"; then
- return 0
- fi
- return 1
- else
- if query "SECURITY: Do you still want to cast ${SPELL_COLOR}
$SPELL ${QUERY_COLOR}?" "y"; then
- return 0
- fi
- return 1
- fi
+ if grep -q critical $SCRIPT_DIRECTORY/SECURITY; then
+ query "${RED}SECURITY CRITICAL:${QUERY_COLOR} Do you still want to
cast ${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}?" "n"
+ else
+ query "SECURITY: Do you still want to cast
${SPELL_COLOR}$SPELL${QUERY_COLOR}?" "y"
+ fi
+ rc=$?
fi
- return 0
+ [[ $rc != 0 ]] && log_failure_reason "security"
+ return $rc
}


@@ -407,7 +404,9 @@ function run_spell_failure() {

sound FAILURE

- activity_log "cast" "$SPELL" "$VERSION" "failure"
+ local reason
+ get_failure_reason reason
+ activity_log "cast" "$SPELL" "$VERSION" "failure" "$reason"
echo $SPELL >> $FAILED_LIST

# if it failed after PRE_BUILD make a compile log
@@ -462,3 +461,31 @@ function append_to_notice_log() {
fi
rm -f $tmp_log
}
+
+#---------------------------------------------------------------------
+## Appends the failure reason (input) to a log for use in displaying
+## the final FAILED_LIST and the activity log
+##
+## @param reason
+#---------------------------------------------------------------------
+function log_failure_reason() {
+ # delve has a different TMP_DIR, so we can't use it
+ local failure_reason_log=$CAST_BACKUPDIR/failure_reason_log
+ echo "$SPELL ($1)" >> "$failure_reason_log"
+}
+
+#---------------------------------------------------------------------
+## Checks if there is an entry for the spell in the failure_reason_log
+## If there is one, set the upvar to the reason
+##
+## @param upvar
+#---------------------------------------------------------------------
+function get_failure_reason() {
+ local failure_reason_log=$CAST_BACKUPDIR/failure_reason_log
+ local _upvar=$1
+ local _reason
+
+ # if a spell has more than one entry, the first will be used
+ _reason=$(grep -s -m1 "^$SPELL " $failure_reason_log | sed
's,^[^(]*(\([^)]*\)).*$,\1,')
+ upvar $_upvar "$_reason"
+}
diff --git a/var/lib/sorcery/modules/libcast b/var/lib/sorcery/modules/libcast
index ec8d368..0052ff6 100755
--- a/var/lib/sorcery/modules/libcast
+++ b/var/lib/sorcery/modules/libcast
@@ -121,6 +121,7 @@ function run_conflicts() {
echo ${spell_and_default[0]} >> $CONFLICT_LIST
else
echo $SPELL >> $FAILED_LIST
+ log_failure_reason "conflict"
return 1
fi

diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index 7fc5b3f..8343a23 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -944,23 +944,20 @@ function boost() {
## Given a list of source files, returns true if each file exists.
##
#---------------------------------------------------------------------
-function verify_source() { (
-
-
- for SOURCE_FILE in $@; do
- if ! guess_filename $SOURCE_CACHE/$SOURCE_FILE >/dev/null
- then
- message "${PROBLEM_COLOR}Missing ${FILE_COLOR}${1}${DEFAULT_COLOR}"
+function verify_source() {
+ local source_file
+ for source_file in $@; do
+ if ! guess_filename $SOURCE_CACHE/$source_file > /dev/null; then
+ message "${PROBLEM_COLOR}Missing
${FILE_COLOR}$source_file${DEFAULT_COLOR}"
message "${PROBLEM_COLOR}Cast aborting.${DEFAULT_COLOR}"
activity_log "cast" "$SPELL" "$VERSION" "failure" \
- "because it was missing source: $1"
+ "because it was missing source: $source_file"
+ log_failure_reason "missing source"
return 1
fi
done
-
return 0
-
-) }
+}


#---------------------------------------------------------------------
@@ -1180,7 +1177,7 @@ function invoke_build_dir() {
##
#---------------------------------------------------------------------
function verify_sources() {
- verify_source "`sources $SPELL`";
+ verify_source $(sources $SPELL)
}


diff --git a/var/lib/sorcery/modules/libspell
b/var/lib/sorcery/modules/libspell
index 71e988f..f7c2cf8 100755
--- a/var/lib/sorcery/modules/libspell
+++ b/var/lib/sorcery/modules/libspell
@@ -173,6 +173,10 @@ function run_spell_file() {
fi;rc=$?
persistent_save

+ if [[ $rc != 0 ]]; then
+ log_failure_reason $function_suffix
+ fi
+
# restore these, so they're always false except when needed
eval "function real_default_${function_suffix}() {
false
diff --git a/var/lib/sorcery/modules/libsummon
b/var/lib/sorcery/modules/libsummon
index 9d779a2..fa729e7 100755
--- a/var/lib/sorcery/modules/libsummon
+++ b/var/lib/sorcery/modules/libsummon
@@ -45,7 +45,7 @@ function summon_spell() {
if [[ $rc == 0 ]]; then
activity_log "summon" "$SPELL" "$VERSION" "success"
else
- activity_log "summon" "$SPELL" "$VERSION" "failure"
+ activity_log "summon" "$SPELL" "$VERSION" "failure" "download
failed"
fi

# this actually only returns from the subshell, not the function



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (4db5017f94ac7a985367ee6aec5332e185d5d1d6), Jaka Kranjc, 09/01/2008

Archive powered by MHonArc 2.6.24.

Top of Page