Browse Source

scripts: Refactor command printing into new printcmd() function

Guillem Jover 8 years ago
parent
commit
5833b05c48
2 changed files with 11 additions and 3 deletions
  1. 8 0
      scripts/Dpkg/ErrorHandling.pm
  2. 3 3
      scripts/dpkg-buildpackage.pl

+ 8 - 0
scripts/Dpkg/ErrorHandling.pm

@@ -28,6 +28,7 @@ our @EXPORT = qw(
     error
     errormsg
     syserr
+    printcmd
     subprocerr
     usageerr
 );
@@ -91,6 +92,13 @@ sub errormsg($;@)
     print { *STDERR } report(g_('error'), @_);
 }
 
+sub printcmd
+{
+    my (@cmd) = @_;
+
+    print { *STDERR } " @cmd\n";
+}
+
 sub subprocerr(@)
 {
     my ($p) = (shift);

+ 3 - 3
scripts/dpkg-buildpackage.pl

@@ -540,7 +540,7 @@ push @changes_opts, "-C$desc" if defined $desc;
 my $chg = "../$pva.changes";
 my $changes = Dpkg::Control->new(type => CTRL_FILE_CHANGES);
 
-print { *STDERR } " dpkg-genchanges @changes_opts >$chg\n";
+printcmd("dpkg-genchanges @changes_opts >$chg");
 
 open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts
     or subprocerr('dpkg-genchanges');
@@ -614,7 +614,7 @@ sub mustsetvar {
 }
 
 sub withecho {
-    print { *STDERR } " @_\n";
+    printcmd(@_);
     system(@_)
 	and subprocerr("@_");
 }
@@ -655,7 +655,7 @@ sub run_hook {
 sub signfile {
     my $file = shift;
 
-    print { *STDERR } " signfile $file\n";
+    printcmd("signfile $file");
 
     my $signdir = tempdir('dpkg-sign.XXXXXXXX', CLEANUP => 1);
     my $signfile = "$signdir/$file";