#765662 dpkg: please consider adding support for the :target qualifier in build dependencies

Package:
dpkg-dev
Source:
dpkg
Submitter:
Johannes Schauer
Date:
2015-02-11 06:54:15 UTC
Severity:
wishlist
Tags:
#765662#5
Date:
2014-10-17 07:10:39 UTC
From:
To:
Hi,

this has not been agreed upon with a wider audience yet, so I'll post
this just as a proposal and to not loose the patch I attached.

By default, build dependencies are resolved using only host architecture
packages (except for dependencies on multiarch:foreign packages). The
multiarch cross spec [MACROSS] allows to explicitly select packages of
the build architecture instead, using the :native architecture
qualifier.

When building compilers, there is a third architecture to be considered
beyond build and host architecture: the target architecture which
specifies the architecture the compiler will produce code for.

Since it is already possible to explicitly depend on packages of the
host and build architecture, it only makes sense to also allow to
explicitly depend on packages of the target architecture. I propose the
:target qualifier for this purpose.

In the multiarch context, dependencies with the :target qualifier will
be resolved using packages of the target architecture except
multiarch:foreign packages which are not allowed to satisfy such a
dependency. This goes in line with the :native qualifier which also does
not allow multiarch:foreign packages. In this sense, the table on the
multiarch cross spec page would get a fourth column which would look
exactly like the third column except that s/native/target/.

In addition to preserving consistency between the input architectures
for a compilation (build, host and target) and the architectures that
one is allowed to select through build dependencies, having the :target
qualifier has a practical purpose.

When building gcc as a cross compiler, then it is currently necessary to
regenerate its debian/control to reflect its dependencies when building
a cross instead of a native compiler. If the :target qualifier would
exist, then it would be possible to switch between building a native
compiler or a cross compiler (or even a canadian cross?) without
regenerating debian/control.

Some build dependencies, like the one of gcc on binutils during stage2,
have to be translated to binutils-$TARGET:native. This can be done in
the same way that the translation of native compilers to cross compilers
is proposed using multiarch in section 4.1 of the bootstrap sprint
results [SPRINT] but is only possible once the :target qualifier exists.

Thank you for your consideration.

cheers, josch

[MACROSS] https://wiki.ubuntu.com/MultiarchCross
[SPRINT] https://lists.debian.org/debian-devel-announce/2014/08/msg00013.html

#765662#10
Date:
2014-10-20 15:21:00 UTC
From:
To:
Hi!

I've just skimmed over the patch, skipped the report body text for now,
and did not sit down to think about possible consequences/problems, etc.

Thanks for the patch!

This should be target not host.

Also, wouldn't dpkg-buildpackage need to pass this option to
dpkg-checkbuilddeps?

The rest looks good (as long as it behaves correctly that is :). But it
would be nice to add some unit tests to Dpkg_Deps.t, I've just enabled
very minimal ones for :native.

Thanks,
Guillem

#765662#21
Date:
2015-02-11 06:43:59 UTC
From:
To:
Hi,

(second try sending this email. I just discovered that the one I sent in
october 2014 does not show up in the bts)

Quoting Guillem Jover (2014-10-20 17:21:00)

ah yes, a copy-paste error.

well, I wondered the same thing about the host architecture option which is
also not explicitly passed to dpkg-checkbuilddeps by dpkg-buildpackage. When I
tested whether my patch works it did, so I guess dpkg-checkbuilddeps gets the
host- (and with this patch also target-) architecture through the environment
set by the dpkg-architecture call earlier in dpkg-buildpackage?

I fixed the s/host/target/ error and added a test case.

cheers, josch