This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=746c73d49d30bb0cd748befb547b2bf3df282eb5

commit 746c73d49d30bb0cd748befb547b2bf3df282eb5
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Dec 20 04:05:40 2022 +0100

    Dpkg::Compression::Process: Unify and simplify cmdline handling
    
    Make the two functions handle the program name fetching in the same way,
    and simplify the compression level option generation.
---
 scripts/Dpkg/Compression/Process.pm | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/scripts/Dpkg/Compression/Process.pm 
b/scripts/Dpkg/Compression/Process.pm
index 34d99bd70..9ced4598d 100644
--- a/scripts/Dpkg/Compression/Process.pm
+++ b/scripts/Dpkg/Compression/Process.pm
@@ -1,4 +1,5 @@
 # Copyright © 2008-2010 Raphaël Hertzog <[email protected]>
+# Copyright © 2008-2022 Guillem Jover <[email protected]>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -105,17 +106,22 @@ and its standard output.
 
 sub get_compress_cmdline {
     my $self = shift;
-    my @prog = (@{compression_get_property($self->{compression}, 
'comp_prog')});
-    my $level = '-' . $self->{compression_level};
-    $level = '--' . $self->{compression_level}
-           if $self->{compression_level} !~ m/^[1-9]$/;
-    push @prog, $level;
+
+    my @prog = @{compression_get_property($self->{compression}, 'comp_prog')};
+    my $level = $self->{compression_level};
+    if ($level =~ m/^[1-9]$/) {
+        push @prog, "-$level";
+    } else {
+        push @prog, "--$level";
+    }
     return @prog;
 }
 
 sub get_uncompress_cmdline {
     my $self = shift;
-    return (@{compression_get_property($self->{compression}, 'decomp_prog')});
+
+    my @prog = @{compression_get_property($self->{compression}, 
'decomp_prog')};
+    return @prog;
 }
 
 sub _check_opts {

-- 
Dpkg.Org's dpkg

Reply via email to