summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2018-07-31 14:04:58 +0800
committerSean Whitton <spwhitton@spwhitton.name>2018-07-31 14:04:58 +0800
commit3c5614c2292cb2fa1c50915d18510f5c2c915b76 (patch)
tree37703aa7eda0ad83849308db586566c1f23d6fae
parente21dbf9b02e32aec335262b2999686c37f01ba00 (diff)
parentf052e1326357a6365a5eddbb985a5b1ef9b4fdb2 (diff)
Merge tag 'debian/6.2' into stretch-bpo
dgit release 6.2 for unstable (sid) [dgit] [dgit distro=debian] # gpg: Signature made Sun 29 Jul 2018 08:02:30 PM CST # gpg: using RSA key 559AE46C2D6B6D3265E7CBA1E3E3392348B50D39 # gpg: Can't check signature: No public key
-rw-r--r--debian/changelog67
-rw-r--r--debian/control2
-rw-r--r--debian/copyright4
-rw-r--r--debian/tests/control2
-rwxr-xr-xdgit373
-rw-r--r--dgit-maint-debrebase.7.pod5
-rw-r--r--dgit-maint-gbp.7.pod63
-rw-r--r--dgit-maint-merge.7.pod20
-rw-r--r--dgit-maint-native.7.pod4
-rw-r--r--dgit-sponsorship.7.pod8
-rw-r--r--dgit.175
-rwxr-xr-xgit-debrebase3
-rwxr-xr-xinfra/dgit-repos-policy-debian17
-rw-r--r--tests/Makefile13
-rw-r--r--tests/lib27
-rw-r--r--tests/lib-build-modes41
-rw-r--r--tests/lib-import-chk22
-rw-r--r--tests/lib-restricts2
-rwxr-xr-xtests/pretend-pbuilder26
-rwxr-xr-xtests/run-all13
-rwxr-xr-xtests/tests/build-modes-asplit5
-rwxr-xr-xtests/tests/build-modes-gbp1
-rwxr-xr-xtests/tests/build-modes-gbp-asplit5
-rwxr-xr-xtests/tests/build-modes-sbuild4
-rwxr-xr-xtests/tests/import-nonnative1
-rwxr-xr-xtests/tests/pbuilder42
-rwxr-xr-xtests/tests/push-source1
-rwxr-xr-xtests/tests/push-source-with-changes4
-rwxr-xr-xtests/tests/quilt-gbp-build-modes-sbuild2
-rwxr-xr-xtests/tests/quilt-splitbrains3
-rwxr-xr-xtests/tests/sbuild-gitish3
31 files changed, 607 insertions, 251 deletions
diff --git a/debian/changelog b/debian/changelog
index 870e0c0..f5498ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,70 @@
+dgit (6.2) unstable; urgency=medium
+
+ * dgit(1): Improve and correct --build-products-dir description.
+ * dgit: Minor code cleanup.
+ * dgit build: Warn if --build-products-dir is not `..'. Closes:#904859.
+ * test suite: Test dgit import-dsc --build-products-dir.
+
+ [Sean Whitton]
+ * manpages: alioth->salsa
+ * manpages: add references to pbuilder and cowbuilder
+ * dgit-maint-gbp(7): discuss dgit.default.build-products-dir
+ * dgit-maint-gbp(7): update references to --*-dirty
+ * dgit-sponsorship(7): add references to push-source
+ * dgit-maint-debrebase(7): fix command to just launder
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk> Sun, 29 Jul 2018 12:57:26 +0100
+
+dgit (6.1) unstable; urgency=medium
+
+ New feature:
+ * 'pbuilder' and 'cowbuilder' subcommands (Closes: #844125).
+ - Suggest sbuild | pbuilder | cowbuilder.
+
+ Minor fixes:
+ * Fix an error message to refer to the build products dir instead of
+ just the parent directory.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Sat, 28 Jul 2018 20:14:23 +0800
+
+dgit (6.0) unstable; urgency=medium
+
+ New features [Sean Whitton]:
+ * Introduce dgit.default.build-products-dir git configuration key.
+ Closes:#857316.
+ * Die earlier, and with a more helpful message, if the user tries to
+ include dirty changes when building a source package in split brain
+ mode.
+
+ dgit behavioural changes:
+ * dgit: Always build the source package ourselves, rather than
+ sometimes leaving that to the builder command. dgit will now
+ usually generate *_multi.changes rather than *_$arch.changes.
+ * dgit: Build source packages in a private directory, except when
+ the user passes --include-dirty [Sean Whitton].
+ - dgit push-source no longer cleans the tree [Sean Whitton].
+ * dgit: Rename --ignore-dirty to --include-dirty (leaving the old
+ name supported as a deprecated alias).
+
+ Test suite improvements:
+ * test suite: unset VISUAL, which interferes. Closes:#904308.
+ * Honour DGIT_SCHROOT_CHROOT to set the schroot to use for the sbuild
+ tests.
+ * Support tests/run-all --progressive.
+ * Drop now-obsolete *-asplit tests.
+
+ Other improvements:
+ * apt-get method: when apt does not update release files,
+ unconditionally print hint about noatime. Closes:#851873.
+ * messages: Be a lot more friendly about NEW in particular,
+ and also add a couple of `please's. Closes:#904448.
+ * Make --build-products-dir (and the new config key) actually work.
+ Closes:#863582. [ Ian and Sean. ]
+ * dgit: Many important internal rearrangemnts relating to source
+ package production and building.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk> Thu, 26 Jul 2018 14:43:47 +0100
+
dgit (5.10~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
diff --git a/debian/control b/debian/control
index 3fca347..a36b357 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,7 @@ Depends: perl, libwww-perl, libdpkg-perl, git-core, devscripts, dpkg-dev,
libjson-perl, ca-certificates,
libtext-iconv-perl, libtext-glob-perl
Recommends: ssh-client
-Suggests: sbuild
+Suggests: sbuild | pbuilder | cowbuilder
Architecture: all
Description: git interoperability with the Debian archive
dgit (with the associated infrastructure) makes it possible to
diff --git a/debian/copyright b/debian/copyright
index 740bafa..c5b10a1 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,8 +1,8 @@
dgit
Integration between git and Debian-style archives
-Copyright (C)2013-2017 Ian Jackson
-Copyright (C)2016-2017 Sean Whitton
+Copyright (C)2013-2018 Ian Jackson
+Copyright (C)2016-2018 Sean Whitton
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/debian/tests/control b/debian/tests/control
index dfd73bb..8480655 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -60,7 +60,7 @@ Tests: trustingpolicy-replay
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, dput-ng
-Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-asplit build-modes-gbp-asplit checkout clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct drs-clone-nogit drs-push-masterupdate drs-push-rejects dsd-clone-nogit dsd-divert fetch-localgitonly fetch-somegit-notlast gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite newtag-clone-nogit oldnewtagalt oldtag-clone-nogit orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version protocol-compat push-buildproductsdir push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush sourceonlypolicy tag-updates test-list-uptodate unrepresentable version-opt
+Tests: absurd-gitapply badcommit-rewrite build-modes checkout clone-clogsigpipe clone-gitnosuite clone-nogit debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct drs-clone-nogit drs-push-masterupdate drs-push-rejects dsd-clone-nogit dsd-divert fetch-localgitonly fetch-somegit-notlast gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite newtag-clone-nogit oldnewtagalt oldtag-clone-nogit orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version pbuilder protocol-compat push-buildproductsdir push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-singlepatch quilt-splitbrains quilt-useremail rpush sourceonlypolicy tag-updates test-list-uptodate unrepresentable version-opt
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc
diff --git a/dgit b/dgit
index 357adc9..4e43d21 100755
--- a/dgit
+++ b/dgit
@@ -2,8 +2,8 @@
# dgit
# Integration between git and Debian-style archives
#
-# Copyright (C)2013-2017 Ian Jackson
-# Copyright (C)2017 Sean Whitton
+# Copyright (C)2013-2018 Ian Jackson
+# Copyright (C)2017-2018 Sean Whitton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -63,9 +63,10 @@ our @ropts;
our $sign = 1;
our $dryrun_level = 0;
our $changesfile;
-our $buildproductsdir = '..';
+our $buildproductsdir;
+our $bpd_glob;
our $new_package = 0;
-our $ignoredirty = 0;
+our $includedirty = 0;
our $rmonerror = 1;
our @deliberatelies;
our %previously;
@@ -128,6 +129,8 @@ our (@mergechanges) = qw(mergechanges -f);
our (@gbp_build) = ('');
our (@gbp_pq) = ('gbp pq');
our (@changesopts) = ('');
+our (@pbuilder) = ("sudo -E pbuilder");
+our (@cowbuilder) = ("sudo -E cowbuilder");
our %opts_opt_map = ('dget' => \@dget, # accept for compatibility
'curl' => \@curl,
@@ -147,7 +150,9 @@ our %opts_opt_map = ('dget' => \@dget, # accept for compatibility
'gbp-build' => \@gbp_build,
'gbp-pq' => \@gbp_pq,
'ch' => \@changesopts,
- 'mergechanges' => \@mergechanges);
+ 'mergechanges' => \@mergechanges,
+ 'pbuilder' => \@pbuilder,
+ 'cowbuilder' => \@cowbuilder);
our %opts_opt_cmdonly = ('gpg' => 1, 'git' => 1);
our %opts_cfg_insertpos = map {
@@ -165,7 +170,6 @@ our $keyid;
autoflush STDOUT 1;
our $supplementary_message = '';
-our $need_split_build_invocation = 0;
our $split_brain = 0;
END {
@@ -274,20 +278,28 @@ sub quiltmode_splitbrain () {
}
sub opts_opt_multi_cmd {
+ my $extra = shift;
my @cmd;
push @cmd, split /\s+/, shift @_;
+ push @cmd, @$extra;
push @cmd, @_;
@cmd;
}
sub gbp_pq {
- return opts_opt_multi_cmd @gbp_pq;
+ return opts_opt_multi_cmd [], @gbp_pq;
}
sub dgit_privdir () {
our $dgit_privdir_made //= ensure_a_playground 'dgit';
}
+sub bpd_abs () {
+ my $r = $buildproductsdir;
+ $r = "$maindir/$r" unless $r =~ m{^/};
+ return $r;
+}
+
sub branch_gdr_info ($$) {
my ($symref, $head) = @_;
my ($status, $msg, $current, $ffq_prev, $gdrlast) =
@@ -563,6 +575,7 @@ main usages:
dgit [dgit-opts] fetch|pull [dgit-opts] [suite]
dgit [dgit-opts] build [dpkg-buildpackage-opts]
dgit [dgit-opts] sbuild [sbuild-opts]
+ dgit [dgit-opts] pbuilder|cowbuilder [debbuildopts]
dgit [dgit-opts] push [dgit-opts] [suite]
dgit [dgit-opts] push-source [dgit-opts] [suite]
dgit [dgit-opts] rpush build-host:build-dir ...
@@ -811,7 +824,8 @@ sub access_forpush () {
}
sub pushing () {
- die "$access_forpush ?" if ($access_forpush // 1) ne 1;
+ confess 'internal error '.Dumper($access_forpush)," ?" if
+ defined $access_forpush and !$access_forpush;
badcfg "pushing but distro is configured readonly"
if access_forpush_config() eq '0';
$access_forpush = 1;
@@ -1237,7 +1251,14 @@ END
}
my @inreleasefiles = grep { m#/InRelease$# } @releasefiles;
@releasefiles = @inreleasefiles if @inreleasefiles;
- die "apt updated wrong number of Release files (@releasefiles), erk"
+ if (!@releasefiles) {
+ fail <<END;
+apt seemed to not to update dgit's cached Release files for $isuite.
+(Perhaps $cache
+ is on a filesystem mounted `noatime'; if so, please use `relatime'.)
+END
+ }
+ die "apt updated too many Release files (@releasefiles), erk"
unless @releasefiles == 1;
($aptget_releasefile) = @releasefiles;
@@ -2105,7 +2126,7 @@ sub generate_commits_from_dsc () {
foreach my $fi (@dfi) {
my $f = $fi->{Filename};
die "$f ?" if $f =~ m#/|^\.|\.dsc$|\.tmp$#;
- my $upper_f = "$maindir/../$f";
+ my $upper_f = (bpd_abs()."/$f");
printdebug "considering reusing $f: ";
@@ -2113,12 +2134,12 @@ sub generate_commits_from_dsc () {
printdebug "linked (using ...,fetch).\n";
} elsif ((printdebug "($!) "),
$! != ENOENT) {
- fail "accessing ../$f,fetch: $!";
+ fail "accessing $buildproductsdir/$f,fetch: $!";
} elsif (link_ltarget $upper_f, $f) {
printdebug "linked.\n";
} elsif ((printdebug "($!) "),
$! != ENOENT) {
- fail "accessing ../$f: $!";
+ fail "accessing $buildproductsdir/$f: $!";
} else {
printdebug "absent.\n";
}
@@ -2133,14 +2154,14 @@ sub generate_commits_from_dsc () {
printdebug "linked.\n";
} elsif ((printdebug "($!) "),
$! != EEXIST) {
- fail "saving ../$f: $!";
+ fail "saving $buildproductsdir/$f: $!";
} elsif (!$refetched) {
printdebug "no need.\n";
} elsif (link $f, "$upper_f,fetch") {
printdebug "linked (using ...,fetch).\n";
} elsif ((printdebug "($!) "),
$! != EEXIST) {
- fail "saving ../$f,fetch: $!";
+ fail "saving $buildproductsdir/$f,fetch: $!";
} else {
printdebug "cannot.\n";
}
@@ -2567,7 +2588,7 @@ sub ensure_we_have_orig () {
foreach my $fi (@dfi) {
my $f = $fi->{Filename};
next unless is_orig_file_in_dsc($f, \@dfi);
- complete_file_from_dsc('..', $fi)
+ complete_file_from_dsc($buildproductsdir, $fi)
or next;
}
}
@@ -3723,7 +3744,7 @@ sub check_not_dirty () {
}
}
- return if $ignoredirty;
+ return if $includedirty;
git_check_unmodified();
}
@@ -3985,7 +4006,7 @@ sub splitbrain_pseudomerge ($$$$) {
$@ =~ s/^\n//; chomp $@;
print STDERR <<END;
$@
-| Not fast forward; maybe --overwrite is needed, see dgit(1)
+| Not fast forward; maybe --overwrite is needed ? Please see dgit(1).
END
finish -1;
}
@@ -4419,7 +4440,8 @@ END
responder_send_command("param isuite $isuite");
responder_send_command("param tagformat $tagformat");
if (defined $maintviewhead) {
- die unless ($protovsn//4) >= 4;
+ confess "internal error (protovsn=$protovsn)"
+ if defined $protovsn and $protovsn < 4;
responder_send_command("param maint-view $maintviewhead");
}
@@ -4742,21 +4764,6 @@ sub cmd_push {
dopush();
}
-sub cmd_push_source {
- prep_push();
- if ($changesfile) {
- my $changes = parsecontrol("$buildproductsdir/$changesfile",
- "source changes file");
- unless (test_source_only_changes($changes)) {
- fail "user-specified changes file is not source-only";
- }
- } else {
- # Building a source package is very fast, so just do it
- build_source_for_push();
- }
- dopush();
-}
-
#---------- remote commands' implementation ----------
sub pre_remote_push_build_host {
@@ -5618,14 +5625,12 @@ END
quilt_fixup_multipatch($clogp, $headref, $upstreamversion);
}
- die 'bug' if $split_brain && !$need_split_build_invocation;
-
changedir $maindir;
runcmd_ordryrun_local
@git, qw(pull --ff-only -q), "$playground/work", qw(master);
}
-sub quilt_fixup_mkwork ($) {
+sub unpack_playtree_mkwork ($) {
my ($headref) = @_;
mkdir "work" or die $!;
@@ -5634,12 +5639,14 @@ sub quilt_fixup_mkwork ($) {
runcmd @git, qw(reset -q --hard), $headref;
}
-sub quilt_fixup_linkorigs ($$) {
+sub unpack_playtree_linkorigs ($$) {
my ($upstreamversion, $fn) = @_;
# calls $fn->($leafname);
- foreach my $f (<$maindir/../*>) { #/){
- my $b=$f; $b =~ s{.*/}{};
+ my $bpd_abs = bpd_abs();
+ opendir QFD, $bpd_abs or fail "buildproductsdir: $bpd_abs: $!";
+ while ($!=0, defined(my $b = readdir QFD)) {
+ my $f = bpd_abs()."/".$b;
{
local ($debuglevel) = $debuglevel-1;
printdebug "QF linkorigs $b, $f ?\n";
@@ -5649,6 +5656,8 @@ sub quilt_fixup_linkorigs ($$) {
link_ltarget $f, $b or die "$b $!";
$fn->($b);
}
+ die "$buildproductsdir: $!" if $!;
+ closedir QFD;
}
sub quilt_fixup_delete_pc () {
@@ -5670,8 +5679,8 @@ sub quilt_fixup_singlepatch ($$$) {
# get it to generate debian/patches/debian-changes, it is
# necessary to build the source package.
- quilt_fixup_linkorigs($upstreamversion, sub { });
- quilt_fixup_mkwork($headref);
+ unpack_playtree_linkorigs($upstreamversion, sub { });
+ unpack_playtree_mkwork($headref);
rmtree("debian/patches");
@@ -5711,7 +5720,7 @@ END
print $fakedsc " ".$md->hexdigest." $size $b\n" or die $!;
};
- quilt_fixup_linkorigs($upstreamversion, $dscaddfile);
+ unpack_playtree_linkorigs($upstreamversion, $dscaddfile);
my @files=qw(debian/source/format debian/rules
debian/control debian/changelog);
@@ -5779,7 +5788,7 @@ sub quilt_check_splitbrain_cache ($$) {
next unless m/^(\w+) (\S.*\S)$/ && $2 eq $splitbrain_cachekey;
my $cachehit = $1;
- quilt_fixup_mkwork($headref);
+ unpack_playtree_mkwork($headref);
my $saved = maybe_split_brain_save $headref, $cachehit, "cache-hit";
if ($cachehit ne $headref) {
progress "dgit view: found cached ($saved)";
@@ -5910,13 +5919,13 @@ sub quilt_fixup_multipatch ($$$) {
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
- anomaly (depending on the quilt mode). See --quilt= in dgit(1).
+ anomaly (depending on the quilt mode). Please see --quilt= in dgit(1).
END
}
changedir '..';
- quilt_fixup_mkwork($headref);
+ unpack_playtree_mkwork($headref);
my $mustdeletepc=0;
if (stat_exists ".pc") {
@@ -6088,6 +6097,10 @@ sub cmd_clean () {
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++;
@@ -6096,6 +6109,7 @@ sub build_or_push_prep_early () {
$isuite = getfield $clogp, 'Distribution';
$package = getfield $clogp, 'Source';
$version = getfield $clogp, 'Version';
+ $dscfn = dscfn($version);
}
sub build_prep_early () {
@@ -6104,9 +6118,12 @@ sub build_prep_early () {
check_not_dirty();
}
-sub build_prep () {
+sub build_prep ($) {
+ my ($wantsrc) = @_;
build_prep_early();
- clean_tree();
+ # clean the tree if we're trying to include dirty changes in the
+ # source package, or we are running the builder in $maindir
+ clean_tree() if $includedirty || ($wantsrc & WANTSRC_BUILDER);
build_maybe_quilt_fixup();
if ($rmchanges) {
my $pat = changespat $version;
@@ -6165,28 +6182,11 @@ sub changesopts () {
sub massage_dbp_args ($;$) {
my ($cmd,$xargs) = @_;
- # We need to:
- #
- # - if we're going to split the source build out so we can
- # do strange things to it, massage the arguments to dpkg-buildpackage
- # so that the main build doessn't build source (or add an argument
- # to stop it building source by default).
- #
- # - add -nc to stop dpkg-source cleaning the source tree,
- # unless we're not doing a split build and want dpkg-source
- # as cleanmode, in which case we can do nothing
- #
- # return values:
- # 0 - source will NOT need to be built separately by caller
- # +1 - source will need to be built separately by caller
- # +2 - source will need to be built separately by caller AND
- # dpkg-buildpackage should not in fact be run at all!
+ # Since we split the source build out so we can do strange things
+ # to it, massage the arguments to dpkg-buildpackage so that the
+ # main build doessn't build source (or add an argument to stop it
+ # building source by default).
debugcmd '#massaging#', @$cmd if $debuglevel>1;
-#print STDERR "MASS0 ",Dumper($cmd, $xargs, $need_split_build_invocation);
- if ($cleanmode eq 'dpkg-source' && !$need_split_build_invocation) {
- $clean_using_builder = 1;
- return 0;
- }
# -nc has the side effect of specifying -b if nothing else specified
# and some combinations of -S, -b, et al, are errors, rather than
# later simply overriding earlie. So we need to:
@@ -6201,35 +6201,34 @@ sub massage_dbp_args ($;$) {
}
push @$cmd, '-nc';
#print STDERR "MASS1 ",Dumper($cmd, $xargs, $dmode);
- my $r = 0;
- if ($need_split_build_invocation) {
- printdebug "massage split $dmode.\n";
- $r = $dmode =~ m/[S]/ ? +2 :
- $dmode =~ y/gGF/ABb/ ? +1 :
- $dmode =~ m/[ABb]/ ? 0 :
- die "$dmode ?";
- }
+ my $r = WANTSRC_BUILDER;
+ printdebug "massage split $dmode.\n";
+ $r = $dmode =~ m/[S]/ ? WANTSRC_SOURCE :
+ $dmode =~ y/gGF/ABb/ ? WANTSRC_SOURCE | WANTSRC_BUILDER :
+ $dmode =~ m/[ABb]/ ? WANTSRC_BUILDER :
+ die "$dmode ?";
printdebug "massage done $r $dmode.\n";
push @$cmd, $dmode;
#print STDERR "MASS2 ",Dumper($cmd, $xargs, $r);
return $r;
}
-sub in_parent (&) {
+sub in_bpd (&) {
my ($fn) = @_;
my $wasdir = must_getcwd();
- changedir "..";
+ changedir $buildproductsdir;
$fn->();
changedir $wasdir;
}
-sub postbuild_mergechanges ($) { # must run with CWD=.. (eg in in_parent)
+# this sub must run with CWD=$buildproductsdir (eg in in_bpd)
+sub postbuild_mergechanges ($) {
my ($msg_if_onlyone) = @_;
# If there is only one .changes file, fail with $msg_if_onlyone,
# 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
@@ -6265,8 +6264,11 @@ END
sub midbuild_checkchanges () {
my $pat = changespat $version;
return if $rmchanges;
- my @unwanted = map { s#^\.\./##; $_; } glob "../$pat";
- @unwanted = grep { $_ ne changespat $version,'source' } @unwanted;
+ my @unwanted = map { s#.*/##; $_; } glob "$bpd_glob/$pat";
+ @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.
@@ -6276,13 +6278,13 @@ END
sub midbuild_checkchanges_vanilla ($) {
my ($wantsrc) = @_;
- midbuild_checkchanges() if $wantsrc == 1;
+ midbuild_checkchanges() if $wantsrc == (WANTSRC_SOURCE|WANTSRC_BUILDER);
}
sub postbuild_mergechanges_vanilla ($) {
my ($wantsrc) = @_;
- if ($wantsrc == 1) {
- in_parent {
+ if ($wantsrc == (WANTSRC_SOURCE|WANTSRC_BUILDER)) {
+ in_bpd {
postbuild_mergechanges(undef);
};
} else {
@@ -6292,15 +6294,18 @@ sub postbuild_mergechanges_vanilla ($) {
sub cmd_build {
build_prep_early();
+ $buildproductsdir eq '..' or print STDERR <<END;
+$us: warning: build-products-dir set, but not supported by dgit build
+$us: warning: things may go wrong or files may go to the wrong place
+END
my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
my $wantsrc = massage_dbp_args \@dbp;
- if ($wantsrc > 0) {
+ build_prep($wantsrc);
+ if ($wantsrc & WANTSRC_SOURCE) {
build_source();
midbuild_checkchanges_vanilla $wantsrc;
- } else {
- build_prep();
}
- if ($wantsrc < 2) {
+ if ($wantsrc & WANTSRC_BUILDER) {
push @dbp, changesopts_version();
maybe_apply_patches_dirtily();
runcmd_ordryrun_local @dbp;
@@ -6324,12 +6329,11 @@ sub cmd_gbp_build {
# orig is absent.
my $upstreamversion = upstreamversion $version;
my $origfnpat = srcfn $upstreamversion, '.orig.tar.*';
- my $gbp_make_orig = $version =~ m/-/ && !(() = glob "../$origfnpat");
+ my $gbp_make_orig = $version =~ m/-/ && !(() = glob "$bpd_glob/$origfnpat");
if ($gbp_make_orig) {
clean_tree();
$cleanmode = 'none'; # don't do it again
- $need_split_build_invocation = 1;
}
my @dbp = @dpkgbuildpackage;
@@ -6343,7 +6347,7 @@ sub cmd_gbp_build {
$gbp_build[0] = 'gbp buildpackage';
}
}
- my @cmd = opts_opt_multi_cmd @gbp_build;
+ my @cmd = opts_opt_multi_cmd [], @gbp_build;
push @cmd, (qw(-us -uc --git-no-sign-tags),
"--git-builder=".(shellquote @dbp));
@@ -6367,17 +6371,17 @@ sub cmd_gbp_build {
}
}
- if ($wantsrc > 0) {
+ build_prep($wantsrc);
+ if ($wantsrc & WANTSRC_SOURCE) {
build_source();
midbuild_checkchanges_vanilla $wantsrc;
} else {
if (!$clean_using_builder) {
push @cmd, '--git-cleaner=true';
}
- build_prep();
}
maybe_unapply_patches_again();
- if ($wantsrc < 2) {
+ if ($wantsrc & WANTSRC_BUILDER) {
push @cmd, changesopts();
runcmd_ordryrun_local @cmd, @ARGV;
}
@@ -6385,77 +6389,158 @@ sub cmd_gbp_build {
}
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 building_source_in_playtree {
+ # If $includedirty, we have to build the source package from the
+ # working tree, not a playtree, so that uncommitted changes are
+ # included (copying or hardlinking them into the playtree could
+ # cause trouble).
+ #
+ # Note that if we are building a source package in split brain
+ # mode we do not support including uncommitted changes, because
+ # that makes quilt fixup too hard. I.e. ($split_brain && (dgit is
+ # building a source package)) => !$includedirty
+ return !$includedirty;
}
sub build_source {
- build_prep_early();
- build_prep();
$sourcechanges = changespat $version,'source';
if (act_local()) {
- unlink "../$sourcechanges" or $!==ENOENT
+ unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
or fail "remove $sourcechanges: $!";
}
- $dscfn = dscfn($version);
my @cmd = (@dpkgsource, qw(-b --));
- if ($split_brain) {
+ my $leafdir;
+ if (building_source_in_playtree()) {
+ $leafdir = 'work';
+ my $headref = git_rev_parse('HEAD');
+ # If we are in split brain, there is already a playtree with
+ # the thing we should package into a .dsc (thanks to quilt
+ # fixup). If not, make a playtree
+ prep_ud() unless $split_brain;
changedir $playground;
- runcmd_ordryrun_local @cmd, "work";
- my @udfiles = <${package}_*>;
- changedir $maindir;
- foreach my $f (@udfiles) {
- printdebug "source copy, found $f\n";
- next unless
- $f eq $dscfn or
- ($f =~ m/\.debian\.tar(?:\.\w+)$/ &&
- $f eq srcfn($version, $&));
- printdebug "source copy, found $f - renaming\n";
- rename "$playground/$f", "../$f" or $!==ENOENT
- or fail "put in place new source file ($f): $!";
+ unless ($split_brain) {
+ my $upstreamversion = upstreamversion $version;
+ unpack_playtree_linkorigs($upstreamversion, sub { });
+ unpack_playtree_mkwork($headref);
+ changedir '..';
}
} else {
- my $pwd = must_getcwd();
- my $leafdir = basename $pwd;
- changedir "..";
- runcmd_ordryrun_local @cmd, $leafdir;
- changedir $pwd;
+ $leafdir = basename $maindir;
+ changedir '..';
}
+ runcmd_ordryrun_local @cmd, $leafdir;
+
+ changedir $leafdir;
runcmd_ordryrun_local qw(sh -ec),
- 'exec >$1; shift; exec "$@"','x',
- "../$sourcechanges",
+ 'exec >../$1; shift; exec "$@"','x', $sourcechanges,
@dpkggenchanges, qw(-S), changesopts();
+ changedir '..';
+
+ printdebug "moving $dscfn, $sourcechanges, etc. to ".bpd_abs()."\n";
+ $dsc = parsecontrol($dscfn, "source package");
+
+ my $mv = sub {
+ my ($why, $l) = @_;
+ printdebug " renaming ($why) $l\n";
+ rename "$l", bpd_abs()."/$l"
+ or fail "put in place new built file ($l): $!";
+ };
+ foreach my $l (split /\n/, getfield $dsc, 'Files') {
+ $l =~ m/\S+$/ or next;
+ $mv->('Files', $&);
+ }
+ $mv->('dsc', $dscfn);
+ $mv->('changes', $sourcechanges);
+
+ changedir $maindir;
}
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 {
+sub cmd_push_source {
+ prep_push();
+ 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",
+ "source changes file");
+ unless (test_source_only_changes($changes)) {
+ fail "user-specified changes file is not source-only";
+ }
+ } else {
+ # Building a source package is very fast, so just do it
+ build_source();
+ die "er, patches are applied dirtily but shouldn't be.."
+ if $patches_applied_dirtily;
+ $changesfile = $sourcechanges;
+ }
+ dopush();
+}
+
+sub binary_builder {
+ my ($bbuilder, $pbmc_msg, @args) = @_;
+ build_prep(WANTSRC_SOURCE);
build_source();
midbuild_checkchanges();
- in_parent {
+ in_bpd {
if (act_local()) {
- stat_exists $dscfn or fail "$dscfn (in parent directory): $!";
+ stat_exists $dscfn or fail "$dscfn (in build products dir): $!";
stat_exists $sourcechanges
- or fail "$sourcechanges (in parent directory): $!";
+ or fail "$sourcechanges (in build products dir): $!";
}
- runcmd_ordryrun_local @sbuild, qw(-d), $isuite, @ARGV, $dscfn;
+ runcmd_ordryrun_local @$bbuilder, @args;
};
maybe_unapply_patches_again();
- in_parent {
- postbuild_mergechanges(<<END);
+ in_bpd {
+ postbuild_mergechanges($pbmc_msg);
+ };
+}
+
+sub cmd_sbuild {
+ build_prep_early();
+ 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
- };
-}
+}
+
+sub pbuilder ($) {
+ my ($pbuilder) = @_;
+ build_prep_early();
+ # @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"
+ 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
+ # to include "build" in their customised value. However, if the
+ # user passes any additional args to pbuilder using the dgit
+ # option --pbuilder:foo, such args need to come after the "build"
+ # verb. opts_opt_multi_cmd does all of that.
+ binary_builder([opts_opt_multi_cmd ["build"], @$pbuilder], undef,
+ qw(--debbuildopts), "@ARGV", qw(--distribution), $isuite,
+ $dscfn);
+}
+
+sub cmd_pbuilder {
+ pbuilder(\@pbuilder);
+}
+
+sub cmd_cowbuilder {
+ pbuilder(\@cowbuilder);
+}
sub cmd_quilt_fixup {
badusage "incorrect arguments to dgit quilt-fixup" if @ARGV;
@@ -6585,7 +6670,7 @@ END
my @dfi = dsc_files_info();
foreach my $fi (@dfi) {
my $f = $fi->{Filename};
- my $here = "../$f";
+ my $here = "$buildproductsdir/$f";
if (lstat $here) {
next if stat $here;
fail "lstat $here works but stat gives $! !";
@@ -6846,9 +6931,9 @@ sub parseopts () {
} elsif (m/^--(gbp|dpm)$/s) {
push @ropts, "--quilt=$1";
$quilt_mode = $1;
- } elsif (m/^--ignore-dirty$/s) {
+ } elsif (m/^--(?:ignore|include)-dirty$/s) {
push @ropts, $_;
- $ignoredirty = 1;
+ $includedirty = 1;
} elsif (m/^--no-quilt-fixup$/s) {
push @ropts, $_;
$quilt_mode = 'nocheck';
@@ -6890,10 +6975,6 @@ sub parseopts () {
push @ropts, $_;
$tagformat_want = [ $1, 'command line', 1 ];
# 1 menas overrides distro configuration
- } elsif (m/^--always-split-source-build$/s) {
- # undocumented, for testing
- push @ropts, $_;
- $need_split_build_invocation = 1;
} elsif (m/^--config-lookup-explode=(.+)$/s) {
# undocumented, for testing
push @ropts, $_;
@@ -6974,8 +7055,8 @@ sub check_env_sanity () {
foreach my $name (qw(PIPE CHLD)) {
my $signame = "SIG$name";
my $signum = eval "POSIX::$signame" // die;
- ($SIG{$name} // 'DEFAULT') eq 'DEFAULT' or
- die "$signame is set to something other than SIG_DFL\n";
+ die "$signame is set to something other than SIG_DFL\n"
+ if defined $SIG{$name} and $SIG{$name} ne 'DEFAULT';
$blocked->ismember($signum) and
die "$signame is blocked\n";
}
@@ -7047,7 +7128,8 @@ sub parseopts_late_defaults () {
$$vr = $v;
}
- $need_split_build_invocation ||= quiltmode_splitbrain();
+ fail "dgit: --include-dirty is not supported in split view quilt mode"
+ if $split_brain && $includedirty;
if (!defined $cleanmode) {
local $access_forpush;
@@ -7057,6 +7139,11 @@ sub parseopts_late_defaults () {
badcfg "unknown clean-mode \`$cleanmode'" unless
$cleanmode =~ m/^($cleanmode_re)$(?!\n)/s;
}
+
+ $buildproductsdir //= access_cfg('build-products-dir', 'RETURN-UNDEF');
+ $buildproductsdir //= '..';
+ $bpd_glob = $buildproductsdir;
+ $bpd_glob =~ s#[][\\{}*?~]#\\$&#g;
}
if ($ENV{$fakeeditorenv}) {
diff --git a/dgit-maint-debrebase.7.pod b/dgit-maint-debrebase.7.pod
index e492768..685a6b2 100644
--- a/dgit-maint-debrebase.7.pod
+++ b/dgit-maint-debrebase.7.pod
@@ -406,7 +406,8 @@ is a single debrebase stitch.
=head1 BUILDING AND UPLOADING
You can use dpkg-buildpackage(1) for test builds. When you are ready
-to build for an upload, use B<dgit sbuild>.
+to build for an upload, use B<dgit sbuild>, B<dgit pbuilder> or B<dgit
+cowbuilder>.
Upload with B<dgit push> or B<dgit push-source>. Remember to pass
I<--new> if the package is new in the target suite.
@@ -618,7 +619,7 @@ using git-rebase(1) directly. For example,
=over 4
- % git debrebase launder
+ % git debrebase
% git rebase -i HEAD~5 # there are 4 Debian patches
=back
diff --git a/dgit-maint-gbp.7.pod b/dgit-maint-gbp.7.pod
index 3c438ab..b8abd66 100644
--- a/dgit-maint-gbp.7.pod
+++ b/dgit-maint-gbp.7.pod
@@ -31,6 +31,15 @@ normally used with patches-unapplied.
=head1 GIT CONFIGURATION
+If you have configured an I<export-dir> in your gbp.conf, you should
+tell dgit about it:
+
+=over 4
+
+ % git config --global dgit.default.build-products-dir /home/spwhitton/build-area
+
+=back
+
If you run
=over 4
@@ -46,20 +55,24 @@ branch, never the dgit patches-applied branch.
=head1 BUILDING
-You can perform builds like this:
+You can perform test builds like this:
=over 4
- % dgit [--allow-dirty] gbp-build [OPTIONS]
+ % dgit [--include-dirty] gbp-build [OPTIONS]
=back
-where I<--allow-dirty> is needed for testing uncommitted changes, and
+where I<--include-dirty> is needed for testing uncommitted changes, and
I<OPTIONS> are any further options to be passed on to
gbp-buildpackage(1).
-When you are ready to build for upload, you will probably want to use
-sbuild(1) or pbuilder(1), or do a source-only upload. Either
+If you are doing a source-only upload, you do not need to prepare a
+I<_source.changes>, as B<dgit push-source> will take of that on your
+behalf.
+
+If you need to include binaries with your upload, you will probably
+want to use sbuild(1), pbuilder(1) or cowbuilder(1):
=over 4
@@ -67,37 +80,33 @@ sbuild(1) or pbuilder(1), or do a source-only upload. Either
=back
-or
+replacing 'sbuild' with 'pbuilder' or 'cowbuilder' if appropriate.
-=over 4
+We use I<--rm-old-changes> to ensure that there is exactly one changes
+file corresponding to this package, so we can be confident we're
+uploading what we intend (though B<dgit push> will do some safety
+checks).
- % dgit --rm-old-changes gbp-build --git-pbuilder
+Note that none of the commands in this section are required to upload
+with dgit. You can invoke gbp-buildpackage(1), pbuilder(1),
+cowbuilder(1) and sbuild(1) directly. However, the defaults for these
+tools may leave you with something that dgit will refuse to upload
+because it doesn't match your git HEAD.
-=back
+As a general rule, leave all signing and tagging to dgit.
+
+=head1 UPLOADING
-or
+Don't use I<--git-tag>: B<dgit push> will do this for you. To do a
+source-only upload:
=over 4
- % dgit --rm-old-changes --gbp build-source
+ % dgit --gbp push-source
=back
-We use I<--rm-old-changes> to ensure that there is exactly one changes
-file corresponding to this package, so we can be confident we're
-uploading what we intend (though B<dgit push> will do some safety
-checks).
-
-Note that all of the commands in this section are not required to
-upload with dgit. You can invoke gbp-buildpackage(1), pbuilder(1) and
-sbuild(1) directly. However, the defaults for these tools may leave
-you with something that dgit will refuse to upload because it doesn't
-match your git HEAD. As a general rule, leave all signing and tagging
-to dgit.
-
-=head1 UPLOADING
-
-Don't use I<--git-tag>: B<dgit push> will do this for you. To upload:
+or if you need to include binaries,
=over 4
@@ -106,7 +115,7 @@ Don't use I<--git-tag>: B<dgit push> will do this for you. To upload:
=back
This will push your git history to the dgit-repos, but you probably
-want to follow it up with a push to alioth.
+want to follow it up with a push to salsa.
You will need to pass I<--overwrite> if the previous upload was not
performed with dgit.
diff --git a/dgit-maint-merge.7.pod b/dgit-maint-merge.7.pod
index a02e1fd..c20a252 100644
--- a/dgit-maint-merge.7.pod
+++ b/dgit-maint-merge.7.pod
@@ -68,12 +68,12 @@ been tagged '1.2.2' by upstream.
The final command detaches your master branch from the upstream remote,
so that git doesn't try to push anything there, or merge unreleased
upstream commits. If you want to maintain a copy of your packaging
-branch on B<alioth.debian.org> in addition to B<dgit-repos>, you can
+branch on B<salsa.debian.org> in addition to B<dgit-repos>, you can
do something like this:
=over 4
- % git remote add -f origin git.debian.org:/git/collab-maint/foo.git
+ % git remote add -f origin salsa.debian.org:Debian/foo.git
% git push --follow-tags -u origin master
=back
@@ -173,11 +173,11 @@ Then we can import the upstream version:
Our upstream branch cannot be pushed to B<dgit-repos>, but since we
will need it whenever we import a new upstream version, we must push
-it somewhere. The usual choice is B<alioth.debian.org>:
+it somewhere. The usual choice is B<salsa.debian.org>:
=over 4
- % git remote add -f origin git.debian.org:/git/collab-maint/foo.git
+ % git remote add -f origin salsa.debian.org:Debian/foo.git
% git push --follow-tags -u origin master upstream
=back
@@ -311,11 +311,11 @@ important information present in README.source.
=head1 BUILDING AND UPLOADING
-Use B<dgit build>, B<dgit sbuild>, B<dgit build-source>, and B<dgit
-push> as detailed in dgit(1). If any command fails, dgit will provide
-a carefully-worded error message explaining what you should do. If
-it's not clear, file a bug against dgit. Remember to pass I<--new>
-for the first upload.
+Use B<dgit build>, B<dgit sbuild>, B<dgit pbuilder>, B<dgit
+cowbuilder>, B<dgit push-source>, and B<dgit push> as detailed in
+dgit(1). If any command fails, dgit will provide a carefully-worded
+error message explaining what you should do. If it's not clear, file
+a bug against dgit. Remember to pass I<--new> for the first upload.
As an alternative to B<dgit build> and friends, you can use a tool
like gitpkg(1). This works because like dgit, gitpkg(1) enforces that
@@ -344,7 +344,7 @@ to git), you can just run dpkg-buildpackage(1) or debuild(1) instead.
You will need the I<debian/gbp.conf> from "When upstream releases only
tarballs", above. You will also need your upstream branch. Above, we
-pushed this to B<alioth.debian.org>. You will need to clone or fetch
+pushed this to B<salsa.debian.org>. You will need to clone or fetch
from there, instead of relying on B<dgit clone>/B<dgit fetch> alone.
Then, either
diff --git a/dgit-maint-native.7.pod b/dgit-maint-native.7.pod
index 34aaaff..ac57728 100644
--- a/dgit-maint-native.7.pod
+++ b/dgit-maint-native.7.pod
@@ -65,6 +65,10 @@ Simply prepare your git tree in the usual way, and then:
(Do not make any tags yourself: dgit push will do that.)
+You may use B<dgit pbuilder> or B<dgit cowbuilder>
+instead of B<dgit sbuild>;
+see dgit(1) for the syntax of those subcommands.
+
The --overwrite option tells dgit that you are expecting
that your git history is not a descendant of the
history which dgit synthesised from the previous
diff --git a/dgit-sponsorship.7.pod b/dgit-sponsorship.7.pod
index 0808329..3fbdac8 100644
--- a/dgit-sponsorship.7.pod
+++ b/dgit-sponsorship.7.pod
@@ -30,7 +30,7 @@ This section is addressed to the sponsee:
=head2 General
You should prepare the package as if you were going
-to upload it with C<dgit push> yourself.
+to upload it with C<dgit push-source> or C<dgit push> yourself.
For a straightforward NMU, consult L<dgit-nmu-simple(7)>.
@@ -102,7 +102,7 @@ against the sponsorship-requests pseudo-package.
The sponsee should push their HEAD as a git branch
to any suitable git server.
They can use their own git server;
-alioth is another possibility.
+salsa is another possibility.
The branch names used by the sponsee on their local machine,
and on the server, do not matter.
@@ -220,7 +220,7 @@ C<dgit fetch sid> will get you an up-to-date
C<refs/remotes/dgit/dgit/sid>
showing what's in the archive already.
-C<dgit -wgf --damp-run push>
+C<dgit -wgf --damp-run push-source>
will check that dgit can build an appropriate source package.
There is no need to run debdiff.
@@ -234,6 +234,8 @@ When you have completed your source review,
and use
C<dgit -wgf [--quilt=...] sbuild -A -C>
or similar, to to the build, and then
+C<dgit -wgf [--quilt=...] push-source>
+or
C<dgit -wgf [--quilt=...] push>
to do the upload.
diff --git a/dgit.1 b/dgit.1
index 1460938..a4b1694 100644
--- a/dgit.1
+++ b/dgit.1
@@ -17,6 +17,10 @@ dgit \- git integration with the Debian archive
[\fIbuild\-opts\fP]
.br
.B dgit
+[\fIdgit\-opts\fP] \fBpbuilder\fP|\fBcowbuilder\fP
+[\fIdebbuildopts\fP]
+.br
+.B dgit
[\fIdgit\-opts\fP] \fBpush\fP|\fBpush-source\fP [\fIdgit\-opts\fP]
[\fIsuite\fP]
.br
@@ -194,6 +198,35 @@ You probably want to pass -A, to request those.
.IP
Tagging, signing and actually uploading should be left to dgit push.
.TP
+\fBdgit pbuilder\fR [\fIdebbuildopts\fP]
+Constructs the source package, uses
+.B pbuilder
+to do a binary build, and uses mergechanges to merge the source and
+binary changes files.
+The output is left in
+.IR package \fB_\fR version \fB_multi.changes\fR.
+
+You should ensure that your dgit --build-products-dir setting matches
+your pbuilder --buildresult.
+
+The \fIdebbuildopts\fP are passed to pbuilder using its --debbuildopts
+option. If you want to pass other options to pbuilder, use the
+\fB--pbuilder:\fR dgit option as described below
+(remember that dgit options should appear between \fBdgit\fR and
+\fBpbuilder\fR).
+
+You should ensure that in your pbuilderrc you do
+.B not
+have the setting
+.B SOURCE_ONLY_CHANGES=yes
+as this may cause trouble.
+.TP
+\fBdgit cowbuilder\fR [\fIdebbuildopts\fP]
+Like \fBdgit pbuilder\fR, but uses
+.B cowbuilder
+instead of
+.B pbuilder.
+.TP
\fBdgit gbp-build\fR ...
Runs
.B git-buildpackage
@@ -529,12 +562,17 @@ refuse to push. It may (for Debian, will) be unable to access the git
history for any packages which have been newly pushed and have not yet
been published.
.TP
-.BR --ignore-dirty
-Do not complain if the working tree does not match your git HEAD.
+.BR --include-dirty
+Do not complain if the working tree does not match your git HEAD,
+and when building,
+include the changes from your working tree.
This can be useful with build, if you plan to commit later. (dgit
push will still ensure that the .dsc you upload and the git tree
you push are identical, so this option won't make broken pushes.)
.TP
+.BR --ignore-dirty
+Deprecated alias for --include-dirty.
+.TP
.BR --overwrite [=\fIprevious-version\fR]
Declare that your HEAD really does contain
all the (wanted) changes
@@ -839,9 +877,20 @@ Note that \fBdgit push-source\fR will always find the right .changes,
regardless of this option.
.TP
.BI --build-products-dir= directory
-Specifies where to find the built files to be uploaded.
-By default, dgit looks in the parent directory
+Specifies where to find and create tarballs, binry packages,
+source packages, .changes files, and so on.
+
+By default, dgit uses the parent directory
.RB ( .. ).
+
+Changing this setting may necessitate
+moving .orig tarballs to the new directory,
+so it is probably best to
+use the
+.BI dgit.default.build-products-dir
+configuration setting
+(see CONFIGURATION, below)
+which this command line option overrides).
.TP
.BI --no-rm-on-error
Do not delete the destination directory if clone fails.
@@ -912,6 +961,8 @@ Specifies a single additional option to pass to
.BR dpkg-buildpackage ,
.BR dpkg-genchanges ,
.BR sbuild ,
+.BR pbuilder ,
+.BR cowbuilder ,
.BR ssh ,
.BR dgit ,
.BR git-debrebase ,
@@ -959,6 +1010,8 @@ Specifies alternative programs to use instead of
.BR dpkg-buildpackage ,
.BR dpkg-genchanges ,
.BR sbuild ,
+.BR pbuilder ,
+.BR cowbuilder ,
.BR gpg ,
.BR ssh ,
.BR dgit ,
@@ -997,6 +1050,14 @@ In both cases,
unusually, the specified value is split on whitespace
to produce a command and possibly some options and/or arguments.
+For pbuilder and cowbuilder, the defaults are
+.BR "sudo -E pbuilder"
+and
+.BR "sudo -E cowbuilder"
+respectively.
+Like with gbp-build and gbp pq,
+the specified value is split on whitespace.
+
For
.BR ssh ,
the default value is taken from the
@@ -1096,6 +1157,12 @@ on the dgit command line.
.LP
Settings likely to be useful for an end user include:
.TP
+.BI dgit.default.build-products-dir
+Specifies where to find the built files to be uploaded,
+when --build-products-dir is not specified. The default is
+the parent directory
+.RB ( .. ).
+.TP
.BR dgit-suite. \fIsuite\fR .distro " \fIdistro\fR"
Specifies the distro for a suite. dgit keys off the suite name (which
appears in changelogs etc.), and uses that to determine the distro
diff --git a/git-debrebase b/git-debrebase
index f002225..07e5f47 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -970,7 +970,8 @@ sub defaultcmd_rebase () {
}
sub cmd_analyse () {
- die if ($ARGV[0]//'') =~ m/^-/;
+ badusage "analyse does not support any options"
+ if @ARGV and $ARGV[0] =~ m/^-/;
badusage "too many arguments to analyse" if @ARGV>1;
my ($old) = @ARGV;
if (defined $old) {
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian
index 990abd2..e85e92c 100755
--- a/infra/dgit-repos-policy-debian
+++ b/infra/dgit-repos-policy-debian
@@ -334,10 +334,19 @@ sub action_push () {
if (deliberately('include-questionable-history')) {
return 0;
}
- die "\nPackage is in NEW and has not been accepted or rejected yet;".
- " use a --deliberately option to specify whether you are".
- " keeping or discarding the previously pushed history. ".
- " Please RTFM dgit(1).\n\n";
+ die <<END;
+
+Package is in NEW and has not been accepted or rejected yet.
+Unfortunately, we cannot determine automatically what should happen.
+You will have to pass either --deliberately-not-fast-forward or
+--deliberately-include-questionable-history to specify whether you are
+keeping or discarding the previously pushed history.
+
+The choice is important, to ensure that your git history is both
+suitable for public distribution and as useful as possible. Please
+see the descriptions of these options in dgit(1).
+
+END
}
sub action_push_confirm () {
diff --git a/tests/Makefile b/tests/Makefile
index e6ce153..8494284 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -7,19 +7,12 @@ TESTSCRIPTS ?= $(shell tests/enumerate-tests)
TESTNAMES := $(notdir $(TESTSCRIPTS))
all: $(foreach t,$(TESTNAMES),tests/tmp/$t.ok)
- @echo "ALL PASSED"
-
-tests/tmp:
- mkdir -p $@
+ @echo "ALL PASSED$${DGIT_TESTS_PROGRESSIVE+ AT SOME POINT}"
+tests/tmp/%.ok:
ifeq ($(DGIT_TEST_RETRY_COUNT),)
-
-tests/tmp/%.ok: tests/tmp
tests/tests/$* >tests/tmp/$*.log 2>&1
-
else
-
-tests/tmp/%.ok: tests/tmp
@for retry in $$( seq 1 $(DGIT_TEST_RETRY_COUNT) ); do \
echo "[$$retry] $*"; \
tests/tests/$* >tests/tmp/$*.$$retry.log 2>&1; \
@@ -27,5 +20,5 @@ tests/tmp/%.ok: tests/tmp
if [ $$rc = 0 ]; then exit 0; fi; \
echo >&2 "[$$retry] $* TEST FAILED $$rc"; \
done; exit $$rc
-
endif
+ @touch $@
diff --git a/tests/lib b/tests/lib
index 99345ce..6028133 100644
--- a/tests/lib
+++ b/tests/lib
@@ -40,6 +40,7 @@ root=`pwd`
troot=$root/tests
testname="${DGIT_TEST_TESTNAME-${0##*/}}"
export DGIT_TEST_TROOT=$troot
+bpd=..
tmp=$ADTTMP
if [ x"$tmp" = x ]; then
@@ -64,6 +65,7 @@ env -0 >$tmp/.save-env
ln -f $troot/ssh ssh
export DEBCHANGE_VENDOR=dpkg
+unset VISUAL
mkdir -p $tmp/incoming
cat <<END >$tmp/dput.cf
@@ -73,6 +75,9 @@ incoming = $tmp/incoming
run_dinstall = 0
END
+schroot=${DGIT_SCHROOT_CHROOT:-build}
+# Pretty much any Debian sid snapshot schroot will do.
+
: ${t_archive_method:=aq}
: ${tagpfx:=archive/test-dummy}
: ${suitespecs:=sid:unstable}
@@ -670,6 +675,12 @@ t-push-was-source-only () {
done
}
+t-push-included () {
+ for f in $@; do
+ stat $tmp/incoming/$f
+ done
+}
+
t-pushed-good () {
local branch=$1
local suite=${2:-sid}
@@ -697,6 +708,12 @@ t-pushed-good-core () {
git verify-tag `t-v-tag`
}
+t-pushed-good-check-changes () {
+ changes_filename="$tmp/incoming/${p}_${v}_*.changes"
+ grep -E "^Distribution: $suite" $changes_filename
+ grep -E "^Version: $v" $changes_filename
+}
+
t-splitbrain-pushed-good--unpack () {
cd $tmp
rm -rf t-unpack
@@ -1129,6 +1146,16 @@ t-policy-periodic () {
: '))))))))))))))))))))))))))))))))))))))))'
}
+t-buildproductsdir-config () {
+ bpd=$tmp/bpd
+ t-git-config dgit.default.build-products-dir $bpd
+ mkdir -p $bpd
+ cat <<END >>$tmp/.gbp.conf
+[buildpackage]
+export-dir = $bpd
+END
+}
+
t-restrict () {
local restriction=$1
(cd $root; t-restriction-$restriction >&2)
diff --git a/tests/lib-build-modes b/tests/lib-build-modes
index ee2975d..3bb1bf3 100644
--- a/tests/lib-build-modes
+++ b/tests/lib-build-modes
@@ -87,7 +87,7 @@ bm-quirk-sbuild-after-act () {
# provide sbuild with the dsc, not the tree, so we simply
# ignore all executions of the clean target by schroot.
local arch; arch=$(dpkg-architecture -qDEB_BUILD_ARCH)
- local sblog=../example_${v}_$arch.build
+ local sblog=$bpd/example_${v}_$arch.build
if [ -e $sblog ]; then
sed '
s/^EXAMPLE RULES TARGET clean/HOOK SUPPRESSED &/;
@@ -120,7 +120,31 @@ bm-compute-expected () {
exec 4>$bmexp
echo >&4 "$heading"
- case $cleanmode in
+ local eff_cleanmode=$cleanmode
+
+ case "$e_targets" in
+ *[^\ ]*)
+ ;;
+ *)
+ # dgit won't bother cleaning the tree
+ # if no build is going to be run
+ eff_cleanmode=none
+ ;;
+ esac
+
+ case "$act" in
+ sbuild*)
+ # dgit sbuild won't bother cleaning the tree
+ # because it doesn't need to to make a .dsc for sbuild
+ eff_cleanmode=none
+ ;;
+ esac
+
+ # we are running the builder in-tree ?
+ # when we have --include-dirty, we will want to check
+ # that too and reset eff_cleanmode to $cleanmode
+
+ case $eff_cleanmode in
git) echo >&4 'BUILD-MODES PROGRAM git clean -xdf' ;;
git-ff) echo >&4 'BUILD-MODES PROGRAM git clean -xdff' ;;
check) echo >&4 'BUILD-MODES PROGRAM git clean -xdn' ;;
@@ -155,7 +179,7 @@ bm-run-one () {
bmid="$act,$cleanmode,$branch"
bmid=${bmid// /_}
- rm -f ../${p}_{v}_*.changes
+ rm -f $bpd/${p}_{v}_*.changes
heading="===== [$bmid] dgit $args ====="
@@ -168,7 +192,7 @@ bm-run-one () {
git checkout $branch
git clean -xdf # since we might not do any actual cleaning
- dsc="../example_$v.dsc"
+ dsc="$bpd/example_$v.dsc"
rm -f $dsc
set +o pipefail
@@ -199,7 +223,7 @@ bm-run-one () {
bm-report-test "SOURCE FILE" [ -e $dsc ]
if [ $actual_status = success ]; then
- local changes; changes=$(echo ../example_${v}_*.changes)
+ local changes; changes=$(echo $bpd/example_${v}_*.changes)
case "$changes" in
*' '*) fail "build generated ambiguous .changes: $changes" ;;
esac
@@ -226,10 +250,3 @@ bm-act-iterate () {
done
: bm-act-iterate done.
}
-
-bm-alwayssplit () {
- local t=${0##*/}
- DGIT_TEST_BM_BASEARGS+=' --always-split-source-build'
- export DGIT_TEST_BM_BASEARGS
- t-chain-test "${t%%-asplit}"
-}
diff --git a/tests/lib-import-chk b/tests/lib-import-chk
index d6633f9..e18f66e 100644
--- a/tests/lib-import-chk
+++ b/tests/lib-import-chk
@@ -45,7 +45,7 @@ t-import-chk2() {
# The resulting .dsc does not have a Dgit line (because dgit push
# puts that in). So we just shove it in the archive now
- ln ../${p}_${v}.* $tmp/mirror/pool/main/
+ ln $bpd/${p}_${v}.* $tmp/mirror/pool/main/
t-archive-query
t-dgit fetch
@@ -62,9 +62,9 @@ t-import-chk2() {
t-ref-same refs/remotes/dgit/dgit/sid
t-ref-same refs/heads/first-2nd-import
- for orig in ../${p}_${v%-*}.orig*.tar.*; do
- tar -atf $orig | t-sort >../files.o
- pfx=$(perl <../files.o -ne '
+ for orig in $bpd/${p}_${v%-*}.orig*.tar.*; do
+ tar -atf $orig | t-sort >$bpd/files.o
+ pfx=$(perl <$bpd/files.o -ne '
while (<>) {
m#^([^/]+/)# or exit 0;
$x //= $1;
@@ -75,20 +75,20 @@ t-import-chk2() {
perl -i~ -pe '
s#^\Q'"$pfx"'\E##;
$_="" if m/^$/ || m#/$# || m#^\.git/#;
- ' ../files.o
- orig=${orig#../}
+ ' $bpd/files.o
+ orig=${orig#$bpd/}
pat="^Import ${orig//./\\.}\$"
t-refs-same-start
for start in first-import first-2nd-import; do
git log --pretty='tformat:%H' --grep "$pat" $start \
- >../t.imp
- test $(wc -l <../t.imp) = 1
- imp=$(cat ../t.imp)
+ >$bpd/t.imp
+ test $(wc -l <$bpd/t.imp) = 1
+ imp=$(cat $bpd/t.imp)
t-ref-same-val "$orig $start" "$imp"
done
git ls-tree -r --name-only "$t_ref_val:" \
- | t-sort >../files.g
- diff ../files.{o,g}
+ | t-sort >$bpd/files.g
+ diff $bpd/files.{o,g}
done
cd ..
}
diff --git a/tests/lib-restricts b/tests/lib-restricts
index bb695c4..dfaaa25 100644
--- a/tests/lib-restricts
+++ b/tests/lib-restricts
@@ -13,6 +13,8 @@ t-restriction-x-dgit-git-only () {
}
t-restriction-x-dgit-schroot-build () {
+ # if DGIT_SCHROOT_CHROOT is set, user wants not to skip this test
+ if [ "x${DGIT_SCHROOT_CHROOT}" != x ]; then return 0; fi
schroot -l -c build 2>&1 >/dev/null || return 1
}
diff --git a/tests/pretend-pbuilder b/tests/pretend-pbuilder
new file mode 100755
index 0000000..8495a2f
--- /dev/null
+++ b/tests/pretend-pbuilder
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Getopt::Long;
+
+my $operation = shift;
+die "pbuilder: you should use me only to build, dgit"
+ unless ($operation eq "build" || $operation eq "b");
+
+my $debbuildopts = undef;
+my $distribution = undef;
+GetOptions('debbuildopts=s' => \$debbuildopts,
+ 'distribution=s' => \$distribution);
+
+# ignore user args; last argument has to be the .dsc filename
+my $dsc = $ARGV[-1];
+die "pbuilder: last argument has wrong file extension"
+ unless ($dsc =~ m/^(.*)_.*\.dsc$/);
+
+system "dpkg-source -x $dsc pbuilder";
+chdir 'pbuilder';
+system <<END
+dpkg-buildpackage --changes-option=-DDistribution=$distribution $debbuildopts
+END
diff --git a/tests/run-all b/tests/run-all
index f72b9fa..c930171 100755
--- a/tests/run-all
+++ b/tests/run-all
@@ -1,10 +1,19 @@
#!/bin/bash
set -e
# convenience script for running the tests outside adt-run
-# usage: tests/using-intree tests/run-all
+# usage: tests/using-intree tests/run-all [-p|--progressive] [tests/tests/*]
set -o pipefail
+while [ $# != 0 ]; do
+ case "$1" in
+ --progressive|-p) shift; export DGIT_TESTS_PROGRESSIVE=y;;
+ --) shift; break ;;
+ -*) echo >&2 "run-all: unknown option $1"; exit 20 ;;
+ *) break ;;
+ esac
+done
+
ncpus=$(nproc || echo 1)
jcpus=-j$(( ncpus * 134 / 100 ))
@@ -14,6 +23,8 @@ fi
mkdir -p tests/tmp
+${DGIT_TESTS_PROGRESSIVE+:} rm -f tests/tmp/*.ok
+
export DGIT_GNUPG_STUNT_ERRLOG=$( tty -s ||: )
(
diff --git a/tests/tests/build-modes-asplit b/tests/tests/build-modes-asplit
deleted file mode 100755
index fa3bf8a..0000000
--- a/tests/tests/build-modes-asplit
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -e
-. tests/lib
-. $troot/lib-build-modes
-bm-alwayssplit
diff --git a/tests/tests/build-modes-gbp b/tests/tests/build-modes-gbp
index 50a6288..d99b791 100755
--- a/tests/tests/build-modes-gbp
+++ b/tests/tests/build-modes-gbp
@@ -4,6 +4,7 @@ set -e
. $troot/lib-build-modes
t-dependencies git-buildpackage
+t-buildproductsdir-config
quirk-clean-fixup () {
case $cleanmode in
diff --git a/tests/tests/build-modes-gbp-asplit b/tests/tests/build-modes-gbp-asplit
deleted file mode 100755
index fa3bf8a..0000000
--- a/tests/tests/build-modes-gbp-asplit
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -e
-. tests/lib
-. $troot/lib-build-modes
-bm-alwayssplit
diff --git a/tests/tests/build-modes-sbuild b/tests/tests/build-modes-sbuild
index 19dcc8a..be2d4c9 100755
--- a/tests/tests/build-modes-sbuild
+++ b/tests/tests/build-modes-sbuild
@@ -6,10 +6,12 @@ set -e
t-dependencies sbuild
t-restrict x-dgit-schroot-build
+t-buildproductsdir-config
+
bm_quirk_after_act=bm-quirk-sbuild-after-act
bm-prep
-act="sbuild -c build --no-arch-all"
+act="sbuild -c $schroot --no-arch-all"
real_act="$act"
bm-guess-e-source-e-targets "$act"
diff --git a/tests/tests/import-nonnative b/tests/tests/import-nonnative
index 3568563..7bb33a9 100755
--- a/tests/tests/import-nonnative
+++ b/tests/tests/import-nonnative
@@ -4,6 +4,7 @@ set -e
. $troot/lib-import-chk
t-tstunt-parsechangelog
+t-buildproductsdir-config
# 1.0 with diff
t-import-chk pari-extra 3-1
diff --git a/tests/tests/pbuilder b/tests/tests/pbuilder
new file mode 100755
index 0000000..2c9dbae
--- /dev/null
+++ b/tests/tests/pbuilder
@@ -0,0 +1,42 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+suitespecs+=' stable'
+
+t-buildproductsdir-config
+
+t-prep-newpackage example 1.0
+
+cd $p
+
+t-commit "make a commit" 1.1 stable
+
+t-tstunt pbuilder
+
+t-expect-fail "dgit: error: you asked for a builder but your debbuildopts didn't ask for any binaries -- is this really what you meant?" \
+t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder -S
+
+t-expect-fail "dgit: error: we must build a .dsc to pass to the builder but your debbuiltopts forbids the building of a source package; cannot continue" \
+t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder -b
+
+# it would be nice to try passing -g on the end of the following line
+# to confirm it gets massaged into -A, but the example package is
+# RC-buggy in that it doesn't build with -A ..
+t-dgit -v0 --pbuilder="$troot/pretend-pbuilder" pbuilder
+
+t-dgit -wgf push --new
+
+t-pushed-good master stable
+t-pushed-good-check-changes
+
+# check we actually built binaries
+t-push-included example_1.1_all.deb
+
+# this purpose of this is to check that the _source.changes that was
+# merged is the one that dgit made, not something pbuilder made (this
+# works because the -v$v in the above is handled by dgit and not
+# passed on to pbuilder)
+grep -F "example (1.0)" $changes_filename
+
+t-ok
diff --git a/tests/tests/push-source b/tests/tests/push-source
index 9d132e5..f0eafb8 100755
--- a/tests/tests/push-source
+++ b/tests/tests/push-source
@@ -3,6 +3,7 @@ set -e
. tests/lib
t-tstunt-parsechangelog
+t-buildproductsdir-config
t-prep-newpackage example 1.0
diff --git a/tests/tests/push-source-with-changes b/tests/tests/push-source-with-changes
index b9a3906..580ea3a 100755
--- a/tests/tests/push-source-with-changes
+++ b/tests/tests/push-source-with-changes
@@ -2,8 +2,6 @@
set -e
. tests/lib
-arch=$(dpkg-architecture -qDEB_BUILD_ARCH)
-
t-tstunt-parsechangelog
t-prep-newpackage example 1.0
@@ -18,7 +16,7 @@ t-ref-head
t-dgit --dpkg-buildpackage:-d build -F
t-expect-push-fail 'user-specified changes file is not source-only' \
-t-dgit -C ../${p}_1.0_${arch}.changes push-source --new
+t-dgit -C ../${p}_1.0_multi.changes push-source --new
# (2) try pushing a source-only changes file
diff --git a/tests/tests/quilt-gbp-build-modes-sbuild b/tests/tests/quilt-gbp-build-modes-sbuild
index 4c86bfe..ec1d1c7 100755
--- a/tests/tests/quilt-gbp-build-modes-sbuild
+++ b/tests/tests/quilt-gbp-build-modes-sbuild
@@ -7,6 +7,6 @@ t-dependencies sbuild
t-restrict x-dgit-schroot-build
bm-gbp-example-acts \
- 'sbuild -c build --arch-all' \
+ "sbuild -c $schroot --arch-all" \
t-ok
diff --git a/tests/tests/quilt-splitbrains b/tests/tests/quilt-splitbrains
index 9f0ae5f..6886cf8 100755
--- a/tests/tests/quilt-splitbrains
+++ b/tests/tests/quilt-splitbrains
@@ -35,9 +35,6 @@ want-success () {
echo "===== testing tree suitable for --quilt=gbp (only) ====="
-t-expect-fail 'grep: new-upstream-file: No such file or directory' \
-t-dgit --quilt=dpm build-source
-
t-expect-fail 'git tree differs from result of applying' \
t-dgit -wgf --quilt=dpm build-source
diff --git a/tests/tests/sbuild-gitish b/tests/tests/sbuild-gitish
index 6e497b2..7c0a30c 100755
--- a/tests/tests/sbuild-gitish
+++ b/tests/tests/sbuild-gitish
@@ -6,6 +6,7 @@ t-dependencies sbuild man-db
t-restrict x-dgit-schroot-build
t-tstunt-parsechangelog
+t-buildproductsdir-config
t-prep-newpackage example 1.1
@@ -16,7 +17,7 @@ buildrune=$(
next unless m/^ +\%/ .. 0;
next if !m/\S/ .. 0;
s/^ +\%//;
- $fixchr += s/(\s-c\s*)jessie(\s|$)/$1build$2/;
+ $fixchr += s/(\s-c\s*)jessie(\s|$)/$1'"$schroot"'$2/;
print or die $!;
END { $fixchr == 1 or die $fixchr; }
'