X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=d287cfe742cde72567cb011e9d2262b84180b52a;hp=594281daa42a088ab162137abf5e68f0a6492d1f;hb=e35c1a88e93f56fd874b5cf222e6037b1eb89ca4;hpb=f104e99df970252c36929f63897ba8c8a61c09e0 diff --git a/dgit b/dgit index 594281da..d287cfe7 100755 --- a/dgit +++ b/dgit @@ -113,6 +113,9 @@ sub dscfn ($) { sub changesopts () { return @changesopts[1..$#changesopts]; } our $us = 'dgit'; +our $debugprefix = ' '; + +sub printdebug { print DEBUG $debugprefix, @_ or die $!; } sub fail { die "$us: @_\n"; } @@ -231,7 +234,7 @@ sub responder_send_command ($) { my ($command) = @_; return unless $we_are_responder; # called even without $we_are_responder - print DEBUG "<< $command\n"; + printdebug "<< $command\n"; print $command, "\n" or die $!; } @@ -324,7 +327,7 @@ sub failedcmd { } sub runcmd { - printcmd(\*DEBUG,"+",@_) if $debug>0; + printcmd(\*DEBUG,$debugprefix."+",@_) if $debug>0; $!=0; $?=0; failedcmd @_ if system @_; } @@ -339,16 +342,16 @@ sub printdone { sub cmdoutput_errok { die Dumper(\@_)." ?" if grep { !defined } @_; - printcmd(\*DEBUG,"|",@_) if $debug>0; + printcmd(\*DEBUG,$debugprefix."|",@_) if $debug>0; open P, "-|", @_ or die $!; my $d; $!=0; $?=0; { local $/ = undef; $d =
; }
die $! if P->error;
- if (!close P) { print DEBUG "=>!$?\n" if $debug>0; return undef; }
+ if (!close P) { printdebug "=>!$?\n" if $debug>0; return undef; }
chomp $d;
$d =~ m/^.*/;
- print DEBUG "=> \`$&'",(length $' ? '...' : ''),"\n" if $debug>0; #';
+ printdebug "=> \`$&'",(length $' ? '...' : ''),"\n" if $debug>0; #';
return $d;
}
@@ -359,7 +362,7 @@ sub cmdoutput {
}
sub dryrun_report {
- printcmd(\*STDERR,"#",@_);
+ printcmd(\*STDERR,$debugprefix."#",@_);
}
sub runcmd_ordryrun {
@@ -640,9 +643,9 @@ sub get_archive_dsc () {
next;
}
my $dscfh = new IO::File \$dscdata, '<' or die $!;
- print DEBUG Dumper($dscdata) if $debug>1;
+ printdebug Dumper($dscdata) if $debug>1;
$dsc = parsecontrolfh($dscfh,$dscurl, allow_pgp=>1);
- print DEBUG Dumper($dsc) if $debug>1;
+ printdebug Dumper($dsc) if $debug>1;
my $fmt = getfield $dsc, 'Format';
fail "unsupported source format $fmt, sorry" unless $format_ok{$fmt};
return;
@@ -914,7 +917,7 @@ sub fetch_from_archive () {
} else {
die "$lrref_fn $!";
}
- print DEBUG "previous reference hash=$lastpush_hash\n";
+ printdebug "previous reference hash=$lastpush_hash\n";
my $hash;
if (defined $dsc_hash) {
fail "missing git history even though dsc has hash -".
@@ -948,7 +951,7 @@ Package not found in the archive, but has allegedly been pushed using dgit.
$later_warning_msg
END
} else {
- print DEBUG "nothing found!\n";
+ printdebug "nothing found!\n";
if (defined $skew_warning_vsn) {
print STDERR <