[debhelper-devel] [debhelper] 01/01: dh_update_autotools_config: Improve detection for very old files

Niels Thykier nthykier at moszumanska.debian.org
Fri Sep 1 18:27:05 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 3e7e9212928784f633eab8dfc68d5a71b0c61952
Author: Niels Thykier <niels at thykier.net>
Date:   Fri Sep 1 18:26:14 2017 +0000

    dh_update_autotools_config: Improve detection for very old files
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog           |  4 ++++
 dh_update_autotools_config | 14 +++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 48e2f4d..f73784f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,10 @@ debhelper (10.7.3) UNRELEASED; urgency=medium
     auto-detection can be overrules with the new --doc-main-package.
     (Closes: #824221)
   * dh_installexamples: Ditto.
+  * dh_update_autotools_config: Improve detection to also catch very
+    old versions of config.{guess,sub} that do not have the
+    "timestamp" variable.  Thanks to Guillem Jover for reporting the
+    bug.  (Closes: #872510)
 
   [ Adam Conrad ]
   * dh_gencontrol: Change the synopsis of dbgsym packages so it
diff --git a/dh_update_autotools_config b/dh_update_autotools_config
index d9ce75a..be1e51f 100755
--- a/dh_update_autotools_config
+++ b/dh_update_autotools_config
@@ -44,19 +44,27 @@ for my $basename (qw(config.guess config.sub)) {
 
 sub is_autotools_config_file {
 	my ($file) = @_;
-	my ($saw_timestamp);
+	my ($is_autoconf_file);
 	open(my $fd, '<', $file) or error("open $file for reading failed: $!");
 	while (my $line = <$fd>) {
 		chomp($line);
 		# This is the test lintian uses.
 		if ($line =~ m{^timestamp=['"]\d{4}-\d{2}-\d{2}['"]\s*$}) {
-			$saw_timestamp = 1;
+			$is_autoconf_file = 1;
 			last;
 		}
+		$line =~ s/\s++$//;
+		if ($line eq q{# Attempt to guess a canonical system name.}
+			or $line =~ q{^# Configuration validation subroutine script}) {
+			# Very old scripts do not have that timestamp line, but
+			# they do have these headers (which even new files also
+			# have).
+			$is_autoconf_file = 1;
+		}
 		last if $. >= 10;
 	}
 	close($fd);
-	return $saw_timestamp;
+	return $is_autoconf_file;
 }
 
 

-- 
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