Package: dpkg
Version: 1.15.8.6
Severity: normal
Tags: patch

In order to allow full use of Build-Depends-Indep, and to allow
autobuilding of arch-indep packages on our buildds, as well as
more efficient building of arch-any packages (since building
arch-indep stuff can be skipped), I'd like to get full support
for the build-arch and build-indep targets in debian/rules as
a release goal for wheezy.

The autobuild infrastructure is already capable of handling
Build-(Depends|Conflicts)-Indep correctly.  But, since sbuild uses
dpkg-buildpackage to build the packages, we always call
'debian/rules build' in all cases.  The solution is to fix
dpkg-buildpackage.

The attached patch lets dpkg-buildpackage call the build-arch and
build-indep targets when appropriate:
When run with -b (default), use 'build' and 'binary' targets.
When run with -B, use 'build-arch' and 'binary-arch' targets.
When run with -A, use 'build-indep' and 'binary-indep' targets.

The patch can't be applied just yet, because the build-arch and
build-indep targets are not yet required by Policy, though they
are defined in Policy.  See #604397 for the proposal to change it
to being required.  Policy won't change until we have sufficient
archive coverage to allow that.

cdbs already supplies the appropriate targets, and debhelper's
dh tool has patches I wrote pending to add support there.
Combined, these two tools should give just under 50% coverage
of the entire archive (estimated from the lintian lab source
archive).  And the next step is to add a check to lintian to
warn if the targets are not present.

So hopefully when these prerequisites are met, the patch can be
applied.


Thanks,
Roger

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (550, 'unstable'), (400, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.36-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii  coreutils               8.5-1            GNU core utilities
ii  libbz2-1.0              1.0.5-6          high-quality block-sorting file co
ii  libc6                   2.11.2-7         Embedded GNU C Library: Shared lib
ii  libselinux1             2.0.96-1         SELinux runtime shared libraries
ii  xz-utils                5.0.0-2          XZ-format compression utilities
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt                           0.8.9      Advanced front-end for dpkg

-- no debconf information
>From 200bf97b93ffa6f4bd831302df825f2fd94b33ea Mon Sep 17 00:00:00 2001
From: Roger Leigh <rle...@debian.org>
Date: Thu, 25 Nov 2010 11:44:40 +0000
Subject: [PATCH] dpkg-buildpackage: Use build-arch and build-indep build targets

When run with -b (default), use 'build' and 'binary' targets.
When run with -B, use 'build-arch' and 'binary-arch' targets.
When run with -A, use 'build-indep' and 'binary-indep' targets.

Update manual page to document new behaviour.

Signed-off-by: Roger Leigh <rle...@debian.org>
---
 man/dpkg-buildpackage.1      |    9 +++++----
 scripts/dpkg-buildpackage.pl |    6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 6460e51..e33ecf2 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -27,11 +27,12 @@ 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
+build has been requested with \fB\-S\fP). Note that \fIbuild-target\fR and
+\fIbinary-target\fR 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
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index aaea544..e8d7be1 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -119,6 +119,7 @@ my $checkbuilddep = 1;
 my $signsource = 1;
 my $signchanges = 1;
 my $binarytarget = 'binary';
+my $buildtarget = 'build';
 my $targetarch = my $targetgnusystem = '';
 my $call_target = '';
 my $call_target_as_root = 0;
@@ -202,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");
@@ -403,7 +407,7 @@ unless (build_binaryonly) {
     chdir($dir) or syserr("chdir $dir");
 }
 unless (build_sourceonly) {
-    withecho(@debian_rules, 'build');
+    withecho(@debian_rules, $buildtarget);
     withecho(@rootcommand, @debian_rules, $binarytarget);
 }
 if ($usepause &&
-- 
1.7.2.3

Reply via email to