[debhelper-devel] [debhelper] 01/02: dh: Provide a better error on missing d/control

Niels Thykier nthykier at moszumanska.debian.org
Sat Jul 22 19:56:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 333376abf9c4d6e8f286a7cbda7e8c13307745f3
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Jul 22 19:35:00 2017 +0000

    dh: Provide a better error on missing d/control
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 12 ++++++++----
 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 fec7f2f..6e8c630 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 cd25170..50cb42b 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 at thykier.net>  Sat, 15 Jul 2017 09:42:32 +0000
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list