Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote branch 'fbrito/gci_task'
  • Loading branch information
moritz committed Dec 2, 2010
2 parents 864869c + 25db176 commit 95f3fef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
17 changes: 7 additions & 10 deletions Configure.pl
Expand Up @@ -7,7 +7,7 @@
use Getopt::Long;
use Cwd;
use lib "build/lib";
use Parrot::CompareRevisions qw(compare_parrot_revs);
use Parrot::CompareRevisions qw(compare_parrot_revs parse_parrot_revision_file);

MAIN: {
my %options;
Expand All @@ -20,12 +20,6 @@
exit(0);
}

# Determine the revision of Parrot we require
open my $REQ, '<', "build/PARROT_REVISION"
or die "cannot open build/PARROT_REVISION: $!\n";
my ($reqsvn, $reqpar) = split(' ', <$REQ>);
close $REQ;

# Update/generate parrot build if needed
if ($options{'gen-parrot'}) {
my @opts = @{ $options{'gen-parrot-option'} || [] };
Expand Down Expand Up @@ -58,15 +52,18 @@
# Get configuration information from parrot_config
my %config = read_parrot_config(@parrot_config_exe);

# Determine the revision of Parrot we require
my ($req, $reqpar) = parse_parrot_revision_file;

my $parrot_errors = '';
if (!%config) {
$parrot_errors .= "Unable to locate parrot_config\n";
}
else {
if ($config{git_describe}) {
# a parrot built from git
if (compare_parrot_revs($reqsvn, $config{'git_describe'}) > 0) {
$parrot_errors .= "Parrot revision $reqsvn required (currently $config{'git_describe'})\n";
if (compare_parrot_revs($req, $config{'git_describe'}) > 0) {
$parrot_errors .= "Parrot revision $req required (currently $config{'git_describe'})\n";
}
}
else {
Expand All @@ -81,7 +78,7 @@
die <<"END";
===SORRY!===
$parrot_errors
To automatically clone (git) and build a copy of parrot $reqsvn,
To automatically clone (git) and build a copy of parrot $req,
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
9 changes: 3 additions & 6 deletions build/gen_parrot.pl
Expand Up @@ -22,16 +22,13 @@ =head2 DESCRIPTION
use 5.008;

use lib "build/lib";
use Parrot::CompareRevisions qw(compare_parrot_revs);
use Parrot::CompareRevisions qw(compare_parrot_revs parse_parrot_revision_file);

# 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 ($req, $reqpar) = split(' ', <$REQ>);
close $REQ;
# Determine the revision of Parrot we require
my ($req, $reqpar) = parse_parrot_revision_file;

{
no warnings;
Expand Down
12 changes: 11 additions & 1 deletion build/lib/Parrot/CompareRevisions.pm
Expand Up @@ -3,7 +3,17 @@ use strict;
use warnings;

use base qw(Exporter);
our @EXPORT_OK = qw(compare_parrot_revs parse_parrot_git_describe);
our @EXPORT_OK = qw(compare_parrot_revs parse_parrot_git_describe parse_parrot_revision_file);

sub parse_parrot_revision_file {
# Open the build/PARROT_REVISION file
open my $REQ, '<', "build/PARROT_REVISION"
or die "cannot open build/PARROT_REVISION: $!\n";
my ($req, $reqpar) = split(' ', <$REQ>);
close $REQ;

return $req, $reqpar
}

sub parse_parrot_git_describe {
my $g = shift;
Expand Down

0 comments on commit 95f3fef

Please sign in to comment.