summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2016-01-10 10:52:59 +0000
committerNiels Thykier <niels@thykier.net>2016-01-10 10:53:42 +0000
commit1aa14138eb227c4194dd1f9fe649652f3c2aa23f (patch)
tree99c87d79c85f808b0e88863720987ec7105e606a
parent1566865e67d2712c45462794cc29d89f75c011d1 (diff)
downloaddebhelper-1aa14138eb227c4194dd1f9fe649652f3c2aa23f.tar.gz
dh_update_autotools_config: New helper to update config.{guess,sub}
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog6
-rw-r--r--debian/control2
-rw-r--r--debian/copyright1
-rwxr-xr-xdh1
-rwxr-xr-xdh_update_autotools_config75
5 files changed, 84 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 91548663..7099b0a0 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 8656bd7e..546cc888 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 4b0693bf..df161fd5 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@debian.org>
+ 2015-2016 Niels Thykier <niels@thykier.ne>t
License: GPL-2+
Files: examples/* autoscripts/*
diff --git a/dh b/dh
index 4cf45151..b05efdef 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 00000000..a1ecc8c6
--- /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@thykier.net>
+
+=cut
+
+# Local Variables:
+# indent-tabs-mode: t
+# tab-width: 4
+# cperl-indent-level: 4
+# End: