+2007-11-23 Raphael Hertzog <hertzog@debian.org>
+
+ * scripts/dpkg-shlibdeps.pl: Apply patch from Aaron M. Ucko
+ <ucko@debian.org> to optimize "dpkg -S" lookups by caching
+ results.
+
2007-11-23 Raphael Hertzog <hertzog@debian.org>
* scripts/dpkg-shlibdeps.pl: Limit the number of warnings
dpkg (1.14.11) UNRELEASED; urgency=low
+ [ Raphael Hertzog ]
* dpkg-shlibdeps now ignores the lack of dependency information in some
specific cases (instead of failing):
- when the library is in the same package than the binary analyzed
- when the library is not versionned and can't have a shlibs file
* dpkg-shlibdeps now only displays 10 warnings about symbols not found for
each binary and a count of skipped warnings. Closes: #452318
+ * dpkg-shlibdeps: optimize "dpkg -S" lookups by caching results, patch
+ from Aaron M. Ucko <ucko@debian.org>. Closes: #452577
-- Guillem Jover <guillem@debian.org> Fri, 23 Nov 2007 06:50:02 +0200
return undef;
}
+my %cached_pkgmatch = ();
+
sub find_packages {
- my @files = (@_);
+ my @files;
my $pkgmatch = {};
+
+ foreach (@_) {
+ if (exists $cached_pkgmatch{$_}) {
+ $pkgmatch->{$_} = $cached_pkgmatch{$_};
+ } else {
+ push @files, $_;
+ $cached_pkgmatch{$_} = [""]; # placeholder to cache misses too.
+ }
+ }
+ return $pkgmatch unless scalar(@files);
+
my $pid = open(DPKG, "-|");
syserr(_g("cannot fork for dpkg --search")) unless defined($pid);
if (!$pid) {
print(STDERR " $_\n")
|| syserr(_g("write diversion info to stderr"));
} elsif (m/^([^:]+): (\S+)$/) {
- $pkgmatch->{$2} = [ split(/, /, $1) ];
+ $cached_pkgmatch{$2} = $pkgmatch->{$2} = [ split(/, /, $1) ];
} else {
warning(_g("unknown output from dpkg --search: '%s'"), $_);
}