Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] adding a temporary is_depends_enabled to test

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Juuso Alasuutari <iuso AT sourcemage.org>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: [SM-Discuss] adding a temporary is_depends_enabled to test
  • Date: Thu, 19 Oct 2006 15:13:08 +0300

First of all, let me confess an embarrassing and stupid mistake: I've already
used is_depends_enabled in a few spells in the test grimoire. (Somehow I
must've thought that seeing the commit message about adding
is_depends_enabled to stable sorcery meant that it's actually available to
users right away. By now I'm hoping I really _did_ see that message, and am
not completely tripping.)

I though I'd fix the spells today using alternative config_query hacks, but
lazy as I am, I figured I'd ask this first: Could we add an
is_depends_enabled.function to the test grimoire, and source that in spells
until it's in stable sorcery? That would help avoid complex manouvres to
maintain compatibility. Not being able to use is_depends_enabled is also
complicating things for other people than myself, or at least sobukus
complained about it earlier today.

I looked at the function in devel sorcery's libstate, modified it a bit, and
ran succesful tests with stable sorcery. I only needed to replace the
search_depends_status_simple call with a more generic grep approach, as that
function isn't in stable either. Here's what I've got, please tell me if it's
safe for temporary use. As you see it will only load the function when it's
not available.

if ! declare -f is_depends_enabled &>/dev/null; then
function 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
grep -q "^[[:space:]]*$1:$2:on" $dep_status
}
fi


--
Juuso Alasuutari
[[ Source Mage GNU/Linux ]]

Attachment: pgpI0Pij4He3L.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page