chiark / gitweb /
i18n: dgit: mark some messages (9)
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 9fd01b0d3fc531fe5f6b62d86e6eb231913e21cb..051a4be568c8ab9d8651f64b21c43df1bb18cdd1 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -512,8 +512,8 @@ sub protocol_send_file ($$) {
        my $got = read PF, $d, 65536;
        die "$ourfn: $!" unless defined $got;
        last if !$got;
-       print $fh "data-block ".length($d)."\n" or die $!;
-       print $fh $d or die $!;
+       print $fh "data-block ".length($d)."\n" or confess $!;
+       print $fh $d or confess $!;
     }
     PF->error and die "$ourfn $!";
     print $fh "data-end\n" or die $!;
@@ -4068,7 +4068,7 @@ sub splitbrain_pseudomerge ($$$$) {
     my $i_arch_v = pseudomerge_version_check($clogp, $archive_hash);
 
     if (!defined $overwrite_version) {
-       progress "Checking that HEAD inciudes all changes in archive...";
+       progress __ "Checking that HEAD inciudes all changes in archive...";
     }
 
     return $dgitview if is_fast_fwd $archive_hash, $dgitview;
@@ -4076,10 +4076,11 @@ sub splitbrain_pseudomerge ($$$$) {
     if (defined $overwrite_version) {
     } elsif (!eval {
        my $t_dep14 = debiantag_maintview $i_arch_v->[0], access_nomdistro;
-       my $i_dep14 = infopair_lrf_tag_lookup($t_dep14, "maintainer view tag");
+       my $i_dep14 = infopair_lrf_tag_lookup($t_dep14,
+                                             __ "maintainer view tag");
        my $t_dgit = debiantag_new $i_arch_v->[0], access_nomdistro;
-       my $i_dgit = infopair_lrf_tag_lookup($t_dgit, "dgit view tag");
-       my $i_archive = [ $archive_hash, "current archive contents" ];
+       my $i_dgit = infopair_lrf_tag_lookup($t_dgit, __ "dgit view tag");
+       my $i_archive = [ $archive_hash, __ "current archive contents" ];
 
        printdebug "splitbrain_pseudomerge i_archive @$i_archive\n";
 
@@ -4089,10 +4090,11 @@ sub splitbrain_pseudomerge ($$$$) {
        1;
     }) {
         $@ =~ s/^\n//; chomp $@;
-       print STDERR <<END;
+       print STDERR <<END.(__ <<ENDT);
 $@
-| Not fast forward; maybe --overwrite is needed ?  Please see dgit(1).
 END
+| Not fast forward; maybe --overwrite is needed ?  Please see dgit(1).
+ENDT
        finish -1;
     }
 
@@ -4100,15 +4102,13 @@ END
     my $r = pseudomerge_make_commit
        $clogp, $dgitview, $archive_hash, $i_arch_v,
        "dgit --quilt=$quilt_mode",
-       (defined $overwrite_version ? <<END_OVERWR : <<END_MAKEFF);
-Declare fast forward from $arch_v
-END_OVERWR
-Make fast forward from $arch_v
-END_MAKEFF
+       (defined $overwrite_version
+        ? f_ "Declare fast forward from %s\n", $arch_v
+        : f_ "Make fast forward from %s\n",    $arch_v);
 
     maybe_split_brain_save $maintview, $r, "pseudomerge";
 
-    progress "Made pseudo-merge of $arch_v into dgit view.";
+    progress f_ "Made pseudo-merge of %s into dgit view.", $arch_v;
     return $r;
 }      
 
@@ -4121,7 +4121,7 @@ sub plain_overwrite_pseudomerge ($$$) {
 
     return $head if is_fast_fwd $archive_hash, $head;
 
-    my $m = "Declare fast forward from $i_arch_v->[0]";
+    my $m = f_ "Declare fast forward from %s", $i_arch_v->[0];
 
     my $r = pseudomerge_make_commit
        $clogp, $head, $archive_hash, $i_arch_v,
@@ -4129,7 +4129,7 @@ sub plain_overwrite_pseudomerge ($$$) {
 
     runcmd git_update_ref_cmd $m, 'HEAD', $r, $head;
 
-    progress "Make pseudo-merge of $i_arch_v->[0] into your HEAD.";
+    progress f_ "Make pseudo-merge of %s into your HEAD.", $i_arch_v->[0];
     return $r;
 }
 
@@ -4141,7 +4141,8 @@ sub push_parse_changelog ($) {
 
     my $clogpackage = getfield $clogp, 'Source';
     $package //= $clogpackage;
-    fail "-p specified $package but changelog specified $clogpackage"
+    fail f_ "-p specified %s but changelog specified %s",
+           $package, $clogpackage
        unless $package eq $clogpackage;
     my $cversion = getfield $clogp, 'Version';
 
@@ -4162,8 +4163,9 @@ sub push_parse_dsc ($$$) {
     my $dversion = getfield $dsc, 'Version';
     my $dscpackage = getfield $dsc, 'Source';
     ($dscpackage eq $package && $dversion eq $cversion) or
-       fail "$dscfn is for $dscpackage $dversion".
-           " but debian/changelog is for $package $cversion";
+       fail f_ "%s is for %s %s but debian/changelog is for %s %s",
+               $dscfn, $dscpackage, $dversion,
+                       $package,    $cversion;
 }
 
 sub push_tagwants ($$$$) {
@@ -4222,8 +4224,8 @@ sub push_mktags ($$ $$ $) {
     my $changes = parsecontrol($changesfile,$changesfilewhat);
     foreach my $field (qw(Source Distribution Version)) {
        $changes->{$field} eq $clogp->{$field} or
-           fail "changes field $field \`$changes->{$field}'".
-               " does not match changelog \`$clogp->{$field}'";
+           fail f_ "changes field %s \`%s' does not match changelog \`%s'",
+                   $field, $changes->{$field}, $clogp->{$field};
     }
 
     my $cversion = getfield $clogp, 'Version';
@@ -4249,8 +4251,11 @@ tagger $authline
 
 END
        if ($tw->{View} eq 'dgit') {
+           print TO f_ <<ENDT, $package, $cversion, $clogsuite, $csuite
+%s release %s for %s (%s) [dgit]
+ENDT
+               or die $!;
            print TO <<END or die $!;
-$package release $cversion for $clogsuite ($csuite) [dgit]
 [dgit distro=$declaredistro$delibs]
 END
            foreach my $ref (sort keys %previously) {
@@ -4259,12 +4264,14 @@ END
 END
            }
        } elsif ($tw->{View} eq 'maint') {
-           print TO <<END or die $!;
-$package release $cversion for $clogsuite ($csuite)
-(maintainer view tag generated by dgit --quilt=$quilt_mode)
+           print TO f_ <<END, $package, $cversion, $clogsuite, $csuite,
+%s release %s for %s (%s)
+(maintainer view tag generated by dgit --quilt=%s)
 END
+               $quilt_mode
+               or die $!;
        } else {
-           die Dumper($tw)."?";
+           confess Dumper($tw)."?";
        }
 
        close TO or die $!;
@@ -4309,7 +4316,7 @@ sub sign_changes ($) {
 sub dopush () {
     printdebug "actually entering push\n";
 
-    supplementary_message(<<'END');
+    supplementary_message(__ <<'END');
 Push failed, while checking state of the archive.
 You can retry the push, after fixing the problem, if you like.
 END
@@ -4319,11 +4326,11 @@ END
     my $archive_hash = fetch_from_archive();
     if (!$archive_hash) {
        $new_package or
-           fail "package appears to be new in this suite;".
-               " if this is intentional, use --new";
+           fail __ "package appears to be new in this suite;".
+                   " if this is intentional, use --new";
     }
 
-    supplementary_message(<<'END');
+    supplementary_message(__ <<'END');
 Push failed, while preparing your push.
 You can retry the push, after fixing the problem, if you like.
 END
@@ -4347,8 +4354,8 @@ END
 
     my $dscpath = "$buildproductsdir/$dscfn";
     stat_exists $dscpath or
-       fail "looked for .dsc $dscpath, but $!;".
-           " maybe you forgot to build";
+       fail f_ "looked for .dsc %s, but %s; maybe you forgot to build",
+               $dscpath, $!;
 
     responder_send_file('dsc', $dscpath);
 
@@ -4363,9 +4370,9 @@ END
     if (branch_is_gdr_unstitched_ff($symref, $actualhead, $archive_hash)) {
        if (quiltmode_splitbrain()) {
            my ($ffq_prev, $gdrlast) = branch_gdr_info($symref, $actualhead);
-           fail <<END;
-Branch is managed by git-debrebase ($ffq_prev
-exists), but quilt mode ($quilt_mode) implies a split view.
+           fail f_ <<END, $ffq_prev, $quilt_mode;
+Branch is managed by git-debrebase (%s
+exists), but quilt mode (%s) implies a split view.
 Pass the right --quilt option or adjust your git config.
 Or, maybe, run git-debrebase forget-was-ever-debrebase.
 END
@@ -4387,9 +4394,10 @@ END
            my $cachekey;
            ($dgithead, $cachekey) =
                quilt_check_splitbrain_cache($actualhead, $upstreamversion);
-           $dgithead or fail
- "--quilt=$quilt_mode but no cached dgit view:
- perhaps HEAD changed since dgit build[-source] ?";
+           $dgithead or fail f_
+ "--quilt=%s but no cached dgit view:
+ perhaps HEAD changed since dgit build[-source] ?",
+                              $quilt_mode;
            $split_brain = 1;
            $dgithead = splitbrain_pseudomerge($clogp,
                                               $actualhead, $dgithead,
@@ -4418,7 +4426,7 @@ END
        } elsif (deliberately_not_fast_forward) {
            $forceflag = '+';
        } else {
-           fail "dgit push: HEAD is not a descendant".
+           fail __ "dgit push: HEAD is not a descendant".
                " of the archive's version.\n".
                "To overwrite the archive's contents,".
                " pass --overwrite[=VERSION].\n".
@@ -4428,7 +4436,7 @@ END
     }
 
     changedir $playground;
-    progress "checking that $dscfn corresponds to HEAD";
+    progress f_ "checking that %s corresponds to HEAD", $dscfn;
     runcmd qw(dpkg-source -x --),
         $dscpath =~ m#^/# ? $dscpath : "$maindir/$dscpath";
     my ($tree,$dir) = mktree_in_ud_from_only_subdir("source package");
@@ -4461,22 +4469,27 @@ END
                }
            }
            if (@mode_changes) {
-               fail <<END.(join '', @mode_changes).<<END;
-HEAD specifies a different tree to $dscfn:
+               fail +(f_ <<ENDT, $dscfn).<<END
+HEAD specifies a different tree to %s:
+ENDT
 $diffs
 END
+                   .(join '', @mode_changes)
+                   .(f_ <<ENDT, $tree, $referent);
 There is a problem with your source tree (see dgit(7) for some hints).
-To see a full diff, run git diff $tree $referent
-END
+To see a full diff, run git diff %s %s
+ENDT
            }
 
-           fail <<END;
-HEAD specifies a different tree to $dscfn:
+           fail +(f_ <<ENDT, $dscfn).<<END.(f_ <<ENDT, $tree, $referent);
+HEAD specifies a different tree to %s:
+ENDT
 $diffs
+END
 Perhaps you forgot to build.  Or perhaps there is a problem with your
  source tree (see dgit(7) for some hints).  To see a full diff, run
-   git diff $tree $referent
-END
+   git diff %s %s
+ENDT
        } else {
            failedcmd @diffcmd;
        }
@@ -4484,9 +4497,10 @@ END
     if (!$changesfile) {
        my $pat = changespat $cversion;
        my @cs = glob "$buildproductsdir/$pat";
-       fail "failed to find unique changes file".
-           " (looked for $pat in $buildproductsdir);".
-           " perhaps you need to use dgit -C"
+       fail f_ "failed to find unique changes file".
+               " (looked for %s in %s);".
+               " perhaps you need to use dgit -C",
+               $pat, $buildproductsdir
            unless @cs==1;
        ($changesfile) = @cs;
     } else {
@@ -4505,21 +4519,23 @@ END
     if ($sourceonlypolicy eq 'ok') {
     } elsif ($sourceonlypolicy eq 'always') {
        forceable_fail [qw(uploading-binaries)],
-           "uploading binaries, although distroy policy is source only"
+           __ "uploading binaries, although distroy policy is source only"
            if $hasdebs;
     } elsif ($sourceonlypolicy eq 'never') {
        forceable_fail [qw(uploading-source-only)],
-           "source-only upload, although distroy policy requires .debs"
+           __ "source-only upload, although distroy policy requires .debs"
            if !$hasdebs;
     } elsif ($sourceonlypolicy eq 'not-wholly-new') {
        forceable_fail [qw(uploading-source-only)],
-           "source-only upload, even though package is entirely NEW\n".
-           "(this is contrary to policy in ".(access_nomdistro()).")"
+           f_ "source-only upload, even though package is entirely NEW\n".
+              "(this is contrary to policy in %s)",
+              access_nomdistro()
            if !$hasdebs
            && $new_package
            && !(archive_query('package_not_wholly_new', $package) // 1);
     } else {
-       badcfg "unknown source-only-uploads policy \`$sourceonlypolicy'";
+       badcfg f_ "unknown source-only-uploads policy \`%s'",
+                 $sourceonlypolicy;
     }
 
     # Perhaps adjust .dsc to contain right set of origs
@@ -4561,7 +4577,7 @@ END
                                 dgit_privdir()."/tag");
     my @tagobjfns;
 
-    supplementary_message(<<'END');
+    supplementary_message(__ <<'END');
 Push failed, while signing the tag.
 You can retry the push, after fixing the problem, if you like.
 END
@@ -4574,7 +4590,7 @@ END
                              $changesfile,$changesfile,
                              \@tagwants);
     }
-    supplementary_message(<<'END');
+    supplementary_message(__ <<'END');
 Push failed, *after* signing the tag.
 If you want to try again, you should use a new version number.
 END
@@ -4591,7 +4607,7 @@ END
            @git, qw(update-ref), "refs/tags/$tag", $tag_obj_hash;
     }
 
-    supplementary_message(<<'END');
+    supplementary_message(__ <<'END');
 Push failed, while updating the remote git repository - see messages above.
 If you want to try again, you should use a new version number.
 END
@@ -4608,7 +4624,7 @@ END
        qw(-c push.followTags=false push), access_giturl(), @pushrefs;
     runcmd_ordryrun git_update_ref_cmd 'dgit push', lrref(), $dgithead;
 
-    supplementary_message(<<'END');
+    supplementary_message(__ <<'END');
 Push failed, while obtaining signatures on the .changes and .dsc.
 If it was just that the signature failed, you may try again by using
 debsign by hand to sign the changes file (see the command dgit tried,
@@ -4625,22 +4641,22 @@ END
        if (act_local()) {
            rename "$dscpath.tmp",$dscpath or die "$dscfn $!";
        } else {
-           progress "[new .dsc left in $dscpath.tmp]";
+           progress f_ "[new .dsc left in %s.tmp]", $dscpath;
        }
        sign_changes $changesfile;
     }
 
-    supplementary_message(<<END);
+    supplementary_message(f_ <<END, $changesfile);
 Push failed, while uploading package(s) to the archive server.
 You can retry the upload of exactly these same files with dput of:
-  $changesfile
+  %s
 If that .changes file is broken, you will need to use a new version
 number for your next attempt at the upload.
 END
     my $host = access_cfg('upload-host','RETURN-UNDEF');
     my @hostarg = defined($host) ? ($host,) : ();
     runcmd_ordryrun @dput, @hostarg, $changesfile;
-    printdone "pushed and uploaded $cversion";
+    printdone f_ "pushed and uploaded %s", $cversion;
 
     supplementary_message('');
     responder_send_command("complete");
@@ -4652,7 +4668,7 @@ sub pre_clone () {
 sub cmd_clone {
     parseopts();
     my $dstdir;
-    badusage "-p is not allowed with clone; specify as argument instead"
+    badusage __ "-p is not allowed with clone; specify as argument instead"
        if defined $package;
     if (@ARGV==1) {
        ($package) = @ARGV;
@@ -4663,13 +4679,13 @@ sub cmd_clone {
     } elsif (@ARGV==3) {
        ($package,$isuite,$dstdir) = @ARGV;
     } else {
-       badusage "incorrect arguments to dgit clone";
+       badusage __ "incorrect arguments to dgit clone";
     }
     notpushing();
 
     $dstdir ||= "$package";
     if (stat_exists $dstdir) {
-       fail "$dstdir already exists";
+       fail f_ "%s already exists", $dstdir;
     }
 
     my $cwd_remove;
@@ -4679,15 +4695,16 @@ sub cmd_clone {
            return unless defined $cwd_remove;
            if (!chdir "$cwd_remove") {
                return if $!==&ENOENT;
-               die "chdir $cwd_remove: $!";
+               confess "chdir $cwd_remove: $!";
            }
            printdebug "clone rmonerror removing $dstdir\n";
            if (stat $dstdir) {
-               rmtree($dstdir) or die "remove $dstdir: $!\n";
+               rmtree($dstdir) or fail f_ "remove %s: %s\n", $dstdir, $!;
            } elsif (grep { $! == $_ }
                     (ENOENT, ENOTDIR, EACCES, EPERM, ELOOP)) {
            } else {
-               print STDERR "check whether to remove $dstdir: $!\n";
+               print STDERR f_ "check whether to remove %s: %s\n",
+                               $dstdir, $!;
            }
        };
     }
@@ -4724,7 +4741,7 @@ sub fetchpullargs () {
     } elsif (@ARGV==1) {
        ($isuite) = @ARGV;
     } else {
-       badusage "incorrect arguments to dgit fetch or dgit pull";
+       badusage __ "incorrect arguments to dgit fetch or dgit pull";
     }
     notpushing();
 }
@@ -4740,8 +4757,8 @@ sub cmd_pull {
     fetchpullargs();
     if (quiltmode_splitbrain()) {
        my ($format, $fopts) = get_source_format();
-       madformat($format) and fail <<END
-dgit pull not yet supported in split view mode (--quilt=$quilt_mode)
+       madformat($format) and fail f_ <<END, $quilt_mode
+dgit pull not yet supported in split view mode (--quilt=%s)
 END
     }
     pull();
@@ -4750,7 +4767,7 @@ END
 sub cmd_checkout {
     parseopts();
     package_from_d_control();
-    @ARGV==1 or badusage "dgit checkout needs a suite argument";
+    @ARGV==1 or badusage __ "dgit checkout needs a suite argument";
     ($isuite) = @ARGV;
     notpushing();
 
@@ -4812,17 +4829,17 @@ sub cmd_update_vcs_git () {
     my @cmd;
     my $orgurl = cfg 'remote.vcs-git.url', 'RETURN-UNDEF';
     if (!defined $orgurl) {
-       print STDERR "setting up vcs-git: $url\n";
+       print STDERR f_ "setting up vcs-git: %s\n", $url;
        @cmd = (@git, qw(remote add vcs-git), $url);
     } elsif ($orgurl eq $url) {
-       print STDERR "vcs git already configured: $url\n";
+       print STDERR f_ "vcs git already configured: %s\n", $url;
     } else {
-       print STDERR "changing vcs-git url to: $url\n";
+       print STDERR f_ "changing vcs-git url to: %s\n", $url;
        @cmd = (@git, qw(remote set-url vcs-git), $url);
     }
     runcmd_ordryrun_local @cmd;
     if ($dofetch) {
-       print "fetching (@ARGV)\n";
+       print f_ "fetching (%s)\n", "@ARGV";
        runcmd_ordryrun_local @git, qw(fetch vcs-git), @ARGV;
     }
 }
@@ -4837,7 +4854,7 @@ sub prep_push () {
     } elsif (@ARGV==1) {
        ($specsuite) = (@ARGV);
     } else {
-       badusage "incorrect arguments to dgit $subcommand";
+       badusage f_ "incorrect arguments to dgit %s", $subcommand;
     }
     if ($new_package) {
        local ($package) = $existing_package; # this is a hack
@@ -4848,8 +4865,9 @@ sub prep_push () {
     if (defined $specsuite &&
        $specsuite ne $isuite &&
        $specsuite ne $csuite) {
-           fail "dgit $subcommand: changelog specifies $isuite ($csuite)".
-               " but command line specifies $specsuite";
+           fail f_ "dgit %s: changelog specifies %s (%s)".
+                   " but command line specifies %s",
+                   $subcommand, $isuite, $csuite, $specsuite;
     }
 }
 
@@ -4885,9 +4903,9 @@ sub pre_remote_push_build_host {
        $vsnwant =~ m{^(?:.*,)?$_(?:,.*)?$}
     } @rpushprotovsn_support;
 
-    fail "build host has dgit rpush protocol versions ".
-       (join ",", @rpushprotovsn_support).
-        " but invocation host has $vsnwant"
+    fail f_ "build host has dgit rpush protocol versions %s".
+            " but invocation host has %s",
+           (join ",", @rpushprotovsn_support), $vsnwant
        unless defined $protovsn;
 
     changedir $dir;
@@ -4964,7 +4982,8 @@ sub cmd_rpush {
 
     if (defined $initiator_tempdir) {
        rmtree $initiator_tempdir;
-       mkdir $initiator_tempdir, 0700 or die "$initiator_tempdir: $!";
+       mkdir $initiator_tempdir, 0700
+           or fail f_ "create %s: %s", $initiator_tempdir, $!;
        $i_tmp = $initiator_tempdir;
     } else {
        $i_tmp = tempdir();
@@ -5001,10 +5020,10 @@ sub i_resp_complete {
     printdebug "waiting for build host child $pid...\n";
     my $got = waitpid $pid, 0;
     die $! unless $got == $pid;
-    die "build host child failed $?" if $?;
+    fail f_ "build host child failed: %s", waitstatusmsg() if $?;
 
     i_cleanup();
-    printdebug "all done\n";
+    printdebug __ "all done\n";
     finish 0;
 }
 
@@ -5013,7 +5032,7 @@ sub i_resp_file ($) {
     my $localname = i_method "i_localname", $keyword;
     my $localpath = "$i_tmp/$localname";
     stat_exists $localpath and
-       badproto \*RO, "file $keyword ($localpath) twice";
+       badproto \*RO, f_ "file %s (%s) twice", $keyword, $localpath;
     protocol_receive_file \*RO, $localpath;
     i_method "i_file", $keyword;
 }
@@ -5021,15 +5040,15 @@ sub i_resp_file ($) {
 our %i_param;
 
 sub i_resp_param ($) {
-    $_[0] =~ m/^(\S+) (.*)$/ or badproto \*RO, "bad param spec";
+    $_[0] =~ m/^(\S+) (.*)$/ or badproto \*RO, __ "bad param spec";
     $i_param{$1} = $2;
 }
 
 sub i_resp_previously ($) {
     $_[0] =~ m#^(refs/tags/\S+)=(\w+)$#
-       or badproto \*RO, "bad previously spec";
+       or badproto \*RO, __ "bad previously spec";
     my $r = system qw(git check-ref-format), $1;
-    die "bad previously ref spec ($r)" if $r;
+    confess "bad previously ref spec ($r)" if $r;
     $previously{$1} = $2;
 }
 
@@ -5046,8 +5065,9 @@ sub i_resp_want ($) {
     pushing();
     rpush_handle_protovsn_bothends();
 
-    fail "rpush negotiated protocol version $protovsn".
-       " which does not support quilt mode $quilt_mode"
+    fail f_ "rpush negotiated protocol version %s".
+       " which does not support quilt mode %s",
+       $protovsn, $quilt_mode
        if quiltmode_splitbrain;
 
     my @localpaths = i_method "i_want", $keyword;
@@ -5090,10 +5110,10 @@ sub i_file_buildinfo {
     if (!forceing [qw(buildinfo-changes-mismatch)]) {
        files_compare_inputs($bd, $ch);
        (getfield $bd, $_) eq (getfield $ch, $_) or
-           fail "buildinfo mismatch $_"
+           fail f_ "buildinfo mismatch in field %s", $_
            foreach qw(Source Version);
        !defined $bd->{$_} or
-           fail "buildinfo contains $_"
+           fail f_ "buildinfo contains forbidden field %s", $_
            foreach qw(Changes Changed-by Distribution);
     }
     push @i_buildinfos, $bi;
@@ -5134,7 +5154,7 @@ sub i_want_signed_tag {
 
     return
        push_mktags $i_clogp, $i_dscfn,
-           $i_changesfn, 'remote changes',
+           $i_changesfn, (__ 'remote changes file'),
            \@tagwants;
 }
 
@@ -5160,7 +5180,7 @@ sub quiltify_dpkg_commit ($$$;$) {
 
     mkpath '.git/dgit'; # we are in playtree
     my $descfn = ".git/dgit/quilt-description.tmp";
-    open O, '>', $descfn or die "$descfn: $!";
+    open O, '>', $descfn or confess "$descfn: $!";
     $msg =~ s/\n+/\n\n/;
     print O <<END or die $!;
 From: $author
@@ -5209,21 +5229,21 @@ sub quiltify_trees_differ ($$;$$$) {
 
        if ($unrepres) {
            eval {
-               die "not a plain file or symlink\n"
+               die __ "not a plain file or symlink\n"
                    unless $newmode =~ m/^(?:10|12)\d{4}$/ ||
                           $oldmode =~ m/^(?:10|12)\d{4}$/;
                if ($oldmode =~ m/[^0]/ &&
                    $newmode =~ m/[^0]/) {
                    # both old and new files exist
-                   die "mode or type changed\n" if $oldmode ne $newmode;
-                   die "modified symlink\n" unless $newmode =~ m/^10/;
+                   die __ "mode or type changed\n" if $oldmode ne $newmode;
+                   die __ "modified symlink\n" unless $newmode =~ m/^10/;
                } elsif ($oldmode =~ m/[^0]/) {
                    # deletion
-                   die "deletion of symlink\n"
+                   die __ "deletion of symlink\n"
                        unless $oldmode =~ m/^10/;
                } else {
                    # creation
-                   die "creation with non-default mode\n"
+                   die __ "creation with non-default mode\n"
                        unless $newmode =~ m/^100644$/ or
                               $newmode =~ m/^120000$/;
                }
@@ -5253,7 +5273,7 @@ sub quiltify_tree_sentinelfiles ($) {
 
 sub quiltify_splitbrain_needed () {
     if (!$split_brain) {
-       progress "dgit view: changes are required...";
+       progress __ "dgit view: changes are required...";
        runcmd @git, qw(checkout -q -b dgit-view);
        $split_brain = 1;
     }
@@ -5282,32 +5302,34 @@ sub quiltify_splitbrain ($$$$$$$) {
        my ($x,$y) = @_;
        my $cmd = "git diff $x $y -- :/ ':!debian'";
        $cmd .= " ':!/.gitignore' ':!*/.gitignore'" if $gitignore_special;
-       return "\nFor full diff showing the problem(s), type:\n $cmd\n";
+       return f_ "\nFor full diff showing the problem(s), type:\n %s\n",
+                 $cmd;
     };
 
     if ($quilt_mode =~ m/gbp|unapplied/ &&
        ($diffbits->{O2H} & 01)) {
-       my $msg =
- "--quilt=$quilt_mode specified, implying patches-unapplied git tree\n".
- " but git tree differs from orig in upstream files.";
+       my $msg = f_
+ "--quilt=%s specified, implying patches-unapplied git tree\n".
+ " but git tree differs from orig in upstream files.",
+                     $quilt_mode;
        $msg .= $fulldiffhint->($unapplied, 'HEAD');
        if (!stat_exists "debian/patches") {
-           $msg .=
+           $msg .= __
  "\n ... debian/patches is missing; perhaps this is a patch queue branch?";
        }  
        fail $msg;
     }
     if ($quilt_mode =~ m/dpm/ &&
        ($diffbits->{H2A} & 01)) {
-       fail <<END. $fulldiffhint->($oldtiptree,'HEAD');
---quilt=$quilt_mode specified, implying patches-applied git tree
+       fail +(f_ <<END, $quilt_mode). $fulldiffhint->($oldtiptree,'HEAD');
+--quilt=%s specified, implying patches-applied git tree
  but git tree differs from result of applying debian/patches to upstream
 END
     }
     if ($quilt_mode =~ m/gbp|unapplied/ &&
        ($diffbits->{O2A} & 01)) { # some patches
        quiltify_splitbrain_needed();
-       progress "dgit view: creating patches-applied version using gbp pq";
+       progress __ "dgit view: creating patches-applied version using gbp pq";
        runcmd shell_cmd 'exec >/dev/null', gbp_pq, qw(import);
        # gbp pq import creates a fresh branch; push back to dgit-view
        runcmd @git, qw(update-ref refs/heads/dgit-view HEAD);
@@ -5315,8 +5337,8 @@ END
     }
     if ($quilt_mode =~ m/gbp|dpm/ &&
        ($diffbits->{O2A} & 02)) {
-       fail <<END;
---quilt=$quilt_mode specified, implying that HEAD is for use with a
+       fail f_ <<END, $quilt_mode;
+--quilt=%s specified, implying that HEAD is for use with a
  tool which does not create patches for changes to upstream
  .gitignores: but, such patches exist in debian/patches.
 END
@@ -5324,23 +5346,27 @@ END
     if (($diffbits->{O2H} & 02) && # user has modified .gitignore
        !($diffbits->{O2A} & 02)) { # patches do not change .gitignore
        quiltify_splitbrain_needed();
-       progress "dgit view: creating patch to represent .gitignore changes";
+       progress __
+           "dgit view: creating patch to represent .gitignore changes";
         ensuredir "debian/patches";
        my $gipatch = "debian/patches/auto-gitignore";
-       open GIPATCH, ">>", "$gipatch" or die "$gipatch: $!";
-       stat GIPATCH or die "$gipatch: $!";
-       fail "$gipatch already exists; but want to create it".
-           " to record .gitignore changes" if (stat _)[7];
-       print GIPATCH <<END or die "$gipatch: $!";
+       open GIPATCH, ">>", "$gipatch" or confess "$gipatch: $!";
+       stat GIPATCH or confess "$gipatch: $!";
+       fail f_ "%s already exists; but want to create it".
+               " to record .gitignore changes",
+               $gipatch
+           if (stat _)[7];
+       print GIPATCH +(__ <<END).<<ENDU or die "$gipatch: $!";
 Subject: Update .gitignore from Debian packaging branch
 
 The Debian packaging git branch contains these updates to the upstream
 .gitignore file(s).  This patch is autogenerated, to provide these
 updates to users of the official Debian archive view of the package.
+END
 
 [dgit ($our_version) update-gitignore]
 ---
-END
+ENDU
         close GIPATCH or die "$gipatch: $!";
         runcmd shell_cmd "exec >>$gipatch", @git, qw(diff),
             $unapplied, $headref, "--", sort keys %$editedignores;
@@ -5352,11 +5378,12 @@ END
        print SERIES "auto-gitignore\n" or die $!;
        close SERIES or die  $!;
         runcmd @git, qw(add -f -- debian/patches/series), $gipatch;
-        commit_admin <<END
+        commit_admin +(__ <<END).<<ENDU
 Commit patch to update .gitignore
+END
 
 [dgit ($our_version) update-gitignore-quilt-fixup]
-END
+ENDU
     }
 
     my $dgitview = git_rev_parse 'HEAD';
@@ -5366,8 +5393,8 @@ END
 
     changedir "$playground/work";
 
-    my $saved = maybe_split_brain_save $headref, $dgitview, "converted";
-    progress "dgit view: created ($saved)";
+    my $saved = maybe_split_brain_save $headref, $dgitview, __ "converted";
+    progress f_ "dgit view: created (%s)", $saved;
 }
 
 sub quiltify ($$$$) {
@@ -5432,7 +5459,7 @@ sub quiltify ($$$$) {
        my $c = shift @todo;
        next if $considered{$c->{Commit}}++;
 
-       $not->($c, "maximum search space exceeded") if --$max_work <= 0;
+       $not->($c, __ "maximum search space exceeded") if --$max_work <= 0;
 
        printdebug "quiltify investigate $c->{Commit}\n";
 
@@ -5450,7 +5477,7 @@ sub quiltify ($$$$) {
        }
 
        my $c_sentinels = quiltify_tree_sentinelfiles $c->{Commit};
-       $not->($c, "has $c_sentinels not $t_sentinels")
+       $not->($c, f_ "has %s not %s", $c_sentinels, $t_sentinels)
            if $c_sentinels ne $t_sentinels;
 
        my $commitdata = cmdoutput @git, qw(cat-file commit), $c->{Commit};
@@ -5459,13 +5486,14 @@ sub quiltify ($$$$) {
        my @parents = ($commitdata =~ m/^parent (\w+)$/gm);
        @parents = map { { Commit => $_, Child => $c } } @parents;
 
-       $not->($c, "root commit") if !@parents;
+       $not->($c, __ "root commit") if !@parents;
 
        foreach my $p (@parents) {
            $p->{Nontrivial}= quiltify_trees_differ $p->{Commit},$c->{Commit};
        }
        my $ndiffers = grep { $_->{Nontrivial} } @parents;
-       $not->($c, "merge ($ndiffers nontrivial parents)") if $ndiffers > 1;
+       $not->($c, f_ "merge (%s nontrivial parents)", $ndiffers)
+           if $ndiffers > 1;
 
        foreach my $p (@parents) {
            printdebug "considering C=$c->{Commit} P=$p->{Commit}\n";
@@ -5475,7 +5503,7 @@ sub quiltify ($$$$) {
            my $patchstackchange = cmdoutput @cmd;
            if (length $patchstackchange) {
                $patchstackchange =~ s/\n/,/g;
-               $not->($p, "changed $patchstackchange");
+               $not->($p, f_ "changed %s", $patchstackchange);
            }
 
            printdebug " search queue P=$p->{Commit} ",
@@ -5492,19 +5520,17 @@ sub quiltify ($$$$) {
            $x =~ s/(.*?[0-9a-z]{8})[0-9a-z]*$/$1/;
            return $x;
        };
-       my $reportnot = sub {
-           my ($notp) = @_;
-           my $s = $abbrev->($notp);
-           my $c = $notp->{Child};
-           $s .= "..".$abbrev->($c) if $c;
-           $s .= ": ".$notp->{Whynot};
-           return $s;
-       };
        if ($quilt_mode eq 'linear') {
-           print STDERR "\n$us: error: quilt fixup cannot be linear.  Stopped at:\n";
+           print STDERR f_
+               "\n%s: error: quilt fixup cannot be linear.  Stopped at:\n",
+               $us;
            my $all_gdr = !!@nots;
            foreach my $notp (@nots) {
-               print STDERR "$us:  ", $reportnot->($notp), "\n";
+               my $c = $notp->{Child};
+               my $cprange = $abbrev->($notp);
+               $cprange .= "..".$abbrev->($c) if $c;
+               print STDERR f_ "%s:  %s: %s\n",
+                   $us, $cprange, $notp->{Whynot};
                $all_gdr &&= $notp->{Child} &&
                    (git_cat_file $notp->{Child}{Commit}, 'commit')
                    =~ m{^\[git-debrebase(?! split[: ]).*\]$}m;
@@ -5514,13 +5540,13 @@ sub quiltify ($$$$) {
                [ grep { $_->[0] ne 'quilt-mode' } @$failsuggestion ]
                if $all_gdr;
            print STDERR "$us: $_->[1]\n" foreach @$failsuggestion;
-           fail
+           fail __
  "quilt history linearisation failed.  Search \`quilt fixup' in dgit(7).\n";
        } elsif ($quilt_mode eq 'smash') {
        } elsif ($quilt_mode eq 'auto') {
-           progress "quilt fixup cannot be linear, smashing...";
+           progress __ "quilt fixup cannot be linear, smashing...";
        } else {
-           die "$quilt_mode ?";
+           confess "$quilt_mode ?";
        }
 
        my $time = $ENV{'GIT_COMMITTER_DATE'} || time;
@@ -5530,12 +5556,14 @@ sub quiltify ($$$$) {
 
        quiltify_dpkg_commit "auto-$version-$target-$time",
            (getfield $clogp, 'Maintainer'),
-           "Automatically generated patch ($clogp->{Version})\n".
-           "Last (up to) $ncommits git changes, FYI:\n\n". $msg;
+           (f_ "Automatically generated patch (%s)\n".
+            "Last (up to) %s git changes, FYI:\n\n",
+            $clogp->{Version}, $ncommits).
+            $msg;
        return;
     }
 
-    progress "quiltify linearisation planning successful, executing...";
+    progress __ "quiltify linearisation planning successful, executing...";
 
     for (my $p = $sref_S;
         my $c = $p->{Child};
@@ -5569,15 +5597,16 @@ sub quiltify ($$$$) {
            my ($what) = @_;
 
            eval {
-               die "contains unexpected slashes\n" if m{//} || m{/$};
-               die "contains leading punctuation\n" if m{^\W} || m{/\W};
-               die "contains bad character(s)\n" if m{[^-a-z0-9_.+=~/]}i;
-               die "is series file\n" if m{$series_filename_re}o;
-               die "too long" if length > 200;
+               die __ "contains unexpected slashes\n" if m{//} || m{/$};
+               die __ "contains leading punctuation\n" if m{^\W} || m{/\W};
+               die __ "contains bad character(s)\n" if m{[^-a-z0-9_.+=~/]}i;
+               die __ "is series file\n" if m{$series_filename_re}o;
+               die __ "too long\n" if length > 200;
            };
            return $_ unless $@;
-           print STDERR "quiltifying commit $cc:".
-               " ignoring/dropping Gbp-Pq $what: $@";
+           print STDERR f_
+               "quiltifying commit %s: ignoring/dropping Gbp-Pq %s: %s",
+               $cc, $what, $@;
            return undef;
        };
 
@@ -5605,7 +5634,7 @@ sub quiltify ($$$$) {
                $patchname = $translitname;
            };
            print STDERR
-               "dgit: patch title transliteration error: $@"
+               +(f_ "dgit: patch title transliteration error: %s", $@)
                if $@;
            $patchname =~ y/ A-Z/-a-z/;
            $patchname =~ y/-a-z0-9_.+=~//cd;
@@ -5627,7 +5656,7 @@ sub quiltify ($$$$) {
        for ($index='';
             stat "debian/patches/$patchname$index";
             $index++) { }
-       $!==ENOENT or die "$patchname$index $!";
+       $!==ENOENT or confess "$patchname$index $!";
 
        runcmd @git, qw(checkout -q), $cc;
 
@@ -5741,17 +5770,18 @@ sub unpack_playtree_linkorigs ($$) {
 
 sub quilt_fixup_delete_pc () {
     runcmd @git, qw(rm -rqf .pc);
-    commit_admin <<END
+    commit_admin +(__ <<END).<<ENDU
 Commit removal of .pc (quilt series tracking data)
+END
 
 [dgit ($our_version) upgrade quilt-remove-pc]
-END
+ENDU
 }
 
 sub quilt_fixup_singlepatch ($$$) {
     my ($clogp, $headref, $upstreamversion) = @_;
 
-    progress "starting quiltify (single-debian-patch)";
+    progress __ "starting quiltify (single-debian-patch)";
 
     # dpkg-source --commit generates new patches even if
     # single-debian-patch is in debian/source/options.  In order to
@@ -5829,7 +5859,7 @@ sub quilt_fakedsc2unapplied ($$) {
 
     changedir 'fake';
 
-    remove_stray_gits("source package");
+    remove_stray_gits(__ "source package");
     mktree_in_ud_here();
 
     rmtree '.pc';
@@ -5850,8 +5880,9 @@ sub quilt_check_splitbrain_cache ($$) {
 
     my $splitbrain_cachekey;
     
-    progress
- "dgit: split brain (separate dgit view) may be needed (--quilt=$quilt_mode).";
+    progress f_
+ "dgit: split brain (separate dgit view) may be needed (--quilt=%s).",
+                $quilt_mode;
     # we look in the reflog of dgit-intern/quilt-cache
     # we look for an entry whose message is the key for the cache lookup
     my @cachekey = (qw(dgit), $our_version);
@@ -5881,12 +5912,12 @@ sub quilt_check_splitbrain_cache ($$) {
        unpack_playtree_mkwork($headref);
        my $saved = maybe_split_brain_save $headref, $cachehit, "cache-hit";
        if ($cachehit ne $headref) {
-           progress "dgit view: found cached ($saved)";
+           progress f_ "dgit view: found cached (%s)", $saved;
            runcmd @git, qw(checkout -q -b dgit-view), $cachehit;
            $split_brain = 1;
            return ($cachehit, $splitbrain_cachekey);
        }
-       progress "dgit view: found cached, no changes required";
+       progress __ "dgit view: found cached, no changes required";
        return ($headref, $splitbrain_cachekey);
     }
 
@@ -5897,7 +5928,8 @@ sub quilt_check_splitbrain_cache ($$) {
 sub quilt_fixup_multipatch ($$$) {
     my ($clogp, $headref, $upstreamversion) = @_;
 
-    progress "examining quilt state (multiple patches, $quilt_mode mode)";
+    progress f_ "examining quilt state (multiple patches, %s mode)",
+               $quilt_mode;
 
     # Our objective is:
     #  - honour any existing .pc in case it has any strangeness
@@ -5986,7 +6018,7 @@ sub quilt_fixup_multipatch ($$$) {
     $!=0; $?=-1;
     if (system @bbcmd) {
        failedcmd @bbcmd if $? < 0;
-       fail <<END;
+       fail __ <<END;
 failed to apply your git tree's patch stack (from debian/patches/) to
  the corresponding upstream tarball(s).  Your source tree and .orig
  are probably too inconsistent.  dgit can only fix up certain kinds of
@@ -6001,7 +6033,7 @@ END
     my $mustdeletepc=0;
     if (stat_exists ".pc") {
         -d _ or die;
-       progress "Tree already contains .pc - will use it then delete it.";
+       progress __ "Tree already contains .pc - will use it then delete it.";
         $mustdeletepc=1;
     } else {
         rename '../fake/.pc','.pc' or die $!;
@@ -6037,39 +6069,40 @@ END
     }
     printdebug "differences \@dl @dl.\n";
 
-    progress sprintf
-"$us: base trees orig=%.20s o+d/p=%.20s",
-              $unapplied, $oldtiptree;
-    progress sprintf
-"$us: quilt differences: src:  %s orig %s     gitignores:  %s orig %s\n".
-"$us: quilt differences:      HEAD %s o+d/p               HEAD %s o+d/p",
-                             $dl[0], $dl[1],              $dl[3], $dl[4],
-                                 $dl[2],                     $dl[5];
+    progress f_
+"%s: base trees orig=%.20s o+d/p=%.20s",
+              $us, $unapplied, $oldtiptree;
+    progress f_
+"%s: quilt differences: src:  %s orig %s     gitignores:  %s orig %s\n".
+"%s: quilt differences:      HEAD %s o+d/p               HEAD %s o+d/p",
+  $us,                      $dl[0], $dl[1],              $dl[3], $dl[4],
+  $us,                          $dl[2],                     $dl[5];
 
     if (@unrepres) {
-       print STDERR "dgit:  cannot represent change: $_->[1]: $_->[0]\n"
+       print STDERR f_ "dgit:  cannot represent change: %s: %s\n",
+                       $_->[1], $_->[0]
            foreach @unrepres;
-       forceable_fail [qw(unrepresentable)], <<END;
+       forceable_fail [qw(unrepresentable)], __ <<END;
 HEAD has changes to .orig[s] which are not representable by `3.0 (quilt)'
 END
     }
 
     my @failsuggestion;
     if (!($diffbits->{O2H} & $diffbits->{O2A})) {
-        push @failsuggestion, [ 'unapplied',
                             "This might be a patches-unapplied branch." ];
+        push @failsuggestion, [ 'unapplied', __
+ "This might be a patches-unapplied branch." ];
     } elsif (!($diffbits->{H2A} & $diffbits->{O2A})) {
-        push @failsuggestion, [ 'applied',
                              "This might be a patches-applied branch." ];
+        push @failsuggestion, [ 'applied', __
+ "This might be a patches-applied branch." ];
     }
-    push @failsuggestion, [ 'quilt-mode',
+    push @failsuggestion, [ 'quilt-mode', __
  "Maybe you need one of --[quilt=]gbp --[quilt=]dpm --quilt=unapplied ?" ];
 
-    push @failsuggestion, [ 'gitattrs',
+    push @failsuggestion, [ 'gitattrs', __
  "Warning: Tree has .gitattributes.  See GITATTRIBUTES in dgit(7)." ]
        if stat_exists '.gitattributes';
 
-    push @failsuggestion, [ 'origs',
+    push @failsuggestion, [ 'origs', __
  "Maybe orig tarball(s) are not identical to git representation?" ];
 
     if (quiltmode_splitbrain()) {
@@ -6079,7 +6112,7 @@ END
        return;
     }
 
-    progress "starting quiltify (multiple patches, $quilt_mode mode)";
+    progress f_ "starting quiltify (multiple patches, %s mode)", $quilt_mode;
     quiltify($clogp,$headref,$oldtiptree,\@failsuggestion);
 
     if (!open P, '>>', ".pc/applied-patches") {