~ubuntu-branches/ubuntu/precise/rakudo/precise

« back to all changes in this revision

Viewing changes to build/gen_parrot.pl

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-05-17 11:31:09 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110517113109-rmfir654u1axbpt4
Tags: 0.1~2011.04-1
* New upstream release (Closes: #601862, #585762, #577502)
* New maintainer
* Switch to 3.0 (quilt) format
* Update dependencies (Closes: #584498)
* Update debian/copyright to lastest DEP5 revision
* Do not generate/install perl6 manpage (now done by the build system)
* Enable tests
* Bump Standards-Version to 3.9.2 (no changes needed)
* Do not install extra LICENSE files and duplicated docs
* Remove debian/clean (no more needed)
* Add Vcs-* fields in debian/control
* Rewrite (short) description
* Update upstream copyright years
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
use warnings;
22
22
use 5.008;
23
23
 
 
24
use lib "build/lib";
 
25
use Parrot::CompareRevisions qw(compare_revs parse_revision_file);
 
26
 
24
27
#  Work out slash character to use.
25
28
my $slash = $^O eq 'MSWin32' ? '\\' : '/';
26
29
 
27
 
##  determine what revision of Parrot we require
28
 
open my $REQ, "build/PARROT_REVISION"
29
 
  || die "cannot open build/PARROT_REVISION\n";
30
 
my ($reqsvn, $reqpar) = split(' ', <$REQ>);
31
 
$reqsvn += 0;
32
 
close $REQ;
 
30
# Determine the revision of Parrot we require
 
31
my $req = parse_revision_file;
33
32
 
34
33
{
35
34
    no warnings;
36
 
    if (open my $REV, '-|', "parrot_install${slash}bin${slash}parrot_config revision") {
37
 
        my $revision = 0+<$REV>;
38
 
        close $REV;
39
 
        if ($revision >= $reqsvn) {
40
 
            print "Parrot r$revision already available (r$reqsvn required)\n";
41
 
            exit(0);
 
35
    eval {
 
36
        my $parrot_bin_folder = "parrot_install${slash}bin";
 
37
        if (-e $parrot_bin_folder && open my $REV, '-|', "$parrot_bin_folder${slash}parrot_config git_describe") {
 
38
            my $revision = <$REV>;
 
39
            close $REV;
 
40
            $revision =~ s/\s.*//s;
 
41
            if (compare_revs($revision, $req) >= 0) {
 
42
                print "Parrot $revision already available ($req required). that's new enough.\n";
 
43
                exit(0);
 
44
            }
42
45
        }
 
46
    };
 
47
}
 
48
 
 
49
print "Checking out Parrot $req via git...\n";
 
50
my $fetched = 0;
 
51
if (-d 'parrot') {
 
52
    if (-d 'parrot/.svn') {
 
53
        die "===SORRY===\n"
 
54
           ."Your 'parrot' directory is still an SVN repository.\n"
 
55
           ."Parrot switched to git recently; in order to replace your\n"
 
56
           ."repository by a git repository, please manually delete\n"
 
57
           ."the 'parrot' directory, and then re-run the command that caused\n"
 
58
           ."this error message\n";
43
59
    }
 
60
} else {
 
61
    system_or_die(qw(git clone git://github.com/parrot/parrot.git parrot));
 
62
    $fetched = 1;
44
63
}
45
64
 
46
 
print "Checking out Parrot r$reqsvn via svn...\n";
47
 
system_or_die(qw(svn checkout -r),  $reqsvn , qw(https://svn.parrot.org/parrot/trunk parrot));
48
 
 
49
65
chdir('parrot') || die "Can't chdir to 'parrot': $!";
50
66
 
 
67
system_or_die(qw(git fetch)) unless $fetched;
 
68
system_or_die(qw(git checkout),  $req);
51
69
 
52
70
##  If we have a Makefile from a previous build, do a 'make realclean'
53
71
if (-f 'Makefile') {
71
89
 
72
90
sub read_parrot_config {
73
91
    my %config = ();
74
 
    if (open my $CFG, "config_lib.pasm") {
 
92
    if (open my $CFG, "config_lib.pir") {
75
93
        while (<$CFG>) {
76
94
            if (/P0\["(.*?)"], "(.*?)"/) { $config{$1} = $2 }
77
95
        }