<commit_before>#!/usr/bin/env perl6
# Copyright © 2016
#     <NAME> <<EMAIL>>
#     <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This script will build rakudo for all commits that it can find

use File::Temp;
use File::Directory::Tree;

constant PARALLEL-COUNT    = 7;
constant COMMIT-RANGE      = ‘2015.10^..HEAD’;

constant WORKING-DIRECTORY = ‘.’; # TODO not supported yet

constant RAKUDO-ORIGIN     = ‘https://github.com/rakudo/rakudo.git’;
constant RAKUDO-LATEST     = ‘/tmp/whateverable/rakudo-repo’;
constant RAKUDO-CURRENT    = “{WORKING-DIRECTORY}/rakudo”.IO.absolute;

constant ARCHIVES-LOCATION = “{WORKING-DIRECTORY}/builds/rakudo-moar”.IO.absolute;
constant BUILDS-LOCATION   = ‘/tmp/whateverable/rakudo-moar’;
constant BUILD-LOCK        = ‘/tmp/whateverable/build-lock’;

constant LEGACY-BUILDS-LOCATION = “{WORKING-DIRECTORY}/builds”.IO.absolute;

mkdir BUILDS-LOCATION;
mkdir ARCHIVES-LOCATION;

# TODO IO::Handle.lock ? run ‘flock’? P5 modules?
exit 0 unless run ‘mkdir’, ‘--’, BUILD-LOCK; # only one instance running
my $locked = True;
END BUILD-LOCK.IO.rmdir if $locked;

if RAKUDO-LATEST.IO ~~ :d  {
    my $old-dir = $*CWD;
    LEAVE chdir $old-dir;
    chdir RAKUDO-LATEST;
    run ‘git’, ‘pull’;
} else {
    exit unless run ‘git’, ‘clone’, ‘--’, RAKUDO-ORIGIN, RAKUDO-LATEST;
}

if RAKUDO-CURRENT.IO !~~ :d  {
    run ‘git’, ‘clone’, ‘--’, RAKUDO-LATEST, RAKUDO-CURRENT;
}

my $channel = Channel.new;

my @git-latest = ‘git’, ‘--git-dir’, “{RAKUDO-LATEST}/.git”, ‘--work-tree’, RAKUDO-LATEST;
my @args-tags   = |@git-latest, ‘log’, ‘-z’, ‘--pretty=%H’, ‘--tags’, ‘--no-walk’;
my @args-latest = |@git-latest, ‘log’, ‘-z’, ‘--pretty=%H’, COMMIT-RANGE;

$channel.send: $_ for run(:out, |@args-tags  ).out.split(0.chr, :skip-empty);
$channel.send: $_ for run(:out, |@args-latest).out.split(0.chr, :skip-empty);

await (for ^PARALLEL-COUNT { # TODO rewrite when .race starts working in rakudo
              start loop {
                  my $commit = $channel.poll;
                  last unless $commit;<commit_msg>Stop attempting to build pre-moar tags<commit_after>#!/usr/bin/env perl6
# Copyright © 2016
#     <NAME> <<EMAIL>>
#     <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This script will build rakudo for all commits that it can find

use File::Temp;
use File::Directory::Tree;

constant PARALLEL-COUNT    = 7;
constant COMMIT-RANGE      = ‘2015.10^..HEAD’;
constant TAGS-SINCE        = ‘2014-01-01’;

constant WORKING-DIRECTORY = ‘.’; # TODO not supported yet

constant RAKUDO-ORIGIN     = ‘https://github.com/rakudo/rakudo.git’;
constant RAKUDO-LATEST     = ‘/tmp/whateverable/rakudo-repo’;
constant RAKUDO-CURRENT    = “{WORKING-DIRECTORY}/rakudo”.IO.absolute;

constant ARCHIVES-LOCATION = “{WORKING-DIRECTORY}/builds/rakudo-moar”.IO.absolute;
constant BUILDS-LOCATION   = ‘/tmp/whateverable/rakudo-moar’;
constant BUILD-LOCK        = ‘/tmp/whateverable/build-lock’;

constant LEGACY-BUILDS-LOCATION = “{WORKING-DIRECTORY}/builds”.IO.absolute;

mkdir BUILDS-LOCATION;
mkdir ARCHIVES-LOCATION;

# TODO IO::Handle.lock ? run ‘flock’? P5 modules?
exit 0 unless run ‘mkdir’, ‘--’, BUILD-LOCK; # only one instance running
my $locked = True;
END BUILD-LOCK.IO.rmdir if $locked;

if RAKUDO-LATEST.IO ~~ :d  {
    my $old-dir = $*CWD;
    LEAVE chdir $old-dir;
    chdir RAKUDO-LATEST;
    run ‘git’, ‘pull’;
} else {
    exit unless run ‘git’, ‘clone’, ‘--’, RAKUDO-ORIGIN, RAKUDO-LATEST;
}

if RAKUDO-CURRENT.IO !~~ :d  {
    run ‘git’, ‘clone’, ‘--’, RAKUDO-LATEST, RAKUDO-CURRENT;
}

my $channel = Channel.new;

my @git-latest = ‘git’, ‘--git-dir’, “{RAKUDO-LATEST}/.git”, ‘--work-tree’, RAKUDO-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;

$channel.send: $_ for run(:out, |@args-tags  ).out.split(0.chr, :skip-empty);
$channel.send: $_ for run(:out, |@args-latest).out.split(0.chr, :skip-empty);

await (for ^PARALLEL-COUNT { # TODO rewrite when .race starts working in rakudo
              start loop {
                  my $commit = $channel.poll;
                  last unless $commit;
{'fraction_non_alphanumeric': 0.15017505067256312, 'fraction_numerical': 0.007739082365948038, 'mean_word_length': 3.5233333333333334, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2687123', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1909, 'n_words': 553}