diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-09-29 15:56:55 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-10-01 03:34:12 +0100 |
commit | 66b8676ac88921bcf2c97abd4e5ae4dea87e4360 (patch) | |
tree | 256169032918504c7bcae70721bbc52e53461c0f /dgit | |
parent | d5a04ee68cb3ed5c2853bae83b132505b850a5e6 (diff) |
i18n: dgit: mark some messages (3)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 201 |
1 files changed, 107 insertions, 94 deletions
@@ -2890,8 +2890,8 @@ sub git_fetch_us () { } elsif ($here{$lref} eq $objid) { lrfetchref_used $fullrefname; } else { - print STDERR - "Not updating $lref from $here{$lref} to $objid.\n"; + print STDERR f_ "Not updating %s from %s to %s.\n", + $lref, $here{$lref}, $objid; } }); } @@ -2939,20 +2939,20 @@ sub parse_dsc_field ($$) { } if (!defined $f) { - progress "$what: NO git hash"; + progress f_ "%s: NO git hash", $what; parse_dsc_field_def_dsc_distro(); } elsif (($dsc_hash, $dsc_distro, $dsc_hint_tag, $dsc_hint_url) = $f =~ m/^(\w+)\s+($distro_re)\s+($versiontag_re)\s+(\S+)(?:\s|$)/) { - progress "$what: specified git info ($dsc_distro)"; + progress f_ "%s: specified git info (%s)", $what, $dsc_distro; $dsc_hint_tag = [ $dsc_hint_tag ]; } elsif ($f =~ m/^\w+\s*$/) { $dsc_hash = $&; parse_dsc_field_def_dsc_distro(); $dsc_hint_tag = [ debiantags +(getfield $dsc, 'Version'), $dsc_distro ]; - progress "$what: specified git hash"; + progress f_ "%s: specified git hash", $what; } else { - fail "$what: invalid Dgit info"; + fail f_ "%s: invalid Dgit info", $what; } } @@ -2974,18 +2974,17 @@ sub resolve_dsc_field_commit ($$) { my $lrf = lrfetchrefs; if (!$chase_dsc_distro) { - progress - "not chasing .dsc distro $dsc_distro: not fetching $what"; + progress f_ "not chasing .dsc distro %s: not fetching %s", + $dsc_distro, $what; return 0; } - progress - ".dsc names distro $dsc_distro: fetching $what"; + progress f_ ".dsc names distro %s: fetching %s", $dsc_distro, $what; my $url = access_giturl(); if (!defined $url) { - defined $dsc_hint_url or fail <<END; -.dsc Dgit metadata is in context of distro $dsc_distro + defined $dsc_hint_url or fail f_ <<END, $dsc_distro; +.dsc Dgit metadata is in context of distro %s for which we have no configured url and .dsc provides no hint END my $proto = @@ -2994,10 +2993,10 @@ END parse_cfg_bool "dsc-url-proto-ok", 'false', cfg("dgit.dsc-url-proto-ok.$proto", "dgit.default.dsc-url-proto-ok") - or fail <<END; -.dsc Dgit metadata is in context of distro $dsc_distro + or fail f_ <<END, $dsc_distro, $proto; +.dsc Dgit metadata is in context of distro %s for which we have no configured url; -.dsc provides hinted url with protocol $proto which is unsafe. +.dsc provides hinted url with protocol %s which is unsafe. (can be overridden by config - consult documentation) END $url = $dsc_hint_url; @@ -3015,30 +3014,30 @@ END if (parse_cfg_bool 'rewrite-map-enable', 'true', $rewrite_enable) { if (!defined $mapref) { - my $lrf = $do_fetch->("rewrite map", $rewritemap) or return; + my $lrf = $do_fetch->((__ "rewrite map"), $rewritemap) or return; $mapref = $lrf.'/'.$rewritemap; } my $rewritemapdata = git_cat_file $mapref.':map'; if (defined $rewritemapdata && $rewritemapdata =~ m/^$dsc_hash(?:[ \t](\w+))/m) { - progress + progress __ "server's git history rewrite map contains a relevant entry!"; $dsc_hash = $1; if (defined $dsc_hash) { - progress "using rewritten git hash in place of .dsc value"; + progress __ "using rewritten git hash in place of .dsc value"; } else { - progress "server data says .dsc hash is to be disregarded"; + progress __ "server data says .dsc hash is to be disregarded"; } } } if (!defined git_cat_file $dsc_hash) { my @tags = map { "tags/".$_ } @$dsc_hint_tag; - my $lrf = $do_fetch->("additional commits", @tags) && + my $lrf = $do_fetch->((__ "additional commits"), @tags) && defined git_cat_file $dsc_hash - or fail <<END; -.dsc Dgit metadata requires commit $dsc_hash + or fail f_ <<END, $dsc_hash; +.dsc Dgit metadata requires commit %s but we could not obtain that object anywhere. END foreach my $t (@tags) { @@ -3062,11 +3061,11 @@ sub fetch_from_archive () { get_archive_dsc(); if ($dsc) { - parse_dsc_field($dsc, 'last upload to archive'); + parse_dsc_field($dsc, __ 'last upload to archive'); resolve_dsc_field_commit access_basedistro, lrfetchrefs."/".$rewritemap } else { - progress "no version available from the archive"; + progress __ "no version available from the archive"; } # If the archive's .dsc has a Dgit field, there are three @@ -3149,19 +3148,19 @@ sub fetch_from_archive () { printdebug "previous reference hash=$lastpush_hash\n"; $lastpush_mergeinput = $lastpush_hash && { Commit => $lastpush_hash, - Info => "dgit suite branch on dgit git server", + Info => (__ "dgit suite branch on dgit git server"), }; my $lastfetch_hash = git_get_ref(lrref()); printdebug "fetch_from_archive: lastfetch=$lastfetch_hash\n"; my $lastfetch_mergeinput = $lastfetch_hash && { Commit => $lastfetch_hash, - Info => "dgit client's archive history view", + Info => (__ "dgit client's archive history view"), }; my $dsc_mergeinput = $dsc_hash && { Commit => $dsc_hash, - Info => "Dgit field in .dsc from archive", + Info => (__ "Dgit field in .dsc from archive"), }; my $cwd = getcwd(); @@ -3202,10 +3201,10 @@ END # push. This can happen if the archive moves .dscs about. # Just follow its lead. if (is_fast_fwd($lastpush_hash,$dsc_hash)) { - progress "archive .dsc names newer git commit"; + progress __ "archive .dsc names newer git commit"; @mergeinputs = ($dsc_mergeinput); } else { - progress "archive .dsc names other git commit, fixing up"; + progress __ "archive .dsc names other git commit, fixing up"; @mergeinputs = ($dsc_mergeinput, $lastpush_mergeinput); } } @@ -3234,10 +3233,10 @@ END } else { printdebug "nothing found!\n"; if (defined $skew_warning_vsn) { - print STDERR <<END or die $!; + print STDERR f_ <<END, $skew_warning_vsn or die $!; Warning: relevant archive skew detected. -Archive allegedly contains $skew_warning_vsn +Archive allegedly contains %s But we were not able to obtain any version from the archive or git. END @@ -3319,8 +3318,8 @@ END if (defined $compat_info->{Message}) { print MC $compat_info->{Message} or die $!; } else { - print MC <<END or die $!; -Record $package ($cversion) in archive suite $csuite + print MC f_ <<END, $package, $cversion, $csuite or die $!; +Record %s (%s) in archive suite %s Record that END @@ -3332,7 +3331,7 @@ END }; $message_add_info->($mergeinputs[0]); - print MC <<END or die $!; + print MC __ <<END or die $!; should be treated as descended from END $message_add_info->($_) foreach @mergeinputs[1..$#mergeinputs]; @@ -3348,12 +3347,12 @@ END my $chkff = sub { my ($lasth, $what) = @_; return unless $lasth; - die "$lasth $hash $what ?" unless is_fast_fwd($lasth, $hash); + confess "$lasth $hash $what ?" unless is_fast_fwd($lasth, $hash); }; - $chkff->($lastpush_hash, 'dgit repo server tip (last push)') + $chkff->($lastpush_hash, __ 'dgit repo server tip (last push)') if $lastpush_hash; - $chkff->($lastfetch_hash, 'local tracking tip (last fetch)'); + $chkff->($lastfetch_hash, __ 'local tracking tip (last fetch)'); fetch_from_archive_record_1($hash); @@ -3363,11 +3362,11 @@ END my $got_vsn = getfield $gotclogp, 'Version'; printdebug "SKEW CHECK GOT $got_vsn\n"; if (version_compare($got_vsn, $skew_warning_vsn) < 0) { - print STDERR <<END or die $!; + print STDERR f_ <<END, $skew_warning_vsn, $got_vsn or die $!; Warning: archive skew detected. Using the available version: -Archive allegedly contains $skew_warning_vsn -We were able to obtain only $got_vsn +Archive allegedly contains %s +We were able to obtain only %s END } @@ -3379,7 +3378,7 @@ END lrfetchref_used lrfetchref(); - check_gitattrs($hash, "fetched source tree"); + check_gitattrs($hash, __ "fetched source tree"); unshift @end, $del_lrfetchrefs; return $hash; @@ -3415,7 +3414,7 @@ sub setup_mergechangelogs (;$) { print NATTRS "debian/changelog merge=$driver\n" or die $!; close NATTRS; - set_local_git_config "$cb.name", 'debian/changelog merge driver'; + set_local_git_config "$cb.name", __ 'debian/changelog merge driver'; set_local_git_config "$cb.driver", 'dpkg-mergechangelogs -m %O %A %B %A'; rename "$attrs.new", "$attrs" or die "$attrs: $!"; @@ -3479,7 +3478,7 @@ sub setup_gitattrs (;$) { my $already = is_gitattrs_setup(); if ($already) { - progress <<END; + progress __ <<END; [attr]dgit-defuse-attrs already found, and proper, in .git/info/attributes not doing further gitattributes setup END @@ -3490,11 +3489,12 @@ END ensuredir "$maindir_gitcommon/info"; open GAO, "> $af.new" or die $!; - print GAO <<END or die $! unless defined $already; + print GAO <<END, __ <<ENDT or die $! unless defined $already; * dgit-defuse-attrs $new -# ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1) END +# ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1) +ENDT my $gai = open_main_gitattrs(); if ($gai) { while (<$gai>) { @@ -3508,7 +3508,7 @@ END $gai->error and die $!; } close GAO or die $!; - rename "$af.new", "$af" or die "install $af: $!"; + rename "$af.new", "$af" or fail f_ "install %s: %s", $af, $!; } sub setup_new_tree () { @@ -3534,8 +3534,8 @@ sub check_gitattrs ($$) { next unless m{(?:^|/)\.gitattributes$}; # oh dear, found one - print STDERR <<END; -dgit: warning: $what contains .gitattributes + print STDERR f_ <<END, $what; +dgit: warning: %s contains .gitattributes dgit: .gitattributes not (fully) defused. Recommended: dgit setup-new-tree. END close $gafl; @@ -3557,7 +3557,7 @@ sub multisuite_suite_child ($$$) { $isuite = $tsuite; $us .= " [$isuite]"; $debugprefix .= " "; - progress "fetching $tsuite..."; + progress f_ "fetching %s...", $tsuite; canonicalise_suite(); print $canonsuitefh $csuite, "\n" or die $!; close $canonsuitefh or die $!; @@ -3565,7 +3565,8 @@ sub multisuite_suite_child ($$$) { return undef; } waitpid $pid,0 == $pid or die $!; - fail "failed to obtain $tsuite: ".waitstatusmsg() if $? && $?!=256*4; + fail f_ "failed to obtain %s: %s", $tsuite, waitstatusmsg() + if $? && $?!=256*4; seek $canonsuitefh,0,0 or die $!; local $csuite = <$canonsuitefh>; die $! unless defined $csuite && chomp $csuite; @@ -3603,7 +3604,7 @@ sub fork_for_multisuite ($) { sub { }); return 0 unless defined $cbasesuite; - fail "package $package missing in (base suite) $cbasesuite" + fail f_ "package %s missing in (base suite) %s", $package, $cbasesuite unless @mergeinputs; my @csuites = ($cbasesuite); @@ -3635,9 +3636,9 @@ sub fork_for_multisuite ($) { if ($previous) { unshift @mergeinputs, { Commit => $previous, - Info => "local combined tracking branch", - Warning => - "archive seems to have rewound: local tracking branch is ahead!", + Info => (__ "local combined tracking branch"), + Warning => (__ + "archive seems to have rewound: local tracking branch is ahead!"), }; } @@ -3676,8 +3677,9 @@ sub fork_for_multisuite ($) { my $tree = cmdoutput qw(git rev-parse), $needed[0]{Commit}.':'; my $commit = "tree $tree\n"; - my $msg = "Combine archive branches $csuite [dgit]\n\n". - "Input branches:\n"; + my $msg = f_ "Combine archive branches %s [dgit]\n\n". + "Input branches:\n", + $csuite; foreach my $mi (sort { $a->{Index} <=> $b->{Index} } @mergeinputs) { printdebug "multisuite merge include $mi->{Info}\n"; @@ -3689,9 +3691,10 @@ sub fork_for_multisuite ($) { $mi->{Info}; } my $authline = clogp_authline mergeinfo_getclogp $needed[0]; - $msg .= "\nKey\n". + $msg .= __ "\nKey\n". " * marks the highest version branch, which choose to use\n". - " + marks each branch which was not already an ancestor\n\n". + " + marks each branch which was not already an ancestor\n\n"; + $msg .= "[dgit multi-suite $csuite]\n"; $commit .= "author $authline\n". @@ -3703,7 +3706,7 @@ sub fork_for_multisuite ($) { fetch_from_archive_record_1($output); fetch_from_archive_record_2($output); - progress "calculated combined tracking suite $csuite"; + progress f_ "calculated combined tracking suite %s", $csuite; return 1; } @@ -3721,7 +3724,7 @@ sub clone_finish ($) { git ls-tree -r --name-only -z HEAD | \ xargs -0r touch -h -r . -- END - printdone "ready for work in $dstdir"; + printdone f_ "ready for work in %s", $dstdir; } sub clone ($) { @@ -3729,7 +3732,7 @@ sub clone ($) { # once in parent after first suite fetched, # and then again in child after everything is finished my ($dstdir) = @_; - badusage "dry run makes no sense with clone" unless act_local(); + badusage __ "dry run makes no sense with clone" unless act_local(); my $multi_fetched = fork_for_multisuite(sub { printdebug "multi clone before fetch merge\n"; @@ -3746,7 +3749,7 @@ sub clone ($) { canonicalise_suite(); my $hasgit = check_for_git(); - mkdir $dstdir or fail "create \`$dstdir': $!"; + mkdir $dstdir or fail f_ "create \`%s': %s", $dstdir, $!; changedir $dstdir; runcmd @git, qw(init -q); record_maindir(); @@ -3757,11 +3760,11 @@ sub clone ($) { runcmd @git, qw(remote add), 'origin', $giturl; } if ($hasgit) { - progress "fetching existing git history"; + progress __ "fetching existing git history"; git_fetch_us(); runcmd_ordryrun_local @git, qw(fetch origin); } else { - progress "starting new git history"; + progress __ "starting new git history"; } fetch_from_archive() or no_such_package; my $vcsgiturl = $dsc->{'Vcs-Git'}; @@ -3786,13 +3789,13 @@ sub fetch_one () { cfg 'dgit.vcs-git.suites')) { my $current = cfg 'remote.vcs-git.url', 'RETURN-UNDEF'; if (defined $current && $current ne $vcsgiturl) { - print STDERR <<END; -FYI: Vcs-Git in $csuite has different url to your vcs-git remote. + print STDERR f_ <<END, $csuite; +FYI: Vcs-Git in %s has different url to your vcs-git remote. Your vcs-git remote url may be out of date. Use dgit update-vcs-git ? END } } - printdone "fetched into ".lrref(); + printdone f_ "fetched into %s", lrref(); } sub dofetch () { @@ -3803,15 +3806,16 @@ sub dofetch () { sub pull () { dofetch(); - runcmd_ordryrun_local @git, qw(merge -m),"Merge from $csuite [dgit]", + runcmd_ordryrun_local @git, qw(merge -m), + (f_ "Merge from %s [dgit]", $csuite), lrref(); - printdone "fetched to ".lrref()." and merged into HEAD"; + printdone f_ "fetched to %s and merged into HEAD", lrref(); } sub check_not_dirty () { foreach my $f (qw(local-options local-patch-header)) { if (stat_exists "debian/source/$f") { - fail "git tree contains debian/source/$f"; + fail f_ "git tree contains debian/source/%s", $f; } } @@ -3829,9 +3833,10 @@ sub commit_admin ($) { sub quiltify_nofix_bail ($$) { my ($headinfo, $xinfo) = @_; if ($quilt_mode eq 'nofix') { - fail "quilt fixup required but quilt mode is \`nofix'\n". - "HEAD commit".$headinfo." differs from tree implied by ". - " debian/patches".$xinfo; + fail f_ + "quilt fixup required but quilt mode is \`nofix'\n". + "HEAD commit%s differs from tree implied by debian/patches%s", + $headinfo, $xinfo; } } @@ -3846,15 +3851,16 @@ sub commit_quilty_patch () { } delete $adds{'.pc'}; # if there wasn't one before, don't add it if (!%adds) { - progress "nothing quilty to commit, ok."; + progress __ "nothing quilty to commit, ok."; return; } - quiltify_nofix_bail "", " (wanted to commit patch update)"; + quiltify_nofix_bail "", __ " (wanted to commit patch update)"; my @adds = map { s/[][*?\\]/\\$&/g; $_; } sort keys %adds; runcmd_ordryrun_local @git, qw(add -f), @adds; - commit_admin <<END + commit_admin +(__ <<ENDT).<<END Commit Debian 3.0 (quilt) metadata +ENDT [dgit ($our_version) quilt-fixup] END } @@ -3895,12 +3901,12 @@ sub madformat_wantfixup ($) { return 0 unless $format eq '3.0 (quilt)'; our $quilt_mode_warned; if ($quilt_mode eq 'nocheck') { - progress "Not doing any fixup of \`$format' due to". - " ----no-quilt-fixup or --quilt=nocheck" + progress f_ "Not doing any fixup of \`%s'". + " due to ----no-quilt-fixup or --quilt=nocheck", $format unless $quilt_mode_warned++; return 0; } - progress "Format \`$format', need to check/update patch stack" + progress f_ "Format \`%s', need to check/update patch stack", $format unless $quilt_mode_warned++; return 1; } @@ -3908,14 +3914,15 @@ sub madformat_wantfixup ($) { sub maybe_split_brain_save ($$$) { my ($headref, $dgitview, $msg) = @_; # => message fragment "$saved" describing disposition of $dgitview + # (used inside parens, in the English texts) my $save = $internal_object_save{'dgit-view'}; - return "commit id $dgitview" unless defined $save; + return f_ "commit id %s", $dgitview unless defined $save; my @cmd = (shell_cmd 'cd "$1"; shift', $maindir, git_update_ref_cmd "dgit --dgit-view-save $msg HEAD=$headref", $save, $dgitview); runcmd @cmd; - return "and left in $save"; + return f_ "and left in %s", $save; } # An "infopair" is a tuple [ $thing, $what ] @@ -3940,17 +3947,19 @@ sub infopair_lrf_tag_lookup ($$) { printdebug "infopair_lrfetchref_tag_lookup $tagobj $tagname $what\n"; return [ git_rev_parse($tagobj), $what ]; } - fail @tagnames==1 ? <<END : <<END; -Wanted tag $what (@tagnames) on dgit server, but not found + fail @tagnames==1 ? (f_ <<END, $what, "@tagnames") +Wanted tag %s (%s) on dgit server, but not found END -Wanted tag $what (one of: @tagnames) on dgit server, but not found + : (f_ <<END, $what, "@tagnames"); +Wanted tag %s (one of: %s) on dgit server, but not found END } sub infopair_cond_ff ($$) { my ($anc,$desc) = @_; - is_fast_fwd($anc->[0], $desc->[0]) or fail <<END; -$anc->[1] ($anc->[0]) .. $desc->[1] ($desc->[0]) is not fast forward + is_fast_fwd($anc->[0], $desc->[0]) or + fail f_ <<END, $anc->[1], $anc->[0], $desc->[1], $desc->[0]; +%s (%s) .. %s (%s) is not fast forward END }; @@ -3959,7 +3968,7 @@ sub pseudomerge_version_check ($$) { my $arch_clogp = commit_getclogp $archive_hash; my $i_arch_v = [ (getfield $arch_clogp, 'Version'), - 'version currently in archive' ]; + __ 'version currently in archive' ]; if (defined $overwrite_version) { if (length $overwrite_version) { infopair_cond_equal([ $overwrite_version, @@ -3967,7 +3976,8 @@ sub pseudomerge_version_check ($$) { $i_arch_v); } else { my $v = $i_arch_v->[0]; - progress "Checking package changelog for archive version $v ..."; + progress f_ + "Checking package changelog for archive version %s ...", $v; my $cd; eval { my @xa = ("-f$v", "-t$v"); @@ -3975,7 +3985,8 @@ sub pseudomerge_version_check ($$) { my $gf = sub { my ($fn) = @_; [ (getfield $vclogp, $fn), - "$fn field from dpkg-parsechangelog @xa" ]; + (f_ "%s field from dpkg-parsechangelog %s", + $fn, "@xa") ]; }; my $cv = $gf->('Version'); infopair_cond_equal($i_arch_v, $cv); @@ -3984,12 +3995,13 @@ sub pseudomerge_version_check ($$) { if ($@) { $@ =~ s/^dgit: //gm; fail "$@". - "Perhaps debian/changelog does not mention $v ?"; + f_ "Perhaps debian/changelog does not mention %s ?", $v; } - fail <<END if $cd->[0] =~ m/UNRELEASED/; -$cd->[1] is $cd->[0] -Your tree seems to based on earlier (not uploaded) $v. + fail f_ <<END, $cd->[1], $cd->[0], $v +%s is %s +Your tree seems to based on earlier (not uploaded) %s. END + if $cd->[0] =~ m/UNRELEASED/; } } @@ -4000,7 +4012,8 @@ END sub pseudomerge_make_commit ($$$$ $$) { my ($clogp, $dgitview, $archive_hash, $i_arch_v, $msg_cmd, $msg_msg) = @_; - progress "Declaring that HEAD inciudes all changes in $i_arch_v->[0]..."; + progress f_ "Declaring that HEAD inciudes all changes in %s...", + $i_arch_v->[0]; my $tree = cmdoutput qw(git rev-parse), "${dgitview}:"; my $authline = clogp_authline $clogp; |