Control: tags -1 +patch

On Sat, 28 Jun 2008 10:02:30 +0200, Sune Vuorela wrote:
> But I would like a option to pass to dh_install so it lists all files it
> can't find and then exits non-zero.

I understand this bug is very old, but it's still actual nevertheless.

So I have prepared a patch that makes the behavior specified by Sune the
default. If you think it will break compatibility, I can prepare another
patch that will implement it as an option. (However I hope that won't be
needed, as I can't imagine a situation where one will rely on the old
behavior).

--
Dmitry Shachnev
From 45309e2956dd29e04546b2ddac2ec74b4244e58b Mon Sep 17 00:00:00 2001
From: Dmitry Shachnev <mity...@gmail.com>
Date: Tue, 5 Jan 2016 16:57:16 +0300
Subject: [PATCH] dh_install: Fail late when there were non-existing files

Print warnings for each glob that did not match anything, and fail
after processing all packages if there were any missing files.

Closes: #488346
---
 debian/changelog |  5 +++++
 dh_install       | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c0dbc06..b50a81d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 debhelper (9.20151225+unreleased) UNRELEASED; urgency=medium
 
+  [ Niels Thykier ]
   * Dh_Lib.pm: Pass "-S" to dpkg-parsechangelog when requesting
     the Version field.
   * Drop compat level 3.
@@ -7,6 +8,10 @@ debhelper (9.20151225+unreleased) UNRELEASED; urgency=medium
     does not start with debian/tmp.  This should make the
     output on failures less weird.
 
+  [ Dmitry Shachnev ]
+  * dh_install: Fail because of missing files only after processing
+    all file lists for all packages.  (Closes: #488346)
+
  -- Niels Thykier <ni...@thykier.net>  Sat, 26 Dec 2015 20:13:36 +0000
 
 debhelper (9.20151225) unstable; urgency=medium
diff --git a/dh_install b/dh_install
index 7da40d3..9ff5bcd 100755
--- a/dh_install
+++ b/dh_install
@@ -136,6 +136,8 @@ my @installed;
 my $srcdir = '.';
 $srcdir = $dh{SOURCEDIR} if defined $dh{SOURCEDIR};
 
+my $missing_files = 0;
+
 # PROMISE: DH NOOP WITHOUT install
 
 foreach my $package (getpackages()) {
@@ -180,12 +182,16 @@ foreach my $package (getpackages()) {
 						if $glob !~ m{^(?:\./)?debian/tmp/};
 				}
 			}
-			push @filelist, @found;
+			if (@found && (-e $found[0] || -l $found[0])) {
+				push @filelist, @found;
+			}
 		}
 
 		if (! compat(4)) { # check added in v5
 			if (! @filelist && ! $skip_install) {
-				error("$package missing files (@$set), aborting");
+				warning("$package missing files: @$set");
+				++$missing_files;
+				next;
 			}
 		}
 
@@ -194,6 +200,7 @@ foreach my $package (getpackages()) {
 			
 			push @installed, $src;
 			next if $skip_install;
+			next if $missing_files;
 		
 			if (! defined $dest) {
 				# Guess at destination directory.
@@ -270,6 +277,10 @@ if ($dh{LIST_MISSING} || $dh{FAIL_MISSING}) {
 	}
 }
 
+if ($missing_files) {
+	error("missing files, aborting");
+}
+
 =head1 LIMITATIONS
 
 B<dh_install> cannot rename files or directories, it can only install them
-- 
2.6.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to