r54290 - /scripts/rm-pkg-from-repo

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Mar 14 13:41:57 UTC 2010


Author: gregoa
Date: Sun Mar 14 13:41:29 2010
New Revision: 54290

URL: http://svn.debian.org/wsvn/?sc=1&rev=54290
Log:
first draft of a -r (resurrect from attic to regular tree) option

Modified:
    scripts/rm-pkg-from-repo

Modified: scripts/rm-pkg-from-repo
URL: http://svn.debian.org/wsvn/scripts/rm-pkg-from-repo?rev=54290&op=diff
==============================================================================
--- scripts/rm-pkg-from-repo (original)
+++ scripts/rm-pkg-from-repo Sun Mar 14 13:41:29 2010
@@ -18,20 +18,22 @@
 }
 
 MV_TO_ATTIC=
+RESURRECT=
 
-while getopts a f
+while getopts ar f
 do
-    case $f in
-        a)  MV_TO_ATTIC=1;;
-        *)  die "Unsupported command line option -$f"
-    esac
+	case $f in
+		a)  MV_TO_ATTIC=1;;
+		r)  RESURRECT=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 ]"
+[ -n "$PKG" ] || die "$(basename $0) [-a|-r] PACKAGE [ REPO ]"
 
 # try to find "real" paths
 for DIR in "./trunk/$PKG" "./$PKG" "."; do
@@ -48,7 +50,7 @@
 	TRUNK=$(svnpath)
 	TAGS=$(svnpath tags)
 	UPSTREAM=$(svnpath branches/upstream)
-else
+elif [ -z "$RESURRECT" ] ; then
 	warn "No working copy for $PKG found, guessing ..."
 fi
 
@@ -56,38 +58,51 @@
 TRUNK="${TRUNK:-$REPO/trunk/$PKG}"
 UPSTREAM="${UPSTREAM:-$REPO/branches/upstream/$PKG}"
 TAGS="${TAGS:-$REPO/tags/$PKG}"
+ATTIC="$REPO/attic/$PKG"
 
 if [ -n "$MV_TO_ATTIC" ]; then
-    ATTIC=${ATTIC:-$REPO/attic}
-    echo "Package $PKG to be moved to $ATTIC"
+	echo "Package $PKG to be moved to $ATTIC"
 
-    ATTIC="$ATTIC/$PKG"
+	read -p "Proceed (y|N)? " PROCEED
+	case "$PROCEED" in
+		y|Y)
+			svn mkdir --parents "$ATTIC" -m "Prepare attic directory for $PKG"
+			svn mkdir --parents "$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
+elif [ -n "$RESURRECT" ]; then
+	echo "Resurrecting package $PKG from $ATTIC to the regular tree."
 
-    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
+	read -p "Move back (y|N)? " BACK
+	case "$BACK" in
+		y|Y)
+			svn mv "$ATTIC/trunk" "$TRUNK" -m "Move $PKG trunk back from attic/"
+			svn mv "$ATTIC/branches/upstream" "$UPSTREAM" -m "Move upstream branch back from attic"
+			svn mv "$ATTIC/tags" "$TAGS" -m "Move tags of $PKG back from attic"
+			svn rm "$ATTIC" -m "Remove attic subdirectory for $PKG"
+		;;
+		*)
+		;;
+	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."
+	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"
+	echo "or -r option to resurrect a package from attic/."
 
-    read -p "Delete (y|N)? " DELETE
-    case "$DELETE" in
-        y|Y)
-            svn rm "$TRUNK" "$UPSTREAM" "$TAGS" -m "Removing $PKG from repository."
-        ;;
-        *)
-        ;;
-    esac
+	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