File: release

package info (click to toggle)
moarvm 2020.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 18,652 kB
  • sloc: ansic: 268,178; perl: 8,186; python: 1,316; makefile: 768; sh: 287
file content (102 lines) | stat: -rwxr-xr-x 3,547 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env raku

sub MAIN($release, Bool :$update-changelog = True, Bool :$update-version = True, Bool :$check-git-status = True) {
    if $check-git-status {
        unless run(<git diff --no-ext-diff --quiet>) and run(<git diff --no-ext-diff --cached --quiet>) {
            say "git status is not clean";
            exit 1;
        }
    }

    my $changelog-file = "docs/ChangeLog".IO;
    my $changelog = $changelog-file.open(:r);
    my @changelog-lines = $changelog.lines;
    my $old-version = 'VERSION'.IO.slurp.chomp;

    if $update-changelog {
        my @lines = get-commits($old-version, :subject);

        $changelog = $changelog-file.open(:w);
        $changelog.put: "New in $release\n";
        $changelog.put: "+ $_" for @lines;
        $changelog.put: '';
        $changelog.put: @changelog-lines.join: "\n";
    }
    else {
        for get-commits($old-version) -> $commit {
            my @files = run(<<git diff --name-only "$commit" "$commit^">>, :out).out.lines;
            for @files -> $file {
                next if $file eq 'VERSION'|'docs/ChangeLog';
                say "Commit {run(<<git show -s --oneline $commit>>, :out).out.slurp.chomp} not logged"
                    unless any(@changelog-lines) ~~ /$commit/;
            }
        }
    }

    if $update-version {
        "VERSION".IO.spurt: $release;
        run <git add VERSION>;
        run <git commit -v>;
        run 'make', 'release', "VERSION=$release";
    }

    my $builddir = $*TMPDIR.child("moarvm-release-test-{(^2**128).pick.base(36)}");
    say "Building in $builddir";
    $builddir.IO.mkdir;
    "$builddir/install".IO.mkdir;
    run <<perl Configure.pl "--prefix=$builddir/install">>;
    run <<make "-j$*KERNEL.cpu-cores()" install>>;

    %*ENV<TEST_JOBS> = $*KERNEL.cpu-cores;
    indir $builddir, {
        run <git clone https://github.com/perl6/nqp.git>;
        indir "nqp".IO, {
            run <<perl Configure.pl --backends=moar "--with-moar=$builddir/install/bin/moar" "--prefix=$builddir/install">>;
            run <make test>;
            run <make install>;
        };
        run <git clone https://github.com/rakudo/rakudo.git>;
        indir "rakudo".IO, {
            run <<perl Configure.pl "--with-nqp=$builddir/install/bin/nqp" "--prefix=$builddir/install">>;
            run <make test>;
            run <make spectest>;
            run <make stresstest>;
        }
    };

    my $debug-nfg-patch = q:to/PATCH/;
        diff --git a/src/strings/ops.h b/src/strings/ops.h
        index 5cdb3d355..fd20f1d50 100644
        --- a/src/strings/ops.h
        +++ b/src/strings/ops.h
        @@ -142 +142 @@ char * MVM_string_encoding_cname(MVMThreadContext *tc, MVMint64 encoding);
        -#define MVM_DEBUG_NFG 0
        +#define MVM_DEBUG_NFG 1
        @@ -145 +145 @@ char * MVM_string_encoding_cname(MVMThreadContext *tc, MVMint64 encoding);
        -#define MVM_DEBUG_NFG_STRICT 0
        +#define MVM_DEBUG_NFG_STRICT 1
        PATCH
    run(<patch -p1>, :in).in.spurt: $debug-nfg-patch, :close;
    run <<make "-j$*KERNEL.cpu-cores()" install>>;

    indir "$builddir/rakudo".IO, {
        run <make test>;
        run <make spectest>;
    }

    run(<patch -R -p1>, :in).in.spurt: $debug-nfg-patch, :close;

    run <<rm -rf "$builddir">>;
}

sub get-commits($old-version, :$subject) {
    run(
        'git',
        'log',
        '--reverse',
        '--no-merges',
        $subject ?? '--pretty=format:[%h] %s' !! '--pretty=format:%h',
        "$old-version..HEAD",
        :out,
    ).out.lines
}