sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master sorcery by Jaka Kranjc (1532f73b4846be139346ffc43e6d9f29ec3143dd)
- 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 (1532f73b4846be139346ffc43e6d9f29ec3143dd)
- Date: Wed, 2 Apr 2008 12:19:25 -0500
GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:
ChangeLog | 3 +
var/lib/sorcery/modules/libcodex | 57
+++++++++++++++++++++++++++++++++++++
var/lib/sorcery/modules/libdepends | 8 +----
var/lib/sorcery/modules/libsorcery | 46 -----------------------------
var/lib/sorcery/modules/libstate | 19 ------------
5 files changed, 63 insertions(+), 70 deletions(-)
New commits:
commit 1532f73b4846be139346ffc43e6d9f29ec3143dd
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
libdepends: fixed formatting of the previous change
commit 638238be5c03f92fef79f3eeb238896c28cb8ed4
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
libstate, libsorcery, libcodex: moved codex_is_local and find_providers
to libcodex
diff --git a/ChangeLog b/ChangeLog
index 1c68139..10f3cd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,8 +4,11 @@
* libdepends: added support for recasting of spells that have a
disabled
dependency on a feature which the cast spell is a provider of. Part
of
private_recast_optionals
+ fixed formatting of the previous change
* libstate: changed a regex in toggle_depends_status to be more
general
added change_spell_provider for silently changing and toggling
providers
+ * libstate, libsorcery, libcodex: moved codex_is_local and
find_providers
+ to libcodex
2008-03-31 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libmisc: added an esc_provider_str function for queries that look
for
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index 355b414..08c48df 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -361,6 +361,23 @@ function codex_get_all_grimoires() {
return $?
}
+#---------------------------------------------------------------------
+## @param grimoire-name
+##
+## returns true if the grimoire is set local, false otherwise.
+#---------------------------------------------------------------------
+function codex_is_local () {(
+ local g_name=$1 idx
+
+ codex_find_grimoire $g_name grimoire idx
+ if ! [[ $grimoire ]]; then
+ return 1
+ fi
+
+ . "$grimoire/GRIMOIRE"
+
+ [[ $CODEX_IS_LOCAL == "yes" ]]
+)}
#####################SECTION FUNCTIONS###############################
@@ -737,6 +754,46 @@ function codex_find_spell_provides() {
done
}
+#---------------------------------------------------------------------
+## @param category/service
+## @Stdout spelllist
+##
+## First argument is a category of spell. Returns a list of spells
+## that match that category. For example,
+## C<find_providers email-client> returns evolution,althea,mutt,etc.
+##
+## This will list spells exactly once, exiled spells are not listed.
+## This also takes into account grimoire ordering. A spell must provide
+## the category in the first grimoire the spell is seen in (because that
+## is the only one that will be cast) otherwise it is not listed.
+#---------------------------------------------------------------------
+function find_providers() {
+ local feature="$1"
+ local provider GRIMOIRE spell_path
+ local providers=$(
+ for GRIMOIRE in $(codex_get_all_grimoires); do
+ gawk '/^'"$feature"'[[:blank:]]/ { print $2 }' \
+ "$GRIMOIRE/$PROVIDE_INDEX_FILE"
+ done | get_basenames|sort -u)
+
+ # filter out providers we dont want, so far this is:
+ # a) do not provide something in the first grimoire they are found in
+ # b) are exiled.
+ # ex: foo provides FOOBAR in the "stable" grimoire but not the "test"
+ # grimoire and test is searched before stable in this case cast will
+ # use the spell from test which does NOT provide FOOBAR, therefore
+ # we should not list foo as a provider of FOOBAR
+ for provider in $providers; do
+ if ! spell_exiled $provider; then
+ spell_path=$(codex_find_spell_by_name $provider)
+ GRIMOIRE=$(dirname $( dirname $spell_path))
+ # ensure the first place we look for the spell is a provider
+ grep -q "^$feature $spell_path$" $GRIMOIRE/$PROVIDE_INDEX_FILE &&
+ echo $provider
+ fi
+ done
+}
+
##############################CACHE FUNCTIONS#########################
#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 1ebbaf4..3b8052d 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -637,11 +637,9 @@ function private_recast_optionals() {
NEW_UP_DEPENDS[$j]=$spell
let j++
# toggle all the features that $1 provides and set $1 as their
provider
-
-for feature in $features; do
- change_spell_provider $DEPENDS_STATUS $spell "$1" "$feature" "on"
-done
-
+ for feature in $features; do
+ change_spell_provider $DEPENDS_STATUS $spell "$1" "$feature" "on"
+ done
spells=( ${spells[*]} $spell )
fi
done
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index db26792..b46d2ba 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -1532,52 +1532,6 @@ function invoke_build_dir() {
fi
}
-
-#---------------------------------------------------------------------
-## @param category/service
-## @Stdout spelllist
-##
-## First argument is a category of spell. Returns a list of spells
-## that match that category. For example,
-## C<find_providers email-client> returns evolution,althea,mutt,etc.
-##
-## This will list spells exactly once, exiled spells are not listed.
-## This also takes into account grimoire ordering. A spell must provide
-## the category in the first grimoire the spell is seen in (because that
-## is the only one that will be cast) otherwise it is not listed.
-##
-## Note to self: move to libcodex
-##
-#---------------------------------------------------------------------
-function find_providers() {
- local feature="$1"
- local provider GRIMOIRE spell_path
- local providers=$(
- for GRIMOIRE in $(codex_get_all_grimoires); do
- gawk '/^'"$feature"'[[:blank:]]/ { print $2 }' \
- "$GRIMOIRE/$PROVIDE_INDEX_FILE"
- done | get_basenames|sort -u)
-
- # filter out providers we dont want, so far this is:
- # a) do not provide something in the first grimoire they are found in
- # b) are exiled.
- # ex: foo provides FOOBAR in the "stable" grimoire but not the "test"
- # grimoire and test is searched before stable in this case cast will
- # use the spell from test which does NOT provide FOOBAR, therefore
- # we should not list foo as a provider of FOOBAR
- for provider in $providers; do
- if ! spell_exiled $provider; then
- spell_path=$(codex_find_spell_by_name $provider)
- GRIMOIRE=$(dirname $( dirname $spell_path))
- # ensure the first place we look for the spell is a provider
- grep -q "^$feature $spell_path$" $GRIMOIRE/$PROVIDE_INDEX_FILE &&
- echo $provider
- fi
- done
-
-}
-
-
#---------------------------------------------------------------------
## @Stdout filelist
## Returns false if one or more source files for the current spell
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 65f9b7d..1bd6a45 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -1074,25 +1074,6 @@ function remove_config() {
}
#---------------------------------------------------------------------
-## @param grimoire-name
-##
-## returns true if the grimoire is set local, false otherwise.
-#---------------------------------------------------------------------
-function codex_is_local () {(
- local g_name=$1 idx
-
- codex_find_grimoire $g_name grimoire idx
- if ! [[ $grimoire ]]; then
- return 1
- fi
-
- . "$grimoire/GRIMOIRE"
-
- [[ $CODEX_IS_LOCAL == "yes" ]]
-)}
-
-
-#---------------------------------------------------------------------
##
## This software is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
- [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (1532f73b4846be139346ffc43e6d9f29ec3143dd), Jaka Kranjc, 04/02/2008
Archive powered by MHonArc 2.6.24.