# HG changeset patch # User Pascal Bellard # Date 1262688990 -3600 # Node ID 031f6e973842049edfca5e99ec48b3a2295c8ca4 # Parent ca310437a4a4919eec75391659d2ffeb638a8b49 slitaz-dev-tools: add tazdev purge diff -r ca310437a4a4 -r 031f6e973842 slitaz-dev-tools/stuff/tazdev --- a/slitaz-dev-tools/stuff/tazdev Mon Jan 04 23:24:52 2010 +0100 +++ b/slitaz-dev-tools/stuff/tazdev Tue Jan 05 11:56:30 2010 +0100 @@ -30,6 +30,7 @@ chroot Mount virtual fs if needed and chroot into the build env. gen-chroot Generate a chroot using the last cooking base rootfs. clean-chroot Clean a chroot environment (skip root/ and home/). + purge Remove obsolate packages and obsolate source tarballs. push Upload new packages to the main mirror (-p). dry-push Show what will be uploaded to the mirror. Does nothing (-dp). pull Download new packages from the main mirror. @@ -145,6 +146,45 @@ echo -e "Example: tazdev chroot $ROOTFS\n" } +# Remove obsolate slitaz packages +purge_packages() +{ + TMP_FILE=/tmp/tazdev.$$ + ls $BUILD_WOK | while read pkg; do + [ -f $BUILD_WOK/$pkg/taz/*/receipt ] || continue + EXTRAVERSION="" + . $BUILD_WOK/$pkg/taz/*/receipt + echo $PACKAGE-$VERSION$EXTRAVERSION.tazpkg + done > $TMP_FILE + ls $SLITAZ/chroot/home/slitaz/packages | while read pkg; do + case "$pkg" in + *.tazpkg) + grep -q ^$pkg$ $TMP_FILE && continue + echo Remove $pkg + rm -f $SLITAZ/chroot/home/slitaz/packages/$pkg ;; + esac + done + rm -f $TMP_FILE +} + +# Remove obsolate source tarballs +purge_sources() +{ + TMP_FILE=/tmp/tazdev.$$ + ls $BUILD_WOK | while read pkg; do + [ -f $BUILD_WOK/$pkg/taz/*/receipt ] || continue + TARBALL="" + . $BUILD_WOK/$pkg/taz/*/receipt + [ -n "$TARBALL" ] && echo $TARBALL + done > $TMP_FILE + ls $SLITAZ/chroot/home/slitaz/src | while read pkg; do + grep -q ^$pkg$ $TMP_FILE && continue + echo Remove $pkg + rm -f $SLITAZ/chroot/home/slitaz/src/$pkg + done + rm -f $TMP_FILE +} + case "$1" in cmplog) # Log 'tazwok cmp' for the web interface (can be used via a cron job). @@ -260,6 +300,12 @@ check_mirror $@ rsync -r -t -l -v -z --delete --dry-run \ -e ssh $USER@$MIRROR:$REMOTE_DIR $LOCAL_DIR ;; + purge) + check_root + get_version $@ + purge_packages + purge_sources + ;; usage|*) usage ;; esac