Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (7c2d6782cf168d294de09adbeeec88a94371c3b7)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (7c2d6782cf168d294de09adbeeec88a94371c3b7)
  • Date: Wed, 16 Apr 2008 11:55:36 -0500

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 48 ++++++++++++
etc/sorcery/config | 2
etc/sorcery/state | 1
usr/sbin/dispel | 1
usr/sbin/gaze | 2
usr/sbin/scribe | 36 ++++++++-
usr/share/man/man8/scribe.8 | 5 +
var/lib/sorcery/modules/build_api/common | 6 +
var/lib/sorcery/modules/libcast | 2
var/lib/sorcery/modules/libcodex | 24 ++++++
var/lib/sorcery/modules/libdepends | 40 ++++++++--
var/lib/sorcery/modules/libdispel | 1
var/lib/sorcery/modules/libresurrect | 16 ++++
var/lib/sorcery/modules/libsorcery | 124
++++++++++++++++++++++---------
var/lib/sorcery/modules/libstate | 36 +++++++++
var/lib/sorcery/modules/libtablet | 43 ++++++++++
var/lib/sorcery/modules/libunpack | 19 +++-
17 files changed, 355 insertions(+), 51 deletions(-)

New commits:
commit 7c2d6782cf168d294de09adbeeec88a94371c3b7
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

change tee to sed p in clean_logs, it didn't work nicely for Vlad

commit 8f5eb2776d19eab74a904cda03abdae64384f0c3
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libsorcery: removed a use of hardcoded $INSTALL_CACHE

commit d5764c61e85113d38fd0568cc23d38539ca9b859
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libcast: made run_conflicts query in QUERY_COLOR

commit 559b978b88ba20e02033179cedcd64aca6609803
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libdepends: when falling back to installed spells as default choices for
providers, try to use the currently used provider; added a warning

commit 09f84954e6c69f9981d7d66b50ca098f446e6ece
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

scribe.8: don't mention local grimoires for reindex-version, nothing good
can come of it

commit cdd1d78ce01b32d8ce5d1f23f4548543e21a418b
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libsorcery: changed silent queuing to use the new version caches

since the grimoires don't generate the caches yet, this is pretty useless,
unless you plan to queue more than once over the same grimoire

USAGE:
scribe reindex-version
VERBOSE_QUEUING=off sorcery queue #first time only - cache generation

VERBOSE_QUEUING=off sorcery queue #all the rest take only 20s here (vs
200s :D)

If you don't have any multiversion spells installed, the queuing is
instant. I
have 40.

commit 77981be5624669bdb8d8dbefbb008bd53c9051af
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libresurrect: fixed bad variable name in previous commit

commit d1b362df9e4dd21be4b0e61282a03ad64b24ef56
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libcodex: don't insert anything into the cache for multiversioned spells

commit db9a29592d38a662c31bf654ac6968e5e1023e32
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

common, libresurrect, libdispel: update the tablet version cache when
needed

commit da67f03b49f153452e3d7ae5e0b37b15e1e66ce6
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libstate: added remove_version_cache and add_version_cache for keeping
the tablet version cache up to date

commit b2204268190f4db3fa5c64d805f2a85b9f0e18be
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libtablet: added tablet_{create,check}_version_cache for creating a
cache of installed spells' queuing factors - the system variant of
scribe reindex-version; allows for a great speedup in sorcery queue

commit e4610e559a9ba573a887738f4864b3edd934bfd6
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

state: added VERSION_STATUS=${STATE_DIRECTORY}/versions

commit 046a5c1e3bd71b86b89533d86af842a2f7d85173
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libunpack: removed one of the parameters to uncompress_unpack and
made it pass on possible hints to uncompress/unpack;
changed unpack_core to allow for perserving permissions and owners;
uncompress_unpack_cache now requests the above via a hint

commit bfdbd0607a25439427611f682d77b4eae8f1c632
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* gaze: don't show find errors when searching for aliens

commit 704b769b6ee2f46734f09e735f7036ae8315ae18
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

dispel: display the version of the downgraded spell too

commit 46ca69725f974b3fadc9be53be68490416570f21
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* scribe: fixed progress message when reindexing keywords or versions

commit 0ce1c4518bc7c09920765836c6ad618bea21adee
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

finished the merge

commit f7768e6ba0a82272a470a4d5e3b8fa0d641c8231
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

