Skip to Content.
Sympa Menu

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

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 (ad1fca2d26c4dde52480f5521436ad8813f53813)
  • Date: Fri, 18 Jan 2008 11:01:57 -0600

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

ChangeLog | 5 ++++
usr/sbin/cast | 3 +-
usr/sbin/cleanse | 6 ++---
usr/sbin/sorcery | 4 +--
var/lib/sorcery/modules/build_api/common | 6 +++--
var/lib/sorcery/modules/libcodex | 6 ++---
var/lib/sorcery/modules/libdepends | 5 ++--
var/lib/sorcery/modules/libdispel | 3 +-
var/lib/sorcery/modules/liblock | 20 +++++++++++++-----
var/lib/sorcery/modules/libmisc | 3 +-
var/lib/sorcery/modules/libresurrect | 3 +-
var/lib/sorcery/modules/libsorcery | 8 ++++---
var/lib/sorcery/modules/libstate | 33
++++++++++++++++++-------------
var/lib/sorcery/modules/libtriggers | 2 -
14 files changed, 68 insertions(+), 39 deletions(-)

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

*: use lock_start_transaction by reference

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

readded a local variable to store the transaction file name

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

liblock: lock_start_transaction now supports returning by reference

diff --git a/ChangeLog b/ChangeLog
index f6d7759..63592f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-18 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * liblock: lock_start_transaction now supports returning by reference
+ readded a local variable to store the transaction file name
+ * *: use lock_start_transaction by reference
+
2008-01-16 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libdepends: added more locking calls #7917
* libgrimoire: 100% speedup of private_installed_version;
unfortunately
diff --git a/usr/sbin/cast b/usr/sbin/cast
index 59853dc..0967270 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -778,7 +778,8 @@ function main() {
if [[ "$CAST_QUEUE" == yes ]] ; then

touch "$INSTALL_QUEUE"
- local tfile=$(lock_start_transaction "$INSTALL_QUEUE")
+ local tfile
+ lock_start_transaction "$INSTALL_QUEUE" tfile
grep -Ev '^$' $INSTALL_QUEUE > $tfile
lock_commit_transaction "$INSTALL_QUEUE"
if [ -s $INSTALL_QUEUE ]; then
diff --git a/usr/sbin/cleanse b/usr/sbin/cleanse
index 548e105..cf151fb 100755
--- a/usr/sbin/cleanse
+++ b/usr/sbin/cleanse
@@ -983,12 +983,12 @@ function cleanse_fix_md5sum_check() {
# the wrong place a future improvement would be
# to use iterate or some other method that is not naive to
# filenames with spaces in them
- tfile=`lock_start_transaction $INSTALL_LOG`
+ lock_start_transaction "$INSTALL_LOG" tfile
sed "s${A}^$LINE\$${A}${A}" $INSTALL_LOG|tr -s '\n' > $tfile
lock_commit_transaction $INSTALL_LOG
message -n '.'

- tfile=`lock_start_transaction $MD5_LOG`
+ lock_start_transaction "$MD5_LOG" tfile
sed "s$A.* $LINE\$${A}${A}" $MD5_LOG|tr -s '\n' > $tfile
lock_commit_transaction $MD5_LOG
message -n '.'
@@ -996,7 +996,7 @@ function cleanse_fix_md5sum_check() {
test -d $POSSESSED_LOGS || mkdir -p $POSSESSED_LOGS

possessed=$POSSESSED_LOGS/$SPELL-$2
- tfile=`lock_start_transaction $possessed`
+ lock_start_transaction "$possessed" tfile
echo $LINE >> $tfile
# remove duplicates
cp $tfile $TMP_DIR/$SPELL.possessed.$$
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index 8d5bd4f..dd8ee73 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -1930,7 +1930,7 @@ sorcery_remove_defaults () {
## cli function
#---------------------------------------------------------------------
sorcery_queue_add() {
- tINSTALL_QUEUE=`lock_start_transaction "$INSTALL_QUEUE"`
+ lock_start_transaction "$INSTALL_QUEUE" tINSTALL_QUEUE
for SPELL in "$@"; do
grep -qE "^$SPELL\$" "$tINSTALL_QUEUE" || echo "$SPELL" >>
"$tINSTALL_QUEUE"
done
@@ -1945,7 +1945,7 @@ sorcery_queue_add() {
## cli function
#---------------------------------------------------------------------
sorcery_queue_remove() {
- tINSTALL_QUEUE=`lock_start_transaction "$INSTALL_QUEUE"`
+ lock_start_transaction "$INSTALL_QUEUE" tINSTALL_QUEUE
for SPELL in "$@"; do
if grep -qE "^$SPELL\$" "$tINSTALL_QUEUE"; then
grep -vE "^$SPELL\$" "$tINSTALL_QUEUE" > "$TMP_DIR/tmp_queue"
diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index 4e1f7e8..3903ae1 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -249,7 +249,8 @@ function run_spell_success() {
# 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
- local t_DEPENDS_STATUS=$(lock_start_transaction $DEPENDS_STATUS)
+ local t_DEPENDS_STATUS
+ lock_start_transaction "$DEPENDS_STATUS" t_DEPENDS_STATUS
get_uncommitted_depends_file $SPELL spell_depends
if [ -e "$spell_depends" ] ; then
cat $spell_depends >> $t_DEPENDS_STATUS
@@ -264,7 +265,8 @@ function run_spell_success() {
# none of the old values are valid, only the new, uncommitted values are
remove_sub_depends $SUB_DEPENDS_STATUS "" "$SPELL"
local spell_sub_depends
- local t_SUB_DEPENDS_STATUS=$(lock_start_transaction $SUB_DEPENDS_STATUS)
+ local t_SUB_DEPENDS_STATUS
+ lock_start_transaction "$SUB_DEPENDS_STATUS" t_SUB_DEPENDS_STATUS
get_uncommitted_sub_depends_file $SPELL spell_sub_depends
if [ -e "$spell_sub_depends" ] ; then
cat $spell_sub_depends >> $t_SUB_DEPENDS_STATUS
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index 4ef82f9..36f03e8 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -222,7 +222,7 @@ function codex_add_grimoire() {

local i
touch $GRIMOIRE_LIST
- tGRIMOIRE_LIST=`lock_start_transaction $GRIMOIRE_LIST`
+ lock_start_transaction "$GRIMOIRE_LIST" tGRIMOIRE_LIST
rm $tGRIMOIRE_LIST
for ((i=0; i<$GRIMOIRE_COUNT;i++)); do
echo GRIMOIRE_DIR[$i]=${GRIMOIRE_DIR[$i]} >> $tGRIMOIRE_LIST
@@ -245,7 +245,7 @@ function codex_remove_grimoire() {

local GRIMOIRES=`codex_get_all_grimoires`

- tGRIMOIRE_LIST=`lock_start_transaction $GRIMOIRE_LIST`
+ lock_start_transaction "$GRIMOIRE_LIST" tGRIMOIRE_LIST
touch $GRIMOIRE_LIST
cp $GRIMOIRE_LIST $GRIMOIRE_LIST_BACKUP
rm -f $tGRIMOIRE_LIST
@@ -282,7 +282,7 @@ function codex_remove_duplicates() {


touch $GRIMOIRE_LIST
- tGRIMOIRE_LIST=`lock_start_transaction $GRIMOIRE_LIST`
+ lock_start_transaction "$GRIMOIRE_LIST" tGRIMOIRE_LIST
rm -f $tGRIMOIRE_LIST


diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 9da13d4..da7ea0b 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -463,11 +463,12 @@ function private_run_depends()
get_uncommitted_depends_file $SPELL spell_depends
spell_sub_depends=$spell_depends.sub
if [ -n "$RECONFIGURE" ]; then
+ local t_spell_p t_abandonded_p
rm -f $DEPENDS_CONFIG/$SPELL
test -f $DEPENDS_CONFIG/$SPELL.p &&
mkdir -p $ABANDONED_PERSIST &&
- local t_spell_p=$(lock_start_transaction "$DEPENDS_CONFIG/$SPELL.p") &&
- local t_abandonded_p=$(lock_start_transaction
"$ABANDONED_PERSIST/$SPELL.p") &&
+ lock_start_transaction "$DEPENDS_CONFIG/$SPELL.p" t_spell_p &&
+ lock_start_transaction "$ABANDONED_PERSIST/$SPELL.p" t_abandonded_p &&
mv -f "$t_spell_p" "$t_abandonded_p" &&
lock_commit_transaction "$DEPENDS_CONFIG/$SPELL.p" &&
lock_commit_transaction "$ABANDONED_PERSIST/$SPELL.p"
diff --git a/var/lib/sorcery/modules/libdispel
b/var/lib/sorcery/modules/libdispel
index 0a9c1e5..d0f5395 100755
--- a/var/lib/sorcery/modules/libdispel
+++ b/var/lib/sorcery/modules/libdispel
@@ -81,7 +81,8 @@ function reap_depends() {
# save the old depends data as abandoned stuff so its seen later on
# recasts as the default
mkdir -p $ABANDONED_DEPENDS
- local t_file=$(lock_start_transaction "$ABANDONED_DEPENDS/$SPELL")
+ local t_file
+ lock_start_transaction "$ABANDONED_DEPENDS/$SPELL" t_file
search_depends_status $DEPENDS_STATUS $SPELL > $t_file
lock_commit_transaction "$ABANDONED_DEPENDS/$SPELL"

diff --git a/var/lib/sorcery/modules/liblock b/var/lib/sorcery/modules/liblock
index 3ed8767..cac21fb 100755
--- a/var/lib/sorcery/modules/liblock
+++ b/var/lib/sorcery/modules/liblock
@@ -232,6 +232,7 @@ function unlock_file()
#---------------------------------------------------------------------
## @param File to start transaction on
## @param <file> ... (optional)
+## @param variable to set (optional)
##
## A transaction locks a file and ensures that changes made to the
## file are all made at once. No changes are made to the file until
@@ -248,7 +249,7 @@ function unlock_file()
function lock_start_transaction()
{
debug "liblock" "$FUNCNAME - $*"
- local NUMTRANS file="$1"
+ local NUMTRANS transaction_file file="$1"

if lock_file "$file" ; then

@@ -259,16 +260,21 @@ function lock_start_transaction()
NUMTRANS=${NUMTRANS:-1} # TODO: check if this should fallback to 0

let NUMTRANS++
+ transaction_file="$LOCK_TRANSACTIONS.$NUMTRANS"
# cp file to temp file or if doesn't exist, create an empty file.
if [[ -e $file ]]; then
- cp "$file" "$LOCK_TRANSACTIONS.$NUMTRANS"
+ cp "$file" "$transaction_file"
else
- echo -n "" > $LOCK_TRANSACTIONS.$NUMTRANS
+ echo -n "" > "$transaction_file"
fi
echo "$NUMTRANS:$file:$$" >$LOCK_TRANSACTIONS

unlock_file $LOCK_TRANSACTIONS
- echo "$LOCK_TRANSACTIONS.$NUMTRANS"
+ if [[ $2 ]]; then
+ eval "$2=\"\$transaction_file\""
+ else
+ echo "$transaction_file"
+ fi
return 0

else
@@ -377,7 +383,8 @@ function counter_down() {
counterfile="${LOCK_DIR}/${counterfile//\//^}"

touch $counterfile
- local tc=$(lock_start_transaction $counterfile)
+ local tc
+ lock_start_transaction "$counterfile" tc
for each in $(counter_clean $tc); do
[[ $foo ]] && echo $each && continue
if [[ $each == $$ ]] ; then foo=found ; else echo $each; fi
@@ -417,7 +424,8 @@ function counter_check() {
# we replace / with ^
counterfile="${LOCK_DIR}/${counterfile//\//^}"
if test -f $counterfile ; then
- local tc=$(lock_start_transaction $counterfile)
+ local tc
+ lock_start_transaction "$counterfile" tc
# sort saves a temp file since it has to read all the input
counter_clean $tc |sort > $tc
lock_commit_transaction $counterfile
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index a7450b7..82d3390 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -731,7 +731,8 @@ function real_persistent_save () {
local VAR
local TMP
local file=$SPELL_CONFIG.p
- local tfile=$(lock_start_transaction $file)
+ local tfile
+ lock_start_transaction "$file" tfile
> "$tfile"
for VAR in $PERSISTENT_VARIABLES; do
config_get_option $VAR TMP
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index b701923..72d6212 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -575,7 +575,8 @@ function resurrect_success() {
# none of the old values are valid, only the new, uncommitted values are
remove_depends_status $DEPENDS_STATUS $SPELL
local spell_depends=$OLD_TABLET_DIR/depends
- local t_DEPENDS_STATUS=$(lock_start_transaction "$DEPENDS_STATUS")
+ local t_DEPENDS_STATUS
+ lock_start_transaction "$DEPENDS_STATUS" t_DEPENDS_STATUS
if [ -e $spell_depends ] ; then
cat $spell_depends >> $t_DEPENDS_STATUS
fi
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index c4423f1..73c886a 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -659,7 +659,7 @@ function pop_queue() { (
local ITEM=`esc_str $2`
local exit_code=0

- tQUEUE_FILE=$( lock_start_transaction $1 )
+ lock_start_transaction "$1" tQUEUE_FILE
if ! [ -f "$1" ]; then
exit_code=1
elif [ -n "$ITEM" ]; then
@@ -709,7 +709,8 @@ function pop_install_queue() {
function push_queue() {

pop_queue "$1" "$2"
- local t_file=$(lock_start_transaction "$1")
+ local t_file
+ lock_start_transaction "$1" t_file
echo "$2" >> "$t_file";
lock_commit_transaction "$1"

@@ -1028,7 +1029,8 @@ function install_queue_history() {
get_new_changes "Viewing history since last update ($datedash) for spell
-- ${spell} -- :" "$date" "$(codex_find_spell_by_name $spell)/HISTORY"

if query "Would you like to ${RED}remove ${QUERY_COLOR}spell
$SPELL_COLOR$spell$QUERY_COLOR from the install queue?" n; then
- local t_queue=$(lock_start_transaction "$INSTALL_QUEUE")
+ local t_queue
+ lock_start_transaction "$INSTALL_QUEUE" t_queue
sedit "s/^$spell$//" "$t_queue"
lock_commit_transaction "$INSTALL_QUEUE"
echo -e "${QUERY_COLOR} The spell ${SPELL_COLOR} $spell ${QUERY_COLOR}
removed from $INSTALL_QUEUE.${DEFAULT_COLOR}"
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 5e7d7ef..9b3160d 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -45,7 +45,8 @@ function add_depends()
return 1
fi

- local t_status=$(lock_start_transaction "$depends_status")
+ local t_status
+ lock_start_transaction "$depends_status" t_status
echo "$1:$2:$3:$4:$5:$6" >> "$t_status"
lock_commit_transaction "$depends_status"

@@ -221,7 +222,8 @@ function remove_depends_status()
a5=${a5:-.*}; a6=${a6:-.*}
[[ "$a5" == "[none]" ]] && a5="\\[none\\]"

- local t_status=$(lock_start_transaction "$depends_status")
+ local t_status
+ lock_start_transaction "$depends_status" t_status
sedit "/^$a1:$a2:$a3:$a4:$a5:$a6$/D" "$t_status"
lock_commit_transaction "$depends_status"
}
@@ -308,7 +310,8 @@ function add_sub_depends() {
local file=$1
shift

- local t_file=$(lock_start_transaction "$file")
+ local t_file
+ lock_start_transaction "$file" t_file
echo "$1:$2:$3" >> "$t_file"
lock_commit_transaction "$file"
}
@@ -355,7 +358,8 @@ function remove_sub_depends() {
a1=`esc_str "$1"`; a2=`esc_str "$2"`; a3=`esc_str "$3"`
a1=${a1:-.*}; a2=${a2:-.*}; a3=${a3:-.*}

- local t_file=$(lock_start_transaction "$file")
+ local t_file
+ lock_start_transaction "$file" t_file
sedit "/^$a1:$a2:$a3$/D" "$t_file"
lock_commit_transaction "$file"
}
@@ -414,7 +418,7 @@ function add_default_depends() {
return 1
fi

- tfile=`lock_start_transaction $file`
+ lock_start_transaction "$file" tfile
remove_default_depends $tfile $1 $2
echo "$1:$2:$3" >> $tfile
lock_commit_transaction $file
@@ -445,7 +449,8 @@ function remove_default_depends() {

a3=${a3:-.*}

- local t_file=$(lock_start_transaction "$file")
+ local t_file
+ lock_start_transaction "$file" t_file
sedit "/^$a1:$a2:$a3$/D" $t_file
lock_commit_transaction "$file"
}
@@ -510,7 +515,7 @@ function add_default_provider() {
return 1
fi

- tfile=`lock_start_transaction $file`
+ lock_start_transaction "$file" tfile
remove_default_provider $tfile "" $2
echo "$1:$2:$3" >> $tfile
lock_commit_transaction $file
@@ -555,7 +560,7 @@ function add_spell_status()
fi
[[ $spell ]] && [[ $action ]] && [[ $version ]] || return 1
date=`date +%Y%m%d`
- tSPELL_STATUS=`lock_start_transaction $SPELL_STATUS`
+ lock_start_transaction "$SPELL_STATUS" tSPELL_STATUS
echo "$spell:$date:$action:$version" >> $tSPELL_STATUS
lock_commit_transaction $SPELL_STATUS

@@ -741,7 +746,7 @@ function real_spell_exiled() {
function remove_spell_status()
{ #$1=spell to remove status of

- tSPELL_STATUS=`lock_start_transaction $SPELL_STATUS`
+ lock_start_transaction "$SPELL_STATUS" tSPELL_STATUS
grep -v "^$1:" $SPELL_STATUS > $tSPELL_STATUS
lock_commit_transaction $SPELL_STATUS

@@ -783,7 +788,8 @@ function all_spell_status()
##
#---------------------------------------------------------------------
function set_held () {
- local t_status=$(lock_start_transaction $SPELL_STATUS)
+ local t_status
+ lock_start_transaction "$SPELL_STATUS" t_status
for to_hold in $@; do
sedit 's/\(^'$(esc_str $to_hold)':[^:]*:\)installed/\1held/'
$t_status
done
@@ -857,7 +863,8 @@ function set_unexiled () {
##
#---------------------------------------------------------------------
function set_unheld () {
- local t_status=$(lock_start_transaction $SPELL_STATUS)
+ local t_status
+ lock_start_transaction "$SPELL_STATUS" t_status
for to_hold in $@; do
sedit 's/\(^'$(esc_str $to_hold)':[^:]*:\)held/\1installed/'
$t_status
done
@@ -939,7 +946,7 @@ function modify_config() {
fi

# remove previous reference
- tFILE=`lock_start_transaction $FILE`
+ lock_start_transaction "$FILE" tFILE
grep -v "^[[:blank:]]*${1}${separator}" $FILE > $tFILE

# justifying...
@@ -987,7 +994,7 @@ function remove_config() {
else separator="=" ; fi

# remove previous reference
- tFILE=`lock_start_transaction $FILE`
+ lock_start_transaction "$FILE" tFILE
grep -v "^[[:blank:]]*${1}${separator}" $FILE > $tFILE
lock_commit_transaction $FILE

diff --git a/var/lib/sorcery/modules/libtriggers
b/var/lib/sorcery/modules/libtriggers
index 539ef97..9920dc1 100755
--- a/var/lib/sorcery/modules/libtriggers
+++ b/var/lib/sorcery/modules/libtriggers
@@ -34,7 +34,7 @@ function remove_triggers ()
debug "libtriggers" "remove_triggers - $*"

[ -f $TRIGGER_LIST ] || return 0
- tTRIGGER_LIST=`lock_start_transaction $TRIGGER_LIST`
+ lock_start_transaction "$TRIGGER_LIST" tTRIGGER_LIST
[ -f $tTRIGGER_LIST ] || return 0
grep -v "^$SPELL:" $TRIGGER_LIST > $tTRIGGER_LIST
lock_commit_transaction $TRIGGER_LIST



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (ad1fca2d26c4dde52480f5521436ad8813f53813), Jaka Kranjc, 01/18/2008

Archive powered by MHonArc 2.6.24.

Top of Page