瀏覽代碼

dpkg-source: Set default compression options in source format specific modules

This paves the way to be able to set package format specific defaults,
and fixes a problem with the default compression level on “3.0 (native)”
packages, as it was being set in dpkg-source but not reset when the
compressor was changed.

Closes: #733326
Guillem Jover 12 年之前
父節點
當前提交
583ee7f304
共有 4 個文件被更改,包括 15 次插入5 次删除
  1. 3 0
      debian/changelog
  2. 7 0
      scripts/Dpkg/Source/Package.pm
  3. 5 0
      scripts/Dpkg/Source/Package/V1.pm
  4. 0 5
      scripts/dpkg-source.pl

+ 3 - 0
debian/changelog

@@ -34,6 +34,9 @@ dpkg (1.17.6) UNRELEASED; urgency=low
   * Add support for Testsuite source field.
   * Clarify error message about missing revision in non-native source package.
     Closes: #719348, #733746
+  * Set default compression options in source format specific modules instead
+    of dpkg-source. This makes sure the correct compression level is set, even
+    for “3.0 (native)” packages with non-default compressors. Closes: #733326
 
   [ Updated dpkg translations ]
   * Swedish (Peter Krefting).

+ 7 - 0
scripts/Dpkg/Source/Package.pm

@@ -225,6 +225,13 @@ sub init_options {
     # Skip debianization while specific to some formats has an impact
     # on code common to all formats
     $self->{options}{skip_debianization} ||= 0;
+
+    # Set default compressor for new formats.
+    $self->{options}{compression} //= 'gzip';
+    $self->{options}{comp_level} //= compression_get_property($self->{options}{compression},
+                                                              'default_level');
+    $self->{options}{comp_ext} //= compression_get_property($self->{options}{compression},
+                                                            'file_ext');
 }
 
 sub initialize {

+ 5 - 0
scripts/Dpkg/Source/Package/V1.pm

@@ -54,6 +54,11 @@ sub init_options {
     $self->{options}{sourcestyle} ||= 'X';
     $self->{options}{skip_debianization} ||= 0;
     $self->{options}{abort_on_upstream_changes} ||= 0;
+
+    # V1.0 only supports gzip compression.
+    $self->{options}{compression} //= 'gzip';
+    $self->{options}{comp_level} //= compression_get_property('gzip', 'default_level');
+    $self->{options}{comp_ext} //= compression_get_property('gzip', 'file_ext');
 }
 
 sub parse_cmdline_option {

+ 0 - 5
scripts/dpkg-source.pl

@@ -59,10 +59,6 @@ my $changelogformat;
 
 my $build_format;
 my %options = (
-    # Compression related
-    compression => compression_get_default(),
-    comp_level => compression_get_default_level(),
-    comp_ext => compression_get_property(compression_get_default(), 'file_ext'),
     # Ignore files
     tar_ignore => [],
     diff_ignore_regex => '',
@@ -149,7 +145,6 @@ while (@options) {
     } elsif (m/^-(?:Z|-compression=)(.*)$/) {
 	my $compression = $1;
 	$options{compression} = $compression;
-	$options{comp_ext} = compression_get_property($compression, 'file_ext');
 	usageerr(_g('%s is not a supported compression'), $compression)
 	    unless compression_is_supported($compression);
 	compression_set_default($compression);