On Mon, Apr 10, 2017 at 12:55 PM, Niels Thykier <[email protected]> wrote:

> On Wed, 22 Mar 2017 19:01:54 +0100 Michael Stapelberg
> <[email protected]> wrote:
> > Package: debhelper
> > Version: 10.2.5
> > Severity: normal
> >
> > Currently, when trying to build a Debian package whose binary packages
> > specify “€œArchitecture: arm64“€  on an amd64 machine, I get the
> following
> > error message:
> >
> > raspi3-firmware $ dh clean
> > dh: No packages to build.
> >
> > While this is technically correct, the error message could be way
> > friendlier: I’€™d suggest something along the lines of “No packages to
> > build (architecture mismatch: got amd64, want arm64)“€ .
> >
> > What do you think?
> >
> > [...]
>
> I am fine with getting patches for the better error messages.
>

Perfect. Find attached a patch to that effect.


>
> Please keep in mind that the "want" part includes architecture
> wildcards, which debhelper doesn't deal with directly so far.
>

I don’t follow. My patch displays the “want” part as-is. Shouldn’t that
give users all the information they need?

-- 
Best regards,
Michael
From 465c2abf9145a2db59a9b1fe2256d73fe5fd75d9 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <[email protected]>
Date: Mon, 15 May 2017 19:00:10 +0200
Subject: [PATCH] include present/wanted architecture in error message

---
 Debian/Debhelper/Dh_Getopt.pm | 6 +++++-
 Debian/Debhelper/Dh_Lib.pm    | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm
index a578edbd..d397d090 100644
--- a/Debian/Debhelper/Dh_Getopt.pm
+++ b/Debian/Debhelper/Dh_Getopt.pm
@@ -277,7 +277,11 @@ sub parseopts {
 
 	if (! defined $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) {
 		if (! $dh{BLOCK_NOOP_WARNINGS}) {
-			warning("No packages to build.");
+			my %archs;
+			for my $pkg (getpackages()) {
+				$archs{package_arch($pkg)} = 1;
+			}
+			warning("No packages to build. Architecture mismatch: " . buildarch() . ", want: " . join(" ", keys %archs));
 		}
 		exit(0);
 	}
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 380a14d2..5eb68ee7 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -50,7 +50,7 @@ use vars qw(@EXPORT %dh);
 	    &generated_file &autotrigger &package_section
 	    &restore_file_on_clean &restore_all_files
 	    &open_gz &reset_perm_and_owner &deprecated_functionality
-	    &log_installed_files
+	    &log_installed_files &buildarch
 );
 
 # The Makefile changes this if debhelper is installed in a PREFIX.
@@ -1102,7 +1102,7 @@ sub package_arch {
 		warning "package $package is not in control info";
 		return buildarch();
 	}
-	return $package_arches{$package} eq 'all' ? "all" : buildarch();
+	return $package_arches{$package};
 }
 
 # Returns the multiarch value of a package.
-- 
2.11.0

Reply via email to