Explorar el Código

scripts: Add -g and -G options for source plus arch-indep/specific builds

These were the last two combinations missing, just add them to let the
user have full control over the build ouput.

Closes: #756975
Guillem Jover hace 12 años
padre
commit
e161b733cf
Se han modificado 4 ficheros con 52 adiciones y 6 borrados
  1. 2 0
      debian/changelog
  2. 13 3
      man/dpkg-buildpackage.1
  3. 19 1
      scripts/dpkg-buildpackage.pl
  4. 18 2
      scripts/dpkg-genchanges.pl

+ 2 - 0
debian/changelog

@@ -100,6 +100,8 @@ dpkg (1.17.11) UNRELEASED; urgency=low
     generated .changes file from dpkg-genchanges, when the debian/files
     contains arch-specific packages but dpkg-genchanges was called with
     one of the build types excluding them.
+  * Add new -g and -G options to dpkg-genchanges and dpkg-buildpackage for
+    source plus arch-indep/specific builds. Closes: #756975
 
   [ Updated programs translations ]
   * Danish (Joe Dalton). Closes: #754127

+ 13 - 3
man/dpkg-buildpackage.1

@@ -54,8 +54,9 @@ then runs the \fBbinary\fP hook followed by \fBfakeroot debian/rules\fP
 \fIbinary-target\fP (unless a source-only build has been requested with
 \fB\-S\fP). Note that \fIbuild-target\fR and \fIbinary-target\fP are either
 \fBbuild\fP and \fBbinary\fP (default 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\-indep\fP (if \fB\-A\fP is specified).
+or \fBbuild\-arch\fP and \fBbinary\-arch\fP (if \fB\-B\fP or \fB\-G\fP are
+specified), or \fBbuild\-indep\fP and \fBbinary\-indep\fP (if \fB\-A\fP
+or \fB\-g\fP are specified).
 .IP \fB6.\fP 3
 It runs the \fBchanges\fP hook and calls \fBdpkg\-genchanges\fP to
 generate a \fB.changes\fP file.
@@ -80,6 +81,14 @@ It runs the \fBdone\fP hook.
 .
 .SH OPTIONS
 .TP
+.B \-g
+Specifies a build limited to source and architecture independent packages.
+Passed to \fBdpkg\-genchanges\fP.
+.TP
+.B \-G
+Specifies a build limited to source and architecture specific packages.
+Passed to \fBdpkg\-genchanges\fP.
+.TP
 .B \-b
 Specifies a binary-only build, no source files are to be built and/or
 distributed. Passed to \fBdpkg\-genchanges\fP.
@@ -174,7 +183,8 @@ Do not check build dependencies and conflicts.
 .TP
 .B \-nc
 Do not clean the source tree (implies \fB\-b\fP if nothing else has been
-selected among \fB\-F\fP, \fB\-B\fP, \fB\-A\fP or \fB\-S\fP).
+selected among \fB\-F\fP, \fB\-g\fP, \fB\-G\fP, \fB\-B\fP, \fB\-A\fP
+or \fB\-S\fP).
 .TP
 .B \-tc
 Clean the source tree (using

+ 19 - 1
scripts/dpkg-buildpackage.pl

@@ -4,7 +4,7 @@
 #
 # Copyright © 1996 Ian Jackson
 # Copyright © 2000 Wichert Akkerman
-# Copyright © 2006-2010,2012-2013 Guillem Jover <guillem@debian.org>
+# Copyright © 2006-2010,2012-2014 Guillem Jover <guillem@debian.org>
 # Copyright © 2007 Frank Lichtenheld
 #
 # This program is free software; you can redistribute it and/or modify
@@ -58,6 +58,8 @@ sub usage {
     . "\n\n" . _g(
 'Options:
   -F (default)   normal full build (binaries and sources).
+  -g             source and arch-indep build.
+  -G             source and arch-specific build.
   -b             binary-only, no source files.
   -B             binary-only, only arch-specific files.
   -A             binary-only, only arch-indep files.
@@ -162,6 +164,8 @@ use constant BUILD_SOURCE     => 2;
 use constant BUILD_ARCH_DEP   => 4;
 use constant BUILD_ARCH_INDEP => 8;
 use constant BUILD_BINARY     => BUILD_ARCH_DEP | BUILD_ARCH_INDEP;
+use constant BUILD_SOURCE_DEP => BUILD_SOURCE | BUILD_ARCH_DEP;
+use constant BUILD_SOURCE_INDEP => BUILD_SOURCE | BUILD_ARCH_INDEP;
 use constant BUILD_ALL        => BUILD_BINARY | BUILD_SOURCE;
 my $include = BUILD_ALL | BUILD_DEFAULT;
 
@@ -178,6 +182,10 @@ sub build_opt {
         return '-A';
     } elsif ($include == BUILD_SOURCE) {
         return '-S';
+    } elsif ($include == BUILD_SOURCE_DEP) {
+        return '-G';
+    } elsif ($include == BUILD_SOURCE_INDEP) {
+        return '-g';
     } else {
         croak "build_opt called with include=$include";
     }
@@ -282,6 +290,16 @@ while (@ARGV) {
 	    if not build_is_default;
 	$include = BUILD_SOURCE;
 	push @changes_opts, '-S';
+    } elsif (/^-G$/) {
+	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
+	    if not build_is_default;
+	$include = BUILD_SOURCE_DEP;
+	push @changes_opts, '-G';
+    } elsif (/^-g$/) {
+	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
+	    if not build_is_default;
+	$include = BUILD_SOURCE_INDEP;
+	push @changes_opts, '-g';
     } elsif (/^-F$/) {
 	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
 	    if not build_is_default;

+ 18 - 2
scripts/dpkg-genchanges.pl

@@ -83,6 +83,8 @@ use constant BUILD_SOURCE     => 1;
 use constant BUILD_ARCH_DEP   => 2;
 use constant BUILD_ARCH_INDEP => 4;
 use constant BUILD_BINARY     => BUILD_ARCH_DEP | BUILD_ARCH_INDEP;
+use constant BUILD_SOURCE_DEP => BUILD_SOURCE | BUILD_ARCH_DEP;
+use constant BUILD_SOURCE_INDEP => BUILD_SOURCE | BUILD_ARCH_INDEP;
 use constant BUILD_ALL        => BUILD_BINARY | BUILD_SOURCE;
 my $include = BUILD_ALL;
 
@@ -98,6 +100,10 @@ sub build_opt {
         return '-A';
     } elsif ($include == BUILD_SOURCE) {
         return '-S';
+    } elsif ($include == BUILD_SOURCE_DEP) {
+        return '-G';
+    } elsif ($include == BUILD_SOURCE_INDEP) {
+        return '-g';
     } else {
         croak "build_opt called with include=$include";
     }
@@ -117,6 +123,8 @@ sub usage {
 'Usage: %s [<option>...]')
     . "\n\n" . _g(
 "Options:
+  -g                       source and arch-indep build.
+  -G                       source and arch-specific build.
   -b                       binary-only, no source files.
   -B                       binary-only, only arch-specific files.
   -A                       binary-only, only arch-indep files.
@@ -162,6 +170,14 @@ while (@ARGV) {
 	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
 	    if not build_is_default;
 	$include = BUILD_SOURCE;
+    } elsif (m/^-G$/) {
+	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
+	    if not build_is_default;
+	$include = BUILD_SOURCE_DEP;
+    } elsif (m/^-g$/) {
+	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
+	    if not build_is_default;
+	$include = BUILD_SOURCE_INDEP;
     } elsif (m/^-s([iad])$/) {
         $sourcestyle= $1;
     } elsif (m/^-q$/) {
@@ -482,8 +498,8 @@ for my $file ($dist->get_files()) {
     if (defined $file->{package}) {
         my $arch_all = debarch_eq('all', $p2arch{$file->{package}});
 
-        next if ($include == BUILD_ARCH_DEP and $arch_all);
-        next if ($include == BUILD_ARCH_INDEP and not $arch_all);
+        next if (not ($include & BUILD_ARCH_INDEP) and $arch_all);
+        next if (not ($include & BUILD_ARCH_DEP) and not $arch_all);
     }
     my $uf = "$uploadfilesdir/$f";
     $checksums->add_from_file($uf, key => $f);