Bug#765662: dpkg: please consider adding support for the :target qualifier in build dependencies
Control: tag -1 moreinfo Hi! On Wed, 2015-02-11 at 07:43:59 +0100, Johannes Schauer wrote: > Quoting Guillem Jover (2014-10-20 17:21:00) > > 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. > > I fixed the s/host/target/ error and added a test case. Thanks for the updated patch, as I mentioned at the time on IRC! Also just to record here, that I'm still in principle fine with merging this, and I keep having it in the back of my head, but I've still got the same concerns I've mentioned on #debian-bootstrap when this has come up in the past. My recollection (confirmed from logs from 2014-10, 2015-02) was that: - I did not act on this as it looked like there was talk that it was not needed/relevant anymore. - On one side there was the question of whether this solved the cross-toolchain problem at all? - Then there was the question of how this interacted with the M-A values. - And it seems Johannes mentioned starting a thread on some lists (debian-dpkg, debian-toolchain and multiarch-devel), but I think that was replaced by filing this report during the freeze to not forget about it, and the mail was then postponed. What I like about the patch in principle is that it completes the arch handling for the build/host/target arches, so if you know about M-A, it should be intuitive to reason about, it also gives an additional "tool" to work with dependencies related to crossing. But the downside is that this is more fringe stuff that people might get confused by, and if it does not really fix any current problem properly, then I'm also hesitant to add it TBH. Thanks, Guillem
Bug#765662: dpkg: please consider adding support for the :target qualifier in build dependencies
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) diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index 3feba3a..47accc9 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -52,6 +52,8 @@ sub usage { -c build-conf use given string for build conflicts instead of retrieving them from control file -a archassume given host architecture + --target-arch=arch + assume given host architecture This should be target not host. ah yes, a copy-paste error. Also, wouldn't dpkg-buildpackage need to pass this option to dpkg-checkbuilddeps? 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? 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. I fixed the s/host/target/ error and added a test case. cheers, josch From 77aff816f9aa894844b9a4bdc9959177467c2971 Mon Sep 17 00:00:00 2001 From: josch j.scha...@email.de Date: Fri, 17 Oct 2014 08:39:30 +0200 Subject: [PATCH] =?UTF-8?q?scripts:=20Accept=20=E2=80=9C:target=E2=80=9D?= =?UTF-8?q?=20arch-qualified=20Build-Dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 6 +- scripts/Dpkg/Arch.pm | 19 +++ scripts/Dpkg/Deps.pm | 27 --- scripts/dpkg-checkbuilddeps.pl | 10 +++--- scripts/t/Dpkg_Deps.t | 5 - 5 files changed, 59 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index bf93b1f..833d319 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ dpkg (1.17.20) UNRELEASED; urgency=low - * + [ Johannes Schauer ] + * dpkg-checkbuilddeps: +- Add the --target-arch option to specify the target architecture for + building compilers +- Accept “:target” arch-qualified Build-Dependencies. -- Guillem Jover guil...@debian.org Mon, 20 Oct 2014 16:06:38 +0200 diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm index f561b66..e5bc67a 100644 --- a/scripts/Dpkg/Arch.pm +++ b/scripts/Dpkg/Arch.pm @@ -23,6 +23,7 @@ our $VERSION = '0.01'; use Exporter qw(import); our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch get_build_arch get_host_arch get_gcc_host_gnu_type +get_target_arch get_valid_arches debarch_eq debarch_is debarch_is_wildcard debarch_to_cpuattrs debarch_to_gnutriplet gnutriplet_to_debarch @@ -50,6 +51,7 @@ my %debarch_to_debtriplet; my $build_arch; my $host_arch; my $gcc_host_gnu_type; +my $target_arch; sub get_raw_build_arch() { @@ -120,6 +122,23 @@ my %debarch_to_debtriplet; { return Dpkg::BuildEnv::get('DEB_HOST_ARCH') || get_raw_host_arch(); } + +sub get_raw_target_arch() +{ + return $target_arch if defined $target_arch; + + if (!defined($target_arch)) { + # Fall back to building a compiler for the host arch. + $host_arch = get_raw_host_arch(); + } + + return $target_arch; +} + +sub get_target_arch() +{ + return Dpkg::BuildEnv::get('DEB_TARGET_ARCH') || get_raw_target_arch(); +} } sub get_valid_arches() diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm index 5e9728b..0aa186a 100644 --- a/scripts/Dpkg/Deps.pm +++ b/scripts/Dpkg/Deps.pm @@ -49,10 +49,10 @@ All the deps_* functions are exported by default. use strict; use warnings; -our $VERSION = '1.05'; +our $VERSION = '1.06'; use Dpkg::Version; -use Dpkg::Arch qw(get_host_arch get_build_arch); +use Dpkg::Arch qw(get_host_arch get_build_arch get_target_arch); use Dpkg::BuildProfiles qw(get_build_profiles); use Dpkg::ErrorHandling; use Dpkg::Gettext; @@ -190,6 +190,11 @@ Dpkg::Arch::get_host_arch() to identify the proper architecture. Define the build architecture. By default it uses Dpkg::Arch::get_build_arch() to identify the proper architecture. +=item target_arch (defaults to the current architecture) + +Define the target architecture. By default it uses +Dpkg::Arch::get_target_arch() to identify the proper architecture. + =item reduce_arch (defaults to 0) If set to 1, ignore dependencies that do not concern the current host @@ -243,6 +248,7 @@ sub deps_parse { $options{reduce_arch} //= 0; $options{host_arch} //= get_host_arch(); $options{build_arch} //=
Bug#765662: dpkg: please consider adding support for the :target qualifier in build dependencies
Hi! On Fri, 2014-10-17 at 09:10:39 +0200, Johannes Schauer wrote: Package: dpkg Version: 1.17.18 Severity: wishlist Tags: patch 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. 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! diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index 3feba3a..47accc9 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -52,6 +52,8 @@ sub usage { -c build-conf use given string for build conflicts instead of retrieving them from control file -a archassume given host architecture + --target-arch=arch + assume given host architecture 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 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#765662: dpkg: please consider adding support for the :target qualifier in build dependencies
Package: dpkg Version: 1.17.18 Severity: wishlist Tags: patch 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 From 8bf58f3dfa8f881646351bd3f2a406375396051b Mon Sep 17 00:00:00 2001 From: josch j.scha...@email.de Date: Fri, 17 Oct 2014 08:39:30 +0200 Subject: [PATCH] =?UTF-8?q?scripts:=20Accept=20=E2=80=9C:target=E2=80=9D?= =?UTF-8?q?=20arch-qualified=20Build-Dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 10 -- scripts/Dpkg/Arch.pm | 19 +++ scripts/Dpkg/Deps.pm | 27 --- scripts/dpkg-checkbuilddeps.pl | 10 +++--- 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6cd5db0..c17f9ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -dpkg (1.17.19) UNRELEASED; urgency=low +dpkg (1.17.19+nmu1) UNRELEASED; urgency=low [ Guillem Jover ] * Bump the Breaks on devscripts to 2.14.10 due to the new dpkg-architecture @@ -17,7 +17,13 @@ dpkg (1.17.19) UNRELEASED; urgency=low [ Updated manpages translations ] * German (Helge Kreutzmann). - -- Guillem Jover guil...@debian.org Sun, 12 Oct 2014 16:42:00 +0200 + [ Johannes Schauer ] + * dpkg-checkbuilddeps: +- Add the --target-arch option to specify the target architecture for + building compilers +- Accept “:target” arch-qualified Build-Dependencies. + + -- Johannes Schauer j.scha...@email.de Fri, 17 Oct 2014 08:16:10 +0200 dpkg (1.17.18) unstable; urgency=low diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm index f561b66..e5bc67a 100644 --- a/scripts/Dpkg/Arch.pm +++ b/scripts/Dpkg/Arch.pm @@ -23,6 +23,7 @@ our $VERSION = '0.01'; use Exporter qw(import); our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch get_build_arch get_host_arch get_gcc_host_gnu_type +get_target_arch get_valid_arches debarch_eq debarch_is debarch_is_wildcard debarch_to_cpuattrs debarch_to_gnutriplet gnutriplet_to_debarch @@ -50,6 +51,7 @@ my %debarch_to_debtriplet; my $build_arch; my $host_arch; my $gcc_host_gnu_type; +my $target_arch; sub get_raw_build_arch() { @@ -120,6 +122,23 @@ my %debarch_to_debtriplet; { return Dpkg::BuildEnv::get('DEB_HOST_ARCH') || get_raw_host_arch(); } + +sub get_raw_target_arch() +{ + return $target_arch if defined