]> git.ozlabs.org Git - next-scripts/commitdiff
automatically remove the oldest releases from korg
authorStephen Rothwell <sfr@canb.auug.org.au>
Mon, 4 Mar 2013 05:42:46 +0000 (16:42 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 4 Mar 2013 05:42:46 +0000 (16:42 +1100)
make_tree_file
remove_oldest [deleted file]

index d1e7890c8b16dfb70b1d0af4483e85f98f4614e9..c14a6dad62709eb6cd1f754e879ccf72c0d53a06 100755 (executable)
@@ -53,6 +53,16 @@ gpg2 -u 41D5C07A -a -b "../$p"
 
 $(dirname $0)/make_abat_scripts "$d" "$l"
 
+oldest=$(date --date "3 months ago" '+%Y%m%d')
+echo "Removing old releases ... <= next-$oldest"
+
+for i in $(git ls-remote --tags korg next-\* |
+               sed -n 's,^.*[ \t]refs/tags/next-\([0-9]*\)$,\1,p' |
+               sort -n); do
+       [ $i -gt $oldest ] && break
+       git push korg --delete next-$i
+done
+
 echo Pushing to korg ...
 git push korg
 
diff --git a/remove_oldest b/remove_oldest
deleted file mode 100755 (executable)
index 296d03c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-oldest=$(git tag -l next-\* | head -n 1)
-[ "$oldest" ] || {
-       echo "Could not find oldest next- tag" 1>&2
-       exit 1
-}
-od=${oldest#next-}
-[ "$od" = "$oldest" ] && {
-       echo "Hmmm, oldest next- tag '$oldest' does not start with next-" 1>&2
-       exit 1
-}
-
-git tag -d $oldest
-git push korg --delete $oldest
-
-exit 0