r42758 - /scripts/rm-pkg-from-repo

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Tue Aug 25 18:20:26 UTC 2009


Author: dmn
Date: Tue Aug 25 18:20:20 2009
New Revision: 42758

URL: http://svn.debian.org/wsvn/?sc=1&rev=42758
Log:
add -a option for moving the package to attic/ instead of removing it completely

Modified:
    scripts/rm-pkg-from-repo

Modified: scripts/rm-pkg-from-repo
URL: http://svn.debian.org/wsvn/scripts/rm-pkg-from-repo?rev=42758&op=diff
==============================================================================
--- scripts/rm-pkg-from-repo (original)
+++ scripts/rm-pkg-from-repo Tue Aug 25 18:20:20 2009
@@ -4,11 +4,7 @@
 # License: same as Perl (i.e. Artistic | GPL-1+)
 
 # TODO:
-# - add option to move to attic/ instead of removing
 # - add option to add an additional message
-
-PKG="$1"
-REPO="${2:-svn+ssh://svn.debian.org/svn/pkg-perl}"
 
 warn() {
 	echo "$1" 1>&2
@@ -18,6 +14,20 @@
 	warn "$1"
 	exit 1
 }
+
+MV_TO_ATTIC=
+
+while getopts a f
+do
+    case $f in
+        a)  MV_TO_ATTIC=1;;
+        *)  die "Unsupported command line option -$f"
+    esac
+done
+shift `expr $OPTIND - 1`
+
+PKG="$1"
+REPO="${2:-svn+ssh://svn.debian.org/svn/pkg-perl}"
 
 [ -n "$PKG" ] || die "$(basename $0) PACKAGE [ REPO ]"
 
@@ -45,18 +55,37 @@
 UPSTREAM="${UPSTREAM:-$REPO/brances/upstream/$PKG}"
 TAGS="${TAGS:-$REPO/tags/$PKG}"
 
-echo "The following directories will be deleted from $REPO:"
-echo "$TRUNK"
-echo "$UPSTREAM"
-echo "$TAGS"
+if [ -n "$MV_TO_ATTIC" ]; then
+    ATTIC=${ATTIC:-$REPO/attic}
+    echo "Package $PKG to be moved to $ATTIC"
 
-read -p "Delete (y|N)? " DELETE
-case "$DELETE" in
-	y|Y)
-		svn rm "$TRUNK" "$UPSTREAM" "$TAGS" -m "Removing $PKG from repository."
-		;;
-	*)
-		;;
-esac
+    ATTIC="$ATTIC/$PKG"
 
+    read -p "Proceed (y|N)? " PROCEED
+    case "$PROCEED" in
+        y|Y)
+            svn mkdir "$ATTIC" -m "Prepare attic directory for $PKG"
+            svn mkdir "$ATTIC/branches" -m "Create branches for attic/$PKG"
+            svn mv "$TRUNK" "$ATTIC/trunk" -m "Move $PKG trunk to attic/"
+            svn mv "$UPSTREAM" "$ATTIC/branches/upstream" -m "Move upstream branch to attic"
+            svn mv "$TAGS" "$ATTIC/tags" -m "Move tags of $PKG to attic"
+        ;;
+        *)
+        ;;
+    esac
+else
+    echo "The following directories will be deleted from $REPO:"
+    echo "$TRUNK"
+    echo "$UPSTREAM"
+    echo "$TAGS"
+    echo "Use -a option if you want them moved into attic/ instead."
 
+    read -p "Delete (y|N)? " DELETE
+    case "$DELETE" in
+        y|Y)
+            svn rm "$TRUNK" "$UPSTREAM" "$TAGS" -m "Removing $PKG from repository."
+        ;;
+        *)
+        ;;
+    esac
+fi




More information about the Pkg-perl-cvs-commits mailing list