Control: tags -1 + patch

Hi,

On Thu, 11 May 2017 10:50:55 +0200 Rhonda D'Vine <rho...@debian.org> wrote:
> Package: devscripts
> Version: 2.17.5
> Severity: important
> File: /usr/bin/debrsign
> 
> Dear Maintainer,
> 
>  debrsign doesn't support buildinfo files and thus fails to sign
> changes files properly currently.

Patch proposal attached.

Thanks,

_g.
--- a/debrsign	2017-09-14 04:08:30.000000000 +0200
+++ b/debrsign	2017-10-07 20:11:40.428779172 +0200
@@ -133,6 +133,8 @@
 		changes=$2
 		dsc=`echo $changes | \
 		    perl -pe 's/\.changes$/.dsc/; s/(.*)_(.*)_(.*)\.dsc/\1_\2.dsc/'`
+		buildinfo=`echo $changes | \
+		    perl -pe 's/\.changes$/.buildinfo/; s/(.*)_(.*)_(.*)\.buildinfo/\1_\2_\3.buildinfo/'`
 		;;
 	    *)	echo "$PROGNAME: Only a .changes or .dsc file is allowed as second argument!" >&2
 		exit 1 ;;
@@ -177,6 +179,7 @@
 	pv="${package}_${sversion}"
 	pva="${package}_${sversion}${arch:+_${arch}}"
 	dsc="../$pv.dsc"
+	buildinfo="../$pva.buildinfo"
 	changes="../$pva.changes"
 	if [ -n "$multiarch" -o ! -r $changes ]; then
 	    changes=$(ls "../${package}_${sversion}_*+*.changes" "../${package}_${sversion}_multi.changes" 2>/dev/null | head -1)
@@ -207,8 +210,10 @@
         exit 1
 fi
 
-changesbase=`basename "$changes"`
-dscbase=`basename "$dsc"`
+declare -A base
+base["$changes"]=`basename "$changes"`
+base["$dsc"]=`basename "$dsc"`
+base["$buildinfo"]=`basename "$buildinfo"`
 
 if [ -n "$changes" ]
 then
@@ -218,27 +223,39 @@
 	exit 1
     fi
 
+    files=$changes
     # Is there a dsc file listed in the changes file?
-    if grep -q "$dscbase" "$changes"
+    if grep -q "${base[$dsc]}" "$changes"
     then
+        files="$files $dsc"
 	if [ ! -f "$dsc" -o ! -r "$dsc" ]
 	then
 	    echo "Can't find or can't read dsc file $dsc!" >&2
 	    exit 1
 	fi
-
-	# Now do the real work
-	withecho scp "$changes" "$dsc" "$remotehost:\$HOME"
-	withecho ssh -t "$remotehost" "debsign $signargs $changesbase"
-	withecho scp "$remotehost:\$HOME/$changesbase" "$changes"
-	withecho scp "$remotehost:\$HOME/$dscbase" "$dsc"
-	withecho ssh "$remotehost" "rm -f $changesbase $dscbase"
     else
-	withecho scp "$changes" "$remotehost:\$HOME"
-	withecho ssh -t "$remotehost" "debsign $signargs $changesbase"
-	withecho scp "$remotehost:\$HOME/$changesbase" "$changes"
-	withecho ssh "$remotehost" "rm -f $changesbase"
+        unset base["$dsc"]
+    fi
+    # Is there a buildinfo file listed in the changes file?
+    if grep -q "${base[$buildinfo]}" "$changes"
+    then
+        files="$files $buildinfo"
+	if [ ! -f "$buildinfo" -o ! -r "$buildinfo" ]
+	then
+	    echo "Can't find or can't read buildinfo file $buildinfo!" >&2
+	    exit 1
+	fi
+    else
+        unset base["$buildinfo"]
     fi
+    # Now do the real work
+    withecho scp "${!base[@]}" "$remotehost:\$HOME"
+    withecho ssh -t "$remotehost" "debsign $signargs ${base[$changes]}"
+    for file in "${!base[@]}"
+    do
+	withecho scp "$remotehost:\$HOME/${base["$file"]}" "$file"
+    done
+    withecho ssh "$remotehost" "rm -f ${base[@]}"
 
     echo "Successfully signed changes file"
 else

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to