[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#217963: dpkg-dev: dpkg-buildpackage should create .changes file even if signing .dsc fails



Package: dpkg-dev
Version: 1.10.16
Tags: patch

If something goes wrong with the signature process for the .dsc file,
then dpkg-buildpackage aborts at that point, meaning that the only
obvious way to proceed is to rebuild the entire package.  (Of course,
one could run dpkg-genchanges etc. manually, but that's possibly not
such a great idea.)  The following patch means that a failed signature
does not stop the build, but causes it to exit with an error at the
end anyway.  After this, debsign can be used to sign the .dsc/.changes
files.

--- /usr/bin/dpkg-buildpackage	2003-10-25 21:51:27.000000000 +0100
+++ dpkg-buildpackage	2003-10-28 13:27:25.000000000 +0000
@@ -166,8 +166,14 @@
 		$signcommand -u "${signkey:-$maintainer}" +clearsig=on -fast <"../$1" \
 			>"../$1.asc"
 	fi
+	status=$?
+	if [ $status -eq 0 ]; then
+		mv -- "../$1.asc" "../$1"
+	else
+		/bin/rm -f "../$1.asc"
+	fi
 	echo
-	mv -- "../$1.asc" "../$1"
+	return $status
 }
 
 withecho () {
@@ -205,8 +211,12 @@
     read dummy_stuff
 fi
 
+signerrors=
 if [ x$binaryonly = x ]; then
-        $signsource "$pv.dsc"
+	if ! $signsource "$pv.dsc"; then
+		signerrors="(WARNING: Failed to sign .dsc and .changes file)"
+		signchanges=:
+	fi
 fi
 chg=../"$pva.changes"
 withecho dpkg-genchanges "$@" >"$chg"
@@ -242,10 +252,16 @@
 	fi
 fi
 
-$signchanges "$pva.changes"
+if ! $signchanges "$pva.changes"; then
+	signerrors="(WARNING: Failed to sign .changes file)"
+fi
 
 if $cleansource; then
 	withecho $rootcommand debian/rules clean
 fi
 
 echo "dpkg-buildpackage: $srcmsg"
+if [ -n "$signerrors" ]; then
+	echo >&2 $signerrors
+	exit 1
+fi


   Julian

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        Julian Gilbey, website: http://www.polya.uklinux.net/
   Debian GNU/Linux Developer, see: http://people.debian.org/~jdg/
     Visit http://www.thehungersite.com/ to help feed the hungry



Reply to: