Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 80 lines (68 sloc) 2.05 KB
#!/usr/bin/env perl6
use Panda;
use Shell::Command;
sub gen-result-success($project) {
{ prereq => True, build => True, test => True, warnings => (($project.build-stderr // '') ~~ / \S /).Bool }
}
sub gen-result-failure($ex) {
my %res = do given $ex.?stage {
when 'resolve' | 'fetch' {
{ prereq => False }
}
when 'build' {
{ prereq => True, build => False }
}
when 'test' {
{ prereq => True, build => True, test => False }
}
default {
say $ex.perl;
{ prereq => False }
}
};
%res<description> = $ex.?description // $ex.perl;
%res
}
sub MAIN ($projectsfile) {
try mkdir "installlib";
@*INC.push("{$*CWD}/installlib/lib");
%*ENV<PERL6LIB> = "{$*CWD}/installlib/lib:" ~ (%*ENV<PERL6LIB> // '');
try unlink "{$*CWD}/state";
my $e = Panda::Ecosystem.new(
statefile => "{$*CWD}/state",
projectsfile => $projectsfile,
) but role {
method flush-states { }
};
my $panda = Panda.new(
ecosystem => $e,
installer => Panda::Installer.new(destdir => "{$*CWD}/installlib")
);
my %log;
my $start = time;
for $panda.ecosystem.project-list -> $p {
my $x = $panda.ecosystem.get-project($p);
# don't waste time if it has already been installed once
if $panda.ecosystem.project-get-state($x) ne 'absent' {
%log{$p} = gen-result-success($p);
next;
}
try $panda.resolve($p);
%log{$p} = $! ?? gen-result-failure($!) !! gen-result-success($p);
}
my $end = time;
%log<_statistics> = {
runtime => $end - $start,
compiler => $*PERL.compiler.name,
version => $*PERL.compiler.version.Str,
datetime => DateTime.new(now).Str
}
shell 'rm -rf installlib/';
given open('results.json', :w) {
.say: to-json %log;
.close;
}
say '';
say 'Smoke test results have been written to results.json';
say '====================================================';
}