The branch, master has been updated
       via  0d3c61deb475b1fd731bfea5d8d47a4574db8c7b (commit)
      from  7094cfaeabe63281318019dd3a6b7635be6486d9 (commit)


- Shortlog ------------------------------------------------------------
0d3c61d dpkg-shlibdeps: optimize "dpkg -S" lookups by caching results

Summary of changes:
 ChangeLog                 |    6 ++++++
 debian/changelog          |    3 +++
 scripts/dpkg-shlibdeps.pl |   17 +++++++++++++++--
 3 files changed, 24 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
Details of changes:

commit 0d3c61deb475b1fd731bfea5d8d47a4574db8c7b
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date:   Fri Nov 23 22:41:29 2007 +0100

    dpkg-shlibdeps: optimize "dpkg -S" lookups by caching results

diff --git a/ChangeLog b/ChangeLog
index 93b370b..d62de5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-11-23  Raphael Hertzog  <[EMAIL PROTECTED]>
 
+       * scripts/dpkg-shlibdeps.pl: Apply patch from Aaron M. Ucko
+       <[EMAIL PROTECTED]> to optimize "dpkg -S" lookups by caching
+       results.
+
+2007-11-23  Raphael Hertzog  <[EMAIL PROTECTED]>
+
        * scripts/dpkg-shlibdeps.pl: Limit the number of warnings
        displayed about symbols not found in libraries to 10 per binary.
 
diff --git a/debian/changelog b/debian/changelog
index 3634d4b..02f82ae 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,14 @@
 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 <[EMAIL PROTECTED]>. Closes: #452577
 
  -- Guillem Jover <[EMAIL PROTECTED]>  Fri, 23 Nov 2007 06:50:02 +0200
 
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index fa81c23..438eaac 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -518,9 +518,22 @@ sub my_find_library {
     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) {
@@ -538,7 +551,7 @@ sub find_packages {
            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'"), $_);
        }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to