# HG changeset patch # User Christophe Lincoln # Date 1212753717 -7200 # Node ID 149dde2d1013298b585247f8993a2bd08d6263d7 # Parent b9c07e7e2c49db397a793ca26d10c260f495ddbb Improved 'cmp' command diff -r b9c07e7e2c49 -r 149dde2d1013 tazwok --- a/tazwok Thu Jun 05 21:02:30 2008 +0200 +++ b/tazwok Fri Jun 06 14:01:57 2008 +0200 @@ -87,6 +87,7 @@ \033[1mCommands: \033[0m\n usage Print this short usage. stats Print Tazwok statistics from the config file and the wok. + cmp|compare Compare the wok and the cooked pkgs (--remove old pkgs). list List all packages in the wok tree or by category. info Get informations about a package in the wok. check-log Check the process log file of a package. @@ -558,20 +559,39 @@ ================================================================================" echo "" ;; - cmp) - # Compare the wok and packages repository. + cmp|compare) + # Compare the wok and packages repository to help maintaining + # a mirror. echo "" echo -e "\033[1mWok and packages comparaison\033[0m ================================================================================" for pkg in $WOK/* do . $pkg/receipt + echo "$PACKAGE-$VERSION.tazpkg" >> /tmp/wok.list if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg ]; then echo "Missing package: $PACKAGE ($VERSION)" fi done + for pkg in `cd $PACKAGES_REPOSITORY && ls *.tazpkg` + do + if ! grep -q ^$pkg /tmp/wok.list; then + echo $pkg >> /tmp/pkgs.old + if [ "$2" = "--remove" ]; then + echo "Removing package: $pkg" + rm $PACKAGES_REPOSITORY/$pkg + else + echo "Old package: $pkg" + fi + fi + done + cd /tmp echo "================================================================================" + echo "Wok: `cat wok.list | wc -l` - \ +Cooked: `ls -1 $PACKAGES_REPOSITORY/*.tazpkg 2>/dev/null | wc -l` - \ +Old: `cat pkgs.old | wc -l`" echo "" + rm -f wok.list pkgs.old ;; list) # List packages in wok directory. User can specifiy a category