autoflush STDOUT 1;
our $supplementary_message = '';
-our $need_split_build_invocation = 0;
+our $need_split_build_invocation = 1;
our $split_brain = 0;
END {
dopush();
}
+our $sourcechanges;
+
sub cmd_push_source {
prep_push();
fail "dgit push-source: --include-dirty/--ignore-dirty does not make".
"sense with push-source!" if $includedirty;
+ clean_tree();
+ build_maybe_quilt_fixup();
if ($changesfile) {
my $changes = parsecontrol("$buildproductsdir/$changesfile",
"source changes file");
}
} else {
# Building a source package is very fast, so just do it
- build_source_for_push();
+ build_source();
+ die "er, patches are applied dirtily but shouldn't be.."
+ if $patches_applied_dirtily;
+ $changesfile = $sourcechanges;
}
dopush();
}
#---------- building etc. ----------
our $version;
-our $sourcechanges;
our $dscfn;
#----- `3.0 (quilt)' handling -----
maybe_unapply_patches_again();
}
+# return values from massage_dbp_args are one or both of these flags
+sub WANTSRC_SOURCE () { 01; } # caller should build source (separately)
+sub WANTSRC_BUILDER () { 02; } # caller should run dpkg-buildpackage
+
sub build_or_push_prep_early () {
our $build_or_push_prep_early_done //= 0;
return if $build_or_push_prep_early_done++;
check_not_dirty();
}
-sub build_prep () {
+sub build_prep ($) {
+ my ($wantsrc) = @_;
build_prep_early();
clean_tree();
build_maybe_quilt_fixup();
return (changesopts_initial(), changesopts_version());
}
-# return values from massage_dbp_args are one or both of these flags
-sub WANTSRC_SOURCE () { 01; } # caller should build source (separately)
-sub WANTSRC_BUILDER () { 02; } # caller should run dpkg-buildpackage
-
sub massage_dbp_args ($;$) {
my ($cmd,$xargs) = @_;
# We need to:
# or if that is undef, be a no-op.
# Returns the changes file to report to the user.
my $pat = changespat $version;
- my @changesfiles = glob $pat;
+ my @changesfiles = grep { !m/_multi\.changes/ } glob $pat;
@changesfiles = sort {
($b =~ m/_source\.changes$/ <=> $a =~ m/_source\.changes$/)
or $a cmp $b
my $pat = changespat $version;
return if $rmchanges;
my @unwanted = map { s#.*/##; $_; } glob "$bpd_glob/$pat";
- @unwanted = grep { $_ ne changespat $version,'source' } @unwanted;
+ @unwanted = grep {
+ $_ 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.
build_prep_early();
my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
my $wantsrc = massage_dbp_args \@dbp;
+ build_prep($wantsrc);
if ($wantsrc & WANTSRC_SOURCE) {
build_source();
midbuild_checkchanges_vanilla $wantsrc;
- } else {
- build_prep();
}
if ($wantsrc & WANTSRC_BUILDER) {
push @dbp, changesopts_version();
}
}
+ build_prep($wantsrc);
if ($wantsrc & WANTSRC_SOURCE) {
build_source();
midbuild_checkchanges_vanilla $wantsrc;
if (!$clean_using_builder) {
push @cmd, '--git-cleaner=true';
}
- build_prep();
}
maybe_unapply_patches_again();
if ($wantsrc & WANTSRC_BUILDER) {
}
sub cmd_git_build { cmd_gbp_build(); } # compatibility with <= 1.0
-sub build_source_for_push {
- build_source();
- maybe_unapply_patches_again();
- $changesfile = $sourcechanges;
-}
-
sub build_source {
- build_prep_early();
- build_prep();
$sourcechanges = changespat $version,'source';
if (act_local()) {
unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
}
sub cmd_build_source {
- build_prep_early();
badusage "build-source takes no additional arguments" if @ARGV;
+ build_prep(WANTSRC_SOURCE);
build_source();
maybe_unapply_patches_again();
printdone "source built, results in $dscfn and $sourcechanges";
}
sub cmd_sbuild {
+ build_prep(WANTSRC_SOURCE); # not BUILDER because sbuild uses the .dsc
build_source();
midbuild_checkchanges();
in_bpd {