SVN: toys/tools/cleanbuild/cleanpoldekcache
sparky
sparky at pld-linux.org
Mon Dec 7 03:56:20 CET 2009
Author: sparky
Date: Mon Dec 7 03:56:19 2009
New Revision: 11009
Added:
toys/tools/cleanbuild/cleanpoldekcache (contents, props changed)
Log:
- clean poldekcache of old rpms and temporary files
Added: toys/tools/cleanbuild/cleanpoldekcache
==============================================================================
--- (empty file)
+++ toys/tools/cleanbuild/cleanpoldekcache Mon Dec 7 03:56:19 2009
@@ -0,0 +1,53 @@
+#!/usr/bin/sudo /bin/sh
+
+CACHEDIR="$PWD/poldekcache"
+
+[ -r .cleanbuildrc ] && . .cleanbuildrc
+
+export LC_ALL=C
+unset LANGUAGE
+unset LANG
+
+cd "$CACHEDIR" || exit 1
+
+cleandir()
+{
+ DIR="$1"
+ /usr/bin/poldek --skip-installed -s "$DIR" --cachedir="$CACHEDIR" \
+ --shcmd="ls" > cleanpoldekcache.pkgs
+ for PKG in $(ls $DIR); do
+ case "$PKG" in
+ dirindex.pndir.tndb* | packages.ndir.*)
+ ;;
+ *)
+ if ! grep -q "${PKG%%.rpm}" cleanpoldekcache.pkgs; then
+ rm -v $DIR/$PKG
+ fi
+ ;;
+ esac
+ done
+ rm cleanpoldekcache.pkgs
+}
+
+for FILE in *; do
+ case "$FILE" in
+ ftp*.packages.i|http*.packages.i)
+ echo "removing $FILE if empty"
+ rmdir -v "$FILE"
+ ;;
+ ftp*|http*)
+ echo "cleaning inside $FILE"
+ cleandir "$FILE"
+ ;;
+ _* | tmpmd)
+ echo "removing $FILE"
+ rm -rv "$FILE"
+ ;;
+ *)
+ echo "removing $FILE"
+ rm -v "$FILE"
+ ;;
+ esac
+done
+
+# vim: ts=4 sw=4 filetype=sh
More information about the pld-cvs-commit
mailing list