[devscripts] 04/06: debuild: Disable signing if distribution is "UNRELEASED"
James McCoy
jamessan at debian.org
Sat Jul 8 19:15:32 UTC 2017
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit a1e76fc70e7a36f744854a27506f369bc3294c10
Author: James McCoy <jamessan at debian.org>
Date: Sat Jul 8 15:05:02 2017 -0400
debuild: Disable signing if distribution is "UNRELEASED"
Let the user override that by using dpkg-buildpackage's --force-sign
option.
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 3 +++
scripts/debuild.1 | 10 ++++++----
scripts/debuild.pl | 14 +++++++++++---
test/test_package_lifecycle | 33 +++++++++++++++++++++++++++++++++
4 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index aeb80e1..d0ed2ed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -49,6 +49,9 @@ devscripts (2.17.7) UNRELEASED; urgency=medium
+ When an empty message is provided on the command-line, do not add an
empty entry to the changelog. Thanks to Adam Barratt for the patch.
(Closes: #830968)
+ * debuild:
+ + Disable signing if the target distribution is "UNRELEASED", but honor
+ dpkg-buildpackage's --force-sign as an override. (Closes: #861020)
[ Ben Finney ]
* debdiff:
diff --git a/scripts/debuild.1 b/scripts/debuild.1
index 1e8938a..2232c73 100644
--- a/scripts/debuild.1
+++ b/scripts/debuild.1
@@ -12,10 +12,12 @@ debuild \- build a Debian package
package. It first runs \fBdpkg-buildpackage\fR, then runs
\fBlintian\fR on the \fI.changes\fR file created
(assuming that \fBlintian\fR is installed), and
-finally signs the \fI.changes\fR and/or \fI.dsc\fR files as
-appropriate (using \fBdebsign\fR(1) to do this instead of
-\fBdpkg-buildpackage\fR(1) itself; all relevant key-signing options
-are passed on). Parameters can be passed to \fBdpkg-buildpackage\fR
+finally signs the appropriate files (using \fBdebsign\fR(1) to do
+this instead of \fBdpkg-buildpackage\fR(1) itself; all relevant
+key-signing options are passed on).
+Signing will be skipped if the distribution is \fIUNRELEASED\fR, unless
+\fBdpkg-buildpackage\fR's \fB\-\-force-sign\fR option is used.
+Parameters can be passed to \fBdpkg-buildpackage\fR
and \fBlintian\fR, where the parameters to the latter are
indicated with the \fB\-\-lintian-opts\fR option.
The allowable options in this case are
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index cf89e2c..3ea04ab 100755
--- a/scripts/debuild.pl
+++ b/scripts/debuild.pl
@@ -665,7 +665,7 @@ until (-r 'debian/changelog') {
# Find the source package name and version number
my %changelog;
my $c = changelog_parse();
- at changelog{'Source', 'Version'} = @{$c}{'Source', 'Version'};
+ at changelog{'Source', 'Version', 'Distribution'} = @{$c}{'Source', 'Version', 'Distribution'};
fatal "no package name in changelog!"
unless exists $changelog{'Source'};
@@ -721,8 +721,9 @@ if ( $( != 0 && $) == 0 ) { $( = $) }
# Our first task is to parse the command line options.
# dpkg-buildpackage variables explicitly initialised in dpkg-buildpackage
-my $signsource=1;
-my $signchanges=1;
+my $forcesign;
+my $signsource = $changelog{Distribution} ne 'UNRELEASED';
+my $signchanges = $changelog{Distribution} ne 'UNRELEASED';
my $binarytarget='binary';
my $since='';
my $usepause=0;
@@ -770,6 +771,7 @@ foreach (@dpkg_extra_opts) {
/^-[dD]$/ and next; # already been processed
$_ eq '-us' and $signsource=0, next;
$_ eq '-uc' and $signchanges=0, next;
+ $_ eq '--force-sign' and $forcesign=1, next;
$_ eq '-ap' and $usepause=1, next;
/^-a(.*)/ and $targetarch=$1, push(@dpkg_opts, $_), next;
$_ eq '-tc' and push(@dpkg_opts, $_), next;
@@ -820,6 +822,7 @@ while ($_=shift) {
/^-k/ and push(@debsign_opts, $_), next; # Ditto
$_ eq '-us' and $signsource=0, next;
$_ eq '-uc' and $signchanges=0, next;
+ $_ eq '--force-sign' and $forcesign=1, next;
$_ eq '-ap' and $usepause=1, next;
/^-a(.*)/ and $targetarch=$1, push(@dpkg_opts, $_),
next;
@@ -887,6 +890,11 @@ if (@ARGV) {
}
}
+if ($forcesign) {
+ $signchanges = 1;
+ $signsource = 1;
+}
+
if ($signchanges==1 and $signsource==0) {
push @warnings,
"I will sign the .dsc file anyway as a signed .changes file was requested\n";
diff --git a/test/test_package_lifecycle b/test/test_package_lifecycle
index 6e7a196..f3c768f 100755
--- a/test/test_package_lifecycle
+++ b/test/test_package_lifecycle
@@ -286,6 +286,39 @@ test_debuild2() {
dpkg-genchanges: not including original source code in upload
dpkg-source --after-build test
dpkg-buildpackage: binary and diff upload (original source NOT included)
+EOS
+ runCommandOutCmpFile "-k'uscan test key (no secret) <none at debian.org>'" "${WORKDIR}/package_lifecycle/debuild.txt" "" 0
+ cd ${WORKDIR}
+}
+
+test_debuild_forcesign() {
+ export GNUPGHOME=$GPGHOME
+ cd ${WORKDIR}/package_lifecycle/test
+ COMMAND='debuild --no-conf --no-lintian --preserve-envvar=PATH --preserve-envvar=PERL5LIB --preserve-envvar=DEBFULLNAME --preserve-envvar=DEBEMAIL --preserve-envvar=GNUPGHOME --set-envvar=NO_PKG_MANGLE=1 --force-sign'
+ cat > ${WORKDIR}/package_lifecycle/debuild.txt <<-EOS
+ dpkg-buildpackage -us -uc
+ dpkg-buildpackage: source package test
+ dpkg-buildpackage: source version 1.0-2
+ dpkg-buildpackage: source distribution UNRELEASED
+ dpkg-buildpackage: source changed by Testophilus Testownik <tester at testity.org>
+ dpkg-source --before-build test
+ dpkg-buildpackage: host architecture ${_ARCH}
+ fakeroot debian/rules clean
+ dh clean
+ dpkg-source -b test
+ dpkg-source: info: using source format '3.0 (quilt)'
+ dpkg-source: info: building test using existing ./test_1.0.orig.tar.xz
+ dpkg-source: info: building test in test_1.0-2.debian.tar.xz
+ dpkg-source: info: building test in test_1.0-2.dsc
+ debian/rules build
+ dh build
+ fakeroot debian/rules binary
+ dh binary
+ dpkg-deb: building package 'test' in '../test_1.0-2_all.deb'.
+ dpkg-genchanges >../test_1.0-2_${_ARCH}.changes
+ dpkg-genchanges: not including original source code in upload
+ dpkg-source --after-build test
+ dpkg-buildpackage: binary and diff upload (original source NOT included)
Now signing changes and any dsc files...
EOS
if which dpkg-genbuildinfo >/dev/null 2>&1; then
--
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