Commit 0c4ec983 authored by Leigh Stoller's avatar Leigh Stoller

When doing an export, place each run checkout in its own subdir.

parent 1570737f
......@@ -160,12 +160,6 @@ if (-e $checkout) {
system("mkdir -p $checkout") == 0
or fatal(-1, "Could not mkdir $checkout");
if (libArchive::TBCheckoutExperimentArchivebyExptIDX($exptidx,
$checkout,
$archive_tag) < 0) {
fatal(-1, "Could not checkout $archive_tag to $pid/.checkouts/$$");
}
#
# Since that worked, lets create the XML representation of it and stash
# to a file.
......@@ -249,6 +243,41 @@ open(DUMP, ">$checkout/export.xml")
print DUMP "$xml\n";
close(DUMP);
#
# Now dump a checkout of each run, in its own directory. Eventually we
# need to allow for sending out the actual repo instead of checkouts.
#
if (keys(%runlist)) {
$root->{"runs"} = {};
foreach my $name (keys(%runlist)) {
my $rowref = $runlist{$name};
my $runidx = $rowref->{"idx"};
my $dir = "$checkout/run${runidx}";
my $tag = $rowref->{"archive_tag"};
# This could happen if template still instantiated (last run).
next
if (!defined($tag) || $tag eq "");
system("mkdir -p $dir") == 0
or fatal(-1, "Could not mkdir $dir");
if (libArchive::TBCheckoutExperimentArchivebyExptIDX($exptidx,
$dir, $tag) < 0) {
fatal(-1, "Could not checkout $tag to $dir");
}
}
}
else {
# This would be silly; exporting an instance with no runs.
if (libArchive::TBCheckoutExperimentArchivebyExptIDX($exptidx,
$checkout,
$archive_tag) < 0) {
fatal(-1, "Could not checkout $archive_tag to $checkout");
}
}
if ($spew) {
system("$TAR zcf - -C $checkout .");
cleanup();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment