Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to test sorcery by Andrew Stitt

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 sorcery by Andrew Stitt
  • Date: Thu, 18 May 2006 20:41:51 -0500

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

ChangeLog | 111 ++++++
build | 11
etc/sorcery/config | 3
etc/sorcery/version | 2
usr/sbin/cast | 29 +
usr/sbin/cleanse | 6
usr/sbin/dispel | 71 +++-
usr/sbin/gaze | 44 ++
usr/sbin/scribe | 2
usr/sbin/sorcery | 4
usr/share/man/man1/gaze.1 | 6
usr/share/man/man8/cast.8 | 3
var/lib/sorcery/modules/dl_handlers/dl_svn | 17 -
var/lib/sorcery/modules/libapi | 110 +++++-
var/lib/sorcery/modules/libcast | 10
var/lib/sorcery/modules/libcodex | 116 ++++--
var/lib/sorcery/modules/libdepends | 357
++++++++++++++-------
var/lib/sorcery/modules/libdispel | 49 ++
var/lib/sorcery/modules/libgpg | 2
var/lib/sorcery/modules/libhash | 17 +
var/lib/sorcery/modules/libmisc | 88 ++++-
var/lib/sorcery/modules/libresurrect | 8
var/lib/sorcery/modules/libsorcery | 121 ++++---
var/lib/sorcery/modules/libstate | 3
var/lib/sorcery/modules/libsummon | 44 ++
var/lib/sorcery/modules/libtablet | 108 ++++--
var/lib/sorcery/modules/libunpack | 2
var/lib/sorcery/modules/url_handlers/url_svn_https | 131 +++++++
28 files changed, 1132 insertions(+), 343 deletions(-)

New commits:
commit 67ad1617a25f16e2fde82d7f33f968908d16d66c
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <astitt AT sourcemage.org>

fix location of changelog entries
(cherry picked from 5b2692d5af4f708215462f247ee5a118b37563fe commit)

commit 46010b6e2d3687aa4a94f12a54c682e0caab9495
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <astitt AT sourcemage.org>

------------------------------------------------------------
revno: 35
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack5
timestamp: Fri 2006-05-12 10:02:59 -0700
message:
fix bug 11413, untar permissions

commit 72d9590e2ca92fe0e9b4620a38837221fddb46d5
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 34
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack5
timestamp: Fri 2006-05-12 09:15:57 -0700
message:
fix bug 11767

commit 5bd8851b55fe328fb79b63b74838716d54f5c24f
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 33
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack5
timestamp: Thu 2006-05-11 08:51:53 -0700
message:
fix typo

commit 87d7589f67df31ccda68f351a2a00159510d1109
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 32
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 21:48:19 -0700
message:
add -g parameter to cast

commit e67fbf0277e76efd5d903c78b3420034713558f3
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 31
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 21:33:08 -0700
message:
remove cast --fix and --nofix

commit f8f7656ad0555591ab3ec2a21b59beabff1d60a5
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 30
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 21:24:30 -0700
message:
fix spelling nit

commit e9c9052ba69208e78936b1703ca1070b4b4b1ad8
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 29
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 20:57:35 -0700
message:
teach gaze dependencies about new functions

commit 810ec2761107ebbda5175fd67b411ac431df66c6
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 28
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Tue 2006-05-09 20:53:20 -0700
message:
add runtime/suggested dependencies bugs 10110 and 10790

commit ac87ffdff207c34f745f93f9bacbc907f851cb95
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 27
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Wed 2006-05-03 09:27:27 -0700
message:
fix bug 10528, install_config_files marks files as new or old

commit b3a8f0411a8d4a5202f24a1ca29e991217d89118
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 26
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Wed 2006-05-03 09:22:22 -0700
message:
fix bug 10465, gaze grimoire selection

commit 2635c57b2b1a09dae8f366964850664efc2b3dee
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 25
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Mon 2006-05-01 22:31:38 -0700
message:
fix search for default provider

commit 6305bb07d751c5aa3b745550f434fe2f58bc8155
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 24
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Sun 2006-04-23 18:48:18 -0700
message:
fix bug 8070, make changelog viewing timeout

commit 4f2f2b547a8363498c33ba47b8181b0b9169525d
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 23
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Sun 2006-04-23 17:46:00 -0700
message:
fix bug 9415, add some sanity checking to summon

commit 649593b0499154149897f5c4ee1b9233d866eef6
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 22
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Sun 2006-04-23 17:11:10 -0700
message:
svn should be non-interactive

commit 9d56d7a31b6944dc7304caf183e3aef491dde5f2
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 21
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel
timestamp: Fri 2006-04-21 08:31:15 -0700
message:
fix bug 11372, and some other summon issues

commit f5b27264b908eb4f887b60b0a53327f0f64bd28e
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 20
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel
timestamp: Fri 2006-04-14 09:11:56 -0700
message:
fix bug 9386 -- optimize tablet_import_repair_files
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060414070549-73f8d2b8f9a06a26
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Fri 2006-04-14 00:05:49 -0700
message:
Optimize tablet_import_repair_files, now runs about 10 times faster.
Completes in about 6 seconds for me, compared with over 60 seconds.

* Removed all but one fork (from codex in-memory cache creation).
* Replace codex_set_current_spell_by_name with
codex_get_spell_paths and
hash_get_ref on the in-memory cache.
* Move tablet lookups for version, updated, and patchlevel to
tablet_check_repair_file, so they are only run when actually
needed.
* replace find -type f -mindepth 1 -maxdepth 1 .... with glob
pattern
plus a [[ -f ]]
* use smgl_basename and smgl_dirname where possible
* replace $(cat) with $(<)

Also had to update cleanse routines since they tie into the repair
file routines
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060414061038-ccd58caf381a28c4
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Thu 2006-04-13 23:10:38 -0700
message:
add function to pass up hash values by reference instead of using
stdout
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060414060954-9cd051f486683914
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Thu 2006-04-13 23:09:54 -0700
message:
improve in-memory cache creation by providing an option to only
store
info for spells that are actually installed (easy 10x speedup
for typical installs)
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060414043631-fe729b362d0cfd7f
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Thu 2006-04-13 21:36:31 -0700
message:
add routines to create in-memory spell lookup table
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060414043417-6913968692c52e4d
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Thu 2006-04-13 21:34:17 -0700
message:
move common code for setting spell paths into a seperate function
this is one of many things necessary to make
tablet_import_repair_files as
fast as possible
------------------------------------------------------------
merged: astitt AT sourcemage.org-20060414041654-c932672e93e14ae0
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Thu 2006-04-13 21:16:54 -0700
message:
add smgl_basename and smgl_dirname functions

commit 9b92eb7dd6d38315c6e155d89c3cc7176af6e478
Author: root <root@courier>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 19
committer: root <root@courier>
branch nick: devel
timestamp: Thu 2006-04-13 21:07:42 -0700
message:
fix bug 10282

commit 28bb8993753bc9422e3c0ceee4dec19db36a9b8a
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 18
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Wed 2006-04-12 09:34:02 -0700
message:
fix bug 10682

commit 61539f5190d9cc90c2af3eec7d81529eb4971adc
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 17
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack4
timestamp: Wed 2006-04-12 09:22:33 -0700
message:
fix bug 10144

commit 949d33bf75cc5b3b283587a7af9f207adba46c04
Author: Andrew Stitt <afrayedknot@thefrayedknot>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 16
committer: Andrew Stitt <afrayedknot@thefrayedknot>
branch nick: devel
timestamp: Sat 2006-04-08 11:28:17 -0700
message:
fix bug 10855 and 10900

commit 5aaac07eaec35ba84c4860e4a665c1654ddaa908
Author: Andrew Stitt <afrayedknot@thefrayedknot>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 15
committer: Andrew Stitt <afrayedknot@thefrayedknot>
branch nick: devel
timestamp: Thu 2006-04-06 16:05:30 -0700
message:
fix bug 10869

commit 030d038abec496b1c5e683e6282a7f65b28f4eb7
Author: Andrew Stitt <afrayedknot@thefrayedknot>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 14
committer: Andrew Stitt <afrayedknot@thefrayedknot>
branch nick: devel
timestamp: Wed 2006-04-05 12:12:59 -0700
message:
merge changes from lynxlynxlynx. modified removal of $ to be \$.
------------------------------------------------------------
merged: jakakranjc AT email.si-20060405134200-64dce620d0902f7e
committer: Jaka Kranjc <jakakranjc AT email.si>
branch nick: sorcery-devel
timestamp: Wed 2006-04-05 15:42:00 +0200
message:
update?
------------------------------------------------------------
merged: jakakranjc AT email.si-20060403170110-652215b453dd1556
committer: Jaka Kranjc <jakakranjc AT email.si>
branch nick: sorcery-devel
timestamp: Mon 2006-04-03 19:01:10 +0200
message:
removed two "$" from help to prevent expanding to null
------------------------------------------------------------
merged: jakakranjc AT email.si-20060403164157-369e2d9de99836c1
committer: Jaka Kranjc <jakakranjc AT email.si>
branch nick: sorcery-devel
timestamp: Mon 2006-04-03 18:41:57 +0200
message:
added support for viewing {,PRE_}SUB_DEPENDS files to gaze

commit 9319723afac5bf4d0cf3bc0d39a32b4255bfbde6
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 13
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Tue 2006-04-04 21:06:53 -0700
message:
fix bug 10538

commit 6b674e71843855dcd009db60572f61bf19204e09
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 12
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack3
timestamp: Tue 2006-04-04 20:12:28 -0700
message:
fix bug 10357

commit f2a0ca1b91396ec0469e4ea85678c6fde74b7fb2
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 8
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Mon 2006-04-03 09:11:57 -0700
message:
add svn_https handler, bug 10370

commit 2307225332fdc071a9b79430c1dc4614959dbf24
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 7
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Mon 2006-04-03 09:06:01 -0700
message:
fix bug 10588

commit 7a2b419dd5c5a06030bf6fe6c7916b8a174e57da
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 6
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-hack2
timestamp: Sun 2006-04-02 19:49:54 -0700
message:
version value now gets filled in by the build script

commit a94533ff7e585cccb6c17e0c0575b0701d37438f
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 5
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel
timestamp: Sun 2006-04-02 19:16:43 -0700
message:
fix bug 10183

commit ac8fdf1b8c7f335001cafdfd0b4ec76cb3a16325
Author: Andrew Stitt <astitt AT sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 4
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: devel-clean
timestamp: Sun 2006-04-02 18:17:54 -0700
message:
add support for building from bzr repos

commit 1749f7e6facf768cb92010fc1ffe233f5628ce08
Author: astitt <astitt AT fawkes.sourcemage.org>
Commit: Andrew Stitt <afrayedknot@thefrayedknot.(none)>

------------------------------------------------------------
revno: 3
committer: astitt <astitt AT fawkes.sourcemage.org>
branch nick: devel
timestamp: Sun 2006-04-02 20:08:30 -0500
message:
populate from test

diff --git a/ChangeLog b/ChangeLog
index 6198f75..07495eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,114 @@
+2006-05-12 Andrew Stitt <astitt AT sourcemage.org>
+ * libunpack: change parameters passed to tar, bug 11413
+
+2006-05-12 Andrew Stitt <astitt AT sourcemage.org>
+ * sorcery: remove extra comma, bug 11767
+
+2006-05-11 Andrew Stitt <astitt AT sourcemage.org>
+ * libdepends: fix typo
+
+2006-05-09 Andrew Stitt <astitt AT sourcemage.org>
+ * cast: add -g parameter to allow custom grimoire selection and
ordering
+ * cast: remove --fix and --nofix (been deprecated for several
releases)
+
+2006-05-09 Andrew Stitt <astitt AT sourcemage.org>
+ * libapi: add runtime and suggest_depends, bugs 10110 and 10790.
+ Remove altruistic_sub_depends stub.
+ * dispel: add improved messages to handle new dependency states
+ * libdepends: Add new frontend routines for runtime/suggest
+ dependencies. Factor most common message calls into a
+ subroutine. Add controls for compute_install_depends functions
+ to work on either true dependencies as well as the full set.
+ Generalized the way UP_DEPENDS works because runtime/suggest depends
+ need it as well.
+ * libstate: Add new dependency states to sanity check
+ * cast: update to use generalized bonus spell mechanism
+ * gaze: add function stubs for runtime/suggest dependencies
+
+2006-05-03 Andrew Stitt <astitt AT sourcemage.org>
+ * gaze: fix bug 10465, gaze allows grimoire selection
+ * libresurrect: fix bug 10528, install_config_files marks files
+ as new or old, patch from Jaka Kranjc.
+
+2006-05-01 Andrew Stitt <astitt AT sourcemage.org>
+ * libdepends: fix search for default provider
+
+2006-04-23 Andrew Stitt <astitt AT sourcemage.org>
+ * libsorcery: fix bug 8070, add pager timeout for changelog viewing
+ * config: add a pager timeout, and use less -F instead of -E,
+ see if people like -F better than -E.
+
+2006-04-23 Andrew Stitt <astitt AT sourcemage.org>
+ * libsummon: fix bug 9415, do some sanity checking in summon
+
+2006-04-23 Andrew Stitt <astitt AT sourcemage.org>
+ * dl_handlers/dl_svn: Do no interactive prompting
+
+2006-04-21 Andrew Stitt <astitt AT sourcemage.org>
+ * libsummon: fix bug 11372, bad spells can make us unlock the wrong
+ resource, causing subsequent summons to hang. Also fix return code
+ propagation.
+
+2006-04-14 Andrew Stitt <astitt AT sourcemage.org>
+ * libmisc: add forkless basename and dirname functions using
+ bash variable expansions.
+ * libhash: add lookup routine that returns by reference
+ * libcodex: add routines to setup in-memory cache lookup hash, and
+ factor out code to setup spell paths from spell loading functions
+ * libtablet: fix bug 9386, optimize tablet_import_repair_files,
+ also tie up loose ends with cleanse related functions
+ * cleanse: update parameters to tablet_cleanse_chapter
+
+2006-04-13 Andrew Stitt <astitt AT sourcemage.org>
+ * libsorcery: consolidate history functions, bug 10282
+ modified patch from Jaka Kranjc. Also added a long overdue full
+ explaination changelog parsing awk script.
+
+2006-04-12 Andrew Stitt <astitt AT sourcemage.org>
+ * gaze: fix bug 10144, fix viewing of install queue, patch from
+ Jaka Kranjc
+ * libdispel: print message if dispel fails, bug 10682
+
+2006-04-08 Andrew Stitt <astitt AT sourcemage.org>
+ * libdepends: add default_* functions for dependency resolution
+ phase, bug 10900.
+ * libdispel: add default_* function for dispel phase
+ * libdispel: add persistent_load/persistent_save calls around
+ *_REMOVE functions, bug 10855.
+ * libapi: add entry points for default_* for depends resolution
+ and dispel
+
+2006-04-07 Andrew Stitt <astitt AT sourcemage.org>
+ * libtablet: allow special keyword 'all' to unconditionally
+ update a file in the tablet, bug 10869
+
+2006-04-05 Andrew Stitt <astitt AT sourcemage.org>
+ * gaze: backquoted $level in gaze usage message
+ * gaze: added support for viewing {,PRE_}SUB_DEPENDS file
+ (from Jaka Kranjc)
+
+2006-04-04 Andrew Stitt <astitt AT sourcemage.org>
+ * libmisc: fix select_list default value selection, bug 10538
+ * cleanse, libcast, libgpg: update to slightly modified select_list
api
+
+2006-04-04 Andrew Stitt <astitt AT sourcemage.org>
+ * libmisc: fix bug 10357, add extra check for a file incase theres
+ a directory named make.
+
+2006-04-03 Andrew Stitt <astitt AT sourcemage.org>
+ * libmisc: fix bug 10588, fix provider selection on timeout
+ * url_handlers/url_svn_https: add https handler for svn, bug 10370
+
+2006-04-02 Andrew Stitt <astitt AT sourcemage.org>
+ * build: fill in the version value on devel sorcery
+
+2006-04-02 Andrew Stitt <astitt AT sourcemage.org>
+ * dl_handlers/dl_svn: fix bug 10183, allow for username/password to be
+ passed on the command line
+
+2006-04-02 Andrew Stitt <astitt AT sourcemage.org>
+ * build: exclude .bzr metadata
+
2006-03-26 Andrew Stitt <astitt AT sourcemage.org>
* libsorcery: default to no fuzzy extension matching, bug 10761

diff --git a/build b/build
index 8f737c6..f0801de 100755
--- a/build
+++ b/build
@@ -1,19 +1,26 @@
#!/bin/bash

function build__find_non_volatile() {
- find "$@" -follow -not -type d -and -not -path '*CVS*' -and -not -name
'.#*' -and -not -name '*~' -and -not -path '*.svn*' -and -not -path
'*.arch-id*' -and -not -path '*{arch}*'
+ find "$@" -follow -not -type d -and -not -path '*CVS*' -and -not -name
'.#*' -and -not -name '*~' -and -not -path '*.svn*' -and -not -path
'*.arch-id*' -and -not -path '*{arch}*' -and -not -path '*.bzr*'
}

branch_dir=$(basename $(pwd))
+if [[ $1 ]] ; then
+ branch_name=$1
+else
+ branch_name=$branch_dir
+fi
+
if [ -e ../sorcery ]; then
echo "We need a blank directory beneath the current on to link sorcery ->
$branch_dir"
exit 1
fi
+[[ $branch_name == devel ]] && date "+%Y%m%d" > etc/sorcery/version
pushd .. &>/dev/null
NAMES_TMP=/tmp/sorcery.build.$$
ln -sf $branch_dir sorcery
build__find_non_volatile sorcery > $NAMES_TMP
-tar --owner=0 --group=0 -cvjf sorcery-${branch_dir}.tar.bz2 -T $NAMES_TMP
+tar --owner=0 --group=0 -cvjf sorcery-${branch_name}.tar.bz2 -T $NAMES_TMP
rm $NAMES_TMP
rm sorcery
popd .. &>/dev/null
diff --git a/etc/sorcery/config b/etc/sorcery/config
index 6dd72f3..3686a4b 100755
--- a/etc/sorcery/config
+++ b/etc/sorcery/config
@@ -19,6 +19,7 @@ shopt -u expand_aliases
VIEW_REPORTS=${VIEW_REPORTS:=on}
VOYEUR=${VOYEUR:=on}
PROMPT_DELAY=${PROMPT_DELAY:=150}
+ PAGER_TIMEOUT=${PAGER_TIMEOUT:=150}
MAX_CABALS=${MAX_CABALS:=16}
NET_SELECT=${NET_SELECT:=off}
MD5SUM_DL=${MD5SUM_DL:=ask_risky}
@@ -52,7 +53,7 @@ FORCE_BASESYSTEM_DEPENDS=${FORCE_BASESYS
# -X: dont do screen init and deinit, gaze install
# of a small spell is effectively useless otherwise as
the
# screen is cleared afterwards.
- PAGER=${PAGER:=less -R -E -X -f}
+ PAGER=${PAGER:=less -R -F -X -f}
FILEPROG=${FILEPROG:=file}
DIALOGPROG=${DIALOGPROG:=dialog}

diff --git a/etc/sorcery/version b/etc/sorcery/version
index 9122089..d64531f 100644
--- a/etc/sorcery/version
+++ b/etc/sorcery/version
@@ -1 +1 @@
-20060508
+devel
diff --git a/usr/sbin/cast b/usr/sbin/cast
index aef746b..0af1e06 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -30,10 +30,6 @@ Optional Parameters:

-V [on|off] Override \$VOYEUR setting

--f | --fix Discover and fix broken spells
--n | --nofix Discover, but do not fix broken spells
- (Both deprecated, use cleanse instead)
-
-d | --download Force download of sources (overwrite existing
files)

@@ -44,6 +40,14 @@ Optional Parameters:
-c | --compile Recompile the spells (dont install from
cache).
-r | --reconfigure Select new dependencies for spells (implies
-c)

+-g | --grimoire [...] Use only the specified grimoires for this
cast
+ NOTE: If there are any cross-grimoire
+ dependencies on unspecified grimoires they
+ will not work. The target spell will
+ not be found. To avoid this, specify all
+ relevant grimoires to the -g parameter
+ in the order you wish them to be searched.
+
-R | --recast-down Recast depended-upon spells, even if they are
already installed...
-B | --recast-up Recast dependent spells, even if they are
@@ -80,7 +84,7 @@ EOF
#---------------------------------------------------------------------
## @Aguments Arguments of cast
## @Globals DEPS_ONLY RECONFIGURE COMPILE
-## @Globals FORCE_DOWNLOAD SOURCE_CACHE SILENT FIX NOFIX SEPARATE
+## @Globals FORCE_DOWNLOAD SOURCE_CACHE SILENT SEPARATE
## @Globals BASE_URL INSTALL_QUEUE
##
## Sets these globals except INSTALL_QUEUE according to cast's
@@ -103,6 +107,7 @@ function process_parameters() {
--no-opts) export NO_OPTIMIZATION_FLAGS=1; COMPILE="-c"; shift 1
;;
-V) export VOYEUR_OVERRIDE="$2"; shift 2
;;
--deps) export DEPS_ONLY="$1"; shift 1
;;
+ -g|--grimoire*) export OVERRIDE_GRIMOIRES="$2"; shift 2
;;
-r|--reconfigure) RECONFIGURE="$1"; COMPILE="-c"; shift 1
;;
-R|--recast-down) RECAST_DOWN="$1"; shift 1
;;
-B|--recast-up) RECAST_UP="$1"; shift 1
;;
@@ -117,9 +122,6 @@ function process_parameters() {
-d|--download) export FORCE_DOWNLOAD="$1"; COMPILE="-c"; shift 1
;;
--from) export SOURCE_CACHE=$2; shift 2
;;
--silent) SILENT="$1"; shift 1
;;
- -f|--fix) export FIX="$1"; shift 1
;;
- -n|--nofix) export FIX="--fix"
- export NOFIX="$1"; shift 1
;;
-s) export SEPARATE="$1"; shift 1
;;
--url) export BASE_URL="$2"; shift 2
;;
--pam) cast -c `find_pam_aware` ; shift 1
;;
@@ -186,6 +188,7 @@ function strip_parameters() {
--ldflags) shift 2 ;;
--no-opts) shift 1 ;;
-V) shift 2 ;;
+ -g|--grimoire*) shift 2 ;;
-R|--recast-down) shift 1 ;;
-B|--recast-up) shift 1 ;;
-O|--recast-optional) get_option "$2" "" x n ; shift $n ;;
@@ -194,8 +197,6 @@ function strip_parameters() {
-r|--reconfigure) shift 1 ;;
--from) shift 2 ;;
--silent) shift 1 ;;
- -f|--fix) shift 1 ;;
- -n|--nofix) shift 1 ;;
-c|--compile) shift 1 ;;
-d|--download) shift 1 ;;
-s) shift 1 ;;
@@ -347,7 +348,7 @@ function pass_one() {

SPELLS_TO_CAST=$(hash_get_table_fields "to_cast"|tr '\n' ' ')

- SPELLS="$SPELLS ${UP_DEPENDS[*]}"
+ SPELLS="$SPELLS ${BONUS_SPELLS[*]}"

# special case of no spell making it through dependency resolution
# or if DEPS_ONLY is set, there arent any dependent spells to cast
@@ -779,7 +780,7 @@ function cast_cleanup() {

#---------------------------------------------------------------------
## @Arguments arguments of cast
-## @Globals FIX CAST_PASS
+## @Globals CAST_PASS
## @return 0 always
## Starts prameter processing and casts the given spells.
## The list of given spells is being searched for invalid spells
@@ -792,6 +793,10 @@ function main() {
process_parameters "$@"
SPELLS=`strip_parameters "$@"`

+ if [[ $OVERRIDE_GRIMOIRES ]] ; then
+ codex_set_grimoires $OVERRIDE_GRIMOIRES
+ fi
+
for spell in $SPELLS ; do
codex_does_spell_exist $spell
if [ $? -eq 0 ] ; then
diff --git a/usr/sbin/cleanse b/usr/sbin/cleanse
index 6f3d854..98e66e3 100755
--- a/usr/sbin/cleanse
+++ b/usr/sbin/cleanse
@@ -159,7 +159,7 @@ function args()
fi
;;
--tablet_spell)
- tablet_cleanse_chapter $TABLET_PATH/$1 $BACKUPDIR
+ tablet_cleanse_chapter $TABLET_PATH/$1 $BACKUPDIR yes
let rc+=$?
shift
;;
@@ -220,7 +220,7 @@ function delint()
printf("options[%d]=\"%s\"\n", count++, $0); ENTRIES[$0]=1;
} }' $DEPENDS_STATUS)
if [ ${#options[@]} -gt 1 ] ; then
- select_list choice 0 "${options[@]}"
+ select_list choice "" "${options[@]}"
message "Removing other entries and keeping selected entry"
else
choice="${options[0]}"
@@ -366,7 +366,7 @@ function prune_depends()
fi

#Get the user's choice of action
- select_list choice 0 "${options[@]}"
+ select_list choice "" "${options[@]}"
case ${choice} in
I*) message "Ignoring." ;;
D*) echo $1 >> $TMP_DIR/prune.dispel ;;
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index d4c805a..87cbb9a 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -256,6 +256,37 @@ function strip_parameters() {
}

