diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-12-06 20:58:13 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-16 16:47:47 +0100 |
commit | 4c49acc3a10c4aa95e1be956dde3df7df86aeae4 (patch) | |
tree | 5c02a754d8c40a7c3d93f01cd9842486ba5a2b96 /dgit | |
parent | 1ca959f4e5d5452052ca2abb7dfaf29c958f43c7 (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.
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -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", |