aboutsummaryrefslogtreecommitdiff
path: root/build/download-stuff.pl
blob: f22001000f0a0a7b0fe999b27e22a437eef1d9dd (plain)
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
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use File::Copy;
use autodie qw(mkdir chdir open close copy);

my @bootrap = qw(
    http://github.com/rakudo/rakudo
    http://github.com/masak/proto
    http://github.com/masak/ufo
);
my @modules = qw(
    http://github.com/jnthn/zavolaj
    http://github.com/jnthn/blizkost
    http://github.com/mberends/MiniDBI
    http://github.com/masak/xml-writer
    http://github.com/moritz/svg
    http://github.com/moritz/svg-plot
    http://github.com/moritz/Math-RungeKutta
    http://github.com/moritz/Math-Model
    http://github.com/mattw/form
    http://github.com/tadzik/perl6-Config-INI
    http://github.com/tadzik/perl6-File-Find
    http://github.com/tadzik/perl6-Term-ANSIColor
    http://github.com/arnsholt/Algorithm-Viterbi
    http://gitorious.org/http-daemon/mainline
);

mkdir 'dist' unless -e 'dist';

chdir 'dist' or die "Can't chdir to build dir: $!";

sub fetch_project {
    my $git_url = shift;
    $git_url =~ s/^http/git/;
    $git_url .= '.git';
    my $return = system 'git', 'clone', $git_url;
    if ($return) {
        if ($? == -1) {
            warn "Error while running 'git clone $git_url': $?\n";
        } else {
            warn "Git returned unsuccessfully with return code "
                    . ($? >> 8) . "\n";
        }
        next;
    }

}

for my $m (@bootrap) {
    fetch_project($m);
}
mkdir 'proto/cache';
chdir 'proto/cache';
for my $m (@modules) {
    fetch_project($m);
}
chdir '../..';

# for projects of which we want to ship specific tags or branches
# the right-hand side can be anything that 'git checkout' accepts,
# so a branch name, tag name, sha1 sum, HEAD~3 ( not quite sane, 
# but possible )
#
my %tags = (
    rakudo  => 'master', # XXX replace by tag of Rakudo point release
    proto   => 'pls_rstar_hacks',
);

while (my ($project, $version) = each %tags) {
    chdir $project;
    system('git', 'checkout', $version) == 0
        or die "Can't git checkout $version: $?";
    chdir '..';
}

chdir('..');

copy('build/buildall.pl', 'dist/');
# TODO: copy docs, build scripts, whatever
#