The following commit has been merged in the master branch:
commit 171610876f98768167ec1aec2dbc63cdaa19f1e6
Author: Raphaël Hertzog <[email protected]>
Date:   Thu Oct 1 21:23:15 2009 +0200

    dpkg-scanpackages/dpkg-scansources: support compressed override files
    
    This feature is supported in the dpkg-scanpackages implementation provided
    by dpkg-multicd.

diff --git a/debian/changelog b/debian/changelog
index 7846289..1dd9f08 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -45,6 +45,7 @@ dpkg (1.15.5) UNRELEASED; urgency=low
   * Create Launchpad-Bugs-Fixed directly in the changelog parsing code thanks
     to a new vendor hook post-process-changelog-entry. Closes: #536066
   * Integrate dpkg-ftp into dselect. Add the required Replaces and Conflicts.
+  * dpkg-scanpackages/dpkg-scansources now supports compressed override files.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim).
diff --git a/man/dpkg-scanpackages.1 b/man/dpkg-scanpackages.1
index f73a5b5..2584dcd 100644
--- a/man/dpkg-scanpackages.1
+++ b/man/dpkg-scanpackages.1
@@ -60,7 +60,7 @@ this string.
 .PP
 .I overridefile
 is the name of a file to read which contains information about how the
-package fits into the distribution; see
+package fits into the distribution (it can be a compressed file); see
 .BR deb\-override (5).
 .PP
 .I pathprefix
@@ -79,7 +79,8 @@ Scan for *.\fItype\fP packages, instead of *.deb.
 \fBObsolete\fP alias for \fB-tudeb\fP.
 .TP
 .BR \-e ", " \-\-extra\-override " \fIfile\fP"
-Scan \fIfile\fP to find supplementary overrides. See
+Scan \fIfile\fP to find supplementary overrides (the file can be
+compressed). See
 .BR deb\-extra\-override (5)
 for more information on its format.
 .TP
diff --git a/man/dpkg-scansources.1 b/man/dpkg-scansources.1
index 830f829..8583567 100644
--- a/man/dpkg-scansources.1
+++ b/man/dpkg-scansources.1
@@ -18,8 +18,8 @@ stdout.
 .PP
 The \fIoverride-file\fR, if given, is used to set priorities in the resulting
 index records and to override the maintainer field given in the \fI.dsc\fR
-files. See
-.BR dpkg-scanpackages (1)
+files. The file can be compressed. See
+.BR deb-override (5)
 for the format of this file. \s-1NB:\s0  Since
 the override file is indexed by binary, not source, packages, there's a bit
 of a problem here. The current implementation uses the highest priority of
@@ -48,12 +48,14 @@ Don't sort the index records. Normally they are sorted by 
source package
 name.
 .TP
 .IP "\fB\-e\fR, \fB\-\-extra\-override\fR \fIfile\fP" 4
-Scan \fIfile\fP to find supplementary overrides. See
+Scan \fIfile\fP to find supplementary overrides (the file can be
+compressed). See
 .BR deb\-extra\-override (5)
 for more information on its format.
 .IP "\fB\-s\fR, \fB\-\-source\-override\fR \fIfile\fR" 4
-Use \fIfile\fR as the source override file. The default is the name of the
-override file you specified with \fI.src\fR appended.
+Use \fIfile\fR as the source override file (the file can be compressed).
+The default is the name of the override file you specified with \fI.src\fR
+appended.
 .sp
 The source override file is in a different format from the binary override
 file. It contains only two whitespace separated fields, the first is the
diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl
index ff8e001..40bca97 100755
--- a/scripts/dpkg-scanpackages.pl
+++ b/scripts/dpkg-scanpackages.pl
@@ -11,6 +11,7 @@ use Dpkg::ErrorHandling;
 use Dpkg::Control;
 use Dpkg::Version qw(compare_versions);
 use Dpkg::Checksums;
+use Dpkg::Source::CompressedFile;
 
 textdomain("dpkg-dev");
 
@@ -67,8 +68,8 @@ sub set_type_udeb()
 sub load_override
 {
     my $override = shift;
-    my $override_fh = new IO::File $override, 'r' or
-        syserr(_g("Couldn't open override file %s"), $override);
+    my $comp_file = Dpkg::Source::CompressedFile->new(filename => $override);
+    my $override_fh = $comp_file->open_for_read();
 
     while (<$override_fh>) {
        s/\#.*//;
@@ -109,13 +110,14 @@ sub load_override
     }
 
     close($override_fh);
+    $comp_file->cleanup_after_open();
 }
 
 sub load_override_extra
 {
     my $extra_override = shift;
-    my $override_fh = new IO::File $extra_override, 'r' or
-        syserr(_g("Couldn't open override file %s"), $extra_override);
+    my $comp_file = Dpkg::Source::CompressedFile->new(filename => 
$extra_override);
+    my $override_fh = $comp_file->open_for_read();
 
     while (<$override_fh>) {
        s/\#.*//;
@@ -132,6 +134,7 @@ sub load_override_extra
     }
 
     close($override_fh);
+    $comp_file->cleanup_after_open();
 }
 
 usage() and exit 1 if not $result;
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index 1020098..c9611fa 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -33,6 +33,8 @@ use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Control;
 use Dpkg::Checksums;
+use Dpkg::Source::CompressedFile;
+use Dpkg::Compression;
 
 textdomain("dpkg-dev");
 
@@ -140,8 +142,9 @@ sub load_override {
     my $file = shift;
     local $_;
 
-    open OVERRIDE, $file or syserr(_g("can't read override file %s"), $file);
-    while (<OVERRIDE>) {
+    my $comp_file = Dpkg::Source::CompressedFile->new(filename => $file);
+    my $override_fh = $comp_file->open_for_read();
+    while (<$override_fh>) {
        s/#.*//;
        next if /^\s*$/;
        s/\s+$//;
@@ -178,7 +181,8 @@ sub load_override {
            $Override{$package}[O_MAINT_TO] = $maintainer;
        }
     }
-    close OVERRIDE or syserr(_g("error closing override file"));
+    close($override_fh);
+    $comp_file->cleanup_after_open();
 }
 
 sub load_src_override {
@@ -190,18 +194,23 @@ sub load_src_override {
        $file = $user_file;
     }
     elsif (defined $regular_file) {
-       $file = "$regular_file.src";
+        my $comp = get_compression_from_filename($regular_file);
+        if (defined($comp)) {
+           $file = $regular_file;
+            $file =~ s/\.$comp_ext{$comp}$/.src.$comp_ext{$comp}/;
+        } else {
+           $file = "$regular_file.src";
+        }
+        return unless -e $file;
     }
     else {
        return;
     }
 
     debug "source override file $file";
-    unless (open SRC_OVERRIDE, $file) {
-       return if !defined $user_file;
-       syserr(_g("can't read source override file %s"), $file);
-    }
-    while (<SRC_OVERRIDE>) {
+    my $comp_file = Dpkg::Source::CompressedFile->new(filename => $file);
+    my $override_fh = $comp_file->open_for_read();
+    while (<$override_fh>) {
        s/#.*//;
        next if /^\s*$/;
        s/\s+$//;
@@ -223,16 +232,17 @@ sub load_src_override {
        $Override{$key} = [];
        $Override{$key}[O_SECTION] = $section;
     }
-    close SRC_OVERRIDE or syserr(_g("error closing source override file"));
+    close($override_fh);
+    $comp_file->cleanup_after_open();
 }
 
 sub load_override_extra
 {
     my $extra_override = shift;
-    open(OVERRIDE, "<", $extra_override) or
-        syserr(_g("Couldn't open override file %s"), $extra_override);
+    my $comp_file = Dpkg::Source::CompressedFile->new(filename => 
$extra_override);
+    my $override_fh = $comp_file->open_for_read();
 
-    while (<OVERRIDE>) {
+    while (<$override_fh>) {
        s/\#.*//;
        s/\s+$//;
        next unless $_;
@@ -240,7 +250,8 @@ sub load_override_extra
        my ($p, $field, $value) = split(/\s+/, $_, 3);
         $Extra_Override{$p}{$field} = $value;
     }
-    close(OVERRIDE);
+    close($override_fh);
+    $comp_file->cleanup_after_open();
 }
 
 # Given PREFIX and DSC-FILE, process the file and returns the fields.

-- 
dpkg's main repository


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

Reply via email to