summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rw-r--r--man/dpkg-buildpackage.120
-rwxr-xr-xscripts/dpkg-buildpackage.pl26
3 files changed, 42 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index 06e0dee..9b38d6e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -89,6 +89,9 @@ dpkg (1.16.2) UNRELEASED; urgency=low
* Drop misleading spaces in deb-symbols(5) in the format description.
* Clean up dpkg-architecture(1) dropping useless information and
adding a reference to /usr/share/dpkg/architecture.mk.
+ * Update dpkg-buildpackage to use the "build-arch" (for -B) and
+ "build-indep" (for -A) targets unless "make -qn" says that they do not
+ exist. Closes: #229357
[ Jonathan Nieder ]
* Bump po4a version in Build-Depends to 0.41, since earlier versions do
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 5410a20..a28826e 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -27,12 +27,13 @@ It calls \fBdpkg\-source \-b\fP to generate the source package (unless
a binary\-only build has been requested with \fB\-b\fP, \fB\-B\fP or
\fB\-A\fP).
.IP \fB5.\fP 3
-It calls \fBdebian/rules\fP \fBbuild\fP followed by
+It calls \fBdebian/rules\fP \fIbuild-target\fP followed by
\fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
-build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
-either \fBbinary\fP (default case, or if \fB\-b\fP is specified)
-or \fBbinary\-arch\fP (if \fB\-B\fP is specified) or \fBbinary\-indep\fP
-(if \fB\-A\fP is specified).
+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).
.IP \fB6.\fP 3
It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
\fB\-us\fP is specified).
@@ -241,6 +242,13 @@ exported compiler flags (\fBCFLAGS\fP, \fBCXXFLAGS\fP, \fBFFLAGS\fP,
\fBCPPFLAGS\fP and \fBLDFLAGS\fP) with values as returned
by \fBdpkg\-buildflags\fP. This is no longer the case.
.
+.SH BACKWARD COMPATIBILITY
+\fBdpkg\-buildpackage\fP is using the \fBbuild\-arch\fP and
+\fBbuild\-indep\fP targets since version 1.16.2. Those targets are thus
+mandatory. But to avoid breakages of existing packages, and ease
+the transition, it will fallback to using the \fBbuild\fP target
+if \fBmake \-f debian/rules \-qn\fP \fIbuild-target\fP returns 2 as
+exit code.
.SH BUGS
It should be possible to specify spaces and shell metacharacters in
and initial arguments for
@@ -261,7 +269,7 @@ Copyright \(co 2000 Wichert Akkerman
.br
Copyright \(co 2007 Frank Lichtenheld
.br
-Copyright \(co 2008-2010 Rapha\[:e]l Hertzog
+Copyright \(co 2008-2012 Rapha\[:e]l Hertzog
.sp
This is free software; see the GNU General Public Licence version 2 or later
for copying conditions. There is NO WARRANTY.
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 50e6170..2a36308 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -30,6 +30,7 @@ use Dpkg::Compression;
use Dpkg::Version;
use Dpkg::Changelog::Parse;
use Dpkg::Path qw(find_command);
+use Dpkg::IPC;
textdomain("dpkg-dev");
@@ -117,6 +118,7 @@ my ($admindir, $signkey, $forcesigninterface, $usepause, $noclean,
my $checkbuilddep = 1;
my $signsource = 1;
my $signchanges = 1;
+my $buildtarget = 'build';
my $binarytarget = 'binary';
my $targetarch = my $targetgnusystem = '';
my $call_target = '';
@@ -201,18 +203,21 @@ while (@ARGV) {
$include = BUILD_BINARY;
push @changes_opts, '-b';
@checkbuilddep_opts = ();
+ $buildtarget = 'build';
$binarytarget = 'binary';
} elsif (/^-B$/) {
build_sourceonly && usageerr(_g("cannot combine %s and %s"), $_, "-S");
$include = BUILD_ARCH_DEP;
push @changes_opts, '-B';
@checkbuilddep_opts = ('-B');
+ $buildtarget = 'build-arch';
$binarytarget = 'binary-arch';
} elsif (/^-A$/) {
build_sourceonly && usageerr(_g("cannot combine %s and %s"), $_, "-S");
$include = BUILD_ARCH_INDEP;
push @changes_opts, '-A';
@checkbuilddep_opts = ();
+ $buildtarget = 'build-indep';
$binarytarget = 'binary-indep';
} elsif (/^-S$/) {
build_binaryonly && usageerr(_g("cannot combine %s and %s"), build_opt, "-S");
@@ -393,8 +398,27 @@ unless (build_binaryonly) {
withecho('dpkg-source', @source_opts, '-b', $dir);
chdir($dir) or syserr("chdir $dir");
}
+
+unless ($buildtarget eq "build" or scalar(@debian_rules) > 1) {
+ # Verify that build-{arch,indep} are supported. If not, fallback to build.
+ # This is a temporary measure to not break too many packages on a flag day.
+ my $pid = spawn(exec => [ "make", "-f", @debian_rules, "-qn", $buildtarget ],
+ from_file => "/dev/null", to_file => "/dev/null",
+ error_to_file => "/dev/null");
+ my $cmdline = "make -f @debian_rules -qn $buildtarget";
+ wait_child($pid, nocheck => 1, cmdline => $cmdline);
+ my $exitcode = WEXITSTATUS($?);
+ subprocerr($cmdline) unless WIFEXITED($?);
+ if ($exitcode == 2) {
+ warning(_g("%s must be updated to support the 'build-arch' and " .
+ "'build-indep' targets (at least '%s' seems to be " .
+ "missing)"), "@debian_rules", $buildtarget);
+ $buildtarget = "build";
+ }
+}
+
unless (build_sourceonly) {
- withecho(@debian_rules, 'build');
+ withecho(@debian_rules, $buildtarget);
withecho(@rootcommand, @debian_rules, $binarytarget);
}
if ($usepause &&