X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=051a4be568c8ab9d8651f64b21c43df1bb18cdd1;hp=9fd01b0d3fc531fe5f6b62d86e6eb231913e21cb;hb=cc6570b2dc95d1c70c349e61493a9e57b4f2a233;hpb=6f15f6d53ce1b671a23aea940ca4a0213f6aa6f4 diff --git a/dgit b/dgit index 9fd01b0d..051a4be5 100755 --- 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 <[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_ <{View} eq 'maint') { - print TO <{$_} 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 <{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 <($oldtiptree,'HEAD'); ---quilt=$quilt_mode specified, implying patches-applied git tree + fail +(f_ <($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 <{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 <>", "$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 +(__ <>$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 <{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 <[1]: $_->[0]\n" + print STDERR f_ "dgit: cannot represent change: %s: %s\n", + $_->[1], $_->[0] foreach @unrepres; - forceable_fail [qw(unrepresentable)], <{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") {