summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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