File: rebase-rakudo.pl

package info (click to toggle)
rakudo 2014.07-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,828 kB
  • ctags: 1,299
  • sloc: perl: 22,640; ansic: 2,689; java: 1,686; sh: 17; makefile: 14
file content (108 lines) | stat: -rwxr-xr-x 2,779 bytes parent folder | download | duplicates (2)
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
103
104
105
106
107
108
#!/usr/bin/perl
# Copyright (C) 2008, The Perl Foundation.
# $Id$

use Cwd;
use File::Spec;
use Getopt::Long;
use lib qw| lib ../lib ../../lib |;
use Parrot::Config;


my $help      = 0;
my $verbose   = 0;
my $realclean = 1;
my $jit       = 0;
my $test      = 0;
my $codetest  = 0;
my $spectest  = 0;
my $make      = $PConfig{make};


GetOptions('help!'      => \$help,
           'verbose!'   => \$verbose,
           'realclean!' => \$realclean,
           'jit!'       => \$jit,
           'test!'      => \$test,
           'codetest!'  => \$codetest,
           'spectest!'  => \$spectest,
          );

die <<"USAGE" if $help;
usage:   $0 [options]
options:
  -h|--help        print this usage info
  -v|--verbose     show verbose output
  -j|--jit         enable JIT during configuration
  -t|--test        run '$make test'      after build
  -c|--codetest    run '$make codetest'  after build
  -s|--spectest    run '$make spectest'  after build
  -r|--realclean   run '$make realclean' before rebase, and configure after
                   (default on; use --no-realclean to turn it off)

For extra golfing goodness, try creating a shell alias
to run this script with your favorite options.
USAGE

print "Looking for Parrot root ...\n";
chdir '..' until -f 'parrotbug' || cwd eq File::Spec->rootdir;
die "Couldn't find Parrot root at or above current directory.\n"
    unless -f 'parrotbug';
print "... found at '" . cwd . "'.\n\n" if $verbose;

if ($realclean && -e 'Makefile') {
    print "Cleaning old build ...\n";
    run_command( $make, 'realclean' );
}

print "Rebasing Parrot ...\n";
my @rebase = -e '.git' ? qw( git svn rebase ) :
             -e '.svn' ? qw( svn up         ) :
                         qw( svk pull       ) ;
run_command(@rebase);

unless (-e 'Makefile') {
    print "Configuring Parrot ...\n";
    my   @config = qw( perl Configure.pl );
    push @config,  qw( --jitcapable=0    ) unless $jit;
    run_command(@config);
}

print "Making Parrot ...\n";
run_command( $make );

print "Making Rakudo ...\n";
run_command( $make, 'perl6' );

if ($test) {
    print "Running standard Parrot tests ...\n";
    run_command( $make, 'test' );
}

if ($codetest) {
    print "Running coding standard compliance tests ...\n";
    run_command( $make, 'codetest' );
}

if ($spectest) {
    print "Running Perl 6 spec tests ...\n";
    chdir 'languages/perl6';
    run_command( $make, 'spectest' );
}

print "Done.\n";

sub run_command {
    if ($verbose) {
        my $status = system @_;
        die "Could not '@_': $!\n" if $status == -1;
        print "\n";
    }
    else {
        my $output = `@_ 2>&1`;
        die "Could not '@_': $!\n" unless defined $output;
        print $output if $?;
    }

    die "\n'@_' reports error, exiting.\n" if $?;
}