made sorcery queue more verbose by default. Can be turned off in the local
config->VERBOSE_QUEUING. Prints why the spell was added to the queue. This
info is also displayed for cast -Z
Fixed two semitypos and added a newline before the displayed list.
(cherry picked from commit c6736678e6bdae05c574b17c15304c7c6b349830)

(cherry-picked from commit 539b64110e275f61a3858fff614577e8226e7051)

commit 9d2313c5953ec9807f0a7cbd5190c42c181a0dcd
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libsorcery: sanitized a check in build_install_queue

(cherry-picked from commit 8ed691232f262f20947291e7767538e4f4d79ad6)

commit 2202387a9519d15a2c9b2fd9a51f079015cb940a
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* libcodex: added codex_create_version_cache; will be used for a
faster
sorcery queue
* scribe: added scribe_reindex_version which calls it
* scribe.8: added reindex-version
* config: defined VERSION_INDEX_FILE

(cherry-picked from commit 58a7987d69649c499caf30b8c8056f1d77392b76)

diff --git a/ChangeLog b/ChangeLog
index 4b960d3..5b93167 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2008-04-16 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * scribe.8: don't mention local grimoires for reindex-version,
nothing good
+ can come of it
+ * libdepends: when falling back to installed spells as default
choices for
+ providers, try to use the currently used provider; added a warning
+ * libcast: made run_conflicts query in QUERY_COLOR
+ * libsorcery: removed a use of hardcoded $INSTALL_CACHE
+ change tee to sed p in clean_logs, it didn't work nicely for Vlad
+
+2008-04-15 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * state: added VERSION_STATUS=${STATE_DIRECTORY}/versions
+ * libtablet: added tablet_{create,check}_version_cache for creating a
+ cache of installed spells' queuing factors - the system variant of
+ scribe reindex-version; allows for a great speedup in sorcery queue
+ * libstate: added remove_version_cache and add_version_cache for
keeping
+ the tablet version cache up to date
+ * common, libresurrect, libdispel: update the tablet version cache
when
+ needed
+ * libcodex: don't insert anything into the cache for multiversioned
spells
+ * libresurrect: fixed bad variable name in previous commit
+ * libsorcery: changed silent queuing to use the new version caches
+
+2008-04-14 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libunpack: removed one of the parameters to uncompress_unpack and
+ made it pass on possible hints to uncompress/unpack;
+ changed unpack_core to allow for perserving permissions and owners;
+ uncompress_unpack_cache now requests the above via a hint
+
+2008-04-13 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * gaze: don't show find errors when searching for aliens
+
+2008-04-12 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * scribe: fixed progress message when reindexing keywords or versions
+ * dispel: display the version of the downgraded spell too
+
+2008-04-11 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libsorcery: sanitized a check in build_install_queue
+ fixed two typos and added optional verbose sorcery queue-ing - it
now
+ prints why the spell was added to the queue; also displayed for
cast -Z
+ * config: added VERBOSE_QUEUING=on
+
+2008-04-11 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcodex: added codex_create_version_cache; will be used for a
faster
+ sorcery queue
+ * scribe: added scribe_reindex_version which calls it
+ * scribe.8: added reindex-version
+ * config: defined VERSION_INDEX_FILE
+
2008-04-11 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libressurect: always use the saved version after setting the spell
* libsorcery: rewrote log_list to conform with sorcery standards and
be 50
diff --git a/etc/sorcery/config b/etc/sorcery/config
index 31a10f0..acbe773 100755
--- a/etc/sorcery/config
+++ b/etc/sorcery/config
@@ -132,6 +132,7 @@ GRIMOIRE_MANIFEST_ALGORITHM=sha1
SPELL_INDEX_FILE=codex.index
PROVIDE_INDEX_FILE=provides.index
KEYWORD_INDEX_FILE=keyword.index
+ VERSION_INDEX_FILE=version.index

LOCK_DIR=/tmp/liblock-$UID
LOCK_TRANSACTIONS="$LOCK_DIR/liblock.locklist"
@@ -157,6 +158,7 @@
DEFAULT_CHANGED_CONFIG_ACTION=${DEFAULT_CHANGED_CONFIG_ACTION:-2}
DOCS='README* FAQ* CHAN* DOC* SETUP LICENSE COPYING NEWS
*rc'
DOC_DIRS='doc* conf'
PROGRESS_SPINNER_CHARS='-\|/'
+ VERBOSE_QUEUING=${VERBOSE_QUEUING:-on}

