r8848 - /scripts/qa/QA/DebianArchive.pm

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Sun Nov 4 18:08:40 UTC 2007


Author: tincho-guest
Date: Sun Nov  4 18:08:39 2007
New Revision: 8848

URL: http://svn.debian.org/wsvn/?sc=1&rev=8848
Log:
decoded_content sometimes uncompresses on the fly (if the webserver sets the correct headers)

Modified:
    scripts/qa/QA/DebianArchive.pm

Modified: scripts/qa/QA/DebianArchive.pm
URL: http://svn.debian.org/wsvn/scripts/qa/QA/DebianArchive.pm?rev=8848&op=diff
==============================================================================
--- scripts/qa/QA/DebianArchive.pm (original)
+++ scripts/qa/QA/DebianArchive.pm Sun Nov  4 18:08:39 2007
@@ -90,6 +90,7 @@
     foreach my $suite (keys(%$data)) {
         next unless($ttl{$suite});
         foreach my $pkg (keys(%{$data->{$suite}})) {
+            next if($pkg =~ m#^/#);
             next if(%$pkgs and not $pkgs->{$pkg});
             $g->{$pkg}{$suite} = $data->{$suite}{$pkg};
         }
@@ -120,14 +121,19 @@
         }
         # Still reading it all in memory, couldn't find any nice way to
         # interact with gunzip
-        my $data = $res->decoded_content();
-        #my $z = new IO::Uncompress::Gunzip(\$data);
-        my $sources = Compress::Zlib::memGunzip(\$data);
-        my $z = IO::Scalar->new(\$sources);
+        my $gzdata = $res->decoded_content();
+        my $data;
+        if(substr($gzdata, 0, 2) eq "\037\0213") {
+            #my $z = new IO::Uncompress::Gunzip(\$data);
+            my $uncdata = Compress::Zlib::memGunzip(\$gzdata);
+            $data = IO::Scalar->new(\$uncdata);
+        } else {
+            $data = IO::Scalar->new(\$gzdata);
+        }
 
         # Blank line as "line" separator, so a "line" is a full record
         local $/ = "";
-        while(<$z>) {
+        while(<$data>) {
             s/\n\s+//gm;
             /^package:\s*(\S+)\s*$/mi or next;
             my $pkg = $1;




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