#---------------------------------------------------------------------
+## Display what dependencies were removed
+#---------------------------------------------------------------------
+function dispel_parents_list_borkers() {
+ local parent=$1
+ local optional_borkers=$2
+ local runtime_borkers=$3
+ local suggested_borkers=$4
+ if [[ "$optional_borkers" ]] ; then
+ message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
+ "had the following optional dependencies
removed:${DEFAULT_COLOR}"
+ message "${SPELL_COLOR}"
+ echo $optional_borkers | col
+ message "${DEFAULT_COLOR}"
+ fi
+ if [[ "$runtime_borkers" ]] ; then
+ message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
+ "had the following runtime dependencies removed:${DEFAULT_COLOR}"
+ message "${SPELL_COLOR}"
+ echo $runtime_borkers | col
+ message "${DEFAULT_COLOR}"
+ fi
+ if [[ "$suggested_borkers" ]] ; then
+ message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
+ "had the following suggested dependencies
removed:${DEFAULT_COLOR}"
+ message "${SPELL_COLOR}"
+ echo $suggested_borkers | col
+ message "${DEFAULT_COLOR}"
+ fi
+}
+
+#---------------------------------------------------------------------
## @param spell to dispel
##
## Frontend to do common things for dispelling (keep a note of what
@@ -494,27 +525,33 @@ function dispel_depends_engine() {
# for all borked spells either recast, dispel, or ignore
for parent in $(hash_get_table_fields BORKED_PARENTS) ; do
message "$parent is borked because of $(hash_get BORKED_PARENTS
$parent)"
- recastable=yes
+ local recastable=yes
borkers=$(hash_get BORKED_PARENTS $parent)
- local non_optional_borkers
+ local non_optional_borkers suggested_borkers runtime_borkers type
# if any of the removed children are required depends of the current
# spell, the spell is not recastable
# note: this doesnt take into account the spell changing out from
# under us. Oh well.
for child in $borkers; do
- if [[ $(grep "$parent:$child\(([^:]*)\)\?:on:required"
$DEPENDS_STATUS) ]] ; then
+ type=$(grep -m 1 "$parent:$child\(([^:]*)\)\?:on"
$DEPENDS_STATUS|cut -f4 -d:)
+ if [[ "$type" == required ]]; then
recastable=no
list_add non_optional_borkers $child
+ elif [[ "$type" == "runtime" ]] ; then
+ [[ "$recastable" != no ]] && recastable=NA
+ list_add runtime_borkers $child
+ elif [[ "$type" == "suggest" ]] ; then
+ [[ "$recastable" != no ]] && recastable=NA
+ list_add suggested_borkers $child
+ else
+ list_add optional_borkers $child
fi
done
if [[ $recastable == yes ]] ; then
- message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
- "had the following optional depends removed:${DEFAULT_COLOR}"
- message "${SPELL_COLOR}"
- echo $borkers | col
- message "${DEFAULT_COLOR}"
- if dispel_parent_query \
- "Re-cast $parent without these optional depends?" \
+ dispel_parents_list_borkers $parent "$optional_borkers" \
+ "$runtime_borkers" "$suggested_borkers"
+ if [[ $optional_borkers ]] && dispel_parent_query \
+ "Re-cast $parent without these non-optional depends?"
\
"$RECAST_PARENT_DEFAULT" ; then
# fix up the abandoned depends data for impending recompile
# this is a bit of a hack but should work:
@@ -541,7 +578,7 @@ function dispel_depends_engine() {
done

list_add NEW_CASTS $parent
- elif dispel_parent_query "Dispel $parent instead?" \
+ elif dispel_parent_query "Dispel $parent?" \
"$DISPEL_PARENT_DEFAULT" ; then

foo=$(hash_get down_deps $parent)
@@ -553,12 +590,8 @@ function dispel_depends_engine() {
message "Please fix broken dependencies with cleanse --prune"
fi
else
- message "${SPELL_COLOR}${parent}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
- "had the following non-optional depends removed:" \
- "${DEFAULT_COLOR}"
- message "${SPELL_COLOR}"
- echo $non_optional_borkers | col
- message "${DEFAULT_COLOR}"
+ dispel_parents_list_borkers $parent "$optional_borkers" \
+ "$runtime_borkers" "$suggested_borkers"
if dispel_parent_query "Dispel $parent?" \
"$DISPEL_PARENT_DEFAULT"; then

@@ -607,8 +640,8 @@ function main() {
if [[ $DO_DEPENDS ]] ; then
while [[ $SPELLS ]] ; do
debug dispel "recomputing depends tree"
- compute_installed_depends down_deps
- compute_reverse_installed_depends up_deps
+ compute_installed_depends down_deps all
+ compute_reverse_installed_depends up_deps all
dispel_depends_engine "$SPELLS" SPELLS
debug dispel "SPELLS $SPELLS"
done
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index 5ab0116..2821f64 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -88,12 +88,12 @@ orphans <empty> Displays installed spe
depends [--fast] spell [level]
Displays the spells that explicitly or
recursively depend on this spell,
- up to $level levels (infinity if omitted)
+ up to \$level levels (infinity if omitted)
--fast omits some information but runs
faster

dependencies [-c ] [--no-optionals ] spell [level]
Displays the spells this spell explicitly
- or recursively depends on, up to $level
+ or recursively depends on, up to \$level
levels (infinity if omitted). -c turns
on compact mode, which will prevent
previously shown trees from being displayed
@@ -1486,6 +1486,14 @@ function gaze_show_dependencies() {
recurse "$1" $DEPTH "requires"
return 0
}
+ runtime_depends() {
+ recurse "$1" $DEPTH "runtime"
+ return 0
+ }
+ suggest_depends() {
+ recurse "$1" $DEPTH "suggest"
+ return 0
+ }
repeat () {
local CHAR="$1" COUNT="$2"

@@ -1635,11 +1643,24 @@ parse() {
[[ $UID != 0 ]] && test "$NICE" -lt 0 && NICE=0
renice $NICE -p $$ >/dev/null

- if [ $1 == "-q" ]; then
- shift;
- GAZE_VERBOSE=0
- PAGER=cat
- fi
+ while [[ -n "$1" ]] && [[ ${1:0:1} == "-" ]] ; do
+ case $1 in
+ -q) GAZE_VERBOSE=0
+ PAGER=cat
+ shift
+ ;;
+ -g) for grimoire in $2; do
+ if ! codex_find_grimoire $grimoire >/dev/null; then
+ message "${PROBLEM_COLOR}No such grimoire: " \
+ "${DEFAULT_COLOR}$grimoire"
+ return 1
+ fi
+ codex_set_grimoires $2
+ done
+ shift 2
+ ;;
+ esac
+ done


SPELL=$2
@@ -1667,8 +1688,10 @@ parse() {
PRE_INSTALL) show_spell_component $1 $2 ;;
PRE_REMOVE) show_spell_component $1 $2 ;;
PRE_RESURRECT) show_spell_component $1 $2 ;;
+ PRE_SUB_DEPENDS) show_spell_component $1 $2 ;;
PREPARE) show_spell_component $1 $2 ;;
PROVIDES) show_spell_component $1 $2 ;;
+ SUB_DEPENDS) show_spell_component $1 $2 ;;
TRIGGERS) show_spell_component $1 $2 ;;
UP_TRIGGERS) show_spell_component $1 $2 ;;

@@ -1735,7 +1758,12 @@ parse() {

pam) find_pam_aware ;;

- install-queue) display $INSTALL_QUEUE "Install queue does not exist" ;;
+ install-queue) if [[ -s $INSTALL_QUEUE ]]; then
+ $PAGER $INSTALL_QUEUE
+ else
+ message "Install queue does not exist or is empty"
+ fi
+ ;;

remove-queue) display $REMOVE_QUEUE "Remove queue does not exist" ;;