WHITESPACE_IFS=$' \t\n'
TAB_ENTER_IFS=$'\t\n'
diff --git a/etc/sorcery/state b/etc/sorcery/state
index 01499cb..d4f20b3 100755
--- a/etc/sorcery/state
+++ b/etc/sorcery/state
@@ -26,6 +26,7 @@ DEPENDS_STATUS_BACKUP=${STATE_DIRECTORY}/depends.backup
MENU_STATUS=${STATE_DIRECTORY}/menus
MENU_STATUS_BACKUP=${STATE_DIRECTORY}/menus.backup
ABANDONED_PERSIST=${STATE_DIRECTORY}/abandoned_persist
+ VERSION_STATUS=${STATE_DIRECTORY}/versions



diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index 3ac7f61..f81b4cc 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -93,6 +93,7 @@ function downgrade() {
fi

if spell_installed $SPELL; then
+ message "Dispelling $SPELL $(installed_version $SPELL) ..."
dispel_spell $SPELL
if [ $? != 0 ] ; then
message "${PROBLEM_COLOR}Unable to downgrade" \
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index 76a8962..d581902 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -266,7 +266,7 @@ function alien() {

[[ $GAZE_VERBOSE != 0 ]] &&
message "Discovering ambient files..."
- find $GAZE_ALIEN_PATHS | files | filter "$EXCLUDED" | sort
>$TMP_DIR/gaze.found
+ find $GAZE_ALIEN_PATHS 2>/dev/null | files | filter "$EXCLUDED" | sort
>$TMP_DIR/gaze.found

diff -B -a -d $TMP_DIR/gaze.found $TMP_DIR/gaze.known |
grep -v "^> " |
diff --git a/usr/sbin/scribe b/usr/sbin/scribe
index ddad035..7bef158 100755
--- a/usr/sbin/scribe
+++ b/usr/sbin/scribe
@@ -37,6 +37,7 @@ reindex [grimoire] Recreates the list of
spells
reindex-keyword [grimoire] Recreates keyword listing
(official grimoires should come with
a keyword listing already)
+reindex-version [grimoire] Recreates the version listing

index Prints list of grimoires

@@ -510,13 +511,42 @@ function scribe_reindex_keyword() {
error_message "Grimoire $grim not found!"
return 1
fi
- message -n "Reindexing keywords for $grim ..."
+ message -n "Reindexing keywords for $grim ... "
codex_create_keyword_cache "$grimoire"
+ message "done."
done
- message "done."
}

#---------------------------------------------------------------------
+## scribe_reindex_version
+##
+## Recreate the version index
+##
+## @param grimoire names, if none all grimoires
+##
+## TODO: merge scribe_reindex_* functions?
+#---------------------------------------------------------------------
+function scribe_reindex_version() {
+ local paths=""
+ local grimoire grimoires grim
+ if [[ $@ ]] ; then
+ grimoires="$@"
+ else
+ grimoires=$(codex_get_all_grimoires)
+ fi
+
+ for grim in $grimoires; do
+ if ! grimoire=$(codex_find_grimoire $grim) ; then
+ error_message "Grimoire $grim not found!"
+ return 1
+ fi
+ message -n "Reindexing versions for $grim ... "
+ codex_create_version_cache "$grimoire"
+ message "done."
+ done
+
+}
+#---------------------------------------------------------------------
## scribe_remove
##
## remove a grimoire from the codex
@@ -720,6 +750,7 @@ function find_function() {
i|in|ind|inde|index) FUNCTION="index";;
l|loc|local|localize) FUNCTION="localize";;
reindex-keyword) FUNCTION="reindex-keyword";;
+ reindex-version) FUNCTION="reindex-version";;
rei|reind|reinde|reindex) FUNCTION="reindex";;
rm|rem|remo|remov|remove) FUNCTION="remove" ;;
se|set) FUNCTION="set";;
@@ -752,6 +783,7 @@ function main() {
localize) scribe_localize $@ ;;
reindex) scribe_reindex $@ ;;
reindex-keyword) scribe_reindex_keyword $@ ;;
+reindex-version) scribe_reindex_version $@ ;;
remove) scribe_remove $@ ;;
set) scribe_set $@ ;;
swap) scribe_swap $@ ;;
diff --git a/usr/share/man/man8/scribe.8 b/usr/share/man/man8/scribe.8
index 8de1f0f..6df0228 100644
--- a/usr/share/man/man8/scribe.8
+++ b/usr/share/man/man8/scribe.8
@@ -67,8 +67,11 @@ run
.I scribe reindex
whenever you add/remove spells! Otherwise, strange things will happen!
.SS reindex-keyword [<grimoire>]
-This recreates the keyword index files, of all grimoires or of the specified
one.
+This recreates the keyword index files of all grimoires or of the specified
one.
The keyword indexes come pre-packaged with the grimoire, so this step is
optional. Its also a bit slower than regular reindexing. Run this on any
local grimoire you may have so that you can do keyword based lookups.
+.SS reindex-version [<grimoire>]
+This recreates the version index files of all grimoires or of the specified
one.
+These indexes come pre-packaged with the grimoire, so this step is optional.
.SS index
shows a list of grimoires and locations where you have them installed.
.SS set <grim1> <grim2>
diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index 9ea8182..ca5c56b 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -247,6 +247,12 @@ function run_spell_success() {
# update depends info
debug "build_api/common" "Merging depends info"

+ tablet_check_version_cache "$VERSION_STATUS" &&
+ (
+ codex_set_current_spell_by_name $SPELL
+ add_version_cache "$VERSION_STATUS" "$SPELL" "$VERSION" "$PATCHLEVEL"
"$SECURITY_PATCH" "$UPDATED"
+ )
+
# none of the old values are valid, only the new, uncommitted values are
remove_depends_status $DEPENDS_STATUS $SPELL
local spell_depends spell_sub_depends spell_rsub_depends
diff --git a/var/lib/sorcery/modules/libcast b/var/lib/sorcery/modules/libcast
index 0a605af..63cacb3 100755
--- a/var/lib/sorcery/modules/libcast
+++ b/var/lib/sorcery/modules/libcast
@@ -112,7 +112,7 @@ function run_conflicts() {
[[ "$skip" == "yes" ]] && continue

local text="${SPELL_COLOR}${SPELL}${MESSAGE_COLOR} conflicts with"
- text="$text ${SPELL_COLOR}${spell_and_default[0]}${MESSAGE_COLOR}."
+ text="$text ${SPELL_COLOR}${spell_and_default[0]}${QUERY_COLOR}."
text="$text Dispel"
text="$text ${SPELL_COLOR}${spell_and_default[0]}${MESSAGE_COLOR}?"

diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index 08c48df..36840f6 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -957,6 +957,30 @@ function codex_create_keyword_cache () { (
) }

#---------------------------------------------------------------------
+## @param grimoire-path
+## Creates the version index, which additionally includes the other
+## queuing factors - patchlevels and UPDATED.
+##
+## Multiversioned spells will have no entry. Persistent
+## variables are ignored.
+#---------------------------------------------------------------------
+function codex_create_version_cache () { (
+ grimoire="$1"
+
+ for file in $(codex_find_in_grimoire "$grimoire" DETAILS); do
+ codex_get_spell_paths ${file%/DETAILS}
+ source "$file" &> /dev/null
+ if [[ $(grep -c "^[[:space:]]*VERSION=" "$file") == 1 ]]; then
+ echo "$SPELL ${VERSION:-0} ${PATCHLEVEL:-0} ${SECURITY_PATCH:-0}
${UPDATED:-0}"
+ else
+ # multiversioned or unusually formatted spell - ignore them
+ :
+ fi
+ unset SPELL VERSION PATCHLEVEL SECURITY_PATCH UPDATED
+ done | sort > $grimoire/$VERSION_INDEX_FILE
+) }
+
+#---------------------------------------------------------------------
## @param servicename
## @return 0 if service exists
## @return 1 otherwise
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 3b8052d..7a06ee3 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -990,10 +990,22 @@ function work_depends_provider()
fi

# check if theres a provider already installed
+ # if there are multiple, try to select the previously used one
if [[ ! $default ]]; then
for tmp in $CANDIDATES; do
- spell_ok $tmp && default=$tmp && break
+ spell_ok $tmp && real_list_add choices $tmp
done
+ if [[ $choices == ${choices##* } ]]; then
+ default=$choices
+ else
+ explode "$(search_depends_status $DEPENDS_STATUS "$SPELL" ".*($1)")"
":" "status"
+ local old_provider=${status[1]%(*} # Name of spell which provides $1
+ if real_list_find "$choices" $old_provider; then
+ default=$old_provider
+ else
+ default=${choices%% *}
+ fi
+ fi
fi

select_provider "provider" "$default" 0 $CANDIDATES
@@ -1041,7 +1053,7 @@ function work_optional_depends_provider()
{

debug "libdepends" "$FUNCNAME - $@"
- local default tmp installed=no
+ local default tmp choices installed=no
local status=()

local failure_ok=$1
@@ -1099,8 +1111,13 @@ function work_optional_depends_provider()
# if the user said "on" use the default rather than none
# unless theres something wrong with the provider they chose
# in which case fall back to none
- [[ $tmp ]] && real_list_find "$CANDIDATES" "$tmp" &&
- default=$tmp || default=none
+ if [[ $tmp ]] && real_list_find "$CANDIDATES" "$tmp"; then
+ default=$tmp
+ else
+ message "${PROBLEM_COLOR}The default provider is not good anymore!"
+ message "Falling back to 'none' as the default
choice.$DEFAULT_COLOR"
+ default=none
+ fi
else
default=none
fi
@@ -1115,10 +1132,23 @@ function work_optional_depends_provider()
fi

# check if theres a provider already installed
+ # if there are multiple, try to select the previously used one
if [[ ! $default ]]; then
for tmp in $CANDIDATES; do
- spell_ok $tmp && default=$tmp && break
+ spell_ok $tmp && real_list_add choices $tmp
done
+ if [[ $choices == ${choices##* } ]]; then
+ default=$choices
+ else
+ # only search for enabled dependencies since none is already the
default
+ explode "$(search_depends_status_simple $DEPENDS_STATUS "$SPELL"
".*($1)" "on")" ":" "status"
+ local old_provider=${status[1]%(*} # Name of spell which provides $1
+ if real_list_find "$choices" $old_provider; then
+ default=$old_provider
+ else
+ default=${choices%% *}
+ fi
+ fi
fi

select_provider "provider" "$default" 1 $CANDIDATES
diff --git a/var/lib/sorcery/modules/libdispel
b/var/lib/sorcery/modules/libdispel
index 2a5a9a0..87b62a0 100755
--- a/var/lib/sorcery/modules/libdispel
+++ b/var/lib/sorcery/modules/libdispel
@@ -335,6 +335,7 @@ function dispel_spell() {
reap_state_files $INST_LOG &&
reap_spell_config_stage &&
remove_spell $SPELL &&
+ remove_version_cache "$VERSION_STATUS" $SPELL &&
{ [[ $TRIGGER == off ]] || trigger "dispel";} &&
remove_triggers $SPELL &&
message "${DISPEL_COLOR}Dispelled spell:" \
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index fbbe242..5eaa844 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -612,6 +612,22 @@ function resurrect_success() {
# add packages line
add_spell "$SPELL" "installed" "$VERSION"

+ tablet_check_version_cache "$VERSION_STATUS" &&
+ (
+ if tablet_find_spell_dir $SPELL page_dir && [[ $new_tablet ]]; then
+ tablet_get_patchlevel $page_dir PATCHLEVEL
+ tablet_get_security_patch $page_dir SECURITY_PATCH
+ tablet_get_updated $page_dir UPDATED
+ else
+ # we don't have a good tablet, so we don't know what we just
resurrected
+ # insert dummy values
+ UPDATED=0
+ PATCHLEVEL=0
+ SECURITY_PATCH=0
+ fi
+ add_version_cache "$VERSION_STATUS" "$SPELL" "$VERSION" "$PATCHLEVEL"
"$SECURITY_PATCH" "$UPDATED"
+ )
+
pop_install_queue "$SPELL"
echo $SPELL >> $SUCCESS_LIST

diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index 20b997c..71b933c 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -817,6 +817,7 @@ function list_install_queue() {
if [ -f $INSTALL_QUEUE ]; then
lock_file $INSTALL_QUEUE

+ echo
message -n "The following spells will be updated:"
message "${SPELL_COLOR}"
cat $INSTALL_QUEUE | column
@@ -838,7 +839,7 @@ function list_install_queue() {

#---------------------------------------------------------------------
## Frontend routine to encapsulate whether or not a spell needs updating
-##
+## Used by lazy dependency resolution
#---------------------------------------------------------------------
function does_spell_need_update() {
local line curr_updated curr_version status
@@ -849,6 +850,7 @@ function does_spell_need_update() {
line=$(search_spell_status $SPELL_STATUS $spell)
codex_set_current_spell_by_name $spell
explode "$line" ":" "info"
+ VERBOSE_QUEUING=on # safe override since we're in a subshell
does_spell_need_update_sub "$spell" "${info[3]}" "${info[1]}" /dev/null
)
}
@@ -863,7 +865,12 @@ function does_spell_need_update_sub() {
local curr_version=$2
local curr_updated=$3
local tmp_queue=$4
+ local message="$SPELL_COLOR$spell$DEFAULT_COLOR:"
if [[ $VERSION != $curr_version ]] ; then
+ if [[ $VERBOSE_QUEUING == on ]]; then
+ clear_line
+ message "$message New version ($VERSION)."
+ fi
echo $spell >> $tmp_queue
return 0
else
@@ -875,13 +882,21 @@ function does_spell_need_update_sub() {
tablet_get_patchlevel $page_dir curr_patchlevel
tablet_get_security_patch $page_dir curr_sec_patch
fi
- if (( "${PATCHLEVEL:-0}" > "$curr_patchlevel" )) ||
- # the following is subject to change
- (( "${SECURITY_PATCH:-0}" > "$curr_sec_patch" )) ||
- (( "${UPDATED:-0}" > "${curr_updated:-0}" )) ; then
- echo $spell >> $tmp_queue
- return 0
+ if (( "${SECURITY_PATCH:-0}" > "$curr_sec_patch" )); then
+ message="$message Security update."
+ elif (( "${PATCHLEVEL:-0}" > "$curr_patchlevel" )); then
+ message="$message Spell update."
+ elif (( "${UPDATED:-0}" > "${curr_updated:-0}" )); then
+ message="$message UPDATED changed."
+ else
+ return 1
fi
+ if [[ $VERBOSE_QUEUING == on ]]; then
+ clear_line
+ message "$message"
+ fi
+ echo $spell >> $tmp_queue
+ return 0
fi
return 1
}
@@ -897,31 +912,72 @@ function update_install_queue() {
local line spell curr_version curr_updated page_dir info curr_patchlevel
local curr_sec_patch count size
local tmp_queue=$TMP_DIR/install_queue
+ local recheck_queue=$TMP_DIR/recheck_queue
touch $tmp_queue

- message "${CHECK_COLOR}Generating list of spells to update...
${DEFAULT_COLOR} "
- count=0
- size=$(all_spell_status | wc -l)
- for line in `all_spell_status`; do
- progress_bar $count $size 50
- #0=spell, 1=date, 2=status, 3=version
- explode "$line" ":" "info"
- spell=${info[0]}
- curr_updated=${info[1]}
- status=${info[2]}
- curr_version=${info[3]}
-
- ( # do this in a subshell in case a spell mis-behaves and exits we
- # still want queueing to work
- if [[ "$status" == "installed" ]] &&
- codex_set_current_spell_by_name $spell; then
- does_spell_need_update_sub "$spell" "$curr_version" \
- "$curr_updated" "$tmp_queue"
- fi
- )
- let count++
- done
- clear_line
+ message "${CHECK_COLOR}Generating the list of spells to update...
${DEFAULT_COLOR} "
+ if [[ $VERBOSE_QUEUING == on ]]; then
+ count=0
+ size=$(all_spell_status | wc -l)
+ for line in `all_spell_status`; do
+ progress_bar $count $size 50
+ #0=spell, 1=date, 2=status, 3=version
+ explode "$line" ":" "info"
+ spell=${info[0]}
+ curr_updated=${info[1]}
+ status=${info[2]}
+ curr_version=${info[3]}
+
+ ( # do this in a subshell in case a spell mis-behaves and exits we
+ # still want queueing to work
+ if [[ "$status" == "installed" ]] &&
+ codex_set_current_spell_by_name $spell; then
+ does_spell_need_update_sub "$spell" "$curr_version" \
+ "$curr_updated" "$tmp_queue"
+ fi
+ )
+ let count++
+ done
+ clear_line
+ else
+ tablet_check_version_cache $VERSION_STATUS || return 1
+ local grimoire
+ for grimoire in $(codex_get_all_grimoires); do
+ cat $grimoire/$VERSION_INDEX_FILE 2>/dev/null
+ done |
+ awk -v i=$VERSION_STATUS '{
+ if ( ! ($1 in map)) {
+ map[$1]=$0;
+ }
+ }
+
+ END {
+ while (getline < i) {
+ if ($1 in map) {
+ split(map[$1], factor);
+ if ($2 != factor[2] || $3 < factor[3] || $4 < factor[4] || $5 <
factor[5]) {
+ print $1;
+ }
+ } else {
+ # multiversioned spell - do it the old way
+ print $1 > "/dev/stderr";
+ }
+ }
+ } ' > $tmp_queue 2> $recheck_queue
+ if [[ -s $recheck_queue ]]; then
+ (
+ while read spell; do
+ explode "$(search_spell_status $SPELL_STATUS "$spell")" ":"
"info"
+ curr_updated=${info[1]}
+ curr_version=${info[3]}
+ codex_set_current_spell_by_name $spell &&
+ does_spell_need_update_sub "$spell" "$curr_version" \
+ "$curr_updated" "$tmp_queue"
+ done < $recheck_queue
+ )
+ rm $recheck_queue
+ fi
+ fi
lock_file $INSTALL_QUEUE
rm -f $INSTALL_QUEUE
sort -u $tmp_queue > $INSTALL_QUEUE
@@ -934,7 +990,7 @@ function update_security_install_queue() {
local tmp_queue=$TMP_DIR/install_queue
touch $tmp_queue

- message "${CHECK_COLOR}Generating list of spells to update for" \
+ message "${CHECK_COLOR}Generating the list of spells to update for" \
"security reasons... ${DEFAULT_COLOR} "
for line in `all_spell_status`; do
#0=spell, 1=date, 2=status, 3=version
@@ -980,7 +1036,7 @@ function build_install_queue() {
then edit_file $INSTALL_QUEUE
fi

- if [ -n "`cat $INSTALL_QUEUE`" ]; then
+ if [[ -s $INSTALL_QUEUE ]]; then
cast `cat $INSTALL_QUEUE`
rm $INSTALL_QUEUE
fi
@@ -1173,7 +1229,7 @@ function clean_logs() {
{
# don't try to delete logs of installed spells, as they may not exist
# tee duplicates the output, so uniq will filter them out
- log_list | tee /dev/stdout
+ log_list | sed p
find $INSTALL_LOGS $MD5SUM_LOGS $COMPILE_LOGS -type f
} | sort | uniq -u |
while read file; do
@@ -1355,7 +1411,7 @@ function generate_keep_list() {
while read SPELL_DIRECTORY ; do
codex_set_current_spell_quick $SPELL_DIRECTORY &>/dev/null
sources 2>/dev/null
- ls /var/cache/sorcery/$SPELL-$VERSION-* 1>&2 2>/dev/null
+ ls $INSTALL_CACHE/$SPELL-$VERSION-* 1>&2 2>/dev/null
unset VERSION SPELL ${!SOURCE*}
done
) 2> $cache_keep > $source_keep
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 1bd6a45..a973591 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -594,6 +594,42 @@ function search_default_provider() {
}

#---------------------------------------------------------------------
+## @param cache file
+## @param spell name
+##
+## Removes the spell info from the passed file ($VERSION_STATUS)
+##
+#---------------------------------------------------------------------
+function remove_version_cache() {
+ local file=$1
+ lock_start_transaction "$file" t_file
+ sed -i "/^$2 /d" $t_file
+ lock_commit_transaction $file
+}
+
+#---------------------------------------------------------------------
+## @param cache file
+## @param spell name
+## @param version
+## @param patchlevel
+## @param security patch
+## @param updated
+##
+## Given a spell and the factors that affect queuing, this function
+## adds the info to the passed file (usually $VERSION_STATUS)
+##
+#---------------------------------------------------------------------
+function add_version_cache() {
+ local file=$1
+ shift
+ remove_version_cache "$file" $1
+
+ lock_start_transaction "$file" t_file
+ echo "$1 ${2:-0} ${3:-0} ${4:-0} ${5:-0}" >> $t_file
+ lock_commit_transaction $file
+}
+
+#---------------------------------------------------------------------
##
## Adds an entry to the SPELL_STATUS file
##
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index bd7a2b7..87dd4ea 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -686,6 +686,49 @@ function tablet_check_repair_file() {
fi
}

+#---------------------------------------------------------------------
+## Creates a version cache like the one of scribe reindex-version, but
+## from the data found in the tablet
+##
+## @param file that will hold the cache
+#---------------------------------------------------------------------
+function tablet_create_version_cache() {
+ [[ -f $1 ]] && return 0
+ local file=$1
+ local page_dir
+ local spell version patchlevel security_patch updated
+
+ for spell in $(get_all_spells_with_status installed); do
+ if tablet_find_spell_dir $spell page_dir; then
+ tablet_get_version $page_dir version
+ tablet_get_patchlevel $page_dir patchlevel
+ tablet_get_security_patch $page_dir security_patch
+ tablet_get_updated $page_dir updated
+ echo "$spell ${version:-0} ${patchlevel:-0} ${security_patch:-0}
${updated:-0}"
+ else
+ error_message "${PROBLEM_COLOR}Creation of the cache failed at
$spell," \
+ "please run cleanse --tablet and retry.$DEFAULT_COLOR"
+ return 1
+ fi
+ done | sort > $file
+}
+
+#---------------------------------------------------------------------
+## Checks for existance and on failure creates the tablet version cache
+##
+## @param cache file (usually $VERSION_STATUS)
+#---------------------------------------------------------------------
+function tablet_check_version_cache() {
+ [[ -z $1 ]] && return 1
+ local file=$1
+
+ if [[ ! -f $file ]]; then
+ message "${MESSAGE_COLOR}Creating the tablet version cache, this" \
+ "can take a while ...$DEFAULT_COLOR"
+ tablet_create_version_cache "$file"
+ fi
+}
+
############################ cleanse functions ########################

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libunpack
b/var/lib/sorcery/modules/libunpack
index d945049..cfb7610 100755
--- a/var/lib/sorcery/modules/libunpack
+++ b/var/lib/sorcery/modules/libunpack
@@ -225,8 +225,12 @@ function unpack_core() {

case "$2" in
bzip2|gzip|compress*|tar)
- tar --no-same-owner --no-same-permissions -xf \
- /dev/stdin 2> /dev/null || cat > /dev/null ;;
+ if real_list_find "$3" same-permissions; then
+ tar -xf /dev/stdin 2> /dev/null
+ else
+ tar --no-same-owner --no-same-permissions -xf \
+ /dev/stdin 2> /dev/null
+ fi || cat > /dev/null ;;
Zip) cat /dev/stdin >/dev/null #get rid of unused output
unzip -q "$1" ;;
RPM) cpio -idm < /dev/stdin ;;
@@ -603,7 +607,7 @@ function unpack_missing() {
##
#---------------------------------------------------------------------
function uncompress_unpack_cache() {
- uncompress_unpack "$1" root "cache" silent
+ uncompress_unpack "$1" root cache same-permissions
}

#---------------------------------------------------------------------
@@ -611,7 +615,7 @@ function uncompress_unpack_cache() {
## @param (optional) dirname of the file (default: $SOURCE_CACHE)
## 'root' if you already have an absolute path
## @param (optional) type (default: source)
-## @param (optional) if 'silent' doesn't print the messages (default off)
+## @param (optional) hints - used for passing hints to unpack/uncompress
##
## Given a file, runs the decompression program for that file, as well as
## untar'ing the file.
@@ -625,8 +629,9 @@ function uncompress_unpack() {
local filename=$(guess_filename "$basedir/$1") &&
local compressor=$(guess_compressor "$filename")
local type=${3:-source}
+ local hints="$4"

- if [[ $4 != silent ]]; then
+ if [[ $type != cache ]]; then
message "${MESSAGE_COLOR}Unpacking $type file ${SPELL_COLOR}${1}" \
"${DEFAULT_COLOR}${MESSAGE_COLOR}for spell${SPELL_COLOR}" \
"${SPELL}${DEFAULT_COLOR}${MESSAGE_COLOR}.${DEFAULT_COLOR}"
@@ -637,8 +642,8 @@ function uncompress_unpack() {
return 1
fi

- uncompress_core "$filename" "$compressor" |
- unpack_core "$filename" "$compressor"
+ uncompress_core "$filename" "$compressor" "$hints" |
+ unpack_core "$filename" "$compressor" "$hints"
}

#---------------------------------------------------------------------



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (7c2d6782cf168d294de09adbeeec88a94371c3b7), Jaka Kranjc, 04/16/2008

Archive powered by MHonArc 2.6.24.

Top of Page