Permalink
Browse files

Merge pull request #5 from niner/master

Make emmentaler fully functioning again
  • Loading branch information...
2 parents 0549fe9 + b76aa8b commit 2ff317263d87886735e17c25ce2451db451c31db @colomon colomon committed on GitHub Dec 9, 2016
Showing with 60 additions and 35 deletions.
  1. +2 −2 difftool
  2. +2 −2 formatter
  3. +49 −0 install-dist-to-installlib
  4. +7 −31 smoker
View
@@ -6,8 +6,8 @@ use Term::ANSIColor;
sub MAIN($old-results, $new-results) {
my %old = from-json slurp $old-results;
my %new = from-json slurp $new-results;
- %old.delete('_statistics');
- %new.delete('_statistics');
+ %old<_statistics>:delete;
+ %new<_statistics>:delete;
sub improved($m, $stage) {
my $was = %old{$m}{$stage} // False;
View
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-use Mojo::JSON;
+use Mojo::JSON qw(decode_json);
use Mojo::Template;
my $mt = Mojo::Template->new;
@@ -8,7 +8,7 @@ open my $fh, '<', 'results.json' or die "No results.json available";
my $json = do { local $/; <$fh> };
close $fh;
-my $results = Mojo::JSON->new->decode($json);
+my $results = decode_json($json);
sub sortsub {
($a, $b);
View
@@ -0,0 +1,49 @@
+use JSON::Tiny;
+use Panda;
+
+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, $p) {
+ my $e = Panda::Ecosystem.new(
+ statefile => "{$*CWD}/state".IO,
+ projectsfile => $projectsfile,
+ );
+ my $panda = Panda.new(
+ ecosystem => $e,
+ installer => Panda::Installer.new(prefix => "{$*CWD}/installlib")
+ );
+
+ my $output = 'install-dist.out'.IO.open(:w);
+ 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' {
+ $output.print: to-json(gen-result-success($x));
+ next;
+ }
+ try $panda.resolve($p);
+ $output.print: to-json($! ?? gen-result-failure($!) !! gen-result-success($x));
+}
+
+# vim: ft=perl6
View
38 smoker
@@ -3,30 +3,6 @@ use Panda;
use Shell::Command;
use JSON::Tiny;
-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";
CompUnit::RepositoryRegistry.use-repository(
@@ -50,14 +26,14 @@ sub MAIN ($projectsfile) {
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;
+ unlink('install-dist.out'); # in case there's a stale one
+ my $proc = run('perl6', 'install-dist-to-installlib', $projectsfile, $p.Str);
+ my $output = slurp('install-dist.out');
+ unlink('install-dist.out');
+ {
+ %log{$p} = from-json($output);
+ CATCH { default { note $_ } }
}
- try $panda.resolve($p);
- %log{$p} = $! ?? gen-result-failure($!) !! gen-result-success($p);
}
my $end = time;

0 comments on commit 2ff3172

Please sign in to comment.