[buildd-tools-devel] Bug#697298: libsbuild-perl: setup_apt_archive doesn't pass correct options to deps_parse, breaking foo:native build-dependencies

Colin Watson cjwatson at ubuntu.com
Thu Jan 3 18:10:06 UTC 2013


Package: libsbuild-perl
Version: 0.63.2-1.1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch raring

If you attempt to build a package with a build-dependency on foo:native
(as documented in https://wiki.ubuntu.com/MultiarchCross), you get a
parse error from Dpkg::Deps.  This is because Sbuild::ResolverBase
doesn't pass sufficient options to Dpkg::Deps::deps_parse to explain the
situation to it.  Here are the relevant chunks of perldoc:

=item union (defaults to 0)

If set to 1, returns a Dpkg::Deps::Union instead of a Dpkg::Deps::AND. Use
this when parsing non-dependency fields like Conflicts.

=item build_dep (defaults to 0)

If set to 1, allow build-dep only arch qualifiers, that is “:native”.
This should be set whenever working with build-deps.

I've also added build_arch, in order to correctly handle a case such as
mine where I have an i386 base system with amd64->armhf cross-building
chroots.  This won't work until my patch in #697297 is also applied, but
it also isn't harmful.

diff --git a/lib/Sbuild/ResolverBase.pm b/lib/Sbuild/ResolverBase.pm
index a22352b..efa6d9d 100644
--- a/lib/Sbuild/ResolverBase.pm
+++ b/lib/Sbuild/ResolverBase.pm
@@ -721,11 +721,16 @@ EOF
     my $positive = deps_parse(join(", ", @positive,
 				   @positive_arch, @positive_indep),
 			      reduce_arch => 1,
-			      host_arch => $self->get('Host Arch'));
+			      host_arch => $self->get('Host Arch'),
+			      build_arch => $self->get('Build Arch'),
+			      build_dep => 1);
     my $negative = deps_parse(join(", ", @negative,
 				   @negative_arch, @negative_indep),
 			      reduce_arch => 1,
-			      host_arch => $self->get('Host Arch'));
+			      host_arch => $self->get('Host Arch'),
+			      build_arch => $self->get('Build Arch'),
+			      build_dep => 1,
+			      union => 1);
 
     $self->log("Merged Build-Depends: $positive\n") if $positive;
     $self->log("Merged Build-Conflicts: $negative\n") if $negative;

With this patch, I can cross-build things that build-depend on
foo:native.  There are none of these in Debian right now, but I expect
it to be useful for full cross-building support and so it would be very
handy if sbuild could cope with it.

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]



More information about the Buildd-tools-devel mailing list