about summary refs log tree commit diff
path: root/scripts/capsule.sh
blob: b176ff7c2f5462feb25047e02f89d74294c2a1f5 (plain) (blame)
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
#!/bin/bash

# first arg:  build_dir
# second arg: report path
# third arg: should we use perlbrew?

# this is getting smelly
builddir=$1
report_path=$2
perlbrew=$3

HARNESS_OPTS="HARNESS_VERBOSE=1 HARNESS_TIMER=1"

function jitterbug_build () {
    if [ -f 'dist.ini' ]; then
        echo "Found dist.ini, using Dist::Zilla"
        dzil authordeps | cpanm >> $logfile 2>&1
        cpanm --installdeps . >> $logfile 2>&1
        $HARNESS_OPTS dzil test >> $logfile  2>&1
    elif [ -f 'Build.PL' ]; then
        echo "Found Build.PL, using Build.PL"
        perl Build.PL >> $logfile 2>&1
        # ./Build installdeps is not available in older Module::Build's
        cpanm --installdeps . >> $logfile 2>&1
        # Run this again in case our Build is out of date (suboptimal)
        perl Build.PL >> $logfile 2>&1
        $HARNESS_OPTS ./Build test --verbose >> $logfile 2>&1
    elif [ -f 'Makefile.PL' ]; then
        echo "Found Makefile.PL"
        perl Makefile.PL >> $logfile 2>&1
        cpanm --installdeps . >> $logfile 2>&1
        $HARNESS_OPTS make test >> $logfile 2>&1
    elif [ -f 'setup.pir' ]; then
        echo "Found setup.pir"
        $HARNESS_OPTS parrot setup.pir test >> $logfile 2>&1
    elif [ -f 'setup.nqp' ]; then
        echo "Found setup.nqp"
        $HARNESS_OPTS parrot-nqp setup.nqp test >> $logfile 2>&1
    elif [ -f 'Configure.pl' ]; then
        echo "Found Configure.pl"
        perl Configure.pl >> $logfile 2>&1
        cpanm --installdeps . >> $logfile 2>&1
        $HARNESS_OPTS make test >> $logfile 2>&1
    elif [ -f 'Makefile' ]; then
        echo "Found a Makefile"
        make test >> $logfile 2>&1
    elif [ -f 'Rakefile' ]; then
        rake test >> $logfile 2>&1
    fi
}

echo "Creating report_path=$report_path"
mkdir -p $report_path

cd $builddir

if [ $use_perlbrew ]; then
    source $HOME/perl5/perlbrew/etc/bashrc
    for perl in $HOME/perl5/perlbrew/perls/perl-5.*
    do
        theperl=$(perl -e 'print $^V')
        logfile="$report_path/perl-$theperl.txt"

        mkdir -p $report_path
        touch $logfile

        echo ">perlbrew switch $theperl"
        perlbrew switch $theperl
        # TODO: check error condition

        jitterbug_build
    done
else
        theperl=$(perl -e 'print $^V')
        logfile="$report_path/perl-$theperl.txt"

        mkdir -p $report_path
        touch $logfile

        jitterbug_build
fi