r27324 - /trunk/dh-make-perl/dh-make-perl

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu Nov 27 08:33:43 UTC 2008


Author: dmn
Date: Thu Nov 27 08:33:25 2008
New Revision: 27324

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27324
Log:
move construction of the list of relevant Contents files into a sub

Modified:
    trunk/dh-make-perl/dh-make-perl

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=27324&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Thu Nov 27 08:33:25 2008
@@ -118,6 +118,17 @@
     return $self;
 }
 
+sub get_contents_file_list {
+    my $self = shift;
+
+    my $archspec = `dpkg --print-architecture`;
+    chomp($archspec);
+
+    return( sort glob
+        "/var/cache/apt/apt-file/*_debian_dists_{unstable,sid}_Contents-$archspec.gz"
+    );
+}
+
 sub read_cache() {
     my $self = shift;
 
@@ -130,26 +141,25 @@
         undef($cache) unless ref($cache) and ref($cache) eq 'HASH';
     }
 
-    my $archspec = `dpkg --print-architecture`;
-    chomp($archspec);
-    my $contents_glob = "/var/cache/apt/apt-file/*_debian_dists_{unstable,sid}_Contents-$archspec.gz";
+    my @contents_files = $self->get_contents_file_list();
 
     # see if the cache is stale
     if ( $cache and $cache->{stamp} and $cache->{contents_files} ) {
-        my @contents_files;
-        for ( glob $contents_glob ) {
-            push @contents_files, $_;
-            if ( ( stat($_) )[9] > $cache->{stamp} ) {
-                undef($cache);
-                last;
-            }
-        }
-
-        @contents_files = sort @contents_files;
-
         undef($cache)
             unless join( '><', @contents_files ) eq
                 join( '><', @{ $cache->{contents_files} } );
+
+        # file lists are the same?
+        # see if any of the files has changed since we
+        # last read it
+        if ( $cache ) {
+            for ( @contents_files ) {
+                if ( ( stat($_) )[9] > $cache->{stamp} ) {
+                    undef($cache);
+                    last;
+                }
+            }
+        }
     }
     else {
         undef($cache);
@@ -159,7 +169,7 @@
         $cache->{stamp}          = time;
         $cache->{contents_files} = [];
         $cache->{apt_contents}   = {};
-        for ( glob $contents_glob ) {
+        for ( @contents_files ) {
             push @{ $cache->{contents_files} }, $_;
             warn "Parsing $_ ...\n";
             my $f         = IO::Uncompress::Gunzip->new($_);




More information about the Pkg-perl-cvs-commits mailing list