On Sun, Sep 25, 2011 at 08:59:05PM +0100, Roger Leigh wrote:
> On Sun, Sep 25, 2011 at 12:48:02AM -0500, Jonathan Nieder wrote:
> [...]
> > > - } elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) {
> > > + } elsif (m/^Build-(Depends|Conflicts)(-Arch|-Indep)?$/i) {
> >
> > That’s all it takes? Looks very sane.
> >
> > The only missing pieces I see are some tiny nits mentioned above, (*),
> > and that it would be helpful to add a test to
> >
> > git://git.debian.org/dpkg/pkg-tests.git
> >
> > to make sure bugs affecting this new functionality get caught early.
>
> I'm a bit busy for the next week (thesis submission), but I'll take
> care of all the points you've raised in early October as time allows,
> and I'll get an updated patch back to you.
Attached. This should address all the points you brought up in the
bug report with respect to the first patch.
- Rebased against current git master
- Added manual page clarifications
- Updated dependency ordering in dpkg control file
- Updated dpkg-checkbuilddeps options usage by dpkg-buildpackage
- Updated dpkg-checkbuilddeps help text
- Renamed dpkg-checkbuilddeps option variables to be less confusing
I haven't yet updated the testsuite; this would need doing in a
second patch.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
>From 0b62d3b5122842cb2f75b0bf4bd2e8b490e9a22a Mon Sep 17 00:00:00 2001
From: Roger Leigh <[email protected]>
Date: Sun, 13 Nov 2011 19:18:28 +0000
Subject: [PATCH] Add Build-Depends-Arch and Build-Conflicts-Arch
Signed-off-by: Roger Leigh <[email protected]>
---
man/deb-src-control.5 | 48 ++++++++++++++++++++++++++++++----------
man/dpkg-checkbuilddeps.1 | 4 +++
scripts/Dpkg/Control/Fields.pm | 16 ++++++++++--
scripts/dpkg-buildpackage.pl | 4 +-
scripts/dpkg-checkbuilddeps.pl | 27 ++++++++++++++++-----
scripts/dpkg-source.pl | 2 +-
6 files changed, 76 insertions(+), 25 deletions(-)
diff --git a/man/deb-src-control.5 b/man/deb-src-control.5
index 76e2f9e..177f495 100644
--- a/man/deb-src-control.5
+++ b/man/deb-src-control.5
@@ -109,27 +109,50 @@ 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 Build-Depends-Arch and
+Build-Depends-Indep, 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.2; 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.
+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.
+
+.TP
+.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 Build-Conflicts-Arch and Build-Conflicts-Indep, with the
+additional effect of being used for source-only builds. This field
+was introduced in dpkg version 1.16.2; in order to build with older
+dpkg versions, \fBBuild\-Conflicts\fP should be used instead.
.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\-Arch: " package list"
+Same as \fBBuild\-Conflicts\fP, but only when building the
+architecture dependent packages.
.TP
.BI Build\-Conflicts\-Indep: " package-list"
-Same as \fBBuild\-Conflicts\fP, but only when building the architecture
-independent packages.
+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
@@ -140,7 +163,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 807bf40..772d2ca 100644
--- a/man/dpkg-checkbuilddeps.1
+++ b/man/dpkg-checkbuilddeps.1
@@ -21,6 +21,10 @@ 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 lines. Use when no arch-dep packages will
+be built.
+.TP
.B \-B
Ignore \fIBuild\-Depends\-Indep\fR lines. Use when no arch-indep packages will
be built.
diff --git a/scripts/Dpkg/Control/Fields.pm b/scripts/Dpkg/Control/Fields.pm
index d7d7dcf..e426760 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 50e6170..e98cc88 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -212,13 +212,13 @@ 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');
$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 93af92e..e13db2c 100755
--- a/scripts/dpkg-checkbuilddeps.pl
+++ b/scripts/dpkg-checkbuilddeps.pl
@@ -42,7 +42,8 @@ sub usage {
"Usage: %s [<option>...] [<control-file>]")
. "\n\n" . _g(
"Options:
- -B binary-only, ignore -Indep.
+ -A binary-only, only arch-indep files; ignore B-D-Arch.
+ -B binary-only, no arch-indep files; ignore B-D-Indep.
-d build-deps use given string as build dependencies instead of
retrieving them from control file
-c build-conf use given string for build conflicts instead of
@@ -56,9 +57,11 @@ sub usage {
. "\n", $progname;
}
-my $binary_only=0;
+my $ignore_bd_arch=0;
+my $ignore_bd_indep=0;
my ($bd_value, $bc_value);
-if (!GetOptions('B' => \$binary_only,
+if (!GetOptions('A' => \$ignore_bd_arch,
+ 'B' => \$ignore_bd_indep,
'help|h' => sub { usage(); exit(0); },
'version' => \&version,
'd=s' => \$bd_value,
@@ -78,11 +81,21 @@ my $facts = parse_status("$admindir/status");
unless (defined($bd_value) or defined($bc_value)) {
$bd_value = 'build-essential';
$bd_value .= ", " . $fields->{"Build-Depends"} if defined $fields->{"Build-Depends"};
- if (not $binary_only and defined $fields->{"Build-Depends-Indep"}) {
+ if (not $ignore_bd_arch and defined $fields->{"Build-Depends-Arch"}) {
+ $bd_value .= ", " . $fields->{"Build-Depends-Arch"};
+ }
+ if (not $ignore_bd_indep and defined $fields->{"Build-Depends-Indep"}) {
$bd_value .= ", " . $fields->{"Build-Depends-Indep"};
}
$bc_value = $fields->{"Build-Conflicts"} if defined $fields->{"Build-Conflicts"};
- if (not $binary_only and defined $fields->{"Build-Conflicts-Indep"}) {
+ if (not $ignore_bd_arch and defined $fields->{"Build-Conflicts-Arch"}) {
+ if ($bc_value) {
+ $bc_value .= ", " . $fields->{"Build-Conflicts-Arch"};
+ } else {
+ $bc_value = $fields->{"Build-Conflicts-Arch"};
+ }
+ }
+ if (not $ignore_bd_indep and defined $fields->{"Build-Conflicts-Indep"}) {
if ($bc_value) {
$bc_value .= ", " . $fields->{"Build-Conflicts-Indep"};
} else {
@@ -93,11 +106,11 @@ unless (defined($bd_value) or defined($bc_value)) {
my (@unmet, @conflicts);
if ($bd_value) {
- push @unmet, build_depends('Build-Depends/Build-Depends-Indep)',
+ push @unmet, build_depends('Build-Depends/Build-Depends-Arch/Build-Depends-Indep',
deps_parse($bd_value, reduce_arch => 1), $facts);
}
if ($bc_value) {
- push @conflicts, build_conflicts('Build-Conflicts/Build-Conflicts-Indep',
+ push @conflicts, build_conflicts('Build-Conflicts/Build-Conflicts-Arch/Build-Conflicts-Indep',
deps_parse($bc_value, reduce_arch => 1, union => 1), $facts);
}
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 1b90491..f02aaf2 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -246,7 +246,7 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build|--commit)$
$fields->{$_} = $v;
} elsif (m/^Uploaders$/i) {
($fields->{$_} = $v) =~ s/\s*[\r\n]\s*/ /g; # Merge in a single-line
- } elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) {
+ } elsif (m/^Build-(Depends|Conflicts)(-Arch|-Indep)?$/i) {
my $dep;
my $type = field_get_dep_type($_);
$dep = deps_parse($v, union => $type eq 'union');
--
1.7.7.2