[debhelper-devel] [debhelper] 02/02: dh_update_autotools_config: New helper to update config.{guess, sub}

Niels Thykier nthykier at moszumanska.debian.org
Sun Jan 10 10:54:22 UTC 2016


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 1aa14138eb227c4194dd1f9fe649652f3c2aa23f
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Jan 10 10:52:59 2016 +0000

    dh_update_autotools_config: New helper to update config.{guess,sub}
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog           |  6 ++++
 debian/control             |  2 +-
 debian/copyright           |  1 +
 dh                         |  1 +
 dh_update_autotools_config | 75 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 9154866..7099b0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,12 @@ debhelper (9.20151225+unreleased) UNRELEASED; urgency=medium
   * autoscripts/*-makeshlibs: Removed, no longer used.
   * dh: In compat 10, drop the manual sequence control arguments
     and the sequence log files.  (Closes: #510855)
+  * dh_update_autotools_config: New helper to update config.sub
+    and config.guess.
+  * dh: Run dh_update_autotools_config before dh_auto_configure.
+    (Closes: #733045)
+  * d/control: Add dependency on autotools-dev for the new
+    dh_update_autotools_config tool.
 
   [ Dmitry Shachnev ]
   * dh_install: Fail because of missing files only after processing
diff --git a/debian/control b/debian/control
index 8656bd7..546cc88 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Vcs-Browser: https://anonscm.debian.org/cgit/debhelper/debhelper.git
 
 Package: debhelper
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23), dpkg (>= 1.16.2), dpkg-dev (>= 1.18.2~), binutils, po-debconf, man-db (>= 2.5.1-1), libdpkg-perl (>= 1.17.14), dh-strip-nondeterminism
+Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23), dpkg (>= 1.16.2), dpkg-dev (>= 1.18.2~), binutils, po-debconf, man-db (>= 2.5.1-1), libdpkg-perl (>= 1.17.14), dh-strip-nondeterminism, autotools-dev
 Suggests: dh-make
 Multi-Arch: foreign
 Description: helper programs for debian/rules
diff --git a/debian/copyright b/debian/copyright
index 4b0693b..df161fd 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,6 +2,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 
 Files: *
 Copyright: 1997-2011 Joey Hess <joeyh at debian.org>
+           2015-2016 Niels Thykier <niels at thykier.ne>t
 License: GPL-2+
 
 Files: examples/* autoscripts/*
diff --git a/dh b/dh
index 4cf4515..b05efde 100755
--- a/dh
+++ b/dh
@@ -362,6 +362,7 @@ my @bd_minimal = qw{
 };
 my @bd = (qw{
 	dh_testdir
+	dh_update_autotools_config
 	dh_auto_configure
 	dh_auto_build
 	dh_auto_test
diff --git a/dh_update_autotools_config b/dh_update_autotools_config
new file mode 100755
index 0000000..a1ecc8c
--- /dev/null
+++ b/dh_update_autotools_config
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+dh_update_autotools_config
+
+=cut
+
+use strict;
+use warnings;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_update_autotools_config> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+B<dh_update_autotools_config replaces all occurances of B<config.sub>
+and B<config.guess> in the source tree by the up-to-date versions
+found in the autotools-dev package.  The original files are backed up
+and restored by B<dh_clean>.
+
+=cut
+
+init();
+
+for my $basename (qw(config.guess config.sub)) {
+	my $new_version = "/usr/share/misc/$basename";
+	open(my $fd, '-|', 'find', '-type', 'f', '-name', $basename)
+		or error("Cannot run find -type f -name $basename: $!");
+	while (my $filename = <$fd>) {
+		chomp($filename);
+		next if not is_autotools_config_file($filename);
+		restore_file_on_clean($filename);
+		doit('cp', '-f', $new_version, $filename);
+	}
+	close($fd);
+}
+
+sub is_autotools_config_file {
+	my ($file) = @_;
+	my ($saw_timestamp);
+	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;
+			last;
+		}
+		last if $. >= 10;
+	}
+	close($fd);
+	return $saw_timestamp;
+}
+
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Niels Thykier <niels at thykier.net>
+
+=cut
+
+# Local Variables:
+# indent-tabs-mode: t
+# tab-width: 4
+# cperl-indent-level: 4
+# End:

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