[SM-Commit] PERFORCE change 77076 by Karsten Behrmann for review

Perforce Review Daemon p4review at smee.org
Fri Mar 31 11:20:01 EST 2006


Change 77076 by karsten_behrmann at karsten_behrmann-karsten on 2006/03/31 17:17:11

	several caster tweaks, most noticeable detection of whether or not
	a spell needs updating updated to use the new variables too

Affected files ...

... //sgl/cauldron/devel/ChangeLog#88 edit
... //sgl/cauldron/devel/iso/generation-scripts/caster#12 edit
... //sgl/cauldron/devel/iso/generation-scripts/nightlybuild.sh#4 edit

Differences ...

==== //sgl/cauldron/devel/ChangeLog#88 (text) ====

@@ -1,3 +1,7 @@
+2006-03-31 Karsten Behrmann <BearPerson at sourcemage.org>
+	* caster: fixes with detection if a spell needs to be updated
+	* nightlybuild.sh: fix typo in log naming
+
 2006-03-30 Karsten Behrmann <BearPerson at sourcemage.org>
 	* gen-scripts/{autoupdate.sh,nightlybuild.sh,sanitize-chroot.sh}:
 	  add scripts for automated unattended updates/builds

==== //sgl/cauldron/devel/iso/generation-scripts/caster#12 (xtext) ====

@@ -40,10 +40,10 @@
   {
     gaze install $SPELL ||
     tar -xjOf ${INSTALL_CACHE}/${SPELL}-${VERSION}-${HOST}.tar${EXTENSION} \
-      ${INSTALL_LOGS#/}/$SPELL-$VERSION ||
+      --occurrence ${INSTALL_LOGS#/}/$SPELL-$VERSION ||
     # try without leading / first
     tar -xjOf ${INSTALL_CACHE}/${SPELL}-${VERSION}-${HOST}.tar${EXTENSION} \
-      $INSTALL_LOGS/$SPELL-$VERSION
+      --occurrence $INSTALL_LOGS/$SPELL-$VERSION
     echo $? >$rclog
     # This is a subshell. We can't just set a variable.
     # Exit code of a pipe is the exit code of the last command, here: "sort".
@@ -61,9 +61,22 @@
   done
 }
 
-function get_updated() {
-  tar -xjOf "$1" 'var/state/sorcery/tablet/*/*/updated' ||
-  echo 0
+function needs_updating() {
+  local TMPTABDIR=/tmp/tabletstuff.$$
+  mkdir -p $TMPTABDIR
+    tar -C $TMPTABDIR -xjOf "$1" --occurrence \
+      'var/state/sorcery/tablet/*/*/updated' \
+      'var/state/sorcery/tablet/*/*/patchlevel' \
+      'var/state/sorcery/tablet/*/*/security_patch'
+  popd
+  CACHE_UPDATED=$(cat $TMPTABDIR/var/state/sorcery/tablet/*/*/updated)
+  CACHE_PATCHLEVEL=$(cat $TMPTABDIR/var/state/sorcery/tablet/*/*/patchlevel)
+  CACHE_SECPATCH=$(cat $TMPTABDIR/var/state/sorcery/tablet/*/*/security_patch)
+  rm -rf $TMPTABDIR
+  [[ ${UPDATED:-0} > ${CACHE_UPDATED:-0} ]] && return 0
+  [[ ${PATCHLEVEL:-0} > ${CACHE_PATCHLEVEL:-0} ]] && return 0
+  [[ ${SECURITY_PATCH:-0} > ${CACHE_SECPATCH:-0} ]] && return 0
+  return 1
 }
 
 if [ "$1" == "-c" ] ;then
@@ -87,38 +100,40 @@
 for spell in "$@" ; do
   codex_set_current_spell_by_name $spell
   cachefile=${INSTALL_CACHE}/${SPELL}-${VERSION}-${HOST}.tar${EXTENSION}
-  if [ $RECAST ] ||
-     ! test -e $cachefile ||
-     test $UPDATED -gt $(get_updated $cachefile)
-  then
+
+  if ! test -e $cachefile || [ $RECAST ] || needs_updating $cachefile ;then
 
-    rm -f /tmp/old-install-log
-    try_get_install_log >/tmp/tmp-install-log &&
-    cat /tmp/tmp-install-log | filter_dirs >/tmp/old-install-log
-    # do not create the file when try_get_install_log fails
+    rm -f /tmp/old-install-log /tmp/tmp-install-log
+    try_get_install_log >/tmp/tmp-install-log || rm /tmp/tmp-install-log
 
     prepare_cast
     pre_workaround $spell
     cast --deps $spell
-    pre_workaround $spell
-    # Workaround until --deps works again, currently only openssh is affected
+    rm -f $cachefile
     cast -c $spell
     rc=$?
     post_workaround $spell
-    if ! test -e $cachefile || test $UPDATED -gt $(get_updated $cachefile)
-    then # nonexisting or stale cache
+    if ! test -e $cachefile ;then # ARCHIVE=off
       if [[ $rc == 0 ]] && gaze install $spell >/dev/null ;then
         message "Forcing generation of cache"
-        gaze install-full $spell | tar --no-recursion -cjf $cachefile -T -
+        pushd / >/dev/null
+          # This is how current sorcery makes caches (not quite intentional)
+          gaze install-full $spell | sed 's:^/::' |
+            tar --no-recursion -cjPf $cachefile -T -
+        popd >/dev/null
       fi
     fi
 
+    [ -e /tmp/tmp-install-log] &&
+    cat /tmp/tmp-install-log | filter_dirs >/tmp/old-install-log
+    # filter_dirs only once all the dirs referenced exist
+
     gaze install $spell >/tmp/tmp-install-log &&
     cat /tmp/tmp-install-log | filter_dirs >/tmp/new-install-log &&
     # again, preserving exit status from gaze install
     if [ -e /tmp/old-install-log ] && 
      ! diff /tmp/old-install-log /tmp/new-install-log >/dev/null ;then
-      message "OOPS... Spell ${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}\
+      message "OOPS... Spell ${SPELL_COLOR}${SPELL}${DEFAULT_COLOR} \
 install log suddenly changed..."
       datestr=$(date +%s)
       cp /tmp/old-install-log ~/broken-logs/${SPELL}-${datestr}-pre

==== //sgl/cauldron/devel/iso/generation-scripts/nightlybuild.sh#4 (xtext) ====

@@ -1,5 +1,5 @@
 #!/bin/bash
-LOGFILE="$(pwd)/isogen-log.$(date +%Y%m%d%h)"
+LOGFILE="$(pwd)/isogen-log.$(date +%Y%m%d%H)"
 [[ -e mkprep ]] ||
   cd ${0%/*}
 



More information about the SM-Commit mailing list