Skip to Content.
Sympa Menu

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

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 (95eb54f2fafad8e3319365f2044ce7e38699df60)
  • Date: Fri, 5 Sep 2008 15:05:55 -0500

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

ChangeLog | 7 +++++++
usr/sbin/alter | 2 ++
usr/sbin/cleanse | 16 +++++++++-------
usr/sbin/delve | 2 ++
usr/sbin/dispel | 2 ++
usr/sbin/sorcery | 15 +++++++++------
var/lib/sorcery/modules/build_api/common | 3 +--
var/lib/sorcery/modules/libmisc | 15 ++++++++++++---
var/lib/sorcery/modules/libtriggers | 7 +++++++
9 files changed, 51 insertions(+), 18 deletions(-)

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

common: use spell_ok instead of spell_installed || spell_held

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

sorcery: properly check if the queue is not empty and use spell_ok

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

cleanse: simplified a few lines and made the symlink check locale
agnostic

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

added more locking calls #7917

diff --git a/ChangeLog b/ChangeLog
index e900069..93a37c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-05 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * *: added more locking calls #7917
+ * cleanse: simplified a few lines and made the symlink check locale
+ agnostic and single-spaced
+ * sorcery: properly check if the queue is not empty and use spell_ok
+ * common: use spell_ok instead of spell_installed || spell_held
+
2008-09-03 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libtablet: fixed broken repair file handling - a nonexisting tablet
file caused the function to use the previous found tablet file,
diff --git a/usr/sbin/alter b/usr/sbin/alter
index 3d57e2e..4759998 100755
--- a/usr/sbin/alter
+++ b/usr/sbin/alter
@@ -23,6 +23,7 @@ EOF

source /etc/sorcery/config
SPELL=${SPELL:=alter}
+ lock_resources "cast" "$SPELL"
VERSION="$(gaze -q installed "$SPELL" | grep -v 'not installed')"
[ -z "$VERSION" ] && VERSION=$$
TMP_LOG=$TMP_DIR/$SPELL-$VERSION
@@ -70,6 +71,7 @@ EOF
add_spell "$SPELL" installed "$VERSION"
rm $C_LOG
report_install
+ unlock_resources "cast" "$SPELL"

return 0

diff --git a/usr/sbin/cleanse b/usr/sbin/cleanse
index 34b44bd..a9e66dc 100755
--- a/usr/sbin/cleanse
+++ b/usr/sbin/cleanse
@@ -306,6 +306,7 @@ function prune_depends()

# Lock the depends file so no one messes with it while it's being worked on
lock_file $DEPENDS_STATUS
+ lock_file $SPELL_STATUS

# Get a list of bad dependencies
# Output is in the form "SPELL DEPENDENCY optional/reqired PROVIDER"
@@ -324,6 +325,7 @@ function prune_depends()
printf("%s %s %s %s\n", $1, $2, $4, prov);
}' $DEPENDS_STATUS ) )

+ unlock_file $SPELL_STATUS
# Set the function args to the spells with problems
set -- ${bad[@]}
while [ $# -gt 0 ] ; do
@@ -338,7 +340,7 @@ function prune_depends()
local CANDIDATES=$( find_providers $4 )
provider=""
for spell in $CANDIDATES; do
- if spell_installed $spell || spell_held $spell; then
+ if spell_ok $spell; then
local provider=$spell
break
fi
@@ -701,7 +703,7 @@ function cleanse_fix_find_check() {
return 1;
fi

- local size=$(wc -l $I_LOG | awk '{print $1;}')
+ local size=$(wc -l < $I_LOG)
local count=0

local TMP_I_LOG=$TMP_DIR/${SPELL}/install.log
@@ -867,14 +869,14 @@ function cleanse_fix_sym_check() {
filter_volatiles |
log_adjuster /dev/stdin $TMP_I_LOG filterable root

- local size=$(wc -l $TMP_I_LOG | awk '{print $1;}')
+ local size=$(wc -l < $TMP_I_LOG)
local count=0

while read LINE ; do
progress_bar $count $size 50
- # Add this if so 'file' doesn't have to run for everything,
- # check that's a symlink first
- if [ -h "$LINE" ] && file "$LINE" | grep "broken symbolic link" ; then
+ # check that it is a symlink first, then if it is broken
+ # readlink -e requires all path elements to exist
+ if [[ -h $LINE ]] && ! readlink -q -e "$LINE" > /dev/null; then
BADLIST="${BADLIST}${LINE}"$'\n'
fi
let count++
@@ -883,7 +885,7 @@ function cleanse_fix_sym_check() {
clear_line

if [[ $BADLIST ]] ; then
- message "${PROBLEM_COLOR}The following symlinks from " \
+ message "${PROBLEM_COLOR}The following symlinks from" \
"${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
"${PROBLEM_COLOR}don't link to files it installed:" \
"${DEFAULT_COLOR}"
diff --git a/usr/sbin/delve b/usr/sbin/delve
index dba3aa2..39661a2 100755
--- a/usr/sbin/delve
+++ b/usr/sbin/delve
@@ -78,9 +78,11 @@ function delve_log_helper() {
run_spell_config

get_uncommitted_depends_file $SPELL spell_depends
+ lock_file $ABANDONED_DEPENDS/$SPELL
if test -e $spell_depends && test -e $ABANDONED_DEPENDS/$SPELL ; then
cp $ABANDONED_DEPENDS/$SPELL $spell_depends
fi
+ unlock_file $ABANDONED_DEPENDS/$SPELL
test -e $spell_depends &&
OPTS="$OPTS $(get_depends_options $spell_depends $SPELL)"
fi
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index 490ddeb..74a4a80 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -548,6 +548,7 @@ function dispel_depends_engine() {
# spell, the spell is not recastable
# note: this doesnt take into account the spell changing out from
# under us. Oh well.
+ lock_file $DEPENDS_STATUS
for child in $borkers; do
type=$(grep -m 1 "$parent:$child\(([^:]*)\)\?:on"
$DEPENDS_STATUS|cut -f4 -d:)
if [[ "$type" == required ]]; then
@@ -563,6 +564,7 @@ function dispel_depends_engine() {
list_add optional_borkers $child
fi
done
+ unlock_file $DEPENDS_STATUS
if [[ $recastable == yes ]] ; then
dispel_parents_list_borkers $parent "$optional_borkers" \
"$runtime_borkers" "$suggested_borkers"
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index b3efeb3..4024ce6 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -515,8 +515,7 @@ make_checklist() {

STATUS="OFF"

- if spell_installed $SPELL ||
- spell_held $SPELL
+ if spell_ok $SPELL
then STATUS="on"
else STATUS="off"
fi
@@ -1405,18 +1404,22 @@ queue_menu() {
"s" "Edit spell status" "$s_HELP"'`

do
+ lock_file $SPELL_STATUS
+ lock_file $INSTALL_QUEUE
+ lock_file $REMOVE_QUEUE

case $COMMAND in
-
S) show_file $SPELL_STATUS ;;
s) edit_file $SPELL_STATUS ;;
I) show_file $INSTALL_QUEUE ;;
i) edit_file $INSTALL_QUEUE ;;
R) show_file $REMOVE_QUEUE ;;
r) edit_file $REMOVE_QUEUE ;;
-
esac

+ unlock_file $SPELL_STATUS
+ unlock_file $INSTALL_QUEUE
+ unlock_file $REMOVE_QUEUE
done

}
@@ -1674,7 +1677,7 @@ background_execute() {
dispel `cat $REMOVE_QUEUE` 1>/dev/null 2>&1
rm -f $REMOVE_QUEUE

- if [ -f $INSTALL_QUEUE ]; then
+ if [[ -s $INSTALL_QUEUE ]]; then
cast --deps `cat $INSTALL_QUEUE`
( cast `cat $INSTALL_QUEUE` 1>/dev/null 2>&1 &&
rm $INSTALL_QUEUE
@@ -1692,7 +1695,7 @@ foreground_execute() {
dispel `cat $REMOVE_QUEUE`
rm -f $REMOVE_QUEUE

- [ -f $INSTALL_QUEUE ] &&
+ [[ -s $INSTALL_QUEUE ]] &&
cast `cat $INSTALL_QUEUE`
rm -f $INSTALL_QUEUE

diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index 9cad77d..1996150 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -117,8 +117,7 @@ function real_prepare_install() { (

lock_resources "libgrimoire" "install"

- if spell_installed $SPELL ||
- spell_held $SPELL
+ if spell_ok $SPELL
then

trap "spell_recover" SIGINT
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index f9c1778..7da2b6d 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1532,7 +1532,8 @@ function append_to_notice_log() {

tee $tmp_log
if [[ -s $tmp_log ]]; then
- message "$SPELL_COLOR$SPELL:$DEFAULT_COLOR" >> $notice_log
+ # use echo -e instead of message if we ever bring SILENT back
+ echo -e "$SPELL_COLOR$SPELL:$DEFAULT_COLOR" >> $notice_log
cat $tmp_log >> $notice_log
echo >> $notice_log
fi
@@ -1546,10 +1547,15 @@ function append_to_notice_log() {
## @param reason
#---------------------------------------------------------------------
function log_failure_reason() {
+ [[ -z $CAST_BACKUPDIR ]] && return 1
+
# delve has a different TMP_DIR, so we can't use it
local failure_reason_log=$CAST_BACKUPDIR/failure_reason_log
- [[ -z $CAST_BACKUPDIR ]] && return 1
- echo "$SPELL ($1)" >> "$failure_reason_log"
+ local frl
+
+ lock_start_transaction "$failure_reason_log" frl
+ echo "$SPELL ($1)" >> "$frl"
+ lock_commit_transaction "$failure_reason_log"
}

#---------------------------------------------------------------------
@@ -1564,7 +1570,10 @@ function get_failure_reason() {
local _reason

# if a spell has more than one entry, the first will be used
+ lock_file $failure_reason_log
_reason=$(grep -s -m1 "^$SPELL " $failure_reason_log | sed
's,^[^(]*(\([^)]*\)).*$,\1,')
+ unlock_file $failure_reason_log
+
upvar $_upvar "$_reason"
}

diff --git a/var/lib/sorcery/modules/libtriggers
b/var/lib/sorcery/modules/libtriggers
index 9bf3676..72a3a80 100755
--- a/var/lib/sorcery/modules/libtriggers
+++ b/var/lib/sorcery/modules/libtriggers
@@ -60,6 +60,7 @@ function trigger ()
esc_str "${SPELL:-$2}" spell

[ -f $TRIGGER_LIST ] || return 0
+ # no locking of $TRIGGER_LIST since the triggered actions may need it
iterate do_trigger $'\n' "`grep "^[^:]*:$spell:on_$action" $TRIGGER_LIST`"
}

@@ -72,9 +73,12 @@ function get_triggerees() {
local each
# get all the cast/check_self triggers
[ -f $TRIGGER_LIST ] || return 0
+
+ lock_file $TRIGGER_LIST
for each in $3 ; do
grep "[^:]*:$spell:$event:$each" $TRIGGER_LIST|cut -f1 -d:
done|sort -u|grep -v '^$'
+ unlock_file $TRIGGER_LIST
}

#---------------------------------------------------------------------
@@ -85,7 +89,10 @@ function get_run_script_triggers() {
local spell=$1
local event=$2
local target=$3
+
+ lock_file $TRIGGER_LIST
grep "$target:$spell:$event:run_script" $TRIGGER_LIST|cut -f4 -d:
+ unlock_file $TRIGGER_LIST
}

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



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (95eb54f2fafad8e3319365f2044ce7e38699df60), Jaka Kranjc, 09/05/2008

Archive powered by MHonArc 2.6.24.

Top of Page