wok rev 4717
slitaz-dev-tools: add tazdev purge
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jan 05 11:56:30 2010 +0100 (2010-01-05) |
parents | ca310437a4a4 |
children | 8fbfc72ff1a2 |
files | slitaz-dev-tools/stuff/tazdev |
line diff
1.1 --- a/slitaz-dev-tools/stuff/tazdev Mon Jan 04 23:24:52 2010 +0100 1.2 +++ b/slitaz-dev-tools/stuff/tazdev Tue Jan 05 11:56:30 2010 +0100 1.3 @@ -30,6 +30,7 @@ 1.4 chroot Mount virtual fs if needed and chroot into the build env. 1.5 gen-chroot Generate a chroot using the last cooking base rootfs. 1.6 clean-chroot Clean a chroot environment (skip root/ and home/). 1.7 + purge Remove obsolate packages and obsolate source tarballs. 1.8 push Upload new packages to the main mirror (-p). 1.9 dry-push Show what will be uploaded to the mirror. Does nothing (-dp). 1.10 pull Download new packages from the main mirror. 1.11 @@ -145,6 +146,45 @@ 1.12 echo -e "Example: tazdev chroot $ROOTFS\n" 1.13 } 1.14 1.15 +# Remove obsolate slitaz packages 1.16 +purge_packages() 1.17 +{ 1.18 + TMP_FILE=/tmp/tazdev.$$ 1.19 + ls $BUILD_WOK | while read pkg; do 1.20 + [ -f $BUILD_WOK/$pkg/taz/*/receipt ] || continue 1.21 + EXTRAVERSION="" 1.22 + . $BUILD_WOK/$pkg/taz/*/receipt 1.23 + echo $PACKAGE-$VERSION$EXTRAVERSION.tazpkg 1.24 + done > $TMP_FILE 1.25 + ls $SLITAZ/chroot/home/slitaz/packages | while read pkg; do 1.26 + case "$pkg" in 1.27 + *.tazpkg) 1.28 + grep -q ^$pkg$ $TMP_FILE && continue 1.29 + echo Remove $pkg 1.30 + rm -f $SLITAZ/chroot/home/slitaz/packages/$pkg ;; 1.31 + esac 1.32 + done 1.33 + rm -f $TMP_FILE 1.34 +} 1.35 + 1.36 +# Remove obsolate source tarballs 1.37 +purge_sources() 1.38 +{ 1.39 + TMP_FILE=/tmp/tazdev.$$ 1.40 + ls $BUILD_WOK | while read pkg; do 1.41 + [ -f $BUILD_WOK/$pkg/taz/*/receipt ] || continue 1.42 + TARBALL="" 1.43 + . $BUILD_WOK/$pkg/taz/*/receipt 1.44 + [ -n "$TARBALL" ] && echo $TARBALL 1.45 + done > $TMP_FILE 1.46 + ls $SLITAZ/chroot/home/slitaz/src | while read pkg; do 1.47 + grep -q ^$pkg$ $TMP_FILE && continue 1.48 + echo Remove $pkg 1.49 + rm -f $SLITAZ/chroot/home/slitaz/src/$pkg 1.50 + done 1.51 + rm -f $TMP_FILE 1.52 +} 1.53 + 1.54 case "$1" in 1.55 cmplog) 1.56 # Log 'tazwok cmp' for the web interface (can be used via a cron job). 1.57 @@ -260,6 +300,12 @@ 1.58 check_mirror $@ 1.59 rsync -r -t -l -v -z --delete --dry-run \ 1.60 -e ssh $USER@$MIRROR:$REMOTE_DIR $LOCAL_DIR ;; 1.61 + purge) 1.62 + check_root 1.63 + get_version $@ 1.64 + purge_packages 1.65 + purge_sources 1.66 + ;; 1.67 usage|*) 1.68 usage ;; 1.69 esac