diff options
author | Guillem Jover <guillem@debian.org> | 2015-10-02 13:57:57 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-10-02 14:02:46 +0200 |
commit | 3f8099b21bbb934d03c340fef1925824465e0571 (patch) | |
tree | f9ecf1eae385c71b8be7af71314fda9c74c208ec /scripts/dpkg-scansources.pl | |
parent | a1bb7029b2cd3507ee27434af10354f4fad0f331 (diff) | |
download | dpkg-3f8099b21bbb934d03c340fef1925824465e0571.tar.gz |
scripts: Switch all find(1) command calls to File::Find
The find(1) command has subtle behavior differences depending on the
implementation (for example BSD vs GNU), the perl module is more portable
and has a more consistent behavior, such as always canonicalizing the
pathnames.
Closes: #800649
Diffstat (limited to 'scripts/dpkg-scansources.pl')
-rwxr-xr-x | scripts/dpkg-scansources.pl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl index a823ab4ce..acd9e6467 100755 --- a/scripts/dpkg-scansources.pl +++ b/scripts/dpkg-scansources.pl @@ -21,6 +21,7 @@ use strict; use warnings; use Getopt::Long qw(:config posix_default bundling no_ignorecase); +use File::Find; use Dpkg (); use Dpkg::Gettext; @@ -303,22 +304,22 @@ load_override $override if defined $override; load_src_override $src_override, $override; load_override_extra $extra_override_file if defined $extra_override_file; -open my $find_fh, '-|', 'find', '-L', $dir, '-name', '*.dsc', '-print' - or syserr(g_('cannot fork for %s'), 'find'); -while (<$find_fh>) { - chomp; - s{^\./+}{}; +my @dsc; +my $scan_dsc = sub { + push @dsc, $File::Find::name if m/\.dsc$/; +}; +find({ follow => 1, wanted => $scan_dsc }, $dir); +foreach my $fn (@dsc) { # FIXME: Fix it instead to not die on syntax and general errors? eval { - process_dsc($prefix, $_); + process_dsc($prefix, $fn); }; if ($@) { warn $@; next; } } -close $find_fh or syserr(g_('error closing %s (%s)'), 'find', $!); if (not $no_sort) { @sources = sort { |