HEX
Server: Apache/2.4.18 (Ubuntu)
System: Linux ubuntu 7.0.5-x86_64-linode173 #1 SMP PREEMPT_DYNAMIC Fri May 8 10:12:05 EDT 2026 x86_64
User: root (0)
PHP: 7.2.28-1+ubuntu16.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //usr/bin/dh_update_autotools_config
#!/usr/bin/perl

=head1 NAME

dh_update_autotools_config  - Update autotools config files

=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 occurrences 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', '-mindepth', '1',
		 '(', '-type', 'd', '-name', '.*', '-prune', ')',
		 '-o', '-type', 'f', '-name', $basename, '-print')
		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: