[devscripts] 01/03: uupdate: Add -o option

Osamu Aoki osamu at moszumanska.debian.org
Mon Nov 16 14:32:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

osamu pushed a commit to branch master
in repository devscripts.

commit 9ab4c1b2fa6733f92b4a8fe8fbe920676b6d8a76
Author: Osamu Aoki <osamu at debian.org>
Date:   Mon Nov 16 23:05:49 2015 +0900

    uupdate: Add -o option
    
    Stop using /dev/tty
---
 scripts/uupdate.1  |  5 ++++-
 scripts/uupdate.sh | 16 +++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/scripts/uupdate.1 b/scripts/uupdate.1
index d7cfb0d..ad978d1 100644
--- a/scripts/uupdate.1
+++ b/scripts/uupdate.1
@@ -61,9 +61,12 @@ first option given on the command-line.
 \fB\-\-upstream\-version \fIversion\fR, \fB\-v \fIversion\fR
 Specify the version number of the upstream package explicitly.
 .TP
-\fB\-\-force\-bad\-version, \fB\-b 
+\fB\-\-force\-bad\-version, \fB\-b
 Force a version number to be less than the current one (e.g., when backporting).
 .TP
+\fB\-\-force\-overwrite, \fB\-o
+Force overwriting of the existing *-*.debian.tar.* .
+.TP
 \fB\-\-rootcmd \fIgain-root-command\fR, \fB\-r \fIgain-root-command\fR
 Specify the command to be used to become root to build the package and
 is passed onto \fBdebuild\fR(1) if it is specified.
diff --git a/scripts/uupdate.sh b/scripts/uupdate.sh
index 2120d67..319d0be 100755
--- a/scripts/uupdate.sh
+++ b/scripts/uupdate.sh
@@ -62,6 +62,8 @@ Options are:
    --force-bad-version, -b
                       Force a version number to be less than the current one
                       (e.g., when backporting).
+   --force-overwrite, -o
+                      Force overwriting of the existing *-*.debian.tar.*
    --rootcmd <gain-root-command>, -r <gain-root-command>
                       which command to be used to become root
                       for package-building
@@ -130,6 +132,7 @@ MPATTERN='^(?:[a-zA-Z][a-zA-Z0-9]*(?:-|_|\.))+(\d+\.(?:\d+\.)*\d+)$'
 
 STATUS=0
 BADVERSION=""
+OVERWRITE=0
 
 # Boilerplate: set config variables
 DEFAULT_UUPDATE_ROOTCMD=
@@ -201,9 +204,10 @@ else
 fi
 
 
-TEMP=$(getopt -s bash -o v:p:r:fubs \
+TEMP=$(getopt -s bash -o v:p:r:fubos \
         --long upstream-version:,patch:,rootcmd: \
         --long force-bad-version \
+        --long force-overwrite \
 	--long pristine,no-pristine,nopristine \
 	--long symlink,no-symlink,nosymlink \
 	--long no-conf,noconf \
@@ -219,6 +223,8 @@ while [ "$1" ]; do
     case $1 in
     --force-bad-version|-b)
 	BADVERSION="-b" ;;
+    --force-overwite|-o)
+	OVERWRITE=1 ;;
     --upstream-version|-v)
 	shift; NEW_VERSION="$1" ;;
     --patch|-p)
@@ -1057,8 +1063,12 @@ else
         COMP=${DEBIANFILE##*.}
 	NEW_DEBIANFILE="${PACKAGE}_${NEW_VERSION}-$SUFFIX.debian.tar.$COMP"
     fi
-    cp -i $DEBIANFILE ${NEW_DEBIANFILE} 2>/dev/tty
-    
+    if [ $OVERWRITE = 0 and -e ${NEW_DEBIANFILE} ]; then
+	echo "$PROGNAME: ${NEW_DEBIANFILE} already exists.  Start $PROGNAME with -o to overwrite it." >&2
+	exit 1
+    else
+	cp -f $DEBIANFILE ${NEW_DEBIANFILE}
+    fi
     # fake DSC
     FAKEDSC="${PACKAGE}_${NEW_VERSION}-$SUFFIX.dsc"
     echo "Format: ${FORMAT}" > "$FAKEDSC"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list