Package: dpkg Version: 1.15.10 Severity: wishlist The multiarch spec (https://wiki.ubuntu.com/MultiarchSpec) allows for dependencies to be marked with :any architecture qualifiers to indicate when a dependency on a Multi-arch: allowed package if for the host arch, not the build arch.
The multiarch-cross spec (https://wiki.ubuntu.com/MultiarchCross) allows for build-dependencies to be marked with either :any or :native to indicate exceptions to the default rules for installing dependencies. The attached patch implements parsing of these 'architecture qualifiers' in libdpkg-perl so that it is now possible to parse the build-dependencies of packages and build them just as currently. Nothing is currently done with the parsed qualifier except record it. The existing Dpkg::Deps code assumes that dependencies and build-depencies have the same format. Strictly speaking Depends and Build-depends are now different as :[any|native] is valid for build-deps but only :any for Depends. It is probably not hard to enforce this at a slightly higher level. Indeed, it may make sense to just parse any string after the :, then have higher-level checks for valid values. The multiarch spec explicitly says to reject anything other than :any (in depends) for now, but in the future this syntax will be used to allow cross-architecture dependencies so any valid architecture name should be accepted. This patch is intended to be a simple implementation that allows packages with this info to be used with the build-tools, and ultimately uploaded to the archive (once a few more dependency-parsing packages have been fixed) - nothing more. Wookey -- Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM http://wookware.org/
diff -ur dpkg-1.15.8.10.orig//scripts/Dpkg/Deps.pm dpkg-1.15.8.10/scripts/Dpkg/Deps.pm --- dpkg-1.15.8.10.orig//scripts/Dpkg/Deps.pm 2011-01-30 19:37:44.000000000 +0000 +++ dpkg-1.15.8.10/scripts/Dpkg/Deps.pm 2011-03-24 01:39:15.489973000 +0000 @@ -506,6 +506,7 @@ 'relation' => undef, 'version' => undef, 'arches' => undef, + 'archqual' => undef, }; bless $self, $class; $self->parse_string($arg) if defined($arg); @@ -525,6 +526,9 @@ /^\s* # skip leading whitespace ([a-zA-Z0-9][a-zA-Z0-9+.-]*) # package name (?: # start of optional part + :(any|native) # architecture qualifier + )? # end of optional part + (?: # start of optional part \s* \( # open parenthesis for version part \s* (<<|<=|=|>=|>>|<|>) # relation part \s* (.*?) # do not attempt to parse version @@ -538,12 +542,13 @@ \s*$ # trailing spaces at end /x; $self->{package} = $1; - $self->{relation} = version_normalize_relation($2) if defined($2); - if (defined($3)) { - $self->{version} = Dpkg::Version->new($3); - } + $self->{archqual} = $2 if defined($2); + $self->{relation} = version_normalize_relation($3) if defined($3); if (defined($4)) { - $self->{arches} = [ split(/\s+/, $4) ]; + $self->{version} = Dpkg::Version->new($4); + } + if (defined($5)) { + $self->{arches} = [ split(/\s+/, $5) ]; } } diff -ur dpkg-1.15.8.10.orig//scripts/t/400_Dpkg_Deps.t dpkg-1.15.8.10/scripts/t/400_Dpkg_Deps.t --- dpkg-1.15.8.10.orig//scripts/t/400_Dpkg_Deps.t 2011-01-30 19:37:44.000000000 +0000 +++ dpkg-1.15.8.10/scripts/t/400_Dpkg_Deps.t 2011-03-24 01:34:48.701973000 +0000 @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -use Test::More tests => 17; +use Test::More tests => 19; use strict; use warnings; @@ -82,3 +82,8 @@ ok(!defined($dep_bad_multiline), "invalid dependency split over multiple line"); delete $SIG{'__WARN__'}; +my $dep_multiarch_native = deps_parse("libfoo:native, libbar:native (>= 2.6-1), libfake:native (>= 2.6-1) [arch=armel]"); +my $dep_multiarch_any = deps_parse("libfoo:any, libbar:any (>=2.6-1), libfake:any (>= 2.6-1) [arch=armel]"); +is($dep_multiarch_native->output(), "libfoo, libbar (>= 2.6-1), libfake (>= 2.6-1) [arch=armel]" ,"depends:native syntax"); +is($dep_multiarch_any->output(), "libfoo, libbar (>= 2.6-1), libfake (>= 2.6-1) [arch=armel]" ,"depends:any syntax"); +