]> err.no Git - dpkg/commitdiff
Handling of compression level in dpkg-source
authorRaphael Hertzog <hertzog@debian.org>
Sat, 16 Feb 2008 22:20:35 +0000 (23:20 +0100)
committerRaphael Hertzog <hertzog@debian.org>
Sat, 16 Feb 2008 22:24:43 +0000 (23:24 +0100)
* scripts/Dpkg/Source/Archiver.pm (create): Forward properly the
compression level.
* scripts/Dpkg/Source/Archiver.pm (extract): Correct parameters in
an error message.
* scripts/dpkg-source.pl: Take into account the compression level
when generating a new tarball.

scripts/Dpkg/Source/Archiver.pm
scripts/dpkg-source.pl

index c88c57808a8bb6ac1c9224fcc3100e1335427e5e..dd0abcbfe4f736b6a4510664f35c299847d95ace 100644 (file)
@@ -93,6 +93,10 @@ sub create {
            compressed_filename => $self->get_filename(),
            compression => $self->{"compression"},
        );
+       if ($self->{"compression_level"}) {
+           $self->{"compressor"}->set_compression_level(
+               $self->{"compression_level"});
+       }
        $self->{"compressor"}->compress(from_pipe => \$fork_opts{"to_handle"});
     } else {
        $fork_opts{"to_file"} = $self->get_filename();
@@ -208,8 +212,8 @@ sub extract {
                syserr(_g("Unable to rename %s to %s"),
                       "$tmp/$entries[0]", $dest);
     } else {
-       rename($tmp, $dest) || syserr(_g("Unable to rename %s to %s"),
-                                     "$tmp/$_", "$dest/$_");
+       rename($tmp, $dest) ||
+               syserr(_g("Unable to rename %s to %s"), $tmp, $dest);
     }
     rmtree($tmp);
 }
index ce1c72d0cc85045ecb91e913e8b25b8da13eca59..7d37651f077bb91334b26c74da7f688e84eacf64 100755 (executable)
@@ -595,7 +595,8 @@ if ($opmode eq 'build') {
        my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX",
                                       DIR => getcwd(), UNLINK => 0);
        my $tar = Dpkg::Source::Archiver->new(filename => $newtar,
-                   compression => get_compression_from_filename($tarname));
+                   compression => get_compression_from_filename($tarname),
+                   compression_level => $comp_level);
        $tar->create(options => \@tar_ignore);
        $tar->add_directory($tardirname);
        $tar->close();