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

2022-09-17 Thread Debian Bug Tracking System
Processing control commands:

> tag -1 moreinfo
Bug #765662 [dpkg-dev] dpkg: please consider adding support for the :target 
qualifier in build dependencies
Added tag(s) moreinfo.

-- 
765662: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765662
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



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

2022-09-17 Thread Guillem Jover
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

2015-02-10 Thread Johannes Schauer
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

2014-10-20 Thread Guillem Jover
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-dpkg-bugs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org