slitaz-dev-tools rev 208

tazdev: clean-up old cmd, up (c)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Jan 02 14:23:55 2014 +0100 (2014-01-02)
parents ebb4c707c982
children 58d04aa5882e
files tazdev/tazdev
line diff
     1.1 --- a/tazdev/tazdev	Mon Dec 23 09:58:56 2013 +0000
     1.2 +++ b/tazdev/tazdev	Thu Jan 02 14:23:55 2014 +0100
     1.3 @@ -5,11 +5,12 @@
     1.4  # well commented please, also: configuration variables are $UPPERCASE
     1.5  # and variables initialized by tazdev itself are $lowerspace
     1.6  #
     1.7 -# (c) 2011 SliTaz GNU/Linux - GNU gpl v3
     1.8 +# (c) 2014 SliTaz GNU/Linux - GNU gpl v3
     1.9  #
    1.10  # AUTHORS
    1.11  #     Christophe Lincoln <pankso@slitaz.org>
    1.12  #     Pascal Bellard <bellard@slitaz.org>
    1.13 +#     Eric Joseph-Alexandre <erjo@slitaz.org>
    1.14  #
    1.15  
    1.16  VERSION=1.9
    1.17 @@ -38,8 +39,6 @@
    1.18    gen-chroot|-gc      Generate a chroot using packages from config file
    1.19    umount-chroot|-uc   Unmount chroot specified on cmdline
    1.20    clean-chroot|-cc    Clean a chroot environment (skip root/ and home/)
    1.21 -  !purge              Remove obsolete packages and obsolete source tarballs
    1.22 -  !dry-purge          Show obsolete packages and obsolete source tarballs
    1.23    push|-p             Upload new packages to the main mirror
    1.24    dry-push|-dp        Show what will be uploaded to the mirror. Does nothing
    1.25    pull                Download new packages from the main mirror
    1.26 @@ -198,54 +197,9 @@
    1.27  	newline
    1.28  }
    1.29  
    1.30 -# Remove obsolate slitaz packages --> in cooker ???
    1.31 -purge_packages() {
    1.32 -	arg=$1
    1.33 -	tmp=/tmp/tazdev.$$
    1.34 -	ls $wok| while read pkg; do
    1.35 -		[ -f $wok/$pkg/taz/*/receipt ] || continue
    1.36 -		unset VERSION EXTRAVERSION
    1.37 -		. $wok/$pkg/taz/*/receipt
    1.38 -		echo $pkg-${VERSION}$EXTRAVERSION.tazpkg
    1.39 -	done > $tmp
    1.40 -	ls $slitaz/chroot/home/slitaz/packages | while read pkg; do
    1.41 -		case "$pkg" in
    1.42 -			*.tazpkg)
    1.43 -				grep -q ^$pkg$ $tmp && continue
    1.44 -				echo "Removing pkg: $pkg"
    1.45 -				[ "$arg" == "purge" ] &&
    1.46 -				rm -f $slitaz/chroot/home/slitaz/packages/$pkg ;;
    1.47 -		esac
    1.48 -	done
    1.49 -	rm -f $tmp
    1.50 -}
    1.51 -
    1.52 -# Remove obsolete source tarballs --> in cooker ??? but we share $src
    1.53 -# between cooking and stable to we must scan all versions, all arch
    1.54 -purge_sources() {
    1.55 -	arg=$1
    1.56 -	wok=$slitaz/chroot/home/slitaz/wok
    1.57 -	tmp=/tmp/tazdev.$$
    1.58 -	ls $wok| while read pkg; do
    1.59 -		[ -f $wok/$pkg/receipt ] || continue
    1.60 -		TARBALL=""
    1.61 -		. $wok/$pkg/receipt
    1.62 -		[ -n "$TARBALL" ] && echo $TARBALL
    1.63 -		grep SOURCES_REPOSITORY/ $wok/$pkg/receipt | sed \
    1.64 -		-e 's|.*SOURCES_REPOSITORY/\([^ ]*\)\( .*\)$|\1|' \
    1.65 -		-e 's|.*SOURCES_REPOSITORY/\([^ ]*\)$|\1|' | sort | uniq | \
    1.66 -		sed "s|['\"/]||g" | while read file ; do
    1.67 -			eval echo $file 2> /dev/null
    1.68 -		done
    1.69 -	done > $tmp
    1.70 -	ls $slitaz/chroot/home/slitaz/src | while read pkg; do
    1.71 -		grep -q ^$pkg$ $tmp && continue
    1.72 -		echo "Removing src: $pkg"
    1.73 -		[ "$arg" == "purge" ] &&
    1.74 -			rm -f $slitaz/chroot/home/slitaz/src/$pkg
    1.75 -	done
    1.76 -	rm -f $tmp
    1.77 -}
    1.78 +#
    1.79 +# Commands
    1.80 +#
    1.81  
    1.82  case "$1" in
    1.83  	stats|-s)
    1.84 @@ -346,11 +300,6 @@
    1.85  		check_mirror $@
    1.86  		rsync -r -t -l -v -z --delete --dry-run \
    1.87  			-e ssh $user@$MIRROR:$remote $local ;;
    1.88 -	purge|dry-purge)
    1.89 -		check_root
    1.90 -		get_version $@
    1.91 -		purge_packages $1
    1.92 -		purge_sources $1 ;;
    1.93  	relpkg|-rp)
    1.94  		# Release a slitaz sub-project and upload tarball to mirror
    1.95  		[ -z "$MIRROR_SOURCES" ] && MIRROR_SOURCES="/var/www/slitaz/mirror/sources"