diff options
author | Niels Thykier <niels@thykier.net> | 2017-07-22 19:35:00 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-07-22 19:39:29 +0000 |
commit | 333376abf9c4d6e8f286a7cbda7e8c13307745f3 (patch) | |
tree | b0e90594652ed4d8c8701412bd48a56c9b41d5e0 | |
parent | 10ce039c7072412dbc8a9286e5a520f97203d3af (diff) | |
download | debhelper-333376abf9c4d6e8f286a7cbda7e8c13307745f3.tar.gz |
dh: Provide a better error on missing d/control
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r-- | Debian/Debhelper/Dh_Lib.pm | 12 | ||||
-rw-r--r-- | debian/changelog | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index fec7f2f1..6e8c6300 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -1290,9 +1290,7 @@ sub getpackages { return @{$packages_by_type{$type}}; } - $packages_by_type{$_} = [] for qw(both indep arch all-listed-in-control-file); - - + my $fd; my $package=""; my $arch=""; my $section=""; @@ -1301,8 +1299,14 @@ sub getpackages { if (exists $ENV{'DEB_BUILD_PROFILES'}) { @profiles=split /\s+/, $ENV{'DEB_BUILD_PROFILES'}; } - open (my $fd, '<', 'debian/control') || + if (not open($fd, '<', 'debian/control')) { + error("\"debian/control\" not found. Are you sure you are in the correct directory?") + if $! == ENOENT; error("cannot read debian/control: $!\n"); + }; + + $packages_by_type{$_} = [] for qw(both indep arch all-listed-in-control-file); + while (<$fd>) { chomp; s/\s+$//; diff --git a/debian/changelog b/debian/changelog index cd25170d..50cb42bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,9 @@ debhelper (10.7) UNRELEASED; urgency=medium * Dh_Lib: Make getpackages without any arguments return all packages as the documentation promises it should. Previously, it would hide packages not built (e.g. due to Build-Profiles). + * Dh_Lib: Provide a better error message when getpackages() is called + by a helper in the wrong directory. Unfortunately, dh cannot rely + on dh_testdir to do this as dh_testdir is called too late. -- Niels Thykier <niels@thykier.net> Sat, 15 Jul 2017 09:42:32 +0000 |