25
use Parrot::CompareRevisions qw(compare_revs parse_revision_file);
24
27
# Work out slash character to use.
25
28
my $slash = $^O eq 'MSWin32' ? '\\' : '/';
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>);
30
# Determine the revision of Parrot we require
31
my $req = parse_revision_file;
36
if (open my $REV, '-|', "parrot_install${slash}bin${slash}parrot_config revision") {
37
my $revision = 0+<$REV>;
39
if ($revision >= $reqsvn) {
40
print "Parrot r$revision already available (r$reqsvn required)\n";
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>;
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";
49
print "Checking out Parrot $req via git...\n";
52
if (-d 'parrot/.svn') {
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";
61
system_or_die(qw(git clone git://github.com/parrot/parrot.git parrot));
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));
49
65
chdir('parrot') || die "Can't chdir to 'parrot': $!";
67
system_or_die(qw(git fetch)) unless $fetched;
68
system_or_die(qw(git checkout), $req);
52
70
## If we have a Makefile from a previous build, do a 'make realclean'
53
71
if (-f 'Makefile') {
72
90
sub read_parrot_config {
74
if (open my $CFG, "config_lib.pasm") {
92
if (open my $CFG, "config_lib.pir") {
76
94
if (/P0\["(.*?)"], "(.*?)"/) { $config{$1} = $2 }