From 4497ea352fede61322aa25c22108a59be30ecac0 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Sat, 16 Feb 2008 23:20:35 +0100 Subject: [PATCH] Handling of compression level in dpkg-source * 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 | 8 ++++++-- scripts/dpkg-source.pl | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/Dpkg/Source/Archiver.pm b/scripts/Dpkg/Source/Archiver.pm index c88c5780..dd0abcbf 100644 --- a/scripts/Dpkg/Source/Archiver.pm +++ b/scripts/Dpkg/Source/Archiver.pm @@ -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); } diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index ce1c72d0..7d37651f 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -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(); -- 2.39.5