[packages/rpm-build-tools] move to purge dir, to manually review what to remove

glen glen at pld-linux.org
Thu Dec 26 12:58:47 CET 2013


commit 3502fb3478e13f1ac705885d6139aeadd0ef63f0
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Dec 26 11:58:38 2013 +0000

    move to purge dir, to manually review what to remove

 clean-distfiles.sh | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/clean-distfiles.sh b/clean-distfiles.sh
index 8e7cea9..b49f1b2 100755
--- a/clean-distfiles.sh
+++ b/clean-distfiles.sh
@@ -1,16 +1,32 @@
 #!/bin/sh
-# cleanup distfiles like files, i.e archives that can be likely be
+# cleanup distfiles-like files, i.e archives that can be likely be
 # re-downloaded.
+#
+# TODO:
+# - make it smarter:
+#   - consult .gitignore of each package first
+#   - do not clean NoSource files
+#   - do not clean proprietary License packages
+set -e
 
 # be sure we are in right dir
-dir=$(dirname "$0")
-cd "$dir"
+topdir="${1:-$(rpm -E %_topdir)}"
+topdir=$(readlink -f "$topdir")
+purgedir=$topdir/df-purge
+
+if [ -d "$purgedir" ]; then
+	echo >&2 "Previous pruge dir exists: $purgedir, remove it to resume"
+	exit 1
+fi
+
+cd "$topdir"
 
 ext=bz2,gz,rar,tgz,tbz2,zip,jar,Z,tar,png,ico,xpm,gif,rpm,bin,run,exe,iso,xpi,ZIP,dll,pdf
-ls -ldrSh */*.{$ext}
+ls -ldrSh */*.{$ext} || :
 echo */*.{$ext} | xargs stat -c %s | awk '{s+=$1} END {printf("Total: %d MiB\n", s/1014/1024)}'
 
 echo remove? ctrl+c to abort
 read a
 
-rm -vf */*.{$ext}
+install -d $purgedir
+mv */*.{$ext} $purgedir
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/3502fb3478e13f1ac705885d6139aeadd0ef63f0



More information about the pld-cvs-commit mailing list