diff --git a/Configure.pl b/Configure.pl index 9562c7e1a79..4b8932b6e99 100644 --- a/Configure.pl +++ b/Configure.pl @@ -6,6 +6,8 @@ use warnings; use Getopt::Long; use Cwd; +use lib "build/lib"; +use Rakudo::CompareRevisions qw(compare_parrot_revs); MAIN: { my %options; @@ -22,7 +24,6 @@ open my $REQ, '<', "build/PARROT_REVISION" or die "cannot open build/PARROT_REVISION: $!\n"; my ($reqsvn, $reqpar) = split(' ', <$REQ>); - $reqsvn += 0; close $REQ; # Update/generate parrot build if needed @@ -35,7 +36,8 @@ print "Generating Parrot ...\n"; print "@command\n\n"; - system @command; + system(@command) == 0 + or die "Error while executing @command; aborting\n"; } # Get a list of parrot-configs to invoke. @@ -60,16 +62,16 @@ if (!%config) { $parrot_errors .= "Unable to locate parrot_config\n"; } - elsif ($reqsvn > $config{'revision'} && + elsif (compare_parrot_revs($reqsvn, $config{'git_describe'}) < 0 && ($reqpar eq '' || version_int($reqpar) > version_int($config{'VERSION'}))) { - $parrot_errors .= "Parrot revision r$reqsvn required (currently r$config{'revision'})\n"; + $parrot_errors .= "Parrot revision $reqsvn required (currently $config{'git_describe'})\n"; } if ($parrot_errors) { die <<"END"; ===SORRY!=== $parrot_errors -To automatically checkout (svn) and build a copy of parrot r$reqsvn, +To automatically clone (git) and build a copy of parrot $reqsvn, try re-running Configure.pl with the '--gen-parrot' option. Or, use the '--parrot-config' option to explicitly specify the location of parrot_config to be used to build Rakudo Perl. diff --git a/build/PARROT_REVISION b/build/PARROT_REVISION index d071a36fc0a..574cb71e919 100644 --- a/build/PARROT_REVISION +++ b/build/PARROT_REVISION @@ -1 +1 @@ -49711 +RELEASE_2_9_1-235-g0d855e0 diff --git a/build/gen_parrot.pl b/build/gen_parrot.pl index 63173a3c094..b2456e3376e 100644 --- a/build/gen_parrot.pl +++ b/build/gen_parrot.pl @@ -21,33 +21,49 @@ =head2 DESCRIPTION use warnings; use 5.008; +use lib "build/lib"; +use Rakudo::CompareRevisions qw(compare_parrot_revs); + # Work out slash character to use. my $slash = $^O eq 'MSWin32' ? '\\' : '/'; ## determine what revision of Parrot we require open my $REQ, "build/PARROT_REVISION" || die "cannot open build/PARROT_REVISION\n"; -my ($reqsvn, $reqpar) = split(' ', <$REQ>); -$reqsvn += 0; +my ($req, $reqpar) = split(' ', <$REQ>); close $REQ; { no warnings; if (open my $REV, '-|', "parrot_install${slash}bin${slash}parrot_config revision") { - my $revision = 0+<$REV>; + my $revision = <$REV>; close $REV; - if ($revision >= $reqsvn) { - print "Parrot r$revision already available (r$reqsvn required)\n"; + $revision =~ s/\s.*//s; + if (compare_parrot_revs($revision, $req) >= 0) { + print "Parrot $revision already available ($req required)\n"; exit(0); } } } -print "Checking out Parrot r$reqsvn via svn...\n"; -system_or_die(qw(svn checkout -r), $reqsvn , qw(https://svn.parrot.org/parrot/trunk parrot)); +print "Checking out Parrot $req via git...\n"; +if (-d 'parrot') { + if (-d 'parrot/.svn') { + die "===SORRY===\n" + ."Your 'parrot' directory is still an SVN repository.\n" + ."Parrot switched to git recently; in order to replace your\n" + ."repository by a git repository, please manually delete\n" + ."the 'parrot' directory, and then re-run the command that caused\n" + ."this error message\n"; + } + system_or_die(qw(git fetch)); +} else { + system_or_die(qw(git clone git://github.com/parrot/parrot.git parrot)); +} chdir('parrot') || die "Can't chdir to 'parrot': $!"; +system_or_die(qw(git checkout), $req); ## If we have a Makefile from a previous build, do a 'make realclean' if (-f 'Makefile') { diff --git a/build/lib/Rakudo/CompareRevisions.pm b/build/lib/Rakudo/CompareRevisions.pm new file mode 100644 index 00000000000..d461801f378 --- /dev/null +++ b/build/lib/Rakudo/CompareRevisions.pm @@ -0,0 +1,31 @@ +package Rakudo::CompareRevisions; +use strict; +use warnings; + +use base qw(Exporter); +our @EXPORT_OK = qw(compare_parrot_revs parse_parrot_git_describe); + +sub parse_parrot_git_describe { + my $g = shift; + my $sep = qr/[_\W]/; + $g =~ /^REL(?:EASE)?$sep(\d+)$sep(\d+)$sep(\d+)(?:-(\d+)-g[a-f0-9]*)?$/ + or die "Invalid revision specifier: '$g' " + ."(expected something of format RELEASE_1_2_3-123-gdeadbee)\n"; + my @c = ($1, $2, $3, $4 || 0); + return @c; +} + +sub compare_parrot_revs { + my ($aa, $bb) = @_; + return 1 if $bb =~ /^r?\d+$/; + return -1 if $aa =~ /^r?\d+$/; + my @a = parse_parrot_git_describe($aa); + my @b = parse_parrot_git_describe($bb); + for (0..3) { + my $cmp = $a[$_] <=> $b[$_]; + return $cmp if $cmp; + } + return 0; +} + +1; diff --git a/docs/release_guide.pod b/docs/release_guide.pod index 11110faf80e..c4181e15198 100644 --- a/docs/release_guide.pod +++ b/docs/release_guide.pod @@ -98,8 +98,8 @@ the release announcement). =item 2. Once Parrot issues its monthly release, edit Rakudo's -build/PARROT_REVISION file to contain the subversion revision -number and release number corresponding to Parrot's monthly +build/PARROT_REVISION file to contain the C output +and release number corresponding to Parrot's monthly release. For example, for June 2009 PARROT_REVISION file contained "39599 1.3.0". As always, test to make sure Rakudo still builds and passes its tests. Once build/PARROT_REVISION diff --git a/src/Perl6/Compiler.pir b/src/Perl6/Compiler.pir index 8b1e6c2269c..23174622a0c 100644 --- a/src/Perl6/Compiler.pir +++ b/src/Perl6/Compiler.pir @@ -260,7 +260,7 @@ Perl6::Compiler - Perl6 compiler interp = getinterp config = interp[.IGLOBALS_CONFIG_HASH] version = config['VERSION'] - rev = config['revision'] + rev = config['git_describe'] say '' print 'This is Rakudo Perl 6, version ' @@ -268,7 +268,7 @@ Perl6::Compiler - Perl6 compiler print ' built on parrot ' print version unless rev goto done_rev - print ' r' + print ' ' print rev done_rev: say ''