Преглед изворни кода

dpkg-buildpackage: Move and pack signing logic at the end of the build

This packs all signing in a single place, so that additional checks can
be performed before any signing is done.
Guillem Jover пре 12 година
родитељ
комит
31b73ef005
3 измењених фајлова са 23 додато и 29 уклоњено
  1. 3 0
      debian/changelog
  2. 5 7
      man/dpkg-buildpackage.1
  3. 15 22
      scripts/dpkg-buildpackage.pl

+ 3 - 0
debian/changelog

@@ -1,5 +1,8 @@
 dpkg (1.17.6) UNRELEASED; urgency=low
 dpkg (1.17.6) UNRELEASED; urgency=low
 
 
+  [ Guillem Jover ]
+  * Move signing in dpkg-buildpackage to the end of the build.
+
   [ Updated scripts translations ]
   [ Updated scripts translations ]
   * German (Helge Kreutzmann).
   * German (Helge Kreutzmann).
 
 

+ 5 - 7
man/dpkg-buildpackage.1

@@ -56,18 +56,16 @@ case, or if \fB\-b\fP is specified), or \fBbuild\-arch\fP and
 \fBbinary\-arch\fP (if \fB\-B\fP is specified), or \fBbuild\-indep\fP and
 \fBbinary\-arch\fP (if \fB\-B\fP is specified), or \fBbuild\-indep\fP and
 \fBbinary\-indep\fP (if \fB\-A\fP is specified).
 \fBbinary\-indep\fP (if \fB\-A\fP is specified).
 .IP \fB6.\fP 3
 .IP \fB6.\fP 3
-It calls \fBgpg2\fP or \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
-\fB\-us\fP is specified or on UNRELEASED builds).
-.IP \fB7.\fP 3
 It calls \fBdpkg\-genchanges\fP to generate a \fB.changes\fP file.
 It calls \fBdpkg\-genchanges\fP to generate a \fB.changes\fP file.
 Many \fBdpkg\-buildpackage\fP options are forwarded to
 Many \fBdpkg\-buildpackage\fP options are forwarded to
 \fBdpkg\-genchanges\fP.
 \fBdpkg\-genchanges\fP.
-.IP \fB8.\fP 3
-It calls \fBgpg2\fP or \fBgpg\fP to sign the \fB.changes\fP file (unless
-\fB\-uc\fP is specified or on UNRELEASED builds).
-.IP \fB9.\fP 3
+.IP \fB7.\fP 3
 If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
 If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
 again. Finally it calls \fBdpkg\-source \-\-after\-build\fP.
 again. Finally it calls \fBdpkg\-source \-\-after\-build\fP.
+.IP \fB8.\fP 3
+It calls \fBgpg2\fP or \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
+\fB\-us\fP is specified or on UNRELEASED builds), and the \fB.changes\fP file
+(unless \fB\-uc\fP is specified or on UNRELEASED builds).
 .
 .
 .SH OPTIONS
 .SH OPTIONS
 .TP
 .TP

+ 15 - 22
scripts/dpkg-buildpackage.pl

@@ -446,19 +446,6 @@ if ($include & BUILD_BINARY) {
     withecho(@debian_rules, $buildtarget);
     withecho(@debian_rules, $buildtarget);
     withecho(@rootcommand, @debian_rules, $binarytarget);
     withecho(@rootcommand, @debian_rules, $binarytarget);
 }
 }
-if ($signpause &&
-    ($signchanges || (($include & BUILD_SOURCE) && $signsource))) {
-    print _g("Press the return key to start signing process\n");
-    getc();
-}
-
-my $signerrors;
-if ($include & BUILD_SOURCE) {
-    if ($signsource && signfile("$pv.dsc")) {
-	$signerrors = _g('failed to sign .dsc and .changes file');
-	$signchanges = 0;
-    }
-}
 
 
 if (defined($maint)) { push @changes_opts, "-m$maint" }
 if (defined($maint)) { push @changes_opts, "-m$maint" }
 if (defined($changedby)) { push @changes_opts, "-e$changedby" }
 if (defined($changedby)) { push @changes_opts, "-e$changedby" }
@@ -514,10 +501,6 @@ if (fileomitted '\.deb') {
     }
     }
 }
 }
 
 
-if ($signchanges && signfile("$pva.changes")) {
-    $signerrors = _g('failed to sign .changes file');
-}
-
 if ($cleansource) {
 if ($cleansource) {
     withecho(@rootcommand, @debian_rules, 'clean');
     withecho(@rootcommand, @debian_rules, 'clean');
 }
 }
@@ -525,14 +508,24 @@ chdir('..') or syserr('chdir ..');
 withecho('dpkg-source', @source_opts, '--after-build', $dir);
 withecho('dpkg-source', @source_opts, '--after-build', $dir);
 chdir($dir) or syserr("chdir $dir");
 chdir($dir) or syserr("chdir $dir");
 
 
+print "$Dpkg::PROGNAME: $srcmsg\n";
+
+if ($signpause &&
+    ($signchanges || (($include & BUILD_SOURCE) && $signsource))) {
+    print _g("Press the return key to start signing process\n");
+    getc();
+}
+
+if ($signsource && ($include & BUILD_SOURCE) && signfile("$pv.dsc")) {
+    error(_g('failed to sign .dsc and .changes file'));
+}
+if ($signchanges && signfile("$pva.changes")) {
+    error(_g('failed to sign .changes file'));
+}
+
 if (not $signreleased) {
 if (not $signreleased) {
     warning(_g('not signing UNRELEASED build; use --force-sign to override'));
     warning(_g('not signing UNRELEASED build; use --force-sign to override'));
 }
 }
-print "$Dpkg::PROGNAME: $srcmsg\n";
-if ($signerrors) {
-    warning($signerrors);
-    exit 1;
-}
 
 
 sub mustsetvar {
 sub mustsetvar {
     my ($var, $text) = @_;
     my ($var, $text) = @_;