[Lunar-commits] CVS: theedge/var/lib/lunar/functions main.lunar,
1.18, 1.19
Auke Kok
sofar at lunar-linux.org
Mon Oct 25 19:18:05 UTC 2004
Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/tmp/cvs-serv1532
Modified Files:
main.lunar
Log Message:
Resurrect code fix: #510. This code gently unpacks parts of the tarball given certain conditions, pre-unpacks directories and symlinks too etc. and honors $EXCLUDED algorithms. Tested mildly with postfix etc.
Index: main.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/main.lunar,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- main.lunar 27 Sep 2004 21:41:05 -0000 1.18
+++ main.lunar 25 Oct 2004 19:18:03 -0000 1.19
@@ -112,10 +112,54 @@
message "${MESSAGE_COLOR}Starting rebuild of modules${DEFAULT_COLOR}"
lin -c $QUEUE
fi
-
}
+expand_cache_safe() { (
+ debug_msg "expand_cache_safe ($@)"
+
+ export SOURCE_DIRECTORY=$BUILD_DIRECTORY/resurrect-$MODULE-$VERSION
+ mk_source_dir $SOURCE_DIRECTORY
+ # untar the file so we can compare first
+ tar -pkxjf $1 -C $SOURCE_DIRECTORY 1>/dev/null 2>&1
+ # make a md5sum list of files
+ TMP_TARGETS=$(temp_create "resurrect.targets.$MODULE")
+ tar j --list < $1 > $TMP_TARGETS
+ TMP_TARGETS_OK=$(temp_create "resurrect.targets_OK.$MODULE")
+ # do directories: we don't care here
+ for TARGET in $(cat $TMP_TARGETS | directories) ; do
+ debug_msg "mkdir -p $TARGET"
+ mkdir -p $TARGET
+ done
+ # do links
+ for TARGET in $(find $SOURCE_DIRECTORY -type l | sed "s:$SOURCE_DIRECTORY::g" ) ; do
+ # wipe the current link cos it ruins things
+ if [ -h "$TARGET" ] ; then
+ rm -f "$TARGET"
+ fi
+ debug_msg "ln -s $(readlink $SOURCE_DIRECTORY$TARGET) $TARGET"
+ echo "$TARGET" >> $TMP_TARGETS_OK
+ done
+ # do files - bulk process the normal ones
+ cat $TMP_TARGETS | grep -v -f $EXCLUDED >> $TMP_TARGETS_OK
+ # now double check the EXCLUDED ones
+ for TARGET in $(cat $TMP_TARGETS | files | grep -f $EXCLUDED ) ; do
+ if [ -e "$TARGET" ] ; then
+ debug_msg "Cowardishly not overwriting \"$TARGET\""
+ else
+ echo "$TARGET" >> $TMP_TARGETS_OK
+ fi
+ done
+
+ debug_msg "tar xjf $1 -P -k -T $TMP_TARGETS_OK"
+ tar xjf $1 -P -k -T $TMP_TARGETS_OK > /dev/null 2>&1
+
+ temp_destroy $TMP_TARGETS
+ temp_destroy $TMP_TARGETS_OK
+ rm_source_dir $SOURCE_DIRECTORY
+)}
+
+
resurrect() {
(
debug_msg "resurrect ($@)"
@@ -143,7 +187,7 @@
if [ -f "$CACHE_BZ" ] && bzip2 -tf $CACHE_BZ ; then
message "${RESURRECT_COLOR}Resurrecting ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR} ${MESSAGE_COLOR}version ${VERSION_COLOR}${VERSION}${DEFAULT_COLOR}"
- bzip2 -cd $CACHE_BZ | tar -Pkx 1>/dev/null 2>&1
+ expand_cache_safe $CACHE_BZ &&
add_module $MODULE $STATUS $VERSION &&
verbose_msg "running \"lunar fix $MODULE\"" &&
if run_fix $MODULE ; then
More information about the Lunar-commits
mailing list