diff --git a/usr/sbin/scribe b/usr/sbin/scribe
index 863325b..ce15ea4 100755
--- a/usr/sbin/scribe
+++ b/usr/sbin/scribe
@@ -80,7 +80,7 @@ function unpackage_grimoire_tarball() {
if ! [ -d $grimoire ]; then
#uh oh! bad unzip.
message "ERROR: Grimoire tarball for $grim_name not" \
- "formated correctly!."
+ "formatted correctly!."
return 1
fi
return 0
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index ded6dee..558e0a9 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -393,8 +393,8 @@ ########################################
if [[ \$1 == "autoupdate" ]]; then
message "${MESSAGE_COLOR}"
message "Interrupting while upgrading the sorcery scripts may"
- message "cause the sorcery scripts to be lost. If the sorcery,"
- message "scripts are lost, Source Mage can be restored by"
+ message "cause the sorcery scripts to be lost. If the sorcery"
+ message "scripts are lost, they can be restored by"
message "running the following script:"
message "${FILE_COLOR}"
message " bash ${RESTORE_SCRIPT}"
diff --git a/usr/share/man/man1/gaze.1 b/usr/share/man/man1/gaze.1
index f34b876..f9bf3e3 100644
--- a/usr/share/man/man1/gaze.1
+++ b/usr/share/man/man1/gaze.1
@@ -5,7 +5,7 @@ gaze \- query/view sorcery package manag
.SH SYNOPSIS
.PP
.B gaze
-[-q] <what> [<arguments>]
+[-q] [-g <grimoires>] <what> [<arguments>]
.SH "DESCRIPTION"
.I gaze
is part of the sorcery source-based package management suite. It is a
@@ -22,6 +22,10 @@ installed packages for easy duplication.
.IP
disable human style output.
.PP
+.SS -g <grimoires>
+.IP
+specify which grimoire(s) to look in. To pass more than one, encapsulate
them in quotes.
+.PP
.SS alien
.IP
find and display all files which are not currently tracked by the
diff --git a/usr/share/man/man8/cast.8 b/usr/share/man/man8/cast.8
index d31f2e6..1860c6e 100644
--- a/usr/share/man/man8/cast.8
+++ b/usr/share/man/man8/cast.8
@@ -46,6 +46,9 @@ This will prompt you again for optional
and configuration options, even those you answered before.
Implies
.IR "-c" .
+.SS "-g, --grimoire [grimoire names ...]"
+Use only the specified grimoires for this cast.
+NOTE: If there are any cross-grimoire dependencies on unspecified grimoires
they will not work. The target spell will not be found. To avoid this,
specify all relevant grimoires to the -g parameter in the order you wish them
to be searched.
.SS "--from directory"
Specify an alternate directory to search for cached sources.
An alternate to /var/spool/sorcery.
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_svn
b/var/lib/sorcery/modules/dl_handlers/dl_svn
index c0a4cef..c8393e2 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_svn
+++ b/var/lib/sorcery/modules/dl_handlers/dl_svn
@@ -37,16 +37,25 @@ function dl_svn_get () {
local URL SVN_ROOT SVN_MODULE SVN_TAG
url_crack "$url" "$hints"

+ local svn_args="--non-interactive "
+ if list_find "$hints" "parse_username" ; then
+ local USER_PASS=$(echo $SVN_ROOT|sed 's#.*//\(.*\)@.*#\1#')
+ local SVN_ROOT=$(echo $SVN_ROOT|sed 's#//\(.*\)@#//#')
+ local USER=${USER_PASS%:*};
+ local PASS=${USER_PASS#*:};
+ svn_args="--username $USER --password $PASS "
+ fi
+
if test -d $target; then
message "${MESSAGE_COLOR}Running svn update...${DEFAULT_COLOR}"
- echo svn update -q --non-interactive -r $SVN_TAG $target
- svn update -q --non-interactive -r $SVN_TAG $target
+ echo svn update $svn_args -q --non-interactive -r $SVN_TAG $target
+ svn update $svn_args -q --non-interactive -r $SVN_TAG $target
rc=$?
eval "$dl_target=\"$target\""
else
message "${MESSAGE_COLOR}Running svn checkout...${DEFAULT_COLOR}"
- echo svn checkout -r $SVN_TAG $SVN_ROOT $SVN_MODULE
- svn checkout -r $SVN_TAG $SVN_ROOT $SVN_MODULE
+ echo svn checkout $svn_args -r $SVN_TAG $SVN_ROOT $SVN_MODULE
+ svn checkout $svn_args -r $SVN_TAG $SVN_ROOT $SVN_MODULE
rc=$?
eval "$dl_target=\"$SVN_MODULE\""
fi
diff --git a/var/lib/sorcery/modules/libapi b/var/lib/sorcery/modules/libapi
index f718ee4..8e555ab 100755
--- a/var/lib/sorcery/modules/libapi
+++ b/var/lib/sorcery/modules/libapi
@@ -19,19 +19,23 @@ #---------------------------------------
#---------------------------------------------------------------------
# functions defined in here: (in alphabetical order)
# acquire_src (libsummon)
-# altruistic_sub_depends (libdepends)
# config_query (libmisc)
# config_query_list (libmisc)
# config_query_option (libmisc)
# config_query_string (libmisc)
# conflicts (libgrimoire)
# default_build (build_api/...)
+# default_configure (libdepends)
+# default_depends (libdepends)
# default_download (libsummon)
# default_install (build_api/api2) (BUILD_API==2 only)
# default_post_build (build_api/api1) (BUILD_API==1 only)
# default_post_install (build_api/api2) (BUILD_API==2 only)
+# default_post_remove (libdispel)
# default_pre_build (build_api/common)
# default_pre_install (build_api/api2) (BUILD_API==2 only)
+# default_pre_remove (libdispel)
+# default_prepare (libdepends)
# depends (libdepends)
# devoke_installwatch (libtrack)
# download_src (libsummon)
@@ -65,6 +69,7 @@ # provider_ok (libstate)
# query (libmisc)
# query_string (libmisc)
# requires (libdepends)
+# runtime_depends (libdepends)
# rm_source_dir (libgrimoire)
# sedit (libmisc)
# sub_depends (libdepends)
@@ -72,6 +77,7 @@ # spell_exiled (libstate)
# spell_held (libstate)
# spell_installed (libstate)
# spell_ok (libstate)
+# suggest_depends (libdepends)
# track_manual (libtrack)
# uncompress (libunpack)
# unpack (libunpack) (deprecated)
@@ -124,19 +130,6 @@ function acquire_src() {
}

#---------------------------------------------------------------------
-## @Type API
-## @params Name of a sub-depends that the current spell is providing.
-## @See <@function
var.lib.sorcery.modules.libdepends.html,real_altruistic_sub_depends> for more
details.
-##
-## Altruistically provide a sub-depends.
-##
-#---------------------------------------------------------------------
-function altruistic_sub_depends() {
- debug "libapi" "$FUNCNAME - $*"
- real_altruistic_sub_depends "$@"
-}
-
-#---------------------------------------------------------------------
## @See <@function var.lib.sorcery.modules.libmisc.html,real_config_query>
for more details.
## @param config file variable
## @param question
@@ -294,6 +287,30 @@ function default_build () {

#---------------------------------------------------------------------
## @Type API
+## @See <@function
var.lib.sorcery.modules.libdepends.html,real_default_configure> for more
details.
+##
+## Default configure code, just no-op for now.
+##
+#---------------------------------------------------------------------
+function default_configure() {
+ debug "libapi" "$FUNCNAME - $*"
+ real_default_configure "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
+## @See <@function
var.lib.sorcery.modules.libdepends.html,real_default_depends> for more
details.
+##
+## Default depends code, just no-op for now.
+##
+#---------------------------------------------------------------------
+function default_depends() {
+ debug "libapi" "$FUNCNAME - $*"
+ real_default_depends "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @See <@function
var.lib.sorcery.modules.libsummon.html,real_default_download> for more
details.
##
## Default download code, downloads each SOURCE[[:digit:]]*
@@ -350,6 +367,18 @@ function default_post_install () {

#---------------------------------------------------------------------
## @Type API
+## @See <@function
var.lib.sorcery.modules.libdispel.html,real_default_post_remove> for more
details.
+##
+## Default post_remove code, just no-op for now.
+##
+#---------------------------------------------------------------------
+function default_post_remove() {
+ debug "libapi" "$FUNCNAME - $*"
+ real_default_post_remove "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @See <@function
var.lib.sorcery.modules.libgrimoire.html,real_default_pre_build> for more
details.
## Creates the source directory and unpacks the source package into it.
## Used if no PRE_BUILD script is found for a spell.
@@ -377,6 +406,30 @@ function default_pre_install () {

#---------------------------------------------------------------------
## @Type API
+## @See <@function
var.lib.sorcery.modules.libdispel.html,real_default_pre_remove> for more
details.
+##
+## Default pre_remove code, just no-op for now.
+##
+#---------------------------------------------------------------------
+function default_pre_remove() {
+ debug "libapi" "$FUNCNAME - $*"
+ real_default_pre_remove "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
+## @See <@function
var.lib.sorcery.modules.libdepends.html,real_default_prepare> for more
details.
+##
+## Default prepare code, just no-op for now.
+##
+#---------------------------------------------------------------------
+function default_prepare() {
+ debug "libapi" "$FUNCNAME - $*"
+ real_default_prepare "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @param spell/service
## @param enabled options (optional)
## @param description (optional)
@@ -919,6 +972,20 @@ function query_string () {

#---------------------------------------------------------------------
## @Type API
+## @param spell/service
+## @param enabled options (optional)
+## @param description (optional)
+## @param grimoires (optional)
+## @See <@function var.lib.sorcery.modules.libdepends.html,real_depends> for
more details.
+## Denotes that a spell requires another spell to work.
+#---------------------------------------------------------------------
+function runtime_depends () {
+ debug "libapi" "runtime_depends - $*"
+ real_runtime_depends "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @param sed command
## @param file
## @See <@function var.lib.sorcery.modules.libmisc.html,real_sedit> for more
details.
@@ -998,6 +1065,21 @@ function sub_depends() {

#---------------------------------------------------------------------
## @Type API
+## @param spell/service
+## @param enabled options (optional)
+## @param disabled options (optional)
+## @param description (optional)
+## @param grimoires (optional)
+## @See <@function
var.lib.sorcery.modules.libdepends.html,real_suggest_depends> for more
details.
+## Denotes that a spell can use another spell for additional functionality.
+#---------------------------------------------------------------------
+function suggest_depends () {
+ debug "libapi" "suggest_depends - $*"
+ real_suggest_depends "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @param file to uncompress
## @See <@function var.lib.sorcery.modules.libunpack.html,real_uncompress>
for more details.
##
diff --git a/var/lib/sorcery/modules/libcast b/var/lib/sorcery/modules/libcast
index 6d89132..08a9cef 100755
--- a/var/lib/sorcery/modules/libcast
+++ b/var/lib/sorcery/modules/libcast
@@ -404,13 +404,13 @@ function dual_service_query() {
fi

if [[ $init_default == y ]] && [[ $xinetd_default == y ]] ; then
- default=3
+ default=both
elif [[ $xinetd_default == y ]] ; then
- default=2
+ default=xinetd
elif [[ $init_default == y ]] ; then
- default=1
+ default=init
else
- default=0
+ default=neither
fi
select_list $returnvar $default neither init xinetd both
}
@@ -526,7 +526,7 @@ function install_xinetd_sub() {
! grep -v disable $inst_file|diff - $file &>/dev/null ; then
message "${QUERY_COLOR}$inst_file differs from the default $file," \
"what would you like to do?${DEFAULT_COLOR}"
- select_list choice 0 "ignore" "overwrite" "overwrite/backup"
+ select_list choice "ignore" "ignore" "overwrite" "overwrite/backup"
case $choice in
"overwrite/backup")
local backup=$inst_file.$(date +'%Y%m%d%H%M')
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index 2b67e63..661d015 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -596,32 +596,11 @@ #---------------------------------------
function codex_set_current_spell() {

debug "libcodex" "runing codex_set_current_spell"
- codex_clear_current_spell
- SPELL_DIRECTORY=$1

- # Directories
- SCRIPT_DIRECTORY=$SPELL_DIRECTORY
- # scribbled spells are self contained, SECTION_DIRECTORY and GRIMOIRE
- # point to slightly different places
- if test -e $SPELL_DIRECTORY/SCRIBBLED ; then
- # I dont know how to nest these
- local tmp=${SPELL_DIRECTORY%/*}
- SECTION=${tmp##*/}
- GRIMOIRE_NAME=$(basename ${tmp%/*})
-
- SECTION_DIRECTORY=${SPELL_DIRECTORY}/section
- GRIMOIRE=${SPELL_DIRECTORY}/grimoire
- else
- SECTION_DIRECTORY=${SPELL_DIRECTORY%/*}
- SECTION=${SECTION_DIRECTORY##*/}
- GRIMOIRE=${SECTION_DIRECTORY%/*}
- GRIMOIRE_NAME=$(basename $GRIMOIRE)
- fi
+ codex_clear_current_spell

- # Names
- SPELL=${SPELL_DIRECTORY##*/}
+ codex_get_spell_paths $1

- SPELL_CONFIG="$DEPENDS_CONFIG/$SPELL"
if [ -f $SPELL_CONFIG ]; then
. $SPELL_CONFIG > /dev/null 2> /dev/null
fi
@@ -645,33 +624,46 @@ function codex_set_current_spell() {
true
}

+#---------------------------------------------------------------------
+# Load just the very basics for a spell, skip build api, libcompat
+# and other debug stuff. Intended for use in tight loops.
+#---------------------------------------------------------------------
function codex_set_current_spell_quick() {
+ codex_get_spell_paths $1
+
+ test -f "$SPELL_CONFIG" && . "$SPELL_CONFIG" &> /dev/null
+ persistent_load
+ . $1/DETAILS &> /dev/null
+ persistent_clear
+ true
+}
+
+
+#---------------------------------------------------------------------
+# Setup the various spell paths associated with a spell without
+# loading it.
+#---------------------------------------------------------------------
+function codex_get_spell_paths() {
SPELL_DIRECTORY=$1
SCRIPT_DIRECTORY=$1
if test -e $SPELL_DIRECTORY/SCRIBBLED ; then
- # I dont know how to nest these
- local tmp=${SPELL_DIRECTORY%/*}
- SECTION=${tmp##*/}
- GRIMOIRE_NAME=$(basename ${tmp%/*})
+ local tmp
+ smgl_dirname "$SPELL_DIRECTORY" tmp
+ smgl_basename "$tmp" SECTION
+ smgl_dirname "$tmp" tmp
+ smgl_basename "$tmp" GRIMOIRE_NAME

SECTION_DIRECTORY=${SPELL_DIRECTORY}/section
GRIMOIRE=${SPELL_DIRECTORY}/grimoire
else
- SECTION_DIRECTORY=${SPELL_DIRECTORY%/*}
- SECTION=${SECTION_DIRECTORY##*/}
- GRIMOIRE=${SECTION_DIRECTORY%/*}
- GRIMOIRE_NAME=$(basename $GRIMOIRE)
+ smgl_dirname "$SPELL_DIRECTORY" SECTION_DIRECTORY
+ smgl_basename "$SECTION_DIRECTORY" SECTION
+ smgl_dirname "$SECTION_DIRECTORY" GRIMOIRE
+ smgl_basename "$GRIMOIRE" GRIMOIRE_NAME
fi
-
- # Names
- SPELL=${SPELL_DIRECTORY##*/}
- SPELL=${1##*/}
+ smgl_basename "$SPELL_DIRECTORY" SPELL
SPELL_CONFIG="$DEPENDS_CONFIG/$SPELL"
- test -f "$SPELL_CONFIG" && . "$SPELL_CONFIG" &> /dev/null
- persistent_load
- . $1/DETAILS &> /dev/null
- persistent_clear
- true
+ return 0
}

#---------------------------------------------------------------------
@@ -758,6 +750,50 @@ function codex_create_cache() {

}

+
+#---------------------------------------------------------------------
+## Create in-memory spell lookup table for named grimoires.
+#---------------------------------------------------------------------
+function codex_create_in_memory_cache() {
+ local list
+ if [[ $1 == -i ]] ; then
+ list=$SPELL_STATUS
+ shift
+ fi
+ local hash=$1
+ shift
+ eval $(
+ for each in "$@"; do
+ cat $each/$SPELL_INDEX_FILE
+ done | awk -v i=$list -v hash=$hash '{
+ if ( ! ($1 in map)) {
+ map[$1]=$2;
+ }
+ } END {
+ if (i) {
+ FS=":";
+ while (getline < i) {
+ if( $3=="installed" || $3=="held") {
+ printf("hash_put %s %s \"%s/%s\";\n",hash,$1,map[$1],$1);
+ }
+ }
+ } else {
+ for (spell in map) {
+ printf("hash_put %s %s \"%s/%s\";\n",hash,spell,map[spell],spell);
+ }
+ }
+ }'
+ )
+
+}
+
+#---------------------------------------------------------------------
+## Creae in-memory spell lookup table for all known grimoires.
+#---------------------------------------------------------------------
+function codex_create_in_memory_cache_all() {
+ codex_create_in_memory_cache "$@" $(codex_get_all_grimoires)
+}
+
###########################MISC FUNCTIONS#############################

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index feedd24..7f55f1d 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -18,24 +18,24 @@ # -> for each spell (this list grows d
# -> run PREPARE
# -> run CONFIGURE
# -> run DEPENDS
-# -> depends <spell> (external)
+# -> depends|runtime_depends <spell> (external)
# -> work_depends_spell
# -> private_common_depends -> libstate.add_depends
# -> add to NEW_DEPENDS
# -> libstate.add_depends
-# -> optional_depends <spell> (external)
+# -> optional_depends|suggest_depends <spell> (external)
# -> work_optional_depends_spell
# -> query
# -> private_common_depends -> libstate.add_depends
# -> add to NEW_DEPENDS
# -> libstate.add_depends
-# -> depends <provider> (external)
+# -> depends|runtime_depends <provider> (external)
# -> work_depends_provider
# -> select provider
# -> private_common_depends -> libstate.add_depends
# -> add to NEW_DEPENDS
# -> libstate.add_depends
-# -> optional_depends <provider> (external)
+# -> optional_depends|suggest_depends <provider> (external)
# -> work_optional_depends_provider
# -> select provider
# -> private_common_depends
@@ -82,8 +82,7 @@ function run_prepare()

debug "cast" "run_prepare() - SPELL = $SPELL SCRIPT_DIRECTORY =
$SCRIPT_DIRECTORY"

- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}preparing environment...${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "preparing environment..."

# these are here so you can source section/grimoire level scripts in
# PREPARE, which by definition runs before the spell is loaded
@@ -93,13 +92,19 @@ function run_prepare()
local GRIMOIRE=${SECTION_DIRECTORY%/*}

local PROTECT_SORCERY=yes
+ persistent_load &&
if [ -x $SCRIPT_DIRECTORY/PREPARE ]; then
- # we need &&'s to preserve the proper return code (persistant_save
- # will probably succeed even if PREPARE fails)
- persistent_load &&
- . $SCRIPT_DIRECTORY/PREPARE &&
- persistent_save
+ . $SCRIPT_DIRECTORY/PREPARE
+ else
+ default_prepare
fi
+ rc=$?
+ persistent_save
+ return $rc
+}
+
+function real_default_prepare() {
+ :
}

#---------------------------------------------------------------------
@@ -130,17 +135,21 @@ function run_configure()
local SPELL=$1
debug "cast" "run_configure() - SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"

-
local PROTECT_SORCERY=yes
+ persistent_load &&
if [ -x $SCRIPT_DIRECTORY/CONFIGURE ]; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}running configuration...${DEFAULT_COLOR}"
- # we need &&'s to preserve the proper return code (persistant_save
- # will probably succeed even if PREPARE fails)
- persistent_load &&
- . $SCRIPT_DIRECTORY/CONFIGURE &&
- persistent_save
+ depends_message "${SPELL}" "running configuration..."
+ . $SCRIPT_DIRECTORY/CONFIGURE
+ else
+ default_configure
fi
+ rc=$?
+ persistent_save
+ return $rc
+}
+
+function real_default_configure() {
+ :
}

#---------------------------------------------------------------------
@@ -153,16 +162,20 @@ function run_depends()
debug "cast" "run_depends() - SCRIPT_DIRECTORY = $SCRIPT_DIRECTORY"

local PROTECT_SORCERY=yes
+ persistent_load &&
if [ -x $SCRIPT_DIRECTORY/DEPENDS ]; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}checking dependencies...${DEFAULT_COLOR}"
-
- # we need &&'s to preserve the proper return code (persistant_save
- # will probably succeed even if PREPARE fails)
- persistent_load &&
- . $SCRIPT_DIRECTORY/DEPENDS &&
- persistent_save
+ depends_message "${SPELL}" "checking dependencies..."
+ . $SCRIPT_DIRECTORY/DEPENDS
+ else
+ default_depends
fi
+ rc=$?
+ persistent_save
+ return $rc
+}
+
+function real_default_depends() {
+ :
}

#---------------------------------------------------------------------
@@ -175,8 +188,7 @@ function run_up_triggers() {

local PROTECT_SORCERY=yes
if [ -x $SCRIPT_DIRECTORY/UP_TRIGGERS ]; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}checking for reverse triggers...${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "checking for reverse triggers..."
# we need &&'s to preserve the proper return code (persistant_save
# will probably succeed even if PREPARE fails)
persistent_load &&
@@ -235,6 +247,7 @@ function run_other_sub_depends() {
run_details
local NEW_SUB_DEPENDEES=""
local NEW_DEPENDS=()
+ local NEW_RUNTIME_DEPENDS=()
process_sub_depends "$this_spell" "$sub_dependee" "$sub_depends" ||
return 1

@@ -298,12 +311,19 @@ function compute_installed_depends() {
local hash=$1
touch $DEPENDS_STATUS $SPELL_STATUS &>/dev/null

+ local pattern
+ if [[ $2 ]] ; then
+ pattern="required|optional|runtime|suggest"
+ else
+ pattern="required|optional"
+ fi
+
# From here forward $1 and $2 are only used to refer to awk variables

# sub(/(.*)/, "", $2) removes a provider name
- eval $(awk -F : 'BEGIN {
+ eval $(awk -v pattern="$pattern" -F : 'BEGIN {
while (getline < ARGV[1] ) {
- if( $3=="on") {
+ if( $3=="on" && ( $4 ~ pattern ) ) {
sub(/\(.*\)/, "", $2);
depmap[$1]=depmap[$1]" "$2" "
}
@@ -327,13 +347,19 @@ function compute_reverse_installed_depen
#$1==hash table to fill
local hash=$1
touch $DEPENDS_STATUS $SPELL_STATUS &>/dev/null
+ local pattern
+ if [[ $2 ]] ; then
+ pattern="required|optional|runtime|suggest"
+ else
+ pattern="required|optional"
+ fi

# From here forward $1 and $2 are only used to refer to awk variables

# sub(/(.*)/, "", $2) removes a provider name
- eval $(awk -F : 'BEGIN {
+ eval $(awk -v pattern="$pattern" -F : 'BEGIN {
while (getline < ARGV[1] ) {
- if( $3=="on") {
+ if( $3=="on" && ( $4 ~ pattern ) ) {
sub(/\(.*\)/, "", $2);
depmap[$2]=depmap[$2]" "$1" "
}
@@ -377,6 +403,7 @@ function compute_uninstalled_depends()
local CAST_HASH="$1"
local BACK_CAST_HASH="$2"
local CANNOT_CAST_HASH="$3"
+ BONUS_SPELLS=()
shift 3
local spell spells
spells=( $@ )
@@ -407,6 +434,8 @@ function compute_uninstalled_depends()

# we need this so processes on the other side of make know whats going on
hash_export uncommitted_hash
+
+ BONUS_SPELLS=( ${BONUS_SPELLS[*]} ${UP_DEPENDS[*]} )
}

#---------------------------------------------------------------------
@@ -422,6 +451,8 @@ function private_run_depends()
# special accumulators for the current spell
local NEW_DEPENDS=""
local NEW_SUB_DEPENDEES=""
+ local NEW_RUNTIME_DEPENDS=""
+ local NEW_UP_DEPENDS=""
local triggerees=""
local spell_depends
local spell_sub_depends
@@ -444,8 +475,7 @@ function private_run_depends()
# have a chance at being fixed, ideally we should check in
# depends/optional_depends and fail there
if spell_exiled $1; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}is exiled and will not be
cast.${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "is exiled and will not be cast."
return 1
fi
get_uncommitted_depends_file $SPELL spell_depends
@@ -475,13 +505,17 @@ function private_run_depends()
# no point in keeping the file around if its empty...
test -s $spell_depends || rm -f $spell_depends $spell_sub_depends

+ if echo "${RUNTIME_DEPENDS[*]}"| tr " " "\n" | grep -x -q "$SPELL" ; then
+ local k=${#BONUS_SPELLS[@]}
+ BONUS_SPELLS[$k]=$SPELL
+ fi
+
# this processes any sub-depends we requested and the sub-dependee
# has already been processed, so we must process them on their behalf
# this must be done after everything else!
run_other_sub_depends "$SPELL" || return 1
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}No work to do.${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "No work to do."
hash_put "depends_looked_at" "$SPELL" "ignore"
fi

@@ -490,10 +524,9 @@ function private_run_depends()
}

#---------------------------------------------------------------------
-## Decides if a spell should be case. Check if the spell is installed
-## if it matters, etc...
-## Perhaps this function is overly splayed out in elif's but its
-## easier to add to later than what we had before...
+## Decides if a spell should be cast, or if we can leave it alone.
+## Check if the spell is installed, or if theres some other reason to
+## rebuild it.
## @param Spell
#---------------------------------------------------------------------
function private_should_cast()
@@ -542,10 +575,10 @@ function private_upward_depends() {
# and/or move the weird pattern into library functions...
# (afrayedknot 2005-10-02)
tmp=$(grep "^.*:$1\(([^:]*)\)\?" $DEPENDS_STATUS|cut -f1 -d:|tr "\n" " ")
- local j each
- let j=${#UP_DEPENDS[*]}
+ local j k each
+ let j=${#NEW_UP_DEPENDS[*]}
for each in $tmp; do
- UP_DEPENDS[$j]=$each
+ NEW_UP_DEPENDS[$j]=$each
let j++
done
spells=( ${spells[*]} ${tmp} )
@@ -559,14 +592,12 @@ #---------------------------------------
function private_recast_optionals() {
if [[ $RECAST_OPTIONALS ]] && [[ $RECAST_OPTIONALS != ignore ]] ; then
local spell j enabled
- let j=${#UP_DEPENDS[*]}
+ let j=${#NEW_UP_DEPENDS[*]}
for spell in $(search_depends_status_exact $DEPENDS_STATUS \
'.*' "$1\(([^:]*)\)\?" off optional '.*' '.*'|cut -f1 -d:);
do

enabled=""
- message "${SPELL_COLOR}$spell${DEFAULT_COLOR}${CHECK_COLOR}" \
- "has a disabled optional depends on${DEFAULT_COLOR}" \
- "${SPELL_COLOR}$1${DEFAULT_COLOR}"
+ message "$spell" "has a disabled optional dependency on" "$1"
if [[ $RECAST_OPTIONALS == always ]] ; then
enabled=yes
else
@@ -577,7 +608,7 @@ function private_recast_optionals() {
fi
fi
if [[ $enabled ]] ; then
- UP_DEPENDS[$j]=$each
+ NEW_UP_DEPENDS[$j]=$each
let j++
remove_depends_status $DEPENDS_STATUS $each "${1}\(([^:]*)\)\?"
fi
@@ -595,16 +626,24 @@ ## @param description
## @param grimoires to look in
## Delegates provider and spell cases to different worker functions.
## and gets grimoires if necessary for cross grimoire depends
+##
+## Called by real_depends and real_runtime_depends
#---------------------------------------------------------------------
-function real_depends()
+function real_generic_required_depends()
{
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ "$1" == "-sub" ]] ; then
local requested_sub_depends=$2
shift 2
fi

# see if theres another grimoire
- if [[ "$4" ]] ; then
+ if [[ "$4" ]] && ! [[ "$OVERRIDE_GRIMOIRES" ]] ; then
local grimoire here nothere current

for grimoire in $4; do
@@ -668,18 +707,22 @@ function real_depends()
fi
if [[ ! $here ]] && [[ ! $current ]] ; then
message "${PROBLEM_COLOR}no grimoire for $1 was
retrieved${DEFAULT_COLOR}"
- return 1
+ if [[ $failure_ok == "no" ]] || ! query "Build $1 anyway?" y; then
+ return 1
+ fi
fi
fi

local target_spell
if ! codex_does_spell_exist $1 &> /dev/null; then
- work_depends_provider "$@" &&
+ work_depends_provider "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
if [[ "$requested_sub_depends" ]]; then
target_spell=$(get_spell_provider "$SPELL" "$1")
fi
else
- work_depends_spell "$@" &&
+ work_depends_spell "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
target_spell=$1
fi &&
for sub_depend in $requested_sub_depends; do
@@ -687,6 +730,24 @@ function real_depends()
done
}

+
+#---------------------------------------------------------------------
+## Passthrough to real_generic_required_depends, specifies the
+## parts that differ from runtime depends
+#---------------------------------------------------------------------
+function real_depends() {
+ real_generic_required_depends "no" "a" "dependency" "required" "$@"
+}
+
+#---------------------------------------------------------------------
+## Passthrough to real_generic_required_depends, specifies the
+## parts that differ from required depends
+#---------------------------------------------------------------------
+function real_runtime_depends() {
+ real_generic_required_depends "yes" "a" "runtime dependency" "runtime" "$@"
+}
+
+
#---------------------------------------------------------------------
## @param spell or provider name
## @param addition to OPTS if enabled
@@ -694,16 +755,24 @@ ## @param addition to OPTS if disabled
## @param description
## @param grimoires to look in
## Delegates provider and spell cases to different worker functions.
+##
+## Called by real_depends and real_runtime_depends
#---------------------------------------------------------------------
-function real_optional_depends()
+function real_generic_optional_depends()
{
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ "$1" == "-sub" ]] ; then
local requested_sub_depends=$2
shift 2
fi

# see if theres another grimoire
- if [[ "$5" ]] ; then
+ if [[ "$5" ]] && ! [[ "$OVERRIDE_GRIMOIRES" ]] ; then
local grimoire here nothere current
for grimoire in $5; do
if [[ "$grimoire" == "current" ]] ; then
@@ -765,18 +834,20 @@ function real_optional_depends()
if [[ ! $here ]] && [[ ! $current ]] ; then
message "${PROBLEM_COLOR}no grimoire for $1 was
retrieved${DEFAULT_COLOR}"
message "Assuming dependency is off because it could not be met"
- private_common_depends "$1" "off" "optional" "$2" "$3"
+ private_common_depends "$1" "off" "$database_term" "$2" "$3"
fi
fi

local target_spell
if ! codex_does_spell_exist $1 &> /dev/null; then
- work_optional_depends_provider "$@" &&
+ work_optional_depends_provider "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
if [[ "$requested_sub_depends" ]]; then
target_spell=$(get_spell_provider "$SPELL" "$1")
fi
else
- work_optional_depends_spell "$@" &&
+ work_optional_depends_spell "$failure_ok" "$article" \
+ "$query_term" "$database_term" "$@" &&
target_spell=$1
fi &&
if [[ "$requested_sub_depends" ]] &&
@@ -790,6 +861,23 @@ function real_optional_depends()
}

#---------------------------------------------------------------------
+## Passthrough to real_generic_optional_depends, specifies the
+## parts that differ from suggest depends
+#---------------------------------------------------------------------
+function real_optional_depends() {
+ real_generic_optional_depends "no" "an" "optional dependency" "optional"
"$@"
+}
+
+#---------------------------------------------------------------------
+## Passthrough to real_generic_required_depends, specifies the
+## parts that differ from optional depends
+#---------------------------------------------------------------------
+function real_suggest_depends() {
+ real_generic_optional_depends "yes" "a" "suggested dependency" "suggest"
"$@"
+}
+
+
+#---------------------------------------------------------------------
## Asks the user what provider for a depends is desired if a choice
## has not ben made before.
## @param Service
@@ -803,14 +891,16 @@ function work_depends_provider()
local default tmp installed=no
local status=()

+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ $3 ]] ; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR} ($3)."
+ depends_message "${SPELL}" "has $article $query_term on some" "${1}"
"($3)."
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}."
+ depends_message "$SPELL" "has $article $query_term on some" "${1}."
fi

local CANDIDATES=$( find_providers $1)
@@ -818,7 +908,9 @@ function work_depends_provider()
message "${PROBLEM_COLOR}No providers of${DEFAULT_COLOR}" \
"${SPELL_COLOR}$1${DEFAULT_COLOR}" \
"${PROBLEM_COLOR} can be found!${DEFAULT_COLOR}"
- return 1
+ if [[ $failure_ok == "no" ]] || ! query "Build $1 anyway?" y; then
+ return 1
+ fi
fi

# if not reconfiguring check if theres already an answer in DEPENDS_STATUS
@@ -831,7 +923,7 @@ function work_depends_provider()
tmp=${status[1]%(*} # Name of spell which provides $1
if spell_ok $tmp &&
query "Continue to use ${SPELL_COLOR}$tmp${DEFAULT_COLOR}?" y; then
- private_common_depends "$tmp($1)" "on" "required" "$2" "$3"
+ private_common_depends "$tmp($1)" "on" "$database_term" "$2" "$3"
return 0
fi
fi
@@ -844,7 +936,7 @@ function work_depends_provider()

# check if theres a default provider
if [[ ! $default ]]; then
- explode "$(search_default_provider $DEFAULT_PROVIDERS "" "$1")" ":"
"status"
+ explode "$(search_default_provider $DEFAULT_PROVIDERS ".*" "$1")" ":"
"status"
tmp=${status[0]}
[[ $tmp ]] && echo $CANDIDATES|grep -q "\<$tmp\>" && default=$tmp
fi
@@ -865,7 +957,7 @@ function work_depends_provider()

select_provider "provider" "$default" 0 $CANDIDATES

- private_common_depends "$provider($1)" "on" "required" "$2" ""
+ private_common_depends "$provider($1)" "on" "$database_term" "$2" ""
}

#---------------------------------------------------------------------
@@ -873,23 +965,27 @@ ## One of the worker functions. Checks f
## on to the common dependency function, <@function private_common_depends>
## @param Spell
## @param enabled options
-## @param disabled options (useless, but included for some reason)
-## @param grimoire the spell is in, if its different than the current one
#---------------------------------------------------------------------
function work_depends_spell()
{
debug "libdepends" "$FUNCNAME - $@"

- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}depends on" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
+ depends_message "${SPELL}" "has $article $query_term on" "$1"

if spell_exiled $1 ; then
- hash_put $CANNOT_CAST_HASH "$1" "Exiled"
- message "${SPELL_COLOR}${1}${DEFAULT_COLOR} has been exiled!"
- return 1
+ depends_message "${1}" "has been exiled!"
+ if [[ $failure_ok == "no" ]] || ! query "Build $1 anyway?" y; then
+ hash_put $CANNOT_CAST_HASH "$1" "Exiled"
+ return 1
+ fi
fi
- private_common_depends "$1" "on" "required" "$2" ""
+ private_common_depends "$1" "on" "$database_term" "$2" ""

}

@@ -907,14 +1003,16 @@ function work_optional_depends_provider(
local default tmp installed=no
local status=()

+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4
+
if [[ $4 ]] ; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}optionally requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR} ($4)."
+ depends_message "${SPELL}" "has $article $query_term on some" "${1}"
"($4)."
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}optionally requires some${DEFAULT_COLOR}" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}."
+ depends_message "${SPELL}" "has $article $query_term on some" "${1}."
fi

local CANDIDATES=$( find_providers $1)
@@ -924,7 +1022,7 @@ function work_optional_depends_provider(
local tmp=${status[1]%(*} # Name of spell which provides $1
if spell_ok $tmp &&
query "Continue to use ${SPELL_COLOR}$tmp${DEFAULT_COLOR}?" y; then
- private_common_depends "$tmp($1)" "on" "required" "$2" "$3"
+ private_common_depends "$tmp($1)" "on" "$database_term" "$2" "$3"
return 0
fi
fi
@@ -937,7 +1035,7 @@ function work_optional_depends_provider(

# check if theres a default provider
if [[ ! $default ]]; then
- tmp=$(search_default_provider $DEFAULT_PROVIDERS "" "$1")
+ tmp=$(search_default_provider $DEFAULT_PROVIDERS ".*" "$1")

# make sure we found /something/ before trying to analyze it
# otherwise we'll fall into the else case and use 'none' as the
@@ -974,9 +1072,9 @@ function work_optional_depends_provider(
select_provider "provider" "$default" 1 $CANDIDATES

if [ $provider == "none" ] ; then
- private_common_depends "($1)" "off" "optional" "$2" "$3"
+ private_common_depends "($1)" "off" "$database_term" "$2" "$3"
else
- private_common_depends "$provider($1)" "on" "optional" "$2" "$3"
+ private_common_depends "$provider($1)" "on" "$database_term" "$2" "$3"
fi

}
@@ -993,12 +1091,18 @@ function work_optional_depends_spell()

debug "libdepends" "$FUNCNAME - $@"
local default
+
+ local failure_ok=$1
+ local article=$2
+ local query_term=$3
+ local database_term=$4
+ shift 4

# if $1 optionally depends on something exiled we always say no
if spell_exiled $1 ; then
- message "${SPELL_COLOR}${1}${DEFAULT_COLOR} has been exiled! not using
as a depends"
+ depends_message "${1}" "has been exiled! not using as $article
$query_term"
hash_put $CANNOT_CAST_HASH "$1" "Exiled"
- private_common_depends "$1" "off" "optional" "$2" "$3"
+ private_common_depends "$1" "off" "$database_term" "$2" "$3"
return 0
fi

@@ -1012,18 +1116,25 @@ function work_optional_depends_spell()
if [[ ${status[2]} ]] ; then
# ah there are! use them
if [[ ${status[2]} == "on" ]] ; then
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}optionally depends on" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "has an enabled $query_term on" "${1}"
else
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}has a disabled optional depends on" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ depends_message "${SPELL}" "has a disabled $query_term on" "${1}"
fi
- private_common_depends "$1" "${status[2]}" "optional" "$2" "$3"
+ private_common_depends "$1" "${status[2]}" "$database_term" "$2" "$3"
return 0
fi
fi
+ # colors differ from depends_message
+ if [[ $4 ]]; then
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
+ "has $article $query_term on" \
+ "${SPELL_COLOR}$1${DEFAULT_COLOR} ($4)"
+ else
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
+ "has $article $query_term on" \
+ "${SPELL_COLOR}$1${DEFAULT_COLOR}"
+ fi
+

# check for abandoned answers
if [ -e $ABANDONED_DEPENDS/$SPELL ] ; then
@@ -1071,10 +1182,6 @@ function work_optional_depends_spell()
local stuff
[[ $default == off ]] && stuff=n || stuff=y

- message "${SPELL_COLOR}${1}${DEFAULT_COLOR}" \
- "is an optional dependency for" \
- "${SPELL_COLOR}$SPELL${DEFAULT_COLOR} ($4)"
-
if spell_ok $1 ; then
query "Do you want to use ${SPELL_COLOR}$1${DEFAULT_COLOR}?" "$stuff"
&&
install="on"
@@ -1083,7 +1190,7 @@ function work_optional_depends_spell()
install="on"
fi

- private_common_depends "$1" "$install" "optional" "$2" "$3"
+ private_common_depends "$1" "$install" "$database_term" "$2" "$3"
}

#---------------------------------------------------------------------
@@ -1193,10 +1300,8 @@ function real_sub_depends() {
local sub_dependee=$1
local sub_depends=$2

- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}requests" \
- "${SPELL_COLOR}$sub_dependee${DEFAULT_COLOR}${CHECK_COLOR}" \
- "with ${SPELL_COLOR}$sub_depends${DEFAULT_COLOR}"
+ message "${SPELL}${DEFAULT_COLOR}" "requests" "$sub_dependee" \
+ "${CHECK_COLOR} with ${SPELL_COLOR}$sub_depends${DEFAULT_COLOR}"

# Check if the sub-depends is already known
if spell_ok $sub_dependee; then
@@ -1217,7 +1322,6 @@ function real_sub_depends() {
test -x $SCRIPT_DIRECTORY/PRE_SUB_DEPENDS || return 1
persistent_load &&
source $SCRIPT_DIRECTORY/PRE_SUB_DEPENDS; rc=$?
-echo $rc
persistent_save
return $rc
) && {
@@ -1262,9 +1366,7 @@ function real_force_depends() {
debug "libdepends" "$FUNCNAME - $SPELL - $@"
local check=$(hash_get "depends_looked_at" "$1")

- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
- "${CHECK_COLOR}is forcing a recast of" \
- "${SPELL_COLOR}${1}${DEFAULT_COLOR}"
+ message "${SPELL}" "is forcing a recast of" "${1}"

if [[ "$check" == "ignore" ]] ; then
hash_put "depends_looked_at" "$1" ""
@@ -1282,13 +1384,19 @@ function private_common_depends()
{
debug "libdepends" "$FUNCNAME - $SPELL - $@"
add_depends $spell_depends "$SPELL" "$@"
-
+
+ # runtime and suggested depends have no formal dependency info
if [[ $2 == on ]] ; then
# ${1%(*} = spell name (strips potential provider name)
local spell_name=${1%(*}
- NEW_DEPENDS=( ${NEW_DEPENDS[*]} $spell_name )
+ case $3 in
+ runtime|suggest)
+ NEW_RUNTIME_DEPENDS=( ${NEW_RUNTIME_DEPENDS[*]} $spell_name ) ;;
+ *) NEW_DEPENDS=( ${NEW_DEPENDS[*]} $spell_name ) ;;
+ esac
fi

+
return 0
}

@@ -1373,11 +1481,17 @@ function private_add_depends()
hash_append "$BACK_CAST_HASH" "basesystem" "$SPELL"
fi

- spells=( ${spells[*]} ${NEW_DEPENDS[*]} ${NEW_SUB_DEPENDEES[*]} )
+ spells=( ${spells[*]} ${NEW_DEPENDS[*]}
+ ${NEW_SUB_DEPENDEES[*]}
+ ${NEW_RUNTIME_DEPENDS[*]} )
+
+ RUNTIME_DEPENDS=( ${RUNTIME_DEPENDS[*]} ${NEW_RUNTIME_DEPENDS[*]} )

TRIGGEREES=( ${TRIGGEREES[*]} ${triggerees[*]} )
spells=( ${spells[*]} ${triggerees[*]} )

+ UP_DEPENDS=( ${UP_DEPENDS[*]} ${NEW_UP_DEPENDS[*]} )
+
hash_put "depends_looked_at" "$SPELL" "done"

}
@@ -1389,8 +1503,7 @@ #---------------------------------------
function want_lazy_update() {
if [[ $LAZY_DEPENDS_UPDATES ]] && [[ $LAZY_DEPENDS_UPDATES != ignore ]] ;
then
if does_spell_need_update "$1" ; then
- message "${SPELL_COLOR}$1${DEFAULT_COLOR}${CHECK_COLOR}" \
- "needs updating${DEFAULT_COLOR}"
+ depends_message "$1" "needs updating"
if [[ "$LAZY_DEPENDS_UPDATES" == always ]] ; then
return 0
else
@@ -1403,6 +1516,20 @@ function want_lazy_update() {
return 1
}

+function depends_message() {
+ if [[ $# -ge 2 ]] ; then
+ message -n "${SPELL_COLOR}${1}${DEFAULT_COLOR}" \
+ "${CHECK_COLOR}${2}${DEFAULT_COLOR}"
+ fi
+ if [[ $# -ge 3 ]] ; then
+ message -n " ${SPELL_COLOR}${3}${DEFAULT_COLOR}"
+ fi
+ if [[ $# -ge 4 ]] ; then
+ message -n " ($4)"
+ fi
+ message ""
+}
+

#########################BEGIN OTHER STUFF############################

diff --git a/var/lib/sorcery/modules/libdispel
b/var/lib/sorcery/modules/libdispel
index c1093f3..da09924 100755
--- a/var/lib/sorcery/modules/libdispel
+++ b/var/lib/sorcery/modules/libdispel
@@ -271,28 +271,45 @@ #-----
## Run the PRE_REMOVE script if it exists
#-----
function pre_remove() {
- if [[ $SCRIPT_DIRECTORY ]] && [ -x $SCRIPT_DIRECTORY/PRE_REMOVE ]; then
- unset LD_PRELOAD
- . $SCRIPT_DIRECTORY/PRE_REMOVE
+ local rc=0
+ if [[ $SCRIPT_DIRECTORY ]] ; then
+ persistent_load &&
+ if test -x $SCRIPT_DIRECTORY/PRE_REMOVE ; then
+ . $SCRIPT_DIRECTORY/PRE_REMOVE
+ else
+ default_pre_remove
+ fi
+ rc=$?
+ persistent_save
fi
+ return $rc
+}
+
+function real_default_pre_remove() {
+ :
}

#-----
## Run the POST_REMOVE script if it exists.
#-----
function post_remove() {
- # what is the point of this?
- LD_PRELOAD_OLD="$LD_PRELOAD"
- unset LD_PRELOAD
-
- export LD_PRELOAD="$LD_PRELOAD_OLD"
-
- if [[ $SCRIPT_DIRECTORY ]] && [ -x $SCRIPT_DIRECTORY/POST_REMOVE ]
- then . $SCRIPT_DIRECTORY/POST_REMOVE
+ local rc=0
+ if [[ $SCRIPT_DIRECTORY ]] ; then
+ persistent_load &&
+ if test -x $SCRIPT_DIRECTORY/POST_REMOVE ; then
+ . $SCRIPT_DIRECTORY/POST_REMOVE
+ else
+ default_post_remove
+ fi
+ rc=$?
+ persistent_save
fi
-
+ return $rc
}

+function real_default_post_remove() {
+ :
+}



@@ -336,6 +353,14 @@ function dispel_spell() {
activity_log "dispel" "$SPELL" "$VERSION" "success"
) &&
reap_depends
+ local rc=$?
+ if [[ "$rc" != 0 ]] ; then
+ message "${PROBLEM_COLOR}Dispel of${DEFAULT_COLOR}" \
+ "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}" \
+ "${PROBLEM_COLOR}failed!${DEFAULT_COLOR}"
+ return $rc
+ fi
+ return 0
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libgpg b/var/lib/sorcery/modules/libgpg
index ac30567..2056470 100755
--- a/var/lib/sorcery/modules/libgpg
+++ b/var/lib/sorcery/modules/libgpg
@@ -416,7 +416,7 @@ function grimoire_tree_user_query() {
"${DEFAULT_COLOR}${PROBLEM_COLOR}failed!"
message "What would you like to do?${DEFAULT_COLOR}"
local choice
- select_list choice 0 "set aside" "remove" "ignore"
+ select_list choice "" "set aside" "remove" "ignore"
case "$choice" in
"set aside") local tgt=$grimoire_name.$(date +%Y%m%d%H%M).corrupt
message "moving grimoire to $tgt"
diff --git a/var/lib/sorcery/modules/libhash b/var/lib/sorcery/modules/libhash
index 83c0d78..696191e 100755
--- a/var/lib/sorcery/modules/libhash
+++ b/var/lib/sorcery/modules/libhash
@@ -148,6 +148,23 @@ function hash_get() {
#---------------------------------------------------------------------
## @param table name
## @param field name
+## @param upvar name
+##
+## @Stdout none
+## Returns the value stored in the table/field through the upvar variable
+## name. If no value was previously stored in the table/field, then an
+## empty string is returned.
+##
+#---------------------------------------------------------------------
+function hash_get_ref() {
+ local VARIABLE_NAME
+ hash_build_variable_name "$1" "$2" VARIABLE_NAME
+ eval "$3=\${!VARIABLE_NAME}"
+}
+
+#---------------------------------------------------------------------
+## @param table name
+## @param field name
## @param value
##
## Appends the value to the specified table/field.
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 8ca0fc8..1b06c4c 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -493,6 +493,7 @@ function select_list()
local returnvar=$1
local default=$2
local stuff=()
+ local default_num=0

shift 2
hash_unset select_list_hash
@@ -503,11 +504,12 @@ function select_list()
for foo in "$@"; do
message "\t$DEFAULT_COLOR(${stuff[$i]})
$SPELL_COLOR$foo$DEFAULT_COLOR"
hash_put select_list_hash "${stuff[$i]}" "$foo"
+ [[ "$foo" ]] && [[ "$foo" == "$default" ]] &&
default_num=${stuff[$i]}
let i++
done

- local msg="\n${QUERY_COLOR}Which one do you want?
[$default]$DEFAULT_COLOR "
- select_list_sub "$returnvar" select_list_hash "$msg" "$default"
+ local msg="\n${QUERY_COLOR}Which one do you want?
[$default_num]$DEFAULT_COLOR "
+ select_list_sub "$returnvar" select_list_hash "$msg" "$default_num"
hash_unset select_list_hash
}

@@ -526,12 +528,12 @@ function select_list_sub() {
local msgstr=$3
local default=$4

- local result
+ local result answer

while [[ ! $result ]] ; do
message -n "$msgstr"
read -t $PROMPT_DELAY -n 1 answer
- [[ $answer ]] || answer=$default
+ [[ "$answer" ]] || answer=$default
result="$(hash_get $hashname $answer)"
done
echo
@@ -997,19 +999,10 @@ function real_config_query_list () {
# if there was an answer before, find it
local default default_num=0 foo
config_get_last_option "$VARIABLE" default
- [[ $default ]] || default="$1"
- let i=0
- for foo in "$@"; do
- if [[ "$foo" == "$default" ]] ; then
- default_num=$i
- break
- fi
- let i++
- done

- # we have to ask user
+ # we have to ask the user
message "$QUESTION"
- select_list ANSWER ${default_num} "$@"
+ select_list ANSWER "$default" "$@"
config_set_option "$VARIABLE" "$ANSWER"
fi

@@ -1158,7 +1151,7 @@ function smgl_which() {
local target=$1 location
local BREAK
function smgl_which_sub() {
- if test -x "$1/$target" ; then
+ if test -f "$1/$target" -a -x "$1/$target" ; then
echo "$1/$target"
BREAK=yes
fi
@@ -1394,6 +1387,69 @@ function awkuniq() {
awk '{ if ( seen[$0] != 1) { seen[$0]=1;print $0;}}'
}

+#---------------------------------------------------------------------
+# Dirname written in bash, optionally uses an upvar (making it forkless).
+#---------------------------------------------------------------------
+function smgl_dirname() {
+ local __dir=$1
+ local __last_dir __next_dir
+
+ # Pull of any trailing /'s, there could be more than/one///
+ while [[ "$__dir" != "$__last_dir" ]] ; do
+ __last_dir=$__dir
+ __dir=${__dir%/}
+ done
+
+ # remove the basename
+ __next_dir=${__dir%/*}
+
+ # if the string had no more directory seperators in it (was aaa/, now aaa),
+ # then this is a special case, the answer is '.'
+ if [[ "$__next_dir" == "$__dir" ]] ; then
+ __dir="."
+ else
+ __dir=$__next_dir
+ # Trim off anymore leading /'s (was /aa//bb, now /aa//)
+ while [[ "$__dir" != "$__last_dir" ]] ; do
+ __last_dir=$__dir
+ __dir=${__dir%/}
+ [[ "$__dir" == "/" ]] && break
+ done
+ fi
+
+ if [[ "$2" ]] ; then
+ upvar "$2" "$__dir"
+ else
+ echo "$__dir"
+ fi
+}
+
+#---------------------------------------------------------------------
+# basename written in bash, optionally uses upvar (making it forkless).
+# Does not have ability to remove file extension like the real basename.
+#---------------------------------------------------------------------
+function smgl_basename() {
+ local __base=$1
+ local __last_base
+
+ # trim off leading /'s (foo/bar//// -> foo/bar)
+ while [[ "$__base" != "$__last_base" ]] ; do
+ __last_base=$__base
+ __base=${__base%/}
+ done
+
+ # if there are no more /'s then this does nothing which is what we want
+ __base=${__base##*/}
+
+ if [[ "$2" ]] ; then
+ upvar "$2" "$__base"
+ else
+ echo "$__base"
+ fi
+}
+
+
+
# Standard debug line:
# file "function@line" "all" "args"
STD_DEBUG='eval local _stddbg_file=${BASH_SOURCE[0]} ;
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index f7dcdac..947e7be 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -515,8 +515,8 @@ function real_handle_changed_config() {
while [[ "$continue" == "yes" ]] ; do
message "${QUERY_COLOR}"
message "(0) trash $to and install over it"
- message "(1) backup $to to $to.$savetime, install the new file in its
place"
- message "(2) leave $to in its place, copy the new file to $to.$savetime"
+ message "(1) backup $to to $to.$savetime.old, install the new file in
its place"
+ message "(2) leave $to in its place, copy the new file to
$to.$savetime.new"
message "(3) do nothing"
message "(4) see a diff between $to and the new file"
# TODO: someday add an option to use an external merge tool
@@ -534,10 +534,10 @@ function real_handle_changed_config() {
case $number in
0) cp -pv "$from" "$to"
break ;;
- 1) cp -pv "$to" "$to.$savetime"
+ 1) cp -pv "$to" "$to.$savetime.old"
cp -pv "$from" "$to"
break ;;
- 2) cp -pv "$from" "$to.$savetime"
+ 2) cp -pv "$from" "$to.$savetime.new"
mark_file_modified "$to"
# this is deliberatly not track_manual, if this is run from
# FINAL the user might not have wanted the files tracked
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index 49107c9..182aa01 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -894,19 +894,13 @@ ## Display the history of the install qu
##
#---------------------------------------------------------------------
function install_queue_history() {
- local PAGER2
- if [ "$PAGER" == "less" ] ; then PAGER2="more"; else PAGER2="$PAGER"; fi
- local spell=
+ local spell
for spell in `cat $INSTALL_QUEUE`; do
local date="`grep "^${spell}:" $SPELL_STATUS | cut -d':' -f2`"
- local datedash="`echo "$date" | cut -c1-4`-`echo "$date" | cut
-c5-6`-`echo "$date" | cut -c7-8`"
- (
- echo -e "Viewing history since last update ($datedash) for spell --
${spell} -- :" &&
- echo &&
- gaze history $spell
- ) |
- awk -v date="$date" '{ d = (strtonum(substr($0,1,4) substr($0,6,2)
substr($0,9,2)) < date && strtonum(substr($0,1,4)) > 0) }; NR == 1, d { if
(!d) print }' |
- $PAGER2
+ local datedash="`echo "$date" | sed
's,^\(....\)\(..\)\(..\)$,\1-\2-\3,'`"
+
+ get_new_changes "Viewing history since last update ($datedash) for spell
-- ${spell} -- :" "$date" "$(codex_find_spell_by_name $spell)/HISTORY"
+
query "Would you like to ${RED} remove ${QUERY_COLOR} spell
${SPELL_COLOR} $spell ${QUERY_COLOR} from the install queue?" n &&
sedit "s/^$spell$//" $INSTALL_QUEUE &&
echo -e "${QUERY_COLOR} The spell ${SPELL_COLOR} $spell ${QUERY_COLOR}
removed from $INSTALL_QUEUE.${DEFAULT_COLOR}"
@@ -920,30 +914,18 @@ ## Display the history of the grimoire g
#---------------------------------------------------------------------
function grimoire_history() {

- if [ -e $grimoire/ChangeLog ] ; then
- local PAGER2
- if [ "$PAGER" == "less" ] ; then
- PAGER2="more"
- else
- PAGER2="$PAGER"
- fi
- local grimoire="$1"
+ local grimoire="$1"
+ if [ -e $grimoire/ChangeLog ] ; then
local grimoirename="${grimoire##*/}"
local date="`cat "$STATE_DIRECTORY/$grimoirename.lastupdate" 2>
/dev/null`"
[ -z "$date" ] && date="20030818"
- local datedash="`echo "$date" | cut -c1-4`-`echo "$date" | cut
-c5-6`-`echo "$date" | cut -c7-8`"
- (
- echo -e "Viewing history since last update ($datedash) for grimoire --
${grimoirename} -- :" &&
- echo &&
- cat "$grimoire/ChangeLog" 2> /dev/null
- ) |
- awk -v date="$date" '{ d = (strtonum(substr($0,1,4) substr($0,6,2)
substr($0,9,2)) < date && strtonum(substr($0,1,4)) > 0) }; NR == 1, d { if
(!d) print }' |
- $PAGER2
+ local datedash=$(echo "$date" | sed 's,^\(....\)\(..\)\(..\)$,\1-\2-\3,')
+ get_new_changes "Viewing history since last update ($datedash) for
grimoire -- ${grimoirename} -- :" "$date" "$grimoire/ChangeLog"
else
echo "No ChangeLog in the $grimoire Grimoire, skipping viewing..."
echo ""
fi
- echo "`date +%Y%m%d`" > "$STATE_DIRECTORY/$grimoirename.lastupdate"
+ date +%Y%m%d > "$STATE_DIRECTORY/$grimoirename.lastupdate"
}


@@ -953,21 +935,82 @@ ## Display the history of sorcery for re
##
#---------------------------------------------------------------------
function sorcery_history() {
- local PAGER2
- if [ "$PAGER" == "less" ] ; then PAGER2="more"; else PAGER2="$PAGER"; fi
local date="`cat "$STATE_DIRECTORY/sorcery.lastupdate" 2> /dev/null`"
[ -z "$date" ] && date="20030818"
- local datedash="`echo "$date" | cut -c1-4`-`echo "$date" | cut
-c5-6`-`echo "$date" | cut -c7-8`"
- (
- echo -e "Viewing history since last update ($datedash) for sorcery :" &&
- echo &&
- cat "/usr/share/doc/sorcery/ChangeLog"
- ) |
- awk -v date="$date" '{ d = (strtonum(substr($0,1,4) substr($0,6,2)
substr($0,9,2)) < date && strtonum(substr($0,1,4)) > 0) }; NR == 1, d { if
(!d) print }' |
- $PAGER2
- echo "`date +%Y%m%d`" > "$STATE_DIRECTORY/sorcery.lastupdate"
+ local datedash="`echo "$date" | sed 's,^\(....\)\(..\)\(..\)$,\1-\2-\3,'`"
+
+ get_new_changes "Viewing history since last update ($datedash) for sorcery
:" "$date" /usr/share/doc/sorcery/ChangeLog
+
+ date +%Y%m%d > "$STATE_DIRECTORY/sorcery.lastupdate"
}

+#---------------------------------------------------------------------
+##@param old date
+##@param changelog
+## Get the new changes from passed changelog argument
+##
+#---------------------------------------------------------------------
+function get_new_changes() {
+ local msg="$1"
+ local date="$2"
+ # This needs some explaination:
+ # The first item in {}'s extracts the date, assuming the format
yyyy-mm-dd
+ # then checks if its less than the last-update date ($date). The second
+ # part ensures that we're actually looking at a date and not a line
+ # of changelog. If both those are true, set 'd' to 1, otherwise d is '0'.
+ #
+ # In other words, d is 0 until it encounters a starting changelog entry
+ # from before the given $date. Then d is 1 for each starting entry. Its
+ # always 0 for bulleted changelog lines and blank lines.
+ #
+ # The second portion begins "NR==1,d". This is special awk syntax
+ # that says to run the stuff to the right in {}'s starting once the
+ # first statement is true, up through when the second one is true.
+ # For example, NR==1,NR==8 would run the right-hand block for lines 1
+ # through 8.
+ #
+ # NR is the line number, so its true on the first line. d is true once
the
+ # the dates are from before the last update. The if(!d) is necessary
+ # to skip the first line where the changelog date is less than $date.
+ #
+ local changelog="$( awk -v date="$date" '{ d = (strtonum(substr($0,1,4)
substr($0,6,2) substr($0,9,2)) < date && strtonum(substr($0,1,4)) > 0); }; NR
== 1, d { if (!d) print }' "$3" )"
+
+ if [[ "$changelog" ]] ; then
+ {
+ echo "$msg"
+ echo
+ echo "$changelog"
+ } > $TMP_DIR/pagerdata
+ timeout_pager "$TMP_DIR/pagerdata"
+ rm $TMP_DIR/pagerdata
+ else
+ echo "$msg"
+ echo
+ echo "Nothing new."
+ fi
+}
+
+
+#---------------------------------------------------------------------
+## Pager with timeouts, cannot be used from a pipe.
+## Invokes a subshell in case there are other background jobs running
+#---------------------------------------------------------------------
+function timeout_pager() { (
+ $PAGER "$@" &
+ sleep 1
+ for ((i=0;i<PAGER_TIMEOUT*10;i++)) ; do
+ jobs &>/dev/null # this makes bash clean up so the next line works
+ [[ "$(jobs)" ]] || return 0
+ sleep .1
+ done
+ jobs -p|xargs kill
+ jobs &>/dev/null # hide the [Done [2] blah blah] message
+ stty sane
+ if query "\nPager timeout, continue viewing $@" n; then
+ $PAGER "$@"
+ fi
+) 2>/dev/null # hides less complaining that it was killed
+}

#---------------------------------------------------------------------
##
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 3990b4b..22fd760 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -40,7 +40,8 @@ function add_depends()

#ensure the info is valid (perhaps add check that spells exist?)
if ( [[ $3 != on ]] && [[ $3 != off ]] ) ||
- ( [[ $4 != required ]] && [[ $4 != optional ]] ); then
+ ( [[ $4 != required ]] && [[ $4 != optional ]] &&
+ [[ $4 != runtime ]] && [[ $4 != suggest ]]; ); then
return 1
fi

diff --git a/var/lib/sorcery/modules/libsummon
b/var/lib/sorcery/modules/libsummon
index 17faeca..c152800 100755
--- a/var/lib/sorcery/modules/libsummon
+++ b/var/lib/sorcery/modules/libsummon
@@ -49,7 +49,6 @@ function summon_spell() {
persistent_save
# save the rc, then unlock
rc=$?
- unlock_resources "summon" "${SPELL}"

if [[ $rc == 0 ]]; then
activity_log "summon" "$SPELL" "$VERSION" "success"
@@ -59,10 +58,10 @@ function summon_spell() {

# this actually only returns from the subshell, not the function
return $rc
- ) &&
- popd &>/dev/null
- rm -rf $dl_dir
+ ) && popd &>/dev/null
rc=$?
+ rm -rf $dl_dir
+ unlock_resources "summon" "${SPELL}"
fi
return $rc
}
@@ -240,9 +239,16 @@ function download_src_args() {
rm -rf $new_target
elif [[ "$summon_type" == file ]] ; then
# there is no penalty for guessing tree when the result is a file
-
if [[ $summon_target != $target ]] ; then
- mv -f $summon_target $target
+ mv -f "$summon_target" "$target"
+ fi
+ local type
+ if ! source_sanity "$target" "type"; then
+ message "${PROBLEM_COLOR}Sanity check of${DEFAULT_COLOR}" \
+ "${FILE_COLOR}${target}${DEFAULT_COLOR}" \
+ "${PROBLEM_COLOR}failed:${DEFAULT_COLOR}"
+ message "$type"
+ return 1
fi
else
message "${PROBLEM_COLOR}Unknown download type: \"$summon_type\""\
@@ -407,6 +413,32 @@ function unpack_for_update() {
fi
return 0
}
+
+#---------------------------------------------------------------------
+## Perform rudimentary source sanity checks on summoned files.
+## Currently only checks that tarballs are not html 404 notices.
+## Some sites, notably sourceforge, break http by having missing files
+## do a 30X redirect to a 404 html file which when downloaded has a
+## 200 (OK) status. Other sites do 30X redirect to the new location of
+## the requested file, which then successfully downloads (which is
+## the correct thing to do). We catch that here rather than wait for
+## file verification to catch it.
+#---------------------------------------------------------------------
+function source_sanity() {
+ [[ "$1" ]] && return 0
+ [[ "$SUMMON_SANITY" == off ]] && return 0
+ if [[ "$1" != "${1%.tar.bz2}" ]] ||
+ [[ "$1" != "${1%.tar.gz}" ]] ||
+ [[ "$1" != "${1%.tgz}" ]]; then
+ local _type=$(file "$1")
+ if echo $_type | grep -iq HTML ||
+ echo $_type | grep -iq ascii ; then
+ upvar "$2" "$_type"
+ return 1
+ fi
+ fi
+
+}
#---------------------------------------------------------------------
## 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
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index f6112b3..7f5236e 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -305,7 +305,7 @@ function tablet_get_tb_version() {
return 1
fi
if ! test -f $tb_dir/tb_version ||
- [[ "$(cat $tb_dir/tb_version)" == 0 ]] ; then
+ [[ "$(< $tb_dir/tb_version)" == 0 ]] ; then
tablet_0_repair $tb_dir || return 1
fi
local ____tb_version=$(<$tb_dir/tb_version)
@@ -329,7 +329,10 @@ ## dirname of that is $TABLET_PATH/<spel
## basename of that is <spell>
#---------------------------------------------------------------------
function tablet_get_spell_name_from_path() {
- [[ $1 ]] && basename $(dirname $1)
+ [[ $1 ]] || return
+ local tmp
+ smgl_dirname "$1" tmp
+ smgl_basename "$tmp" $2 # quotes deliberatly left off, (hack for speed)
}

######################################################################
@@ -576,57 +579,84 @@ function tablet_set_spell() {


############################ REPAIR files #############################
-function tablet_import_repair_files() {
+#---------------------------------------------------------------------
+## Import repair files for all tablet pages
+#---------------------------------------------------------------------
+function tablet_import_repair_files() { (
local tablet_path=$1
local dir rc chapter page

+ codex_create_in_memory_cache_all -i spell_lookup_hash
+
+ shopt -s nullglob # so REPAIR^* evaluates to nothing if no REPAIR files
+
for chapter in $tablet_path/* ; do
test -d $chapter || continue
for page in $chapter/*; do
test -d $page || continue
- tablet_import_repair_files_page $page
+ tablet_import_repair_files_page "$page" spell_lookup_hash
done
done
-}
+) }

-function tablet_import_repair_files_page() { (
+#---------------------------------------------------------------------
+## Import repair files for a specific tablet page, expects caller
+## to have spell_lookup_hash setup for a spell lookup, and nullglob set.
+#---------------------------------------------------------------------
+function tablet_import_repair_files_page() {
local page=$1
- local spell=$(tablet_get_spell_name_from_path $page)
- codex_set_current_spell_by_name $spell || return 1
- local spell_version spell_updated codex_md5 repair_file tablet_file
tablet_md5
+
+ local spell spell_dir
+ tablet_get_spell_name_from_path "$page" spell
+ hash_get_ref $2 $spell spell_dir
+ codex_get_spell_paths "$spell_dir"
+
local name key
- tablet_get_version $page spell_version
- tablet_get_updated $page spell_updated
- tablet_get_patchlevel $page spell_patchlevel
- for repair_file in $(find $SPELL_DIRECTORY -maxdepth 1 -mindepth 1 -type f
-name 'REPAIR\^*'); do
- name=$(basename $repair_file|cut -f3- -d^)
- key=$(basename $repair_file|cut -f2 -d^)
+ local loaded
+ local spell_version spell_updated codex_md5 repair_file tablet_file
tablet_md5
+ for repair_file in $SPELL_DIRECTORY/REPAIR^*; do
+ [[ -f "$repair_file" ]] || continue
+ name=$(smgl_basename "$repair_file"|cut -f3- -d^)
+ key=$(smgl_basename "$repair_file"|cut -f2 -d^)
[[ $name ]] || continue
[[ $key ]] || continue
tablet_check_repair_file spell
done

- for repair_file in $(find $SECTION_DIRECTORY -maxdepth 1 -mindepth 1 -type
f -name 'REPAIR\^*'); do
- name=$(basename $repair_file|cut -f3- -d^)
- key=$(basename $repair_file|cut -f2 -d^)
+ for repair_file in $SECTION_DIRECTORY/REPAIR^*; do
+ [[ -f "$repair_file" ]] || continue
+ name=$(smgl_basename "$repair_file"|cut -f3- -d^)
+ key=$(smgl_basename "$repair_file"|cut -f2 -d^)
[[ $name ]] || continue
[[ $key ]] || continue
tablet_check_repair_file section
done

- for repair_file in $(find $GRIMOIRE -maxdepth 1 -mindepth 1 -type f -name
'REPAIR\^*'); do
- name=$(basename $repair_file|cut -f3- -d^)
- key=$(basename $repair_file|cut -f2 -d^)
+ for repair_file in $GRIMOIRE/REPAIR^*; do
+ [[ -f "$repair_file" ]] || continue
+ name=$(smgl_basename "$repair_file"|cut -f3- -d^)
+ key=$(smgl_basename "$repair_file"|cut -f2 -d^)
[[ $name ]] || continue
[[ $key ]] || continue
tablet_check_repair_file grimoire
done
-) }
+}

+#---------------------------------------------------------------------
+## Private subroutine for tablet_import_repair_files_page, do not call
+## from anywhere else.
+#---------------------------------------------------------------------
function tablet_check_repair_file() {
local type=$1
local replace=0

+ if ! [[ "$loaded" ]] ; then
+ tablet_get_version "$page" spell_version
+ tablet_get_updated "$page" spell_updated
+ tablet_get_patchlevel "$page" spell_patchlevel
+ loaded=done
+ fi
+
case $type in
spell) tablet_get_spell_file $page $name tablet_file;;
section) tablet_get_section_file $page $name tablet_file;;
@@ -643,7 +673,8 @@ function tablet_check_repair_file() {
else
codex_md5=$(md5sum $repair_file|cut -f1 -d' ')
tablet_md5=$(md5sum $tablet_file|cut -f1 -d' ')
- if [[ $spell_version == $key ]] ||
+ if [[ $key == "all" ]] ||
+ [[ $spell_version == $key ]] ||
[[ $spell_updated == $key ]] ||
[[ $spell_patchlevel == $key ]] ||
[[ $tablet_md5 == $key ]] ; then
@@ -671,15 +702,16 @@ function tablet_cleanse_tablet() {
local file_backup_dir=$backup_dir/tablet_files
local dir rc

- mkdir -p $file_backup_dir
+ mkdir -p "$file_backup_dir"
for dir in $tablet_path/* ; do
- if test -d $dir ; then
- tablet_cleanse_chapter $dir $backup_dir
+ if test -d "$dir" ; then
+ tablet_cleanse_chapter "$dir" "$backup_dir" no
else
message "$dir is not a directory! backing it up in $backup_dir"
- mv $dir $file_backup_dir
+ mv "$dir" "$file_backup_dir"
fi
done
+ tablet_import_repair_files "$tablet_path"
}

#---------------------------------------------------------------------
@@ -688,20 +720,26 @@ #---------------------------------------
function tablet_cleanse_chapter() {
local sdir=$1
local backup_dir=$2
+ local do_repair=$3
local spell=$(basename $sdir)
local page rc

- mkdir -p $backup_dir/duplicates
- mkdir -p $backup_dir/chapter_files
- tablet_fix_duplicates $spell $sdir $backup_dir/duplicates
- test -d $sdir || return 0
+ mkdir -p "$backup_dir/duplicates"
+ mkdir -p "$backup_dir/chapter_files"
+ tablet_fix_duplicates "$spell" "$sdir" "$backup_dir/duplicates"
+ test -d "$sdir" || return 0
+

for page in $sdir/*; do
- if ! test -d $page; then
+ if ! test -d "$page"; then
message "$dir is not a directory! backing it up in $backup_dir"
- mv $page $backup_dir/chapter_files/$page.$spell
- else
- tablet_import_repair_files_page $page
+ mv "$page" "$backup_dir/chapter_files/$page.$spell"
+ elif [[ $do_repair == yes ]] ; then
+ ( # pretend we're tablet_import_repair_files
+ shopt -s nullglob
+ hash_put spell_lookup_hash "$spell" "$(codex_find_spell_by_name
$spell)"
+ tablet_import_repair_files_page "$page" spell_lookup_hash
+ )
fi
done
}
diff --git a/var/lib/sorcery/modules/libunpack
b/var/lib/sorcery/modules/libunpack
index 3ab0cc6..8225df5 100755
--- a/var/lib/sorcery/modules/libunpack
+++ b/var/lib/sorcery/modules/libunpack
@@ -225,7 +225,7 @@ function unpack_core() {

case "$2" in
bzip2|gzip|compress*|tar)
- tar --owner=root --group=root --no-same-permissions
-xf \
+ tar --no-same-owner --no-same-permissions -xf \
/dev/stdin 2> /dev/null || cat > /dev/null ;;
Zip) cat /dev/stdin >/dev/null #get rid of unused output
unzip -q "$1" ;;
diff --git a/var/lib/sorcery/modules/url_handlers/url_svn_https
b/var/lib/sorcery/modules/url_handlers/url_svn_https
new file mode 100644
index 0000000..e145b66
--- /dev/null
+++ b/var/lib/sorcery/modules/url_handlers/url_svn_https
@@ -0,0 +1,131 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 SYNOPSIS
+##
+## Url handler functions for parsing subversion over https urls.
+##
+##=head1 DESCRIPTION
+##
+## This file contains functions for parsing svn_https urls.
+##
+##=head1 SVN HTTP URL Format
+##
+## The sourcemage specific svn+ssh url is as follows:
+## specific format was invented:
+##
+## svn_https://SVNURL:DIR_NAME
+##
+## The above url will download the latest version of the specified
+## module (i.e., the HEAD revision). To specify a specific revision,
+## the following format can be used:
+##
+## svn://SVNURL:DIR_NAME:REVISION_TAG
+##
+## The SVNURL portion of the url will appear as a normal https url
+## sans https:// prefix.
+##
+## The DIR_NAME will be the tail element of the SOURCE_DIRECTORY.
+##
+## For more details, see the SVN manual at
+## https://svnbook.red-bean.com/svnbook/ch03s04.html
+## and url_svn.
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2004 by the Source Mage Team
+## Copyright 2005 by the Source Mage Team
+##
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+##=item url_svn_https_bucketize
+## @param url
+##
+## Outputs svn as that is the dl handler for svn_https:// urls
+#---------------------------------------------------------------------
+function url_svn_https_bucketize() {
+ echo svn
+}
+
+#---------------------------------------------------------------------
+##=item url_file_download <url>
+##
+## Parse the specified svn_https url.
+##
+## @Global URL
+## @Global SVN_ROOT
+## @Global SVN_MODULE
+## @Global SVN_TAG
+##
+#---------------------------------------------------------------------
+function url_svn_https_crack() {
+
+ URL=`url_strip_prefix "$1" svn_https`
+ SVN_ROOT=https://`echo $URL | sed "s#\(^[^/]*[^:]*\):.*#\1#"`
+ local SVN_MODULE_TAG=`echo $URL | sed "s#^[^/]*[^:]*\(.*\)#\1#"`
+ SVN_MODULE=`echo $SVN_MODULE_TAG | cut -d : -f2`
+ local SVN_TAGNAME=`echo $SVN_MODULE_TAG | cut -d : -f3`
+ SVN_TAG=${SVN_TAGNAME:=HEAD}
+
+}
+
+#---------------------------------------------------------------------
+##=item url_svn_https_is_valid <url>
+##
+## Ensure that all the fields that should be parsed out from a url
+## do indeed exist
+#---------------------------------------------------------------------
+function url_svn_https_is_valid() {
+ url_svn_is_valid "$@"
+}
+
+#---------------------------------------------------------------------
+##=item url_svn_https_hostname <url>
+##
+## Get the hostname of the url
+##
+#---------------------------------------------------------------------
+function url_svn_https_hostname() {
+ echo $1|sed 's#^svn_https://\([^/:]*\)[/:].*$#\1#'
+}
+
+#---------------------------------------------------------------------
+##=item url_svn_https_netselect <url>
+##
+## Gets a netselect type output for the url
+##
+#---------------------------------------------------------------------
+function url_svn_https_netselect() {
+ local tmp_hostname url_speed each
+
+ for each in "$@" ; do
+ tmp_hostname=$(url_svn_https_hostname $each)
+ # since we had to pull the url apart to give netselect
+ # something it can understand we'll just pretend like
+ # multiple A records wont exist for this host...
+ url_speed=$(netselect -s 1 $tmp_hostname 2>/dev/null|awk '{print $1}')
+ [[ -n $url_speed ]] && echo "$url_speed $each"
+ done
+}
+
+#---------------------------------------------------------------------
+##=back
+##
+##=head1 LICENSE
+##
+## 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
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page