Bläddra i källkod

dpkg-buildpackage: Add new --check-command and --check-option options

Call the checker command on the .changes file before signing anything.
Use the new DEB_CHECK_COMMAND environment variable as the default
--check-command value. The command will usually be lintian.
Guillem Jover 12 år sedan
förälder
incheckning
1cef5694e5
3 ändrade filer med 37 tillägg och 0 borttagningar
  1. 3 0
      debian/changelog
  2. 16 0
      man/dpkg-buildpackage.1
  3. 18 0
      scripts/dpkg-buildpackage.pl

+ 3 - 0
debian/changelog

@@ -2,6 +2,9 @@ dpkg (1.17.6) UNRELEASED; urgency=low
 
 
   [ Guillem Jover ]
   [ Guillem Jover ]
   * Move signing in dpkg-buildpackage to the end of the build.
   * Move signing in dpkg-buildpackage to the end of the build.
+  * Add new --check-command and --check-option options to dpkg-buildpackage,
+    and DEB_CHECK_COMMAND environment variable as a default value, to
+    specify a package checker to use before the signing process.
 
 
   [ Updated scripts translations ]
   [ Updated scripts translations ]
   * German (Helge Kreutzmann).
   * German (Helge Kreutzmann).

+ 16 - 0
man/dpkg-buildpackage.1

@@ -65,6 +65,9 @@ again.
 .IP \fB8.\fP 3
 .IP \fB8.\fP 3
 It calls \fBdpkg\-source \-\-after\-build\fP.
 It calls \fBdpkg\-source \-\-after\-build\fP.
 .IP \fB9.\fP 3
 .IP \fB9.\fP 3
+It calls a package checker for the \fB.changes\fP file (if a command is
+specified in DEB_CHECK_COMMAND or with \fB\-\-check\-command\fP).
+.IP \fB10.\fP 3
 It calls \fBgpg2\fP or \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
 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
 \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).
 (unless \fB\-uc\fP is specified or on UNRELEASED builds).
@@ -201,6 +204,14 @@ another make program (for example by using
 .B /usr/local/bin/make \-f debian/rules
 .B /usr/local/bin/make \-f debian/rules
 as \fIrules-file\fR).
 as \fIrules-file\fR).
 .TP
 .TP
+.BI \-\-check\-command= check-command
+Command used to check the \fB.changes\fP file itself and any artifact built
+referenced in the file. The command should take the \fB.changes\fP pathname
+as an argument. This command will usually be \fBlintian\fP.
+.TP
+.BI \-\-check\-option= opt
+Pass option \fIopt\fP to \fIcheck-command\fP.
+.TP
 .BI \-p sign-command
 .BI \-p sign-command
 When \fBdpkg\-buildpackage\fP needs to execute GPG to sign a source
 When \fBdpkg\-buildpackage\fP needs to execute GPG to sign a source
 control (\fB.dsc\fP) file or a \fB.changes\fP file it will run
 control (\fB.dsc\fP) file or a \fB.changes\fP file it will run
@@ -251,6 +262,10 @@ Show the version and exit.
 .
 .
 .SH ENVIRONMENT
 .SH ENVIRONMENT
 .TP
 .TP
+.B DEB_CHECK_COMMAND
+If set, it will be used as the command to check the \fB.changes\fP file.
+Overridden by the \fB\-\-check\-command\fP option.
+.TP
 .B DEB_SIGN_KEYID
 .B DEB_SIGN_KEYID
 If set, it will be used to sign the \fB.changes\fP and \fB.dsc\fP files.
 If set, it will be used to sign the \fB.changes\fP and \fB.dsc\fP files.
 Overridden by the \fB\-k\fP option.
 Overridden by the \fB\-k\fP option.
@@ -295,5 +310,6 @@ and initial arguments for
 .BR dpkg\-buildflags (1),
 .BR dpkg\-buildflags (1),
 .BR dpkg\-genchanges (1),
 .BR dpkg\-genchanges (1),
 .BR fakeroot (1),
 .BR fakeroot (1),
+.BR lintian (1),
 .BR gpg2 (1),
 .BR gpg2 (1),
 .BR gpg (1).
 .BR gpg (1).

+ 18 - 0
scripts/dpkg-buildpackage.pl

@@ -71,6 +71,10 @@ sub usage {
   -j[<number>]   specify jobs to run simultaneously (passed to <rules>).
   -j[<number>]   specify jobs to run simultaneously (passed to <rules>).
   -r<gain-root-command>
   -r<gain-root-command>
                  command to gain root privileges (default is fakeroot).
                  command to gain root privileges (default is fakeroot).
+  --check-command=<check-command>
+                 command to check the .changes file (no default).
+  --check-option=<opt>
+                 pass <opt> to <check-command>.
   -p<sign-command>
   -p<sign-command>
                  command to sign .dsc and/or .changes files
                  command to sign .dsc and/or .changes files
                    (default is gpg2 or gpg).
                    (default is gpg2 or gpg).
@@ -122,6 +126,8 @@ my $parallel;
 my $checkbuilddep = 1;
 my $checkbuilddep = 1;
 my @checkbuilddep_opts;
 my @checkbuilddep_opts;
 my @source_opts;
 my @source_opts;
+my $check_command = $ENV{DEB_CHECK_COMMAND};
+my @check_opts;
 my $signpause;
 my $signpause;
 my $signkey = defined $ENV{DEB_SIGN_KEYID} ? $ENV{DEB_SIGN_KEYID} : undef;
 my $signkey = defined $ENV{DEB_SIGN_KEYID} ? $ENV{DEB_SIGN_KEYID} : undef;
 my $signforce = 0;
 my $signforce = 0;
@@ -188,6 +194,10 @@ while (@ARGV) {
 	$parallel = $1 || '';
 	$parallel = $1 || '';
     } elsif (/^-r(.*)$/) {
     } elsif (/^-r(.*)$/) {
 	@rootcommand = split /\s+/, $1;
 	@rootcommand = split /\s+/, $1;
+    } elsif (/^--check-command=(.*)$/) {
+	$check_command = $1;
+    } elsif (/^--check-option=(.*)$/) {
+	push @check_opts, $1;
     } elsif (/^-p(.*)$/) {
     } elsif (/^-p(.*)$/) {
 	$signcommand = $1;
 	$signcommand = $1;
     } elsif (/^-k(.*)$/) {
     } elsif (/^-k(.*)$/) {
@@ -299,6 +309,10 @@ if ($< == 0) {
     }
     }
 }
 }
 
 
+if ($check_command and not find_command($check_command)) {
+    error(_g("check-commmand '%s' not found"), $check_command);
+}
+
 if (!defined $signcommand &&
 if (!defined $signcommand &&
     (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
     (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
      ($ENV{HOME} && -e "$ENV{HOME}/.gnupg"))) {
      ($ENV{HOME} && -e "$ENV{HOME}/.gnupg"))) {
@@ -497,6 +511,10 @@ chdir($dir) or syserr("chdir $dir");
 
 
 printf "$Dpkg::PROGNAME: %s\n", describe_build($files);
 printf "$Dpkg::PROGNAME: %s\n", describe_build($files);
 
 
+if ($check_command) {
+    withecho($check_command, @check_opts, $chg);
+}
+
 if ($signpause && ($signchanges || $signsource)) {
 if ($signpause && ($signchanges || $signsource)) {
     print _g("Press the return key to start signing process\n");
     print _g("Press the return key to start signing process\n");
     getc();
     getc();