Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to test-1.13 sorcery by Andrew Stitt (8ed1cbf69dfd530bab9b7027f5009def7226e97b)

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 test-1.13 sorcery by Andrew Stitt (8ed1cbf69dfd530bab9b7027f5009def7226e97b)
  • Date: Fri, 18 Aug 2006 11:49:21 -0500

GIT changes to test-1.13 sorcery by Andrew Stitt <astitt AT sourcemage.org>:

ChangeLog | 3 ++
var/lib/sorcery/modules/libapi | 14 ++++++++++
var/lib/sorcery/modules/libstate | 52
+++++++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+)

New commits:
commit 8ed1cbf69dfd530bab9b7027f5009def7226e97b
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <astitt AT sourcemage.org>

fix bug 12949, put is_depends_enabled in test

diff --git a/ChangeLog b/ChangeLog
index df5235b..f4cd9ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2006-08-18 Andrew Stitt <astitt AT sourcemage.org>
+ * libstate, libapi: add is_depends_enabled, bug 12949
+
2006-08-13 Paul Mahon <pmahon AT sourcemage.org>
* cast: shorten screen names (fixes bug #12133)

diff --git a/var/lib/sorcery/modules/libapi b/var/lib/sorcery/modules/libapi
index 4b9e903..055d946 100755
--- a/var/lib/sorcery/modules/libapi
+++ b/var/lib/sorcery/modules/libapi
@@ -45,6 +45,7 @@ # get_spell_provider (libstate)
# get_source_nums (libmisc)
# guess_compressor (libunpack)
# handle_changed_config (libresurrect)
+# is_depends_enabled (libstate)
# installed_version (libgrimoire)
# install_config_file (libresurrect)
# invoke_installwatch (libtrack)
@@ -570,6 +571,19 @@ function handle_changed_config() {
#---------------------------------------------------------------------
## @Type API
## @param spell
+## @param dependency
+## @See <@function var.lib.sorcery.modules.libstate.html,is_depends_enabled>
for more details.
+## Returns whether or not a given dependency is enabled
+##
+#---------------------------------------------------------------------
+function is_depends_enabled() {
+ debug "libapi" "is_depends_enabled - $*"
+ real_is_depends_enabled "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
+## @param spell
## @See <@function
var.lib.sorcery.modules.libgrimoire.html,real_install_version> for more
details.
## Returns the current version of the given spell
##
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index be868c8..004527a 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -131,7 +131,38 @@ function search_depends_status()

}

+#---------------------------------------------------------------------
+##
+## Search depends status, dont do anything escaping.
+##
+## Arguments can be regexp
+##
+## Prints out the matching line(s)
+## @Stdout the matching line(s)
+## @param depends file
+## @param spell
+## @param depends
+## @param on/off (optional)
+## @param optional/required (optional)
+## @param on arg (optional)
+## @param off arg (optional)
+##
+#---------------------------------------------------------------------
+function search_depends_status_simple()
+{ # $1=depends file $2=spell, $3=depends, $4=on/off, $5=optional/required,
$6=on arg, $7=off arg

+ local depends_status=$1
+ shift
+
+ local a1 a2 a3 a4 a5 a6
+ a1=`esc_str "$1"` ; a2=`esc_str "$2"`
+ a3=${3:-.*} ; a4=${4:-.*}
+ a5=`esc_str "$5"`; a6=`esc_str "$6"`
+ a5=${5:-.*} ; a6=${6:-.*}
+
+ grep "^$a1:$a2\(([^:]*)\)\?:$a3:$a4:$a5:$a6$" $depends_status
+
+}

#---------------------------------------------------------------------
##
@@ -662,6 +693,27 @@ function get_all_spells_with_status () {
unlock_file $SPELL_STATUS
}

+#---------------------------------------------------------------------
+## @Type API
+## @param Spell name
+## @param Target spell name
+## @param If empty get the uncommited spell info, if anything else get
+## info from the committed ($DEPENDS_STATUS) database. If the uncommited
+## db doesnt exist (maybe we're not casting) use DEPENDS_STATUS
+##
+## @return 0 if a dependency from $1 on $2 is enabled, 1 otherwise.
+## @stdout the provider name(s)
+#---------------------------------------------------------------------
+function real_is_depends_enabled() {
+ local dep_status
+ if [[ $3 ]] ; then
+ dep_status=$DEPENDS_STATUS
+ else
+ dep_status=$(hash_get uncommitted_hash $1)
+ [[ $dep_status ]] || dep_status=$DEPENDS_STATUS
+ fi
+ [[ -n $(search_depends_status_simple $dep_status "$1" "$2" 'on' ) ]]
+}

#---------------------------------------------------------------------
## @param variable



  • [SM-Commit] GIT changes to test-1.13 sorcery by Andrew Stitt (8ed1cbf69dfd530bab9b7027f5009def7226e97b), Andrew Stitt, 08/18/2006

Archive powered by MHonArc 2.6.24.

Top of Page