[packages/rpm-build-tools] move unknown repos to stashed dir
glen
glen at pld-linux.org
Sat Dec 19 01:55:47 CET 2015
commit 8089559cfde724a615d3c15b48e732930f687bbf
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Dec 19 02:55:25 2015 +0200
move unknown repos to stashed dir
purge-packages.sh | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/purge-packages.sh b/purge-packages.sh
index fe94063..04158b6 100755
--- a/purge-packages.sh
+++ b/purge-packages.sh
@@ -1,7 +1,11 @@
#!/bin/sh
# Purges packages/ checkouts
+#
# - if package has clean state, the dir is cleaned up (moved to purge dir)
# - otherwise git gc is called if CALL_GC=yes
+# Stashes aside packages/ that do not have .git dir
+# - these dirs are usually created by rpmbuild if Name does not match .spec file
+
set -e
CALL_GC=${CALL_GC:-no}
@@ -9,18 +13,20 @@ CALL_GC=${CALL_GC:-no}
topdir="${1:-$(rpm -E %_topdir)}"
topdir=$(readlink -f "$topdir")
purgedir=$topdir/purged
+stashdir=$topdir/stashed
cd "$topdir"
echo "Purging in $topdir, press ENTER to continue"
read a
if [ -d "$purgedir" ]; then
- echo >&2 "Previous pruge dir exists: $purgedir, remove it to resume"
+ echo >&2 "Previous pruge dir exists: $purgedir, remove it to continue"
exit 1
fi
install -d $purgedir
for pkg in */.git; do
+ continue
pkg=${pkg%/.git}
cd "$pkg"
purge='yes'
@@ -62,4 +68,25 @@ done
rmdir --ignore-fail-on-non-empty $purgedir
+# go over packages that do not have .git
+if [ -d "$stashdir" ]; then
+ echo >&2 "Previous stash dir exists: $stashdir, remove it to continue"
+ exit 1
+fi
+install -d $stashdir
+stashdir=$(readlink -f $stashdir)
+for pkg in */; do
+ # skip symlinks
+ test -L "${pkg%/}" && continue
+ # skip packages which do have .git
+ test -d "$pkg/.git" && continue
+ # skip if it's the stash dir itself
+ pkg=$(readlink -f $pkg)
+ test "$pkg" = "$stashdir" && continue
+
+ echo "* Package $pkg does not have .git, stashing"
+ mv $pkg $stashdir
+done
+rmdir --ignore-fail-on-non-empty $stashdir
+
# vi:syntax=sh:ts=4:sw=4:noet
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/8089559cfde724a615d3c15b48e732930f687bbf
More information about the pld-cvs-commit
mailing list