From 058673c0932b146d16f583b43bc4d78f378a8c1c Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Wed, 16 May 2012 20:51:45 +0100 Subject: Add Build-Depends-Arch and Build-Conflicts-Arch dpkg currently supports Build-Depends (arch all and any) Build-Depends-Indep (arch all) and the same Build-Conflicts. This patch adds Build-Depends-Arch (arch any) and Build-Conflicts-Arch. This makes the support for build dependencies for arch all and any packages symmetrical and more logical. It also permits arch-any dependencies to be omitted for arch-all-only builds. This change will not break any existing packages: if the arch any deps are in Build-Depends, they may be installed unnecessarily, but they will still be installed. This change just allows an additional optimisation, and tidies up a slight omission in the original implementation of build dependencies, and would give the buildds additional options when arch-all autobuilding is enabled (especially now it's available as a separate independent arch). Closes: #629480 Signed-off-by: Roger Leigh Signed-off-by: Guillem Jover --- debian/changelog | 3 +++ man/deb-src-control.5 | 45 ++++++++++++++++++++++++++++++++---------- man/dpkg-checkbuilddeps.1 | 12 ++++++++--- scripts/Dpkg/Control/Fields.pm | 16 ++++++++++++--- scripts/dpkg-buildpackage.pl | 4 ++-- scripts/dpkg-checkbuilddeps.pl | 27 ++++++++++++++++++------- scripts/dpkg-source.pl | 2 +- 7 files changed, 83 insertions(+), 26 deletions(-) diff --git a/debian/changelog b/debian/changelog index c561cb2f8..c75431140 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,9 @@ dpkg (1.16.4) UNRELEASED; urgency=low * Add new Dpkg::Substvars::set_as_used() member function. * Rename Dpkg::Substvars no_warn() member function to mark_as_used(), keep the old name aliased to the new one producing a deprecation warning. + * Add support for Build-Depends-Arch and Build-Conflicts-Arch fields, and + a new -A option to dpkg-checkbuilddeps. Closes: #629480 + Thanks to Roger Leigh . [ Updated man page translations ] * German (Helge Kreutzmann). diff --git a/man/deb-src-control.5 b/man/deb-src-control.5 index 891526538..0baf924aa 100644 --- a/man/deb-src-control.5 +++ b/man/deb-src-control.5 @@ -16,7 +16,7 @@ .\" You should have received a copy of the GNU General Public License .\" along with this program. If not, see . . -.TH deb\-src\-control 5 "2011-08-14" "Debian Project" "Debian" +.TH deb\-src\-control 5 "2012-05-16" "Debian Project" "Debian" .SH NAME deb\-src\-control \- Debian source packages' master control file format . @@ -125,27 +125,51 @@ package. .TP .BI Build\-Depends: " package-list" -A list of packages that need to be installed and configured to be able to build -the source package. +A list of packages that need to be installed and configured to be able +to build the source package. Including a dependency in this list has +the same effect as including it in both \fBBuild\-Depends\-Arch\fP and +\fBBuild\-Depends\-Indep\fP, with the additional effect of being used +for source-only builds. + +.TP +.BI Build\-Depends\-Arch: " package list" +Same as \fBBuild\-Depends\fP, but they are only needed when building the +architecture dependent packages. The \fBBuild\-Depends\fP are also +installed in this case. This field was introduced in dpkg version +1.16.4; in order to build with older dpkg versions, \fBBuild\-Depends\fP +should be used instead. .TP .BI Build\-Depends\-Indep: " package-list" Same as \fBBuild\-Depends\fP, but they are only needed when building the -architecture independent packages. The \fBBuild\-Depends\fP are also installed -in this case. +architecture independent packages. The \fBBuild\-Depends\fP are also +installed in this case. .TP -.BI Build\-Conflicts: " package-list" -A list of packages that should not be installed when the package is build, for -example because they interfere with the used build system. +.BI Build\-Conflicts: " package list" +A list of packages that should not be installed when the package is +built, for example because they interfere with the build system used. +Including a dependency in this list has the same effect as including +it in both \fBBuild\-Conflicts\-Arch\fP and +\fBBuild\-Conflicts\-Indep\fP, with the additional effect of being +used for source-only builds. + +.TP +.BI Build\-Conflicts\-Arch: " package list" +Same as \fBBuild\-Conflicts\fP, but only when building the architecture +dependent packages. This field was introduced in dpkg version 1.16.4; in +order to build with older dpkg versions, \fBBuild\-Conflicts\fP should +be used instead. .TP .BI Build\-Conflicts\-Indep: " package-list" Same as \fBBuild\-Conflicts\fP, but only when building the architecture independent packages. +.PP The syntax of the -.B Build\-Depends +.BR Build\-Depends , +.B Build\-Depends\-Arch and .B Build\-Depends\-Indep fields is a list of groups of alternative packages. Each group is a list @@ -156,7 +180,8 @@ optionally followed by a version number specification in parentheses and an architecture specification in square brackets. The syntax of the -.B Build\-Conflicts +.BR Build\-Conflicts , +.B Build\-Conflicts\-Arch and .B Build\-Conflicts\-Indep fields is a list of comma-separated package names, where the comma is read diff --git a/man/dpkg-checkbuilddeps.1 b/man/dpkg-checkbuilddeps.1 index d7dcf1158..597899333 100644 --- a/man/dpkg-checkbuilddeps.1 +++ b/man/dpkg-checkbuilddeps.1 @@ -17,7 +17,7 @@ .\" You should have received a copy of the GNU General Public License .\" along with this program. If not, see . . -.TH dpkg\-checkbuilddeps 1 "2011-07-04" "Debian Project" "dpkg utilities" +.TH dpkg\-checkbuilddeps 1 "2012-05-16" "Debian Project" "dpkg utilities" .SH NAME dpkg\-checkbuilddeps \- check build dependencies and conflicts . @@ -40,9 +40,15 @@ may be specified on the command line. Change the location of the \fBdpkg\fR database. The default location is \fI/var/lib/dpkg\fP. .TP +.B \-A +Ignore \fIBuild\-Depends\-Arch\fR and \fIBuild\-Conflicts\-Arch\fR +lines. Use when only arch-indep packages will be built, or combine with +\fB\-B\fP when only a source package is to be built. +.TP .B \-B -Ignore \fIBuild\-Depends\-Indep\fR lines. Use when no arch-indep packages will -be built. +Ignore \fIBuild\-Depends\-Indep\fR and \fIBuild\-Conflicts\-Indep\fR +lines. Use when only arch-dep packages will be built, or combine with +\fB\-A\fP when only a source package is to be built. .TP .BI "\-d " build-depends-string .TP diff --git a/scripts/Dpkg/Control/Fields.pm b/scripts/Dpkg/Control/Fields.pm index 41b5d9ca8..8ff4c4779 100644 --- a/scripts/Dpkg/Control/Fields.pm +++ b/scripts/Dpkg/Control/Fields.pm @@ -61,23 +61,33 @@ our %FIELDS = ( 'Build-Conflicts' => { allowed => ALL_SRC, dependency => 'union', - dep_order => 3, + dep_order => 4, + }, + 'Build-Conflicts-Arch' => { + allowed => ALL_SRC, + dependency => 'union', + dep_order => 5, }, 'Build-Conflicts-Indep' => { allowed => ALL_SRC, dependency => 'union', - dep_order => 4, + dep_order => 6, }, 'Build-Depends' => { allowed => ALL_SRC, dependency => 'normal', dep_order => 1, }, - 'Build-Depends-Indep' => { + 'Build-Depends-Arch' => { allowed => ALL_SRC, dependency => 'normal', dep_order => 2, }, + 'Build-Depends-Indep' => { + allowed => ALL_SRC, + dependency => 'normal', + dep_order => 3, + }, 'Built-Using' => { allowed => ALL_PKG, dependency => 'union', diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index 7222fb900..5fd2d3002 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -214,14 +214,14 @@ while (@ARGV) { build_sourceonly && usageerr(_g("cannot combine %s and %s"), $_, "-S"); $include = BUILD_ARCH_INDEP; push @changes_opts, '-A'; - @checkbuilddep_opts = (); + @checkbuilddep_opts = ('-A'); $buildtarget = 'build-indep'; $binarytarget = 'binary-indep'; } elsif (/^-S$/) { build_binaryonly && usageerr(_g("cannot combine %s and %s"), build_opt, "-S"); $include = BUILD_SOURCE; push @changes_opts, '-S'; - @checkbuilddep_opts = ('-B'); + @checkbuilddep_opts = ('-A', '-B'); } elsif (/^-F$/) { !build_normal && usageerr(_g("cannot combine %s and %s"), $_, build_opt); $include = BUILD_ALL; diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index e6e97ce51..31ab143d6 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -43,7 +43,8 @@ sub usage { "Usage: %s [