summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2009-07-08 14:13:58 -0500
committerClark Williams <williams@redhat.com>2009-07-08 14:13:58 -0500
commit1fef98d4034c22d35d3fee00d62c3ad15f930b20 (patch)
treee6f0d41bad1666475b294fa7e658933e63a9a920
parent2046136e9f984d844021b3f8521d66a0ac056571 (diff)
downloadmock-1fef98d4034c22d35d3fee00d62c3ad15f930b20.tar.gz
mock-1fef98d4034c22d35d3fee00d62c3ad15f930b20.tar.xz
mock-1fef98d4034c22d35d3fee00d62c3ad15f930b20.zip
added contrib/mock-cleanup script
-rwxr-xr-xcontrib/mock-cleanup30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/mock-cleanup b/contrib/mock-cleanup
new file mode 100755
index 0000000..bf31f30
--- /dev/null
+++ b/contrib/mock-cleanup
@@ -0,0 +1,30 @@
+#! /bin/sh
+#
+# mock-cleanup
+#
+# clean packages in mock's cache directories
+#
+
+NEWCACHEDIR=/var/cache/mock
+OLDCACHEDIR=/var/lib/mock/cache
+
+dirs=
+for d in $NEWCACHEDIR $OLDCACHEDIR
+do
+ if [ -d $d -a ! -z "$d/*/yum_cache" ]
+ then
+ dirs="$dirs $d/*/yum_cache"
+ fi
+done
+
+for d in $dirs
+do
+ echo -n "Clean in $d:"
+ cd $d
+ for r in */packages
+ do
+ echo -n " `dirname $r`"
+ repomanage --old --nocheck $r 2>/dev/null | xargs --no-run-if-empty rm
+ done
+ echo " done"
+done