Skip to Content.
Sympa Menu

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

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 (a8778e407ec19e69511e11b758fa35e3ffe892c0)
  • Date: Fri, 25 Apr 2008 13:57:37 -0500

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

ChangeLog | 19 +++++++++++++
usr/sbin/gaze | 2 -
var/lib/sorcery/modules/build_api/common | 12 ++++----
var/lib/sorcery/modules/libmisc | 44
++++++++++++++-----------------
var/lib/sorcery/modules/libsorcery | 7 ++--
var/lib/sorcery/modules/libstate | 13 ++++++---
var/lib/sorcery/modules/libtablet | 13 +++++++--
7 files changed, 70 insertions(+), 40 deletions(-)

New commits:
commit 02b2c7343ce73fde8f4ed2fa679699681727ff57
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

common: moved the version cache addition in run_spell_success to before
the addition of the spell to the SPELL_STATUS to avoid a false
failure
in tablet_check_version_cache

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

fixed smgl_basename not giving the correct result for /

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

libmisc: rewrote smgl_dirname using an explode approach for it to conform
to the system dirname (it was failing the unit tests for dirs like
/etc
and //)

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

gaze, libsorcery, libtablet: made use of the "ok" status shortcut

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

libtablet: added a check to tablet_check_version_cache to make sure that
it is also in a good state, not just there

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

libstate: made get_all_spells_with_status accept "ok" as a parameter too

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

libtablet: improved the error message in tablet_create_version_cache and
made it remove the partial cache on error

diff --git a/ChangeLog b/ChangeLog
index 5c28be6..fcaeec5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2008-04-25 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libmisc: rewrote smgl_dirname using an explode approach for it to
conform
+ to the system dirname (it was failing the unit tests for dirs like
/etc
+ and //)
+ fixed smgl_basename not giving the correct result for /
+ * common: moved the version cache addition in run_spell_success to
before
+ the addition of the spell to the SPELL_STATUS to avoid a false
failure
+ in tablet_check_version_cache
+
+2008-04-23 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libstate: made get_all_spells_with_status accept "ok" as a
parameter too
+ * libtablet: added a check to tablet_check_version_cache to make sure
that
+ it is also in a good state, not just there
+ * gaze, libsorcery, libtablet: made use of the "ok" status shortcut
+
+2008-04-22 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libtablet: improved the error message in
tablet_create_version_cache and
+ made it remove the partial cache on error
+
2008-04-20 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libsorcery: simplified a loop in save_binaries
fixed a typo in yesterday's change
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index d4e3bb6..7bea2be 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -899,7 +899,7 @@ function gaze_activate_voyeur() {
function show_orphans() {
local spell each
compute_reverse_installed_depends my_hash
- for each in $(get_all_spells_with_status
'installed';get_all_spells_with_status 'held'); do
+ for each in $(get_all_spells_with_status ok); do
hash_get_ref my_hash $each spell
if [[ ! $spell ]]; then
echo "$each"
diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index e0e355d..371d990 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -238,6 +238,12 @@ function run_spell_success() {

sound SUCCESS

+ tablet_check_version_cache "$VERSION_STATUS" &&
+ (
+ codex_set_current_spell_by_name $SPELL
+ add_version_cache "$VERSION_STATUS" "$SPELL" "$VERSION" "$PATCHLEVEL"
"$SECURITY_PATCH" "$UPDATED"
+ )
+
# announce to everyone the spell succeeded
activity_log "cast" "$SPELL" "$VERSION" "success"
add_spell $SPELL installed $VERSION
@@ -247,12 +253,6 @@ 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/libmisc b/var/lib/sorcery/modules/libmisc
index a261a54..ca91ac9 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1445,36 +1445,32 @@ function awkuniq() {
## Dirname written in bash, optionally uses an upvar (making it forkless).
#---------------------------------------------------------------------
function smgl_dirname() {
- local __dir=$1
- local __last_dir __next_dir
+ local __dir=() __dirname i
+ explode "$1" / __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%/*}
+ [[ ${1:0:1} != / ]] && __dirname="."

- # 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="."
+ for (( i=0; i < ${#__dir[@]}; i++ )); do
+ if [[ -n ${__dir[$i]} ]]; then
+ __dirname="$__dirname/${__dir[$i]}"
+ fi
+ done
+ if [[ -z $__dirname ]]; then
+ __dirname=/
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
+ __dirname="${__dirname%/*}"
+ if [[ -z $__dirname ]]; then
+ __dirname=/
+ else
+ # usually not strictly necessary, but let's be conformant with dirname
+ [[ ${__dirname:0:2} == ./ ]] && __dirname="${__dirname:2}"
+ fi
fi

if [[ "$2" ]] ; then
- upvar "$2" "$__dir"
+ upvar "$2" "$__dirname"
else
- echo "$__dir"
+ echo "$__dirname"
fi
}

@@ -1495,6 +1491,8 @@ function smgl_basename() {
# if there are no more /'s then this does nothing which is what we want
__base=${__base##*/}

+ [[ -z $__base ]] && __base=/
+
if [[ "$2" ]] ; then
upvar "$2" "$__base"
else
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index ee246f0..7a6f3a8 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -1412,10 +1412,9 @@ function generate_keep_list() {
local cache_keep=$2
local type=$3
if [[ $type == installed_only ]] ; then
- {
- get_all_spells_with_status installed
- get_all_spells_with_status held
- } | sort -u | while read spell ; do
+ get_all_spells_with_status ok |
+ sort -u |
+ while read spell; do
codex_find_spell_by_name $spell
done
else
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 7151567..9abc0b2 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -982,16 +982,21 @@ function set_unheld () {


#---------------------------------------------------------------------
-## @param status
+## @param status (installed, held, exiled or ok[for the first two])
## @Stdout spells
## returns all spells that are in that status
##
#---------------------------------------------------------------------
function get_all_spells_with_status () {
- lock_file $SPELL_STATUS
- gawk -F: 'BEGIN { status="'$1'" }
+ local status=$1
+ lock_file $SPELL_STATUS
+ if [[ $status != ok ]]; then
+ gawk -F: 'BEGIN { status="'$status'" }
($3 == status) { print $1 }' $SPELL_STATUS
- unlock_file $SPELL_STATUS
+ else
+ awk -F: '{ if ($3 == "installed" || $3 == "held") print $1 }'
$SPELL_STATUS
+ fi
+ unlock_file $SPELL_STATUS
}


diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index d334bb8..aaeae79 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -698,7 +698,7 @@ function tablet_create_version_cache() {
local page_dir
local spell version patchlevel security_patch updated

- for spell in $(get_all_spells_with_status installed;
get_all_spells_with_status held); do
+ for spell in $(get_all_spells_with_status ok); do
if tablet_find_spell_dir $spell page_dir; then
tablet_get_version $page_dir version
tablet_get_patchlevel $page_dir patchlevel
@@ -707,7 +707,9 @@ function tablet_create_version_cache() {
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"
+ "please run cleanse --tablet and retry. If some spells" \
+ "have unfixable tablet pages, recast them.$DEFAULT_COLOR"
+ rm $file
return 1
fi
done | sort > $file
@@ -722,6 +724,13 @@ function tablet_check_version_cache() {
[[ -z $1 ]] && return 1
local file=$1

+ if [[ $file == $VERSION_STATUS ]] &&
+ [[ $(wc -l < $file) != $(get_all_spells_with_status ok | wc -l) ]]; then
+ error_message "${PROBLEM_COLOR}The tablet version cache is damaged,
removing it!"
+ error_message "$DEFAULT_COLOR"
+ rm "$file"
+ fi
+
if [[ ! -f $file ]]; then
message "${MESSAGE_COLOR}Creating the tablet version cache, this" \
"can take a while ...$DEFAULT_COLOR"



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

Archive powered by MHonArc 2.6.24.

Top of Page