Skip to content

Commit

Permalink
Stage distribution in a separate process
Browse files Browse the repository at this point in the history
  • Loading branch information
ugexe committed Apr 29, 2024
1 parent 97664e5 commit 5fbdfa0
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions lib/Zef/Client.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -1087,13 +1087,31 @@ class Zef::Client {
});
my Str @includes = $staging-repo.path-spec;
$_.dist.metainfo<includes> = @includes;
$staging-repo.install($_.dist, :precompile($!precompile-install));
self.logger.emit({
level => INFO,
stage => STAGING,
phase => AFTER,
message => "Staging [OK] for {$_.dist.identity}",
});

# Spawn a new process to run CompUnit::Repository::Staging.install(...) to ensure we have a clean slate.
# We turn the Zef::Distribution::Local into a Distribution::Hash so the new process doesn't need to have
# a repo path pointing to Zef::Distribution::Local.
my $bare-dist = Distribution::Hash.new($_.dist.meta, :prefix($_.dist.path.IO));
my $staged := try so Zef::zrun(:!out, :!err, :cwd($_.dist.path), $*EXECUTABLE, '-e', "{$staging-repo.raku}.install({$bare-dist.raku}, :precompile({$!precompile-install}))");

if $staged {
self.logger.emit({
level => INFO,
stage => STAGING,
phase => AFTER,
message => "Staging [OK] for {$_.dist.identity}",
});
}
else {
self.logger.emit({
level => ERROR,
stage => STAGING,
phase => AFTER,
candi => $_,
message => "Staging [FAIL]: {$_.dist.?identity // $_.as} from {$_.uri}",
});
die("Aborting due to staging failure: {$_.dist.?identity // $_.uri}");
}

$_;
});
Expand Down

0 comments on commit 5fbdfa0

Please sign in to comment.