Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
sub maybe_apply_patches_dirtily () {
return unless $quilt_mode =~ m/gbp|unapplied/;
sub maybe_apply_patches_dirtily () {
return unless $quilt_mode =~ m/gbp|unapplied/;
- print STDERR <<END or confess $!;
+ print STDERR __ <<END or confess $!;
dgit: Building, or cleaning with rules target, in patches-unapplied tree.
dgit: Have to apply the patches - making the tree dirty.
dgit: Building, or cleaning with rules target, in patches-unapplied tree.
dgit: Have to apply the patches - making the tree dirty.
}
sub maybe_unapply_patches_again () {
}
sub maybe_unapply_patches_again () {
- progress "dgit: Unapplying patches again to tidy up the tree."
+ progress __ "dgit: Unapplying patches again to tidy up the tree."
if $patches_applied_dirtily;
runcmd qw(dpkg-source --after-build .)
if $patches_applied_dirtily & 01;
if $patches_applied_dirtily;
runcmd qw(dpkg-source --after-build .)
if $patches_applied_dirtily & 01;
my $leftovers = cmdoutput @git, qw(clean -xdn);
if (length $leftovers) {
print STDERR $leftovers, "\n" or confess $!;
my $leftovers = cmdoutput @git, qw(clean -xdn);
if (length $leftovers) {
print STDERR $leftovers, "\n" or confess $!;
- fail "tree contains uncommitted files and --clean=check specified";
+ fail __
+ "tree contains uncommitted files and --clean=check specified";
}
} elsif ($cleanmode eq 'none') {
} else {
}
} elsif ($cleanmode eq 'none') {
} else {
- badusage "clean takes no additional arguments" if @ARGV;
+ badusage __ "clean takes no additional arguments" if @ARGV;
notpushing();
clean_tree();
maybe_unapply_patches_again();
notpushing();
clean_tree();
maybe_unapply_patches_again();
sub build_or_push_prep_early () {
our $build_or_push_prep_early_done //= 0;
return if $build_or_push_prep_early_done++;
sub build_or_push_prep_early () {
our $build_or_push_prep_early_done //= 0;
return if $build_or_push_prep_early_done++;
- badusage "-p is not allowed with dgit $subcommand" if defined $package;
+ badusage f_ "-p is not allowed with dgit %s", $subcommand
+ if defined $package;
my $clogp = parsechangelog();
$isuite = getfield $clogp, 'Distribution';
$package = getfield $clogp, 'Source';
my $clogp = parsechangelog();
$isuite = getfield $clogp, 'Distribution';
$package = getfield $clogp, 'Source';
my $pat = changespat $version;
foreach my $f (glob "$buildproductsdir/$pat") {
if (act_local()) {
my $pat = changespat $version;
foreach my $f (glob "$buildproductsdir/$pat") {
if (act_local()) {
- unlink $f or fail "remove old changes file $f: $!";
+ unlink $f or
+ fail f_ "remove old changes file %s: %s", $f, $!;
- progress "would remove $f";
+ progress f_ "would remove %s", $f;
"archive query failed (queried because --since-version not specified)";
}
if (@vsns) {
@vsns = map { $_->[0] } @vsns;
@vsns = sort { -version_compare($a, $b) } @vsns;
$changes_since_version = $vsns[0];
"archive query failed (queried because --since-version not specified)";
}
if (@vsns) {
@vsns = map { $_->[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 = '_';
} else {
$changes_since_version = '_';
- progress "package seems new, not specifying -v<version>";
+ progress __ "package seems new, not specifying -v<version>";
}
}
if ($changes_since_version ne '_') {
}
}
if ($changes_since_version ne '_') {
$r |= WANTSRC_SOURCE if grep { s/^full$/binary/ } @d;
$r |= WANTSRC_SOURCE if grep { s/^source$// } @d;
$r |= WANTSRC_BUILDER if grep { m/./ } @d;
$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 :
$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 :
}
printdebug "massage done $r $dmode.\n";
push @$cmd, $dmode;
}
printdebug "massage done $r $dmode.\n";
push @$cmd, $dmode;
} @changesfiles;
my $result;
if (@changesfiles==1) {
} @changesfiles;
my $result;
if (@changesfiles==1) {
- fail <<END.$msg_if_onlyone if defined $msg_if_onlyone;
-only one changes file from build (@changesfiles)
+ fail +(f_ <<END, "@changesfiles").$msg_if_onlyone
+only one changes file from build (%s)
+ if defined $msg_if_onlyone;
$result = $changesfiles[0];
} elsif (@changesfiles==2) {
my $binchanges = parsecontrol($changesfiles[1], "binary changes file");
foreach my $l (split /\n/, getfield $binchanges, 'Files') {
$result = $changesfiles[0];
} elsif (@changesfiles==2) {
my $binchanges = parsecontrol($changesfiles[1], "binary changes file");
foreach my $l (split /\n/, getfield $binchanges, 'Files') {
- fail "$l found in binaries changes file $binchanges"
+ fail f_ "%s found in binaries changes file %s", $l, $binchanges
if $l =~ m/\.dsc$/;
}
runcmd_ordryrun_local @mergechanges, @changesfiles;
my $multichanges = changespat $version,'multi';
if (act_local()) {
if $l =~ m/\.dsc$/;
}
runcmd_ordryrun_local @mergechanges, @changesfiles;
my $multichanges = changespat $version,'multi';
if (act_local()) {
- stat_exists $multichanges
- or fail "$multichanges unexpectedly not created by build";
+ stat_exists $multichanges or fail f_
+ "%s unexpectedly not created by build", $multichanges;
foreach my $cf (glob $pat) {
next if $cf eq $multichanges;
foreach my $cf (glob $pat) {
next if $cf eq $multichanges;
- rename "$cf", "$cf.inmulti" or
- fail "install new changes $cf\{,.inmulti}: $!";
+ rename "$cf", "$cf.inmulti" or fail f_
+ "install new changes %s\{,.inmulti}: %s", $cf, $!;
}
}
$result = $multichanges;
} else {
}
}
$result = $multichanges;
} else {
- fail "wrong number of different changes files (@changesfiles)";
+ fail f_ "wrong number of different changes files (%s)",
+ "@changesfiles";
- printdone "build successful, results in $result\n" or confess $!;
+ printdone f_ "build successful, results in %s\n", $result
+ or confess $!;
}
sub midbuild_checkchanges () {
}
sub midbuild_checkchanges () {
$_ ne changespat $version,'source' and
$_ ne changespat $version,'multi'
} @unwanted;
$_ ne changespat $version,'source' and
$_ ne changespat $version,'multi'
} @unwanted;
- fail <<END
-changes files other than source matching $pat already present; building would result in ambiguity about the intended results.
-Suggest you delete @unwanted.
+ fail +(f_ <<END, $pat, "@unwanted")
+changes files other than source matching %s already present; building would result in ambiguity about the intended results.
+Suggest you delete %s.
postbuild_mergechanges(undef);
};
} else {
postbuild_mergechanges(undef);
};
} else {
- printdone "build successful\n";
+ printdone __ "build successful\n";
}
}
sub cmd_build {
build_prep_early();
}
}
sub cmd_build {
build_prep_early();
- $buildproductsdir eq '..' or print STDERR <<END;
-$us: warning: build-products-dir set, but not supported by dpkg-buildpackage
-$us: warning: build-products-dir will be ignored; files will go to ..
+ $buildproductsdir eq '..' or print STDERR +(f_ <<END, $us, $us);
+%s: warning: build-products-dir set, but not supported by dpkg-buildpackage
+%s: warning: build-products-dir will be ignored; files will go to ..
END
$buildproductsdir = '..';
my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
END
$buildproductsdir = '..';
my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
$sourcechanges = changespat $version,'source';
if (act_local()) {
unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
$sourcechanges = changespat $version,'source';
if (act_local()) {
unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
- or fail "remove $sourcechanges: $!";
+ or fail f_ "remove %s: %s", $sourcechanges, $!;
}
my @cmd = (@dpkgsource, qw(-b --));
my $leafdir;
}
my @cmd = (@dpkgsource, qw(-b --));
my $leafdir;
my ($why, $l) = @_;
printdebug " renaming ($why) $l\n";
rename "$l", bpd_abs()."/$l"
my ($why, $l) = @_;
printdebug " renaming ($why) $l\n";
rename "$l", bpd_abs()."/$l"
- or fail "put in place new built file ($l): $!";
+ or fail f_ "put in place new built file (%s): %s", $l, $!;
};
foreach my $l (split /\n/, getfield $dsc, 'Files') {
$l =~ m/\S+$/ or next;
};
foreach my $l (split /\n/, getfield $dsc, 'Files') {
$l =~ m/\S+$/ or next;
- badusage "build-source takes no additional arguments" if @ARGV;
+ badusage __ "build-source takes no additional arguments" if @ARGV;
build_prep(WANTSRC_SOURCE);
build_source();
maybe_unapply_patches_again();
build_prep(WANTSRC_SOURCE);
build_source();
maybe_unapply_patches_again();
- printdone "source built, results in $dscfn and $sourcechanges";
+ printdone f_ "source built, results in %s and %s",
+ $dscfn, $sourcechanges;
}
sub cmd_push_source {
prep_push();
}
sub cmd_push_source {
prep_push();
- fail "dgit push-source: --include-dirty/--ignore-dirty does not make".
- "sense with push-source!" if $includedirty;
+ fail __
+ "dgit push-source: --include-dirty/--ignore-dirty does not make".
+ "sense with push-source!"
+ if $includedirty;
build_maybe_quilt_fixup();
if ($changesfile) {
my $changes = parsecontrol("$buildproductsdir/$changesfile",
build_maybe_quilt_fixup();
if ($changesfile) {
my $changes = parsecontrol("$buildproductsdir/$changesfile",
- "source changes file");
+ __ "source changes file");
unless (test_source_only_changes($changes)) {
unless (test_source_only_changes($changes)) {
- fail "user-specified changes file is not source-only";
+ fail __ "user-specified changes file is not source-only";
}
} else {
# Building a source package is very fast, so just do it
build_source();
}
} else {
# Building a source package is very fast, so just do it
build_source();
- die "er, patches are applied dirtily but shouldn't be.."
+ confess "er, patches are applied dirtily but shouldn't be.."
if $patches_applied_dirtily;
$changesfile = $sourcechanges;
}
if $patches_applied_dirtily;
$changesfile = $sourcechanges;
}
midbuild_checkchanges();
in_bpd {
if (act_local()) {
midbuild_checkchanges();
in_bpd {
if (act_local()) {
- stat_exists $dscfn or fail "$dscfn (in build products dir): $!";
- stat_exists $sourcechanges
- or fail "$sourcechanges (in build products dir): $!";
+ stat_exists $dscfn or fail f_
+ "%s (in build products dir): %s", $dscfn, $!;
+ stat_exists $sourcechanges or fail f_
+ "%s (in build products dir): %s", $sourcechanges, $!;
}
runcmd_ordryrun_local @$bbuilder, @args;
};
}
runcmd_ordryrun_local @$bbuilder, @args;
};
sub cmd_sbuild {
build_prep_early();
sub cmd_sbuild {
build_prep_early();
- binary_builder(\@sbuild, <<END, qw(-d), $isuite, @ARGV, $dscfn);
+ binary_builder(\@sbuild, (__ <<END), qw(-d), $isuite, @ARGV, $dscfn);
perhaps you need to pass -A ? (sbuild's default is to build only
arch-specific binaries; dgit 1.4 used to override that.)
END
perhaps you need to pass -A ? (sbuild's default is to build only
arch-specific binaries; dgit 1.4 used to override that.)
END
# @ARGV is allowed to contain only things that should be passed to
# pbuilder under debbuildopts; just massage those
my $wantsrc = massage_dbp_args \@ARGV;
# @ARGV is allowed to contain only things that should be passed to
# pbuilder under debbuildopts; just massage those
my $wantsrc = massage_dbp_args \@ARGV;
- fail "you asked for a builder but your debbuildopts didn't ask for".
- " any binaries -- is this really what you meant?"
- unless $wantsrc & WANTSRC_BUILDER;
- fail "we must build a .dsc to pass to the builder but your debbuiltopts".
- " forbids the building of a source package; cannot continue"
+ fail __
+ "you asked for a builder but your debbuildopts didn't ask for".
+ " any binaries -- is this really what you meant?"
+ unless $wantsrc & WANTSRC_BUILDER;
+ fail __
+ "we must build a .dsc to pass to the builder but your debbuiltopts".
+ " forbids the building of a source package; cannot continue"
unless $wantsrc & WANTSRC_SOURCE;
# We do not want to include the verb "build" in @pbuilder because
# the user can customise @pbuilder and they shouldn't be required
unless $wantsrc & WANTSRC_SOURCE;
# We do not want to include the verb "build" in @pbuilder because
# the user can customise @pbuilder and they shouldn't be required
}
sub cmd_print_unapplied_treeish {
}
sub cmd_print_unapplied_treeish {
- badusage "incorrect arguments to dgit print-unapplied-treeish" if @ARGV;
+ badusage __ "incorrect arguments to dgit print-unapplied-treeish"
+ if @ARGV;
my $headref = git_rev_parse('HEAD');
my $clogp = commit_getclogp $headref;
$package = getfield $clogp, 'Source';
my $headref = git_rev_parse('HEAD');
my $clogp = commit_getclogp $headref;
$package = getfield $clogp, 'Source';
my ($dstref, $newhash, $what_log, $what_msg) = @_;
my @cmd = (git_update_ref_cmd $what_log, $dstref, $newhash);
runcmd @cmd;
my ($dstref, $newhash, $what_log, $what_msg) = @_;
my @cmd = (git_update_ref_cmd $what_log, $dstref, $newhash);
runcmd @cmd;
- check_gitattrs($newhash, "source tree");
+ check_gitattrs($newhash, __ "source tree");
- progress "dgit: import-dsc: $what_msg";
+ progress f_ "dgit: import-dsc: %s", $what_msg;
if (m/^--require-valid-signature$/) {
$needsig = 1;
} else {
if (m/^--require-valid-signature$/) {
$needsig = 1;
} else {
- badusage "unknown dgit import-dsc sub-option \`$_'";
+ badusage f_ "unknown dgit import-dsc sub-option \`%s'", $_;
- badusage "usage: dgit import-dsc .../PATH/TO/.DSC BRANCH" unless @ARGV==2;
+ badusage __ "usage: dgit import-dsc .../PATH/TO/.DSC BRANCH"
+ unless @ARGV==2;
my ($dscfn, $dstbranch) = @ARGV;
my ($dscfn, $dstbranch) = @ARGV;
- badusage "dry run makes no sense with import-dsc" unless act_local();
+ badusage __ "dry run makes no sense with import-dsc"
+ unless act_local();
my $force = $dstbranch =~ s/^\+// ? +1 :
$dstbranch =~ s/^\.\.// ? -1 :
my $force = $dstbranch =~ s/^\+// ? +1 :
$dstbranch =~ s/^\.\.// ? -1 :
my $chead = cmdoutput_errok @symcmd;
defined $chead or $?==256 or failedcmd @symcmd;
my $chead = cmdoutput_errok @symcmd;
defined $chead or $?==256 or failedcmd @symcmd;
- fail "$dstbranch is checked out - will not update it"
+ fail f_ "%s is checked out - will not update it", $dstbranch
if defined $chead and $chead eq $dstbranch;
my $oldhash = git_get_ref $dstbranch;
if defined $chead and $chead eq $dstbranch;
my $oldhash = git_get_ref $dstbranch;
- open D, "<", $dscfn or fail "open import .dsc ($dscfn): $!";
+ open D, "<", $dscfn or fail f_ "open import .dsc (%s): %s", $dscfn, $!;
$dscdata = do { local $/ = undef; <D>; };
$dscdata = do { local $/ = undef; <D>; };
- 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
close C;
# we don't normally need this so import it here
local $SIG{__WARN__} = sub {
print STDERR $_[0];
return unless $needsig;
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()) {
};
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();
} else {
my $r = $dp->check_signature();
- die "->check_signature => $r" if $needsig && $r;
+ confess "->check_signature => $r" if $needsig && $r;
$package = getfield $dsc, 'Source';
$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();
unless forceing [qw(import-dsc-with-dgit-field)];
parse_dsc_field_def_dsc_distro();
notpushing();
if (defined $dsc_hash) {
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) {
resolve_dsc_field_commit undef, undef;
}
if (defined $dsc_hash) {
"echo $dsc_hash | git cat-file --batch-check");
my $objgot = cmdoutput @cmd;
if ($objgot =~ m#^\w+ missing\b#) {
"echo $dsc_hash | git cat-file --batch-check");
my $objgot = cmdoutput @cmd;
if ($objgot =~ m#^\w+ missing\b#) {
- fail <<END
-.dsc contains Dgit field referring to object $dsc_hash
+ fail f_ <<END, $dsc_hash
+.dsc contains Dgit field referring to object %s
Your git tree does not have that object. Try `git fetch' from a
plausible server (browse.dgit.d.o? alioth?), and try the import-dsc again.
END
}
if ($oldhash && !is_fast_fwd $oldhash, $dsc_hash) {
if ($force > 0) {
Your git tree does not have that object. Try `git fetch' from a
plausible server (browse.dgit.d.o? alioth?), and try the import-dsc again.
END
}
if ($oldhash && !is_fast_fwd $oldhash, $dsc_hash) {
if ($force > 0) {
- progress "Not fast forward, forced update.";
+ progress __ "Not fast forward, forced update.";
- 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",
}
}
import_dsc_result $dstbranch, $dsc_hash,
"dgit import-dsc (Dgit): $info",
- "updated git ref $dstbranch";
+ f_ "updated git ref %s", $dstbranch;
- fail <<END
-Branch $dstbranch already exists
-Specify ..$specbranch for a pseudo-merge, binding in existing history
-Specify +$specbranch to overwrite, discarding existing history
+ fail f_ <<END, $dstbranch, $specbranch, $specbranch
+Branch %s already exists
+Specify ..%s for a pseudo-merge, binding in existing history
+Specify +%s to overwrite, discarding existing history
END
if $oldhash && !$force;
END
if $oldhash && !$force;
my $here = "$buildproductsdir/$f";
if (lstat $here) {
next if stat $here;
my $here = "$buildproductsdir/$f";
if (lstat $here) {
next if stat $here;
- fail "lstat $here works but stat gives $! !";
+ fail f_ "lstat %s works but stat gives %s !", $here, $!;
- fail "stat $here: $!" unless $! == ENOENT;
+ fail f_ "stat %s: %s", $here, $! unless $! == ENOENT;
my $there = $dscfn;
if ($dscfn =~ m#^(?:\./+)?\.\./+#) {
$there = $';
} elsif ($dscfn =~ m#^/#) {
$there = $dscfn;
} else {
my $there = $dscfn;
if ($dscfn =~ m#^(?:\./+)?\.\./+#) {
$there = $';
} elsif ($dscfn =~ m#^/#) {
$there = $dscfn;
} else {
- fail "cannot import $dscfn which seems to be inside working tree!";
+ fail f_
+ "cannot import %s which seems to be inside working tree!",
+ $dscfn;
- $there =~ s#/+[^/]+$## or
- fail "import $dscfn requires ../$f, but it does not exist";
+ $there =~ s#/+[^/]+$## or fail f_
+ "import %s requires ../%s, but it does not exist",
+ $dscfn, $f;
$there .= "/$f";
my $test = $there =~ m{^/} ? $there : "../$there";
stat $test or fail "import $dscfn requires $test, but: $!";
$there .= "/$f";
my $test = $there =~ m{^/} ? $there : "../$there";
stat $test or fail "import $dscfn requires $test, but: $!";