On Sun, Nov 13, 2011 at 02:31:15PM -0600, Jonathan Nieder wrote: > Roger Leigh wrote: > > > Attached. > > Thanks much!
New version attached. It includes your changes, plus the documentation fixes you suggested. 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 fc2782bcdd940ebf61a47ce182cbdef7a469d62a 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 | 12 +++++++-- scripts/Dpkg/Control/Fields.pm | 16 ++++++++++-- scripts/dpkg-buildpackage.pl | 4 +- scripts/dpkg-checkbuilddeps.pl | 27 ++++++++++++++++----- scripts/dpkg-source.pl | 2 +- 6 files changed, 81 insertions(+), 28 deletions(-) diff --git a/man/deb-src-control.5 b/man/deb-src-control.5 index 76e2f9e..4987223 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..dd14b14 100644 --- a/man/dpkg-checkbuilddeps.1 +++ b/man/dpkg-checkbuilddeps.1 @@ -1,4 +1,4 @@ -.TH dpkg\-checkbuilddeps 1 "2011-07-04" "Debian Project" "dpkg utilities" +.TH dpkg\-checkbuilddeps 1 "2011-11-13" "Debian Project" "dpkg utilities" .SH NAME dpkg\-checkbuilddeps \- check build dependencies and conflicts . @@ -21,9 +21,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 Build-Conflicts-Arch 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 Build-Conflicts-Indep +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 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..d8d36e4 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 ignore Build-Depends-Arch and Build-Conflicts-Arch. + -B ignore Build-Depends-Indep and Build-Conflicts-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

