summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-12-06 20:58:13 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-07-16 16:47:47 +0100
commit4c49acc3a10c4aa95e1be956dde3df7df86aeae4 (patch)
tree5c02a754d8c40a7c3d93f01cd9842486ba5a2b96
parent1ca959f4e5d5452052ca2abb7dfaf29c958f43c7 (diff)
Split brain: Run source build in dgit view directory
And, after the source build is done, copy the resulting files out into the invocation directory's parent, where people expect to find them.
-rwxr-xr-xdgit28
1 files changed, 23 insertions, 5 deletions
diff --git a/dgit b/dgit
index 9763bbf..dd1a647 100755
--- a/dgit
+++ b/dgit
@@ -3442,11 +3442,29 @@ sub build_source {
runcmd_ordryrun_local @dpkgbuildpackage, qw(-us -uc -S -d),
changesopts();
} else {
- my $pwd = must_getcwd();
- my $leafdir = basename $pwd;
- changedir "..";
- runcmd_ordryrun_local @dpkgsource, qw(-b --), $leafdir;
- changedir $pwd;
+ my @cmd = (@dpkgsource, qw(-b --));
+ if ($split_brain) {
+ changedir $ud;
+ runcmd_ordryrun_local @cmd, "work";
+ my @udfiles = <${package}_*>;
+ changedir "../../..";
+ 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 "$ud/$f", "../$f" or $!==ENOENT
+ or fail "put in place new source file ($f): $!";
+ }
+ } else {
+ my $pwd = must_getcwd();
+ my $leafdir = basename $pwd;
+ changedir "..";
+ runcmd_ordryrun_local @cmd, $leafdir;
+ changedir $pwd;
+ }
runcmd_ordryrun_local qw(sh -ec),
'exec >$1; shift; exec "$@"','x',
"../$sourcechanges",