* Replace implementation of prep_ud with a call to fresh_playground
* Replace references to $ud with $playground
* Replace hardcoded changedir ../../.. etc. with $maindir
The overall functional change is fairly minimal. We now call getcwd
more often, and when we want to return to the maindir we changedir to
an absolute path instead of a relative one.
Later, we may rename prep_ud, mktree_in_ud_here, etc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
+use Debian::Dgit qw(:DEFAULT :playground);
setup_sigwarn();
use IO::Handle;
setup_sigwarn();
use IO::Handle;
our ($dsc_hash,$lastpush_mergeinput);
our ($dsc_distro, $dsc_hint_tag, $dsc_hint_url);
our ($dsc_hash,$lastpush_mergeinput);
our ($dsc_distro, $dsc_hint_tag, $dsc_hint_url);
-our $ud = '.git/dgit/unpack';
- my $d = $ud;
- rmtree($d);
- mkpath '.git/dgit';
- mkdir $d or die $!;
+ fresh_playground 'dgit/unpack';
}
sub mktree_in_ud_here () {
}
sub mktree_in_ud_here () {
# See big comment in fetch_from_archive, below.
# See also README.dsc-import.
prep_ud();
# See big comment in fetch_from_archive, below.
# See also README.dsc-import.
prep_ud();
my @dfi = dsc_files_info();
foreach my $fi (@dfi) {
my @dfi = dsc_files_info();
foreach my $fi (@dfi) {
@output = $lastpush_mergeinput;
}
}
@output = $lastpush_mergeinput;
}
}
- changedir '../../../..';
- rmtree($ud);
+ changedir $maindir;
+ rmtree $playground;
if (madformat_wantfixup($format)) {
# user might have not used dgit build, so maybe do this now:
if (quiltmode_splitbrain()) {
if (madformat_wantfixup($format)) {
# user might have not used dgit build, so maybe do this now:
if (quiltmode_splitbrain()) {
quilt_make_fake_dsc($upstreamversion);
my $cachekey;
($dgithead, $cachekey) =
quilt_make_fake_dsc($upstreamversion);
my $cachekey;
($dgithead, $cachekey) =
$actualhead, $dgithead,
$archive_hash);
$maintviewhead = $actualhead;
$actualhead, $dgithead,
$archive_hash);
$maintviewhead = $actualhead;
- changedir '../../../..';
prep_ud(); # so _only_subdir() works, below
} else {
commit_quilty_patch();
prep_ud(); # so _only_subdir() works, below
} else {
commit_quilty_patch();
progress "checking that $dscfn corresponds to HEAD";
runcmd qw(dpkg-source -x --),
$dscpath =~ m#^/# ? $dscpath : "../../../$dscpath";
my ($tree,$dir) = mktree_in_ud_from_only_subdir("source package");
check_for_vendor_patches() if madformat($dsc->{format});
progress "checking that $dscfn corresponds to HEAD";
runcmd qw(dpkg-source -x --),
$dscpath =~ m#^/# ? $dscpath : "../../../$dscpath";
my ($tree,$dir) = mktree_in_ud_from_only_subdir("source package");
check_for_vendor_patches() if madformat($dsc->{format});
- changedir '../../../..';
my @diffcmd = (@git, qw(diff --quiet), $tree, $dgithead);
debugcmd "+",@diffcmd;
$!=0; $?=-1;
my @diffcmd = (@git, qw(diff --quiet), $tree, $dgithead);
debugcmd "+",@diffcmd;
$!=0; $?=-1;
my $dgitview = git_rev_parse 'HEAD';
my $dgitview = git_rev_parse 'HEAD';
- changedir '../../../..';
# When we no longer need to support squeeze, use --create-reflog
# instead of this:
ensuredir ".git/logs/refs/dgit-intern";
# When we no longer need to support squeeze, use --create-reflog
# instead of this:
ensuredir ".git/logs/refs/dgit-intern";
runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache",
$dgitview;
runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache",
$dgitview;
- changedir '.git/dgit/unpack/work';
+ changedir "$playground/work";
my $saved = maybe_split_brain_save $headref, $dgitview, "converted";
progress "dgit view: created ($saved)";
my $saved = maybe_split_brain_save $headref, $dgitview, "converted";
progress "dgit view: created ($saved)";
my $headref = git_rev_parse('HEAD');
prep_ud();
my $headref = git_rev_parse('HEAD');
prep_ud();
my $upstreamversion = upstreamversion $version;
my $upstreamversion = upstreamversion $version;
die 'bug' if $split_brain && !$need_split_build_invocation;
die 'bug' if $split_brain && !$need_split_build_invocation;
- changedir '../../../..';
runcmd_ordryrun_local
@git, qw(pull --ff-only -q .git/dgit/unpack/work master);
}
runcmd_ordryrun_local
@git, qw(pull --ff-only -q .git/dgit/unpack/work master);
}
sub quilt_check_splitbrain_cache ($$) {
my ($headref, $upstreamversion) = @_;
# Called only if we are in (potentially) split brain mode.
sub quilt_check_splitbrain_cache ($$) {
my ($headref, $upstreamversion) = @_;
# Called only if we are in (potentially) split brain mode.
+ # Called in playground.
# Computes the cache key and looks in the cache.
# Returns ($dgit_view_commitid, $cachekey) or (undef, $cachekey)
# Computes the cache key and looks in the cache.
# Returns ($dgit_view_commitid, $cachekey) or (undef, $cachekey)
} else {
my @cmd = (@dpkgsource, qw(-b --));
if ($split_brain) {
} else {
my @cmd = (@dpkgsource, qw(-b --));
if ($split_brain) {
runcmd_ordryrun_local @cmd, "work";
my @udfiles = <${package}_*>;
runcmd_ordryrun_local @cmd, "work";
my @udfiles = <${package}_*>;
foreach my $f (@udfiles) {
printdebug "source copy, found $f\n";
next unless
foreach my $f (@udfiles) {
printdebug "source copy, found $f\n";
next unless
($f =~ m/\.debian\.tar(?:\.\w+)$/ &&
$f eq srcfn($version, $&));
printdebug "source copy, found $f - renaming\n";
($f =~ m/\.debian\.tar(?:\.\w+)$/ &&
$f eq srcfn($version, $&));
printdebug "source copy, found $f - renaming\n";
- rename "$ud/$f", "../$f" or $!==ENOENT
+ rename "$playground/$f", "../$f" or $!==ENOENT
or fail "put in place new source file ($f): $!";
}
} else {
or fail "put in place new source file ($f): $!";
}
} else {