Skip to content

Commit 9bf1bc4

Browse files
committed
Groundwork for bump triples
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.
1 parent 3bde2a3 commit 9bf1bc4

File tree

1 file changed

+63
-13
lines changed

1 file changed

+63
-13
lines changed

xbin/build.p6

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ my \EVERYTHING-RANGE = ‘2014.01^..HEAD’; # to build everything, but in hist
3737

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

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

63-
if REPO-LATEST.IO ~~ :d {
64-
my $old-dir = $*CWD;
65-
LEAVE chdir $old-dir;
66-
chdir REPO-LATEST;
67-
run git, pull;
68-
} else {
69-
exit unless run git, clone, --, REPO-ORIGIN, REPO-LATEST;
67+
sub pull-or-clone($repo-origin, $repo-path) {
68+
if $repo-path.IO ~~ :d {
69+
my $old-dir = $*CWD;
70+
run :cwd($repo-path), git, pull;
71+
} else {
72+
exit unless run git, clone, --, $repo-origin, $repo-path;
73+
}
74+
}
75+
76+
pull-or-clone REPO-ORIGIN, REPO-LATEST;
77+
if RAKUDOISH {
78+
pull-or-clone RAKUDO-NQP-ORIGIN, RAKUDO-NQP-LATEST;
79+
pull-or-clone RAKUDO-MOAR-ORIGIN, RAKUDO-MOAR-LATEST;
7080
}
7181

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

7686
my $channel = Channel.new;
7787

78-
my @git-latest = git, --git-dir, {REPO-LATEST}/.git, --work-tree, REPO-LATEST;
79-
my @args-tags = |@git-latest, log, -z, --pretty=%H, --tags, --no-walk, --since, TAGS-SINCE;
80-
my @args-latest = |@git-latest, log, -z, --pretty=%H, COMMIT-RANGE;
81-
my @args-recent = |@git-latest, log, -z, --pretty=%H, --all, --since, ALL-SINCE;
82-
my @args-old = |@git-latest, log, -z, --pretty=%H, --reverse, EVERYTHING-RANGE;
88+
my @git-log = git, log, -z, --pretty=%H;
89+
my @args-tags = |@git-log, --tags, --no-walk, --since, TAGS-SINCE;
90+
my @args-latest = |@git-log, COMMIT-RANGE;
91+
my @args-recent = |@git-log, --all, --since, ALL-SINCE;
92+
my @args-old = |@git-log, --reverse, EVERYTHING-RANGE;
8393

8494
my %commits;
95+
96+
# Normal Rakudo commits
8597
for @args-tags, @args-latest, @args-recent, @args-old -> @_ {
86-
for run(:out, |@_).out.split(0.chr, :skip-empty) {
98+
for run(:cwd(REPO-LATEST), :out, |@_).out.split(0.chr, :skip-empty) {
8799
next if %commits{$_}:exists;
88100
%commits{$_}++;
89101
$channel.send: $_
90102
}
91103
}
92104

105+
sub get-build-revision($repo, $on-commit, $file) {
106+
run(:cwd($repo), :out, git, show,
107+
{$on-commit}:tools/build/$file).out.slurp-rest.trim
108+
}
109+
110+
# Rakudo-NQP-Moar triples (for bumps)
111+
#`「「「
112+
if PROJECT == Rakudo-Moar {
113+
my @args-bumps = ‘git’, ‘log’, ‘-z’, ‘--pretty=%x00%H’,
114+
‘--follow’, ‘--reverse’,
115+
EVERYTHING-RANGE, ‘tools/build/NQP_REVISION’;
116+
for run(:cwd(REPO-LATEST), :out, |@args-bumps)
117+
.out.split(0.chr, :skip-empty).rotor(2) -> ($rakudo-sha, $diff) {
118+
#my $nqp-old = get-build-revision REPO-LATEST, “$rakudo-sha^”, ‘NQP_REVISION’;
119+
#my $nqp-new = get-build-revision REPO-LATEST, “$rakudo-sha”, ‘NQP_REVISION’;
120+
121+
#say “$rakudo-sha”;
122+
for run(:cwd(RAKUDO-NQP-LATEST), :out, |@git-log, “$nqp-old..$nqp-new”)
123+
.out.split(0.chr, :skip-empty) -> $nqp-sha {
124+
my $moar-sha = get-build-revision RAKUDO-NQP-LATEST, “$nqp-sha”, ‘MOAR_REVISION’;
125+
# TODO shas are not shas
126+
say “|- $nqp-sha - $moar-sha”;
127+
}
128+
for run(:cwd(RAKUDO-NQP-LATEST), :out, |@git-log, ‘--follow’, ‘--reverse’,
129+
“$nqp-old..$nqp-new”, ‘tools/build/MOAR_REVISION’)
130+
.out.split(0.chr, :skip-empty) -> $nqp-sha {
131+
my $moar-old = get-build-revision RAKUDO-NQP-LATEST, “$nqp-sha^”, ‘MOAR_REVISION’;
132+
my $moar-new = get-build-revision RAKUDO-NQP-LATEST, “$nqp-sha”, ‘MOAR_REVISION’;
133+
for run(:cwd(RAKUDO-MOAR-LATEST), :out, |@git-log, “$moar-old..$moar-new”)
134+
.out.split(0.chr, :skip-empty) -> $moar-sha {
135+
say “ |- $moar-sha”;
136+
}
137+
}
138+
}
139+
}
140+
# 」
141+
142+
93143
await (for ^PARALLEL-COUNT { # TODO rewrite when .race starts working in rakudo
94144
start loop {
95145
my $commit = $channel.poll;

0 commit comments

Comments
 (0)