The following commit has been merged in the master branch:
commit 2ac20943f4dba158364ab4d9e04970a6c84e11c9
Author: Carsten Hey <[email protected]>
Date:   Sun Jul 18 17:39:35 2010 +0200

    debsign: Add options --(no-)re-sign to let the user choose whether to 
resign.
    
    Closes: #580821
    Signed-off-by: Carsten Hey <[email protected]>
    Signed-off-by: James Vega <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index bd78b03..4abf2ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,10 @@ devscripts (2.10.66) UNRELEASED; urgency=low
   * uscan: Get rid of extra quoting in dpkg --compare-versions calls.
     (Closes: #590178)
 
+  [ Carsten Hey ]
+  * debsign: Add options --re-sign and --no-re-sign to let the user choose
+    whether an already signed file should be resigned.  (Closes: #580821)
+
  -- James Vega <[email protected]>  Mon, 19 Jul 2010 21:16:02 -0400
 
 devscripts (2.10.65.1) unstable; urgency=low
diff --git a/scripts/debsign.1 b/scripts/debsign.1
index 824e689..39c5c21 100644
--- a/scripts/debsign.1
+++ b/scripts/debsign.1
@@ -87,6 +87,12 @@ use the most recent file with the name pattern
 \fIpackage_version_*+*.changes\fR as the changes file, allowing for the
 changes files produced by \fBdpkg-cross\fR.
 .TP
+\fB\-\-re\-sign\fR, \fB\-\-no\-re\-sign\fR
+Recreate signature, respectively use the existing signature, if the
+file has been signed already.  If neither option is given and an already
+signed file is found the user is asked if he or she likes to use the
+current signature.
+.TP
 \fB\-\-debs\-dir\fR \fIDIR\fR
 Look for the \fI.changes\fR and \fI.dsc\fR files in directory
 \fIDIR\fR instead of the parent of the source directory.  This should
diff --git a/scripts/debsign.sh b/scripts/debsign.sh
index 60f15f5..1625112 100755
--- a/scripts/debsign.sh
+++ b/scripts/debsign.sh
@@ -88,6 +88,8 @@ usage () {
     -a<arch>        Use changes file made for Debian target architecture <arch>
     -t<target>      Use changes file made for GNU target architecture <target>
     --multi         Use most recent multiarch .changes file found
+    --re-sign       Re-sign if the file is already signed.
+    --no-re-sign    Don't re-sign if the file is already signed.
     --debs-dir <directory>
                     The location of the .changes / .dsc files when called from
                     within a source tree (default "..")
@@ -224,23 +226,31 @@ withecho () {
 # and failure if the file needs signing.  Parameters: $1=filename,
 # $2=file description for message (dsc or changes)
 check_already_signed () {
-    if [ "`head -n 1 \"$1\"`" != "-----BEGIN PGP SIGNED MESSAGE-----" ]
-    then
+    [ "`head -n 1 \"$1\"`" = "-----BEGIN PGP SIGNED MESSAGE-----" ] || \
        return 1
+
+    local resign
+    if [ "$opt_re_sign" = "true" ]; then
+       resign="true"
+    elif [ "$opt_re_sign" = "false" ]; then
+       resign="false"
     else
        printf "The .$2 file is already signed.\nWould you like to use the 
current signature? [Yn]"
        read response
        case $response in
-       [Nn]*)
-           UNSIGNED_FILE="$(temp_filename "$1" "unsigned")"
-
-           sed -e '1,/^$/d; /^$/,$d' "$1" > "$UNSIGNED_FILE"
-           movefile "$UNSIGNED_FILE" "$1"
-           return 1
-           ;;
-       *) return 0;;
+       [Nn]*) resign="true" ;;
+       *)     resign="false" ;;
        esac
     fi
+
+    [ "$resign" = "true" ] || \
+       return 0
+
+    UNSIGNED_FILE="$(temp_filename "$1" "unsigned")"
+
+    sed -e '1,/^$/d; /^$/,$d' "$1" > "$UNSIGNED_FILE"
+    movefile "$UNSIGNED_FILE" "$1"
+    return 1
 }
 
 # --- main script
@@ -345,6 +355,8 @@ do
        -a*)    targetarch="$value" ;;
        -t*)    targetgnusystem="$value" ;;
        --multi) multiarch="true" ;;
+       --re-sign)    opt_re_sign="true" ;;
+       --no-re-sign) opt_re_sign="false" ;;
        -r*)    if [ -n "$value" ]; then remotehost=$value;
                elif [ $# -lt 1 ]; then
                    echo "$PROGNAME: -r option missing argument!" >&2

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to