Skip to content

Commit

Permalink
Merge remote branch 'origin/parrotgit'
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Nov 13, 2010
2 parents c548b87 + cfd1b92 commit 5b723aa
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 17 deletions.
12 changes: 7 additions & 5 deletions Configure.pl
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion build/PARROT_REVISION
@@ -1 +1 @@
49711
RELEASE_2_9_1-235-g0d855e0
30 changes: 23 additions & 7 deletions build/gen_parrot.pl
Expand Up @@ -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') {
Expand Down
31 changes: 31 additions & 0 deletions 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;
4 changes: 2 additions & 2 deletions docs/release_guide.pod
Expand Up @@ -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<git describe --tags> 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
Expand Down
4 changes: 2 additions & 2 deletions src/Perl6/Compiler.pir
Expand Up @@ -260,15 +260,15 @@ 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 '
print .RAKUDO_VERSION
print ' built on parrot '
print version
unless rev goto done_rev
print ' r'
print ' '
print rev
done_rev:
say ''
Expand Down

0 comments on commit 5b723aa

Please sign in to comment.