From 1aa14138eb227c4194dd1f9fe649652f3c2aa23f Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 10 Jan 2016 10:52:59 +0000 Subject: dh_update_autotools_config: New helper to update config.{guess,sub} Signed-off-by: Niels Thykier --- debian/changelog | 6 ++++ debian/control | 2 +- debian/copyright | 1 + dh | 1 + dh_update_autotools_config | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100755 dh_update_autotools_config 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 + 2015-2016 Niels Thykier 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 [S>] + +=head1 DESCRIPTION + +B +and B 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. + +=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 + +This program is a part of debhelper. + +=head1 AUTHOR + +Niels Thykier + +=cut + +# Local Variables: +# indent-tabs-mode: t +# tab-width: 4 +# cperl-indent-level: 4 +# End: -- cgit v1.2.3