Skip to Content.
Sympa Menu

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

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 (0441d9a6d14b00deed34673bd95ec824995d8521)
  • Date: Wed, 27 Aug 2008 14:01:36 -0500

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

ChangeLog | 6 ++
var/lib/sorcery/modules/libdepends | 81
+++++++++++++++++++++++++++++++++----
2 files changed, 79 insertions(+), 8 deletions(-)

New commits:
commit 0441d9a6d14b00deed34673bd95ec824995d8521
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libdepends: improved the cleanup algorithm when a spell fails in the
dependency resolution part of cast - now the dependees are really
removed, not just the broken spell #14668/#7164
It does not remove the failed spells dependencies yet

testing would be appreciated, there are possibly many corner cases. The
goal
is to be better than before, but not necessarily perfect.

diff --git a/ChangeLog b/ChangeLog
index 7368b63..fae538a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-27 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libdepends: improved the cleanup algorithm when a spell fails in the
+ dependency resolution part of cast - now the dependees are really
+ removed, not just the broken spell #14668/#7164
+ It does not remove the failed spells dependencies yet
+
2008-08-26 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libdepends: look up the basesystem dependencies only once
made two variables explicitly local
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 3c321e8..f4e5370 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -1613,19 +1613,84 @@ function depends_message() {
#########################BEGIN OTHER STUFF############################

#---------------------------------------------------------------------
-## Removes a dependency from the list.
+## @param Spell name
+## Removes a dependency and its dependees from the to_cast list.
#---------------------------------------------------------------------
function private_remove_dependees()
{
- local SPELL=$1
- local i
- echo "Removing dependees of $1"
+ local spell=$1
+ local dependees dependee
+ message "${PROBLEM_COLOR}Removing dependees of
$SPELL_COLOR$spell$DEFAULT_COLOR"
+
+ # take care of the spell
+ private_remove_dependees_sub $spell
+
+ # take care of the dependees and their dependees and ...
+ recurse_remove_dependees() {
+ local spell=$1
+ local dependees dependee
+ while uncommitted_upward_depends $spell dependees; do
+ [[ -z $dependees ]] && break
+ for dependee in $dependees; do
+ private_remove_dependees_sub $dependee
+ recurse_remove_dependees $dependee
+ done
+ done
+ }
+
+ recurse_remove_dependees $spell
+
+}
+
+#---------------------------------------------------------------------
+## @param Spell name
+## Does the actual removal
+#---------------------------------------------------------------------
+function private_remove_dependees_sub()
+{
+ local spell=$1

# spell is being removed from cast list, add to FAILED_LIST
- echo "$SPELL" >> $FAILED_LIST
- hash_put depends_looked_at $SPELL failed
- hash_unset "$CAST_HASH" "$SPELL"
- hash_put $CANNOT_CAST_HASH "$SPELL" "Failed"
+ echo "$spell" >> $FAILED_LIST
+ hash_put depends_looked_at $spell failed
+ hash_unset "$CAST_HASH" "$spell"
+ hash_put $CANNOT_CAST_HASH "$spell" "Failed"
+
+ local bonus=${BONUS_SPELLS[@]}
+ local up_depends=${UP_DEPENDS[@]}
+ if real_list_find "$bonus" $spell; then
+ real_list_remove bonus $spell
+ BONUS_SPELLS=( $bonus )
+ fi
+ if real_list_find "$up_depends" $spell; then
+ real_list_remove up_depends $spell
+ UP_DEPENDS=( $up_depends )
+ fi
+}
+
+#---------------------------------------------------------------------
+## @param Spell name
+## @param Return variable
+## Find all the spells already processed that depend on the spell given as $1
+## Unlike private_upward_depends, this one works with the uncommitted info
+#---------------------------------------------------------------------
+function uncommitted_upward_depends() {
+ local _spell=$1
+ local _upvar=$2
+ local candidate _dependees _deps
+
+ for candidate in $(hash_get_table_fields $CAST_HASH); do
+ hash_get_ref $CAST_HASH $candidate _deps
+ if real_list_find "$_deps" $_spell; then
+ real_list_add _dependees $candidate
+ fi
+ done
+
+ if [[ -n $_upvar ]]; then
+ upvar $_upvar $_dependees
+ else
+ echo $_dependees
+ fi
}

#---------------------------------------------------------------------



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (0441d9a6d14b00deed34673bd95ec824995d8521), Jaka Kranjc, 08/27/2008

Archive powered by MHonArc 2.6.24.

Top of Page