浏览代码

dpkg-checkbuilddeps: new option -a <arch>

This option tells dpkg-checkbuilddeps to check the build-dependencies
assuming that they must all be satisfied on the given architecture.
In the future build-dependencies might be annotated to indicate whether
we need a package for the host or for the build architecture, but for
now this is a first step that can already be useful.

The normal Multi-Arch logic applies so that so that packages marked as
"Multi-Arch: foreign" can satisfy a build-dependency no matter what
architecture is requested. For the other packages, dpkg-checkbuilddeps
will require a package from the requested architecture.

Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
Colin Watson 14 年之前
父节点
当前提交
c4f30d0909
共有 3 个文件被更改,包括 16 次插入4 次删除
  1. 4 0
      debian/changelog
  2. 5 0
      man/dpkg-checkbuilddeps.1
  3. 7 4
      scripts/dpkg-checkbuilddeps.pl

+ 4 - 0
debian/changelog

@@ -48,6 +48,10 @@ dpkg (1.16.2) UNRELEASED; urgency=low
   * Update dpkg-gensymbols(1) to clarify that -e accepts shell patterns
     expansions and not regular expressions. And let dpkg-gensymbols output a
     warning when a pattern doesn't match any file. Closes: #649248
+  * Add new option "-a <arch>" to dpkg-checkbuilddeps to check build
+    dependencies for another architecture. This is really basic for now since
+    it assumes all build dependencies must be satisfied on the listed
+    architecture. Closes: #648180 Thanks to Colin Watson for the patch.
 
   [ Jonathan Nieder ]
   * Bump po4a version in Build-Depends to 0.41, since earlier versions do

+ 5 - 0
man/dpkg-checkbuilddeps.1

@@ -31,6 +31,11 @@ be built.
 Use the given build dependencies/conflicts instead of those contained in the
 \fIdebian/control\fP file.
 .TP
+.BI "\-a " arch
+Check build dependencies/conflicts assuming that the package described in
+the control file is to be built for the given host architecture instead of
+the architecture of the current system.
+.TP
 .BR \-h ", " \-\-help
 Show the usage message and exit.
 .TP

+ 7 - 4
scripts/dpkg-checkbuilddeps.pl

@@ -47,6 +47,7 @@ sub usage {
                  retrieving them from control file
   -c build-conf  use given string for build conflicts instead of
                  retrieving them from control file
+  -a arch        assume given host architecture
   --admindir=<directory>
                  change the administrative directory.
   -h, --help     show this help message.
@@ -58,11 +59,13 @@ sub usage {
 
 my $binary_only=0;
 my ($bd_value, $bc_value);
+my $host_arch = get_host_arch();
 if (!GetOptions('B' => \$binary_only,
                 'help|h' => sub { usage(); exit(0); },
                 'version' => \&version,
                 'd=s' => \$bd_value,
                 'c=s' => \$bc_value,
+                'a=s' => \$host_arch,
                 'admindir=s' => \$admindir)) {
 	usage();
 	exit(2);
@@ -94,11 +97,13 @@ my (@unmet, @conflicts);
 
 if ($bd_value) {
 	push @unmet, build_depends('Build-Depends/Build-Depends-Indep)',
-		deps_parse($bd_value, reduce_arch => 1), $facts);
+		deps_parse($bd_value, host_arch => $host_arch,
+			   reduce_arch => 1), $facts);
 }
 if ($bc_value) {
 	push @conflicts, build_conflicts('Build-Conflicts/Build-Conflicts-Indep',
-		deps_parse($bc_value, reduce_arch => 1, union => 1), $facts);
+		deps_parse($bc_value, host_arch => $host_arch,
+			   reduce_arch => 1, union => 1), $facts);
 }
 
 if (@unmet) {
@@ -178,8 +183,6 @@ sub check_line {
 	my $fieldname=shift;
 	my $dep_list=shift;
 	my $facts=shift;
-	my $host_arch = shift || get_host_arch();
-	chomp $host_arch;
 
 	my @unmet=();