X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=4cc568457a8305b83dfd83024c909d0dd19654fb;hp=8ce43899bc1e74b9a8c8216cbc8b8b673d00d921;hb=707e502d2fb71f98f990edc12bd5fbd3d32dae52;hpb=00ac08331f4119b8726748c109ce9a2d50f2887e diff --git a/dgit b/dgit index 8ce43899..4cc56845 100755 --- a/dgit +++ b/dgit @@ -5715,7 +5715,10 @@ END if (act_local()) { debugcmd "+",@cmd; $!=0; $?=-1; - failedcmd @cmd if system @cmd and $?!=7*256; + failedcmd @cmd + if system @cmd + and not ($? == 7*256 or + $? == -1 && $!==ENOENT); } else { dryrun_report @cmd; } @@ -6116,7 +6119,7 @@ END quiltify($clogp,$headref,$oldtiptree,\@failsuggestion); if (!open P, '>>', ".pc/applied-patches") { - $!==&ENOENT or confess $!; + $!==&ENOENT or confess $!; } else { close P; } @@ -6149,7 +6152,7 @@ sub quilt_fixup_editor () { sub maybe_apply_patches_dirtily () { return unless $quilt_mode =~ m/gbp|unapplied/; - print STDERR <[0] } @vsns; @vsns = sort { -version_compare($a, $b) } @vsns; $changes_since_version = $vsns[0]; - progress "changelog will contain changes since $vsns[0]"; + progress f_ "changelog will contain changes since %s", $vsns[0]; } else { $changes_since_version = '_'; - progress "package seems new, not specifying -v"; + progress __ "package seems new, not specifying -v"; } } if ($changes_since_version ne '_') { @@ -6322,14 +6328,14 @@ sub massage_dbp_args ($;$) { $r |= WANTSRC_SOURCE if grep { s/^full$/binary/ } @d; $r |= WANTSRC_SOURCE if grep { s/^source$// } @d; $r |= WANTSRC_BUILDER if grep { m/./ } @d; - fail "Wanted to build nothing!" unless $r; + fail __ "Wanted to build nothing!" unless $r; $dmode = '--build='. join ',', grep m/./, @d; } else { $r = $dmode =~ m/[S]/ ? WANTSRC_SOURCE : $dmode =~ y/gGF/ABb/ ? WANTSRC_SOURCE | WANTSRC_BUILDER : $dmode =~ m/[ABb]/ ? WANTSRC_BUILDER : - die "$dmode ?"; + confess "$dmode ?"; } printdebug "massage done $r $dmode.\n"; push @$cmd, $dmode; @@ -6359,30 +6365,35 @@ sub postbuild_mergechanges ($) { } @changesfiles; my $result; if (@changesfiles==1) { - fail <; }; - D->error and fail "read $dscfn: $!"; + D->error and fail f_ "read %s: %s", $dscfn, $!; close C; # we don't normally need this so import it here @@ -6752,13 +6772,13 @@ sub cmd_import_dsc { local $SIG{__WARN__} = sub { print STDERR $_[0]; return unless $needsig; - fail "import-dsc signature check failed"; + fail __ "import-dsc signature check failed"; }; if (!$dp->is_signed()) { - warn "$us: warning: importing unsigned .dsc\n"; + warn f_ "%s: warning: importing unsigned .dsc\n", $us; } else { my $r = $dp->check_signature(); - die "->check_signature => $r" if $needsig && $r; + confess "->check_signature => $r" if $needsig && $r; } } @@ -6766,7 +6786,7 @@ sub cmd_import_dsc { $package = getfield $dsc, 'Source'; - parse_dsc_field($dsc, "Dgit metadata in .dsc") + parse_dsc_field($dsc, __ "Dgit metadata in .dsc") unless forceing [qw(import-dsc-with-dgit-field)]; parse_dsc_field_def_dsc_distro(); @@ -6776,7 +6796,8 @@ sub cmd_import_dsc { notpushing(); if (defined $dsc_hash) { - progress "dgit: import-dsc of .dsc with Dgit field, using git hash"; + progress __ + "dgit: import-dsc of .dsc with Dgit field, using git hash"; resolve_dsc_field_commit undef, undef; } if (defined $dsc_hash) { @@ -6784,29 +6805,29 @@ sub cmd_import_dsc { "echo $dsc_hash | git cat-file --batch-check"); my $objgot = cmdoutput @cmd; if ($objgot =~ m#^\w+ missing\b#) { - fail < 0) { - progress "Not fast forward, forced update."; + progress __ "Not fast forward, forced update."; } else { - fail "Not fast forward to $dsc_hash"; + fail f_ "Not fast forward to %s", $dsc_hash; } } import_dsc_result $dstbranch, $dsc_hash, "dgit import-dsc (Dgit): $info", - "updated git ref $dstbranch"; + f_ "updated git ref %s", $dstbranch; return 0; } - fail < $there"; + stat $test or fail f_ + "import %s requires %s, but: %s", $dscfn, $test, $!; + symlink $there, $here or fail f_ + "symlink %s to %s: %s", $there, $here, $!; + progress f_ "made symlink %s -> %s", $here, $there; # print STDERR Dumper($fi); } my @mergeinputs = generate_commits_from_dsc(); @@ -6843,21 +6869,24 @@ END if ($oldhash) { if ($force > 0) { - progress "Import, forced update - synthetic orphan git history."; + progress __ + "Import, forced update - synthetic orphan git history."; } elsif ($force < 0) { - progress "Import, merging."; + progress __ "Import, merging."; my $tree = cmdoutput @git, qw(rev-parse), "$newhash:"; my $version = getfield $dsc, 'Version'; my $clogp = commit_getclogp $newhash; my $authline = clogp_authline $clogp; - $newhash = make_commit_text <",@cmd; - exec @cmd or fail "exec curl: $!\n"; + exec @cmd or fail f_ "exec curl: %s\n", $!; } sub repos_server_url () { @@ -6893,19 +6922,20 @@ sub pre_clone_dgit_repos_server () { not_necessarily_a_tree(); } sub cmd_clone_dgit_repos_server { - badusage "need destination argument" unless @ARGV==1; + badusage __ "need destination argument" unless @ARGV==1; my ($destdir) = @ARGV; my $url = repos_server_url(); my @cmd = (@git, qw(clone), $url, $destdir); debugcmd ">",@cmd; - exec @cmd or fail "exec git clone: $!\n"; + exec @cmd or fail f_ "exec git clone: %s\n", $!; } sub pre_print_dgit_repos_server_source_url () { not_necessarily_a_tree(); } sub cmd_print_dgit_repos_server_source_url { - badusage "no arguments allowed to dgit print-dgit-repos-server-source-url" + badusage __ + "no arguments allowed to dgit print-dgit-repos-server-source-url" if @ARGV; my $url = repos_server_url(); print $url, "\n" or confess $!; @@ -6915,31 +6945,33 @@ sub pre_print_dpkg_source_ignores { not_necessarily_a_tree(); } sub cmd_print_dpkg_source_ignores { - badusage "no arguments allowed to dgit print-dpkg-source-ignores" + badusage __ + "no arguments allowed to dgit print-dpkg-source-ignores" if @ARGV; print "@dpkg_source_ignores\n" or confess $!; } sub cmd_setup_mergechangelogs { - badusage "no arguments allowed to dgit setup-mergechangelogs" if @ARGV; + badusage __ "no arguments allowed to dgit setup-mergechangelogs" + if @ARGV; local $isuite = 'DGIT-SETUP-TREE'; setup_mergechangelogs(1); } sub cmd_setup_useremail { - badusage "no arguments allowed to dgit setup-useremail" if @ARGV; + badusage __ "no arguments allowed to dgit setup-useremail" if @ARGV; local $isuite = 'DGIT-SETUP-TREE'; setup_useremail(1); } sub cmd_setup_gitattributes { - badusage "no arguments allowed to dgit setup-useremail" if @ARGV; + badusage __ "no arguments allowed to dgit setup-useremail" if @ARGV; local $isuite = 'DGIT-SETUP-TREE'; setup_gitattrs(1); } sub cmd_setup_new_tree { - badusage "no arguments allowed to dgit setup-tree" if @ARGV; + badusage __ "no arguments allowed to dgit setup-tree" if @ARGV; local $isuite = 'DGIT-SETUP-TREE'; setup_new_tree(); } @@ -6986,8 +7018,8 @@ defvalopt '', '-C', '.+', sub { defvalopt '--initiator-tempdir','','.*', sub { ($initiator_tempdir) = (@_); $initiator_tempdir =~ m#^/# or - badusage "--initiator-tempdir must be used specify an". - " absolute, not relative, directory." + badusage __ "--initiator-tempdir must be used specify an". + " absolute, not relative, directory." }; sub defoptmodes ($@) { @@ -7025,11 +7057,11 @@ sub parseopts () { my ($what) = @_; @rvalopts = ($_); if (!defined $val) { - badusage "$what needs a value" unless @ARGV; + badusage f_ "%s needs a value", $what unless @ARGV; $val = shift @ARGV; push @rvalopts, $val; } - badusage "bad value \`$val' for $what" unless + badusage f_ "bad value \`%s' for %s", $val, $what unless $val =~ m/^$oi->{Re}$(?!\n)/s; my $how = $oi->{How}; if (ref($how) eq 'SCALAR') { @@ -7114,7 +7146,8 @@ sub parseopts () { $_=''; } elsif (m/^--force-/) { print STDERR - "$us: warning: ignoring unknown force option $_\n"; + f_ "%s: warning: ignoring unknown force option %s\n", + $us, $_; $_=''; } elsif (m/^--dgit-tag-format=(old|new)$/s) { # undocumented, for testing @@ -7133,7 +7166,7 @@ sub parseopts () { push @ropts, $_; $funcopts_long{$_}(); } else { - badusage "unknown long option \`$_'"; + badusage f_ "unknown long option \`%s'", $_; } } else { while (m/^-./s) { @@ -7186,7 +7219,7 @@ sub parseopts () { $valopt->($oi->{Short}); $_ = ''; } else { - badusage "unknown short option \`$_'"; + badusage f_ "unknown short option \`%s'", $_; } } } @@ -7201,16 +7234,17 @@ sub check_env_sanity () { foreach my $name (qw(PIPE CHLD)) { my $signame = "SIG$name"; my $signum = eval "POSIX::$signame" // die; - die "$signame is set to something other than SIG_DFL\n" + die f_ "%s is set to something other than SIG_DFL\n", + $signame if defined $SIG{$name} and $SIG{$name} ne 'DEFAULT'; $blocked->ismember($signum) and - die "$signame is blocked\n"; + die f_ "%s is blocked\n", $signame; } }; return unless $@; chomp $@; - fail <[0]; $om->[0] = $v; } @@ -7240,7 +7274,7 @@ sub parseopts_late_defaults () { printdebug "CL $c ", (join " ", map { shellquote } @vl), "\n" if $debuglevel >= 4; next unless @vl; - badcfg "cannot configure options for $k" + badcfg f_ "cannot configure options for %s", $k if $opts_opt_cmdonly{$k}; my $insertpos = $opts_cfg_insertpos{$k}; @$om = ( @$om[0..$insertpos-1], @@ -7260,7 +7294,7 @@ sub parseopts_late_defaults () { // access_cfg('quilt-mode', 'RETURN-UNDEF') // 'linear'; $quilt_mode =~ m/^($quilt_modes_re)$/ - or badcfg "unknown quilt-mode \`$quilt_mode'"; + or badcfg f_ "unknown quilt-mode \`%s'", $quilt_mode; $quilt_mode = $1; } @@ -7270,7 +7304,8 @@ sub parseopts_late_defaults () { next if defined $$vr; $$vr = access_cfg($moc->{Key}, 'RETURN-UNDEF') // $moc->{Default}; my $v = $moc->{Vals}{$$vr}; - badcfg "unknown $moc->{Key} setting \`$$vr'" unless defined $v; + badcfg f_ "unknown %s setting \`%s'", $moc->{Key}, $$vr + unless defined $v; $$vr = $v; } @@ -7282,7 +7317,7 @@ sub parseopts_late_defaults () { $cleanmode = access_cfg('clean-mode', 'RETURN-UNDEF'); $cleanmode //= 'dpkg-source'; - badcfg "unknown clean-mode \`$cleanmode'" unless + badcfg f_ "unknown clean-mode \`%s'", $cleanmode unless $cleanmode =~ m/^($cleanmode_re)$(?!\n)/s; } @@ -7303,8 +7338,8 @@ if ($ENV{$fakeeditorenv}) { parseopts(); check_env_sanity(); -print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1; -print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n" +print STDERR __ "DRY RUN ONLY\n" if $dryrun_level > 1; +print STDERR __ "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n" if $dryrun_level == 1; if (!@ARGV) { print STDERR __ $helpmsg or confess $!; @@ -7320,7 +7355,7 @@ record_maindir if $invoked_in_git_tree; git_slurp_config(); my $fn = ${*::}{"cmd_$cmd"}; -$fn or badusage "unknown operation $cmd"; +$fn or badusage f_ "unknown operation %s", $cmd; $fn->(); finish 0;