Pārlūkot izejas kodu

Dpkg::Compression: Only use gzip --rsyncable on Debian and derivatives

The gzip package in Debian at some point acquired a Debian-specific
--rsyncable option via a vendor patch. Which is not present in most
of the major distributions, dpkg downstream systems, nor gzip upstream,
who have stated they will most probably not accept it because people
should be using pigz instead.

This option should have never been accepted in dpkg, ever. But removing
it now would probably cause demands for tarring and feathering. In
addition we cannot use the Dpkg::Vendor logic because that would cause
circular module dependencies. The whole affair is pretty disgusting
really.

Check the perl Config to discern Debian and hopefully derivatives too.
Guillem Jover 10 gadi atpakaļ
vecāks
revīzija
33e6fcb5cd
2 mainītis faili ar 24 papildinājumiem un 1 dzēšanām
  1. 4 0
      debian/changelog
  2. 20 1
      scripts/Dpkg/Compression.pm

+ 4 - 0
debian/changelog

@@ -47,6 +47,10 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     - Port start-stop-daemon process handling to AIX.
     - Fix lookup by name on update-alternatives --config. The code was wrong
       and not working at least on Mac OS X, making the test suite to fail.
+    - Only use gzip --rsyncable in Dpkg::Compression on Debian and hopefully
+      derivatives, by using perl's $Config{cf_by} variable to key on. The
+      Debian-specific --rsyncable option should have never been accepted for
+      use in dpkg to begin with.
   * Perl modules:
     - Obsolete Source-Version substvar in Dpkg::Substvars by emitting errors.
     - Rework keyring hooks in Dpkg::Vendor. Deprecate the keyrings hook, and

+ 20 - 1
scripts/Dpkg/Compression.pm

@@ -35,6 +35,7 @@ our @EXPORT = qw(
 );
 
 use Exporter qw(import);
+use Config;
 
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
@@ -55,7 +56,7 @@ interact with the set of supported compression methods.
 my $COMP = {
     gzip => {
 	file_ext => 'gz',
-	comp_prog => [ 'gzip', '--no-name', '--rsyncable' ],
+	comp_prog => [ 'gzip', '--no-name' ],
 	decomp_prog => [ 'gunzip' ],
 	default_level => 9,
     },
@@ -79,6 +80,24 @@ my $COMP = {
     },
 };
 
+#
+# XXX: The gzip package in Debian at some point acquired a Debian-specific
+# --rsyncable option via a vendor patch. Which is not present in most of the
+# major distributions, dpkg downstream systems, nor gzip upstream, who have
+# stated they will most probably not accept it because people should be using
+# pigz instead.
+#
+# This option should have never been accepted in dpkg, ever. But removing it
+# now would probably cause demands for tarring and feathering. In addition
+# we cannot use the Dpkg::Vendor logic because that would cause circular
+# module dependencies. The whole affair is pretty disgusting really.
+#
+# Check the perl Config to discern Debian and hopefully derivatives too.
+#
+if ($Config{cf_by} eq 'Debian Project') {
+    push @{$COMP->{gzip}->{comp_prog}}, '--rsyncable';
+}
+
 # XXX: Backwards compatibility, stop exporting on VERSION 2.00.
 ## no critic (Variables::ProhibitPackageVars)
 our $default_compression = 'xz';