Skip to content

Commit

Permalink
Groundwork for bump triples
Browse files Browse the repository at this point in the history
The idea is to make it possible to bisect NQP and MoarVM whenever we
hit a bump. Unfortunately this work has never been finished, but
committing it now anyway to get rid of uncommitted files on the
server.
  • Loading branch information
AlexDaniel committed Jul 29, 2019
1 parent 3bde2a3 commit 9bf1bc4
Showing 1 changed file with 63 additions and 13 deletions.
76 changes: 63 additions & 13 deletions xbin/build.p6
Expand Up @@ -37,6 +37,10 @@ my \EVERYTHING-RANGE = ‘2014.01^..HEAD’; # to build everything, but in hist

my \WORKING-DIRECTORY = .; # TODO not supported yet

my \RAKUDO-NQP-ORIGIN = https://github.com/perl6/nqp.git;
my \RAKUDO-NQP-LATEST = /tmp/whateverable/rakudo-triple-nqp-repo;
my \RAKUDO-MOAR-ORIGIN = https://github.com/MoarVM/MoarVM.git;
my \RAKUDO-MOAR-LATEST = /tmp/whateverable/rakudo-triple-moar-repo;
my \REPO-ORIGIN = RAKUDOISH
?? https://github.com/rakudo/rakudo.git
!! https://github.com/MoarVM/MoarVM.git;
Expand All @@ -60,13 +64,19 @@ exit 0 unless run ‘mkdir’, :err(Nil), ‘--’, BUILD-LOCK; # only one insta
my $locked = True;
END BUILD-LOCK.IO.rmdir if $locked;

if REPO-LATEST.IO ~~ :d {
my $old-dir = $*CWD;
LEAVE chdir $old-dir;
chdir REPO-LATEST;
run git, pull;
} else {
exit unless run git, clone, --, REPO-ORIGIN, REPO-LATEST;
sub pull-or-clone($repo-origin, $repo-path) {
if $repo-path.IO ~~ :d {
my $old-dir = $*CWD;
run :cwd($repo-path), git, pull;
} else {
exit unless run git, clone, --, $repo-origin, $repo-path;
}
}

pull-or-clone REPO-ORIGIN, REPO-LATEST;
if RAKUDOISH {
pull-or-clone RAKUDO-NQP-ORIGIN, RAKUDO-NQP-LATEST;
pull-or-clone RAKUDO-MOAR-ORIGIN, RAKUDO-MOAR-LATEST;
}

if REPO-CURRENT.IO !~~ :d {
Expand All @@ -75,21 +85,61 @@ if REPO-CURRENT.IO !~~ :d {

my $channel = Channel.new;

my @git-latest = git, --git-dir, {REPO-LATEST}/.git, --work-tree, REPO-LATEST;
my @args-tags = |@git-latest, log, -z, --pretty=%H, --tags, --no-walk, --since, TAGS-SINCE;
my @args-latest = |@git-latest, log, -z, --pretty=%H, COMMIT-RANGE;
my @args-recent = |@git-latest, log, -z, --pretty=%H, --all, --since, ALL-SINCE;
my @args-old = |@git-latest, log, -z, --pretty=%H, --reverse, EVERYTHING-RANGE;
my @git-log = git, log, -z, --pretty=%H;
my @args-tags = |@git-log, --tags, --no-walk, --since, TAGS-SINCE;
my @args-latest = |@git-log, COMMIT-RANGE;
my @args-recent = |@git-log, --all, --since, ALL-SINCE;
my @args-old = |@git-log, --reverse, EVERYTHING-RANGE;

my %commits;

# Normal Rakudo commits
for @args-tags, @args-latest, @args-recent, @args-old -> @_ {
for run(:out, |@_).out.split(0.chr, :skip-empty) {
for run(:cwd(REPO-LATEST), :out, |@_).out.split(0.chr, :skip-empty) {
next if %commits{$_}:exists;
%commits{$_}++;
$channel.send: $_
}
}

sub get-build-revision($repo, $on-commit, $file) {
run(:cwd($repo), :out, git, show,
{$on-commit}:tools/build/$file).out.slurp-rest.trim
}

# Rakudo-NQP-Moar triples (for bumps)
#`「「「
if PROJECT == Rakudo-Moar {
my @args-bumps = ‘git’, ‘log’, ‘-z’, ‘--pretty=%x00%H’,
‘--follow’, ‘--reverse’,
EVERYTHING-RANGE, ‘tools/build/NQP_REVISION’;
for run(:cwd(REPO-LATEST), :out, |@args-bumps)
.out.split(0.chr, :skip-empty).rotor(2) -> ($rakudo-sha, $diff) {
#my $nqp-old = get-build-revision REPO-LATEST, “$rakudo-sha^”, ‘NQP_REVISION’;
#my $nqp-new = get-build-revision REPO-LATEST, “$rakudo-sha”, ‘NQP_REVISION’;
#say “$rakudo-sha”;
for run(:cwd(RAKUDO-NQP-LATEST), :out, |@git-log, “$nqp-old..$nqp-new”)
.out.split(0.chr, :skip-empty) -> $nqp-sha {
my $moar-sha = get-build-revision RAKUDO-NQP-LATEST, “$nqp-sha”, ‘MOAR_REVISION’;
# TODO shas are not shas
say “|- $nqp-sha - $moar-sha”;
}
for run(:cwd(RAKUDO-NQP-LATEST), :out, |@git-log, ‘--follow’, ‘--reverse’,
“$nqp-old..$nqp-new”, ‘tools/build/MOAR_REVISION’)
.out.split(0.chr, :skip-empty) -> $nqp-sha {
my $moar-old = get-build-revision RAKUDO-NQP-LATEST, “$nqp-sha^”, ‘MOAR_REVISION’;
my $moar-new = get-build-revision RAKUDO-NQP-LATEST, “$nqp-sha”, ‘MOAR_REVISION’;
for run(:cwd(RAKUDO-MOAR-LATEST), :out, |@git-log, “$moar-old..$moar-new”)
.out.split(0.chr, :skip-empty) -> $moar-sha {
say “ |- $moar-sha”;
}
}
}
}
# 」


await (for ^PARALLEL-COUNT { # TODO rewrite when .race starts working in rakudo
start loop {
my $commit = $channel.poll;
Expand Down

0 comments on commit 9bf1bc4

Please sign in to comment.