sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master sorcery by Jaka Kranjc (70cc6cf9a36ddb93c99a99c2c7dd0309399bb73f)
- 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 (70cc6cf9a36ddb93c99a99c2c7dd0309399bb73f)
- Date: Mon, 31 Mar 2008 07:50:34 -0500
GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:
ChangeLog | 7 +++++++
var/lib/sorcery/modules/libmisc | 22 ++++++++++++++++++++++
var/lib/sorcery/modules/libstate | 12 +++---------
3 files changed, 32 insertions(+), 9 deletions(-)
New commits:
commit 70cc6cf9a36ddb93c99a99c2c7dd0309399bb73f
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libmisc: added an esc_provider_str function for queries that look
for
spells that provide the provider, where the initial .* should not be
escaped. This was broken since esc_str became consistent on
2008-03-26
* libstate: use esc_provider_str for the second argument in the
search_depends_status* functions
diff --git a/ChangeLog b/ChangeLog
index 32b1869..10ee174 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-31 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libmisc: added an esc_provider_str function for queries that look
for
+ spells that provide the provider, where the initial .* should not be
+ escaped. This was broken since esc_str became consistent on
2008-03-26
+ * libstate: use esc_provider_str for the second argument in the
+ search_depends_status* functions
+
2008-03-30 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libstate: added a workaround to search_depends_status_exact for
provider
functions, since they were broke after the 2008-03-26 esc_str fix
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index f1e4b07..d8a9e98 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -395,6 +395,28 @@ function esc_str()
fi
}
+#---------------------------------------------------------------------
+## @param string
+## @param upvar
+##
+## esc_str with a minor modification used for escaping provider
+## queries, where only the provider name needs to be escaped.
+## Does NOT escape strings matching "\.\*(.*".
+##
+#---------------------------------------------------------------------
+function esc_provider_str()
+{
+ local _escaped
+ # the pattern is intentionally not quoted, so glob matching occurs
+ if [[ $1 == .\*\(* ]]; then
+ esc_str "${1:2}" _escaped
+ _escaped=".*$_escaped"
+ else
+ _escaped="${1//./\.}"
+ _escaped="${_escaped//\*/\*}"
+ fi
+ upvar $2 "$_escaped"
+}
#---------------------------------------------------------------------
## Properly quotes and backquotes parameters so they can be passed
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 6aca889..e05faf6 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -80,13 +80,7 @@ function search_depends_status_exact()
local a1 a2 a3 a4 a5 a6
esc_str "$1" a1; esc_str "$3" a3
esc_str "$4" a4; esc_str "$5" a5; esc_str "$6" a6
- # ugly, but needed for get_spell_provider and real_provider_ok
- if [[ ${2:0:2} == ".*" ]]; then
- esc_str "${2:2}" a2
- a2=".*$a2"
- else
- esc_str "$2" a2
- fi
+ esc_provider_str "$2" a2
debug "libstate" "search_depends_status_exact: [$a1:$a2:$a3:$a4:$a5:$a6]"
lock_file "$depends_status"
@@ -121,7 +115,7 @@ function search_depends_status_simple()
shift
local a1 a2 a3 a4 a5 a6
- esc_str "$1" a1; esc_str "$2" a2
+ esc_str "$1" a1; esc_provider_str "$2" a2
a3=${3:-.*} ; a4=${4:-.*}
esc_str "$5" a5; esc_str "$6" a6
a5=${5:-.*} ; a6=${6:-.*}
@@ -158,7 +152,7 @@ function search_depends_status()
grep "^$spell:" "$depends_status"
else
local depends
- esc_str "$2" depends
+ esc_provider_str "$2" depends
grep "^$spell:$depends:" "$depends_status"
fi
# unlock_file "$depends_status"
- [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (70cc6cf9a36ddb93c99a99c2c7dd0309399bb73f), Jaka Kranjc, 03/31/2008
Archive powered by MHonArc 2.6.24.