Skip to content

Commit

Permalink
Remove svn cruft from Configure.pl and borrow moritz++'s code to pars…
Browse files Browse the repository at this point in the history
…e describe strings
  • Loading branch information
leto committed Nov 13, 2010
1 parent 85ac914 commit 8f955a7
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions Configure.pl
Expand Up @@ -3,6 +3,7 @@
use strict;
use warnings;
use Getopt::Long;
use Data::Dumper;

use Fatal qw(open);

Expand Down Expand Up @@ -35,34 +36,11 @@
}

# Which version of parrot do we need?
open my $cfh, '<', 'config/PARROT_VERSION';
open my $cfh, '<', 'config/PARROT_GIT_DESCRIBE';
while (<$cfh>) {
next if /^#/;
next if /^\s+$/;
if (/^release:\s*(.*)\s*$/) {
my $rel = $1;
# compare dotted notation.
if (version_int($opt{VERSION}) >= version_int($rel)) {
print "Need at least r$rel of parrot, using r$opt{VERSION}.\n";
if ($opt{revision} != 0) {
print "Warning: this is a development version of parrot (r$opt{revision}).\n";
}
last; # that works.
} else {
die "We need at least release $rel of parrot but only have $opt{VERSION}.\n";
}
} elsif (/^revision:\s*(.*)\s*$/) {
my $rev = $1;
if ($opt{revision} == 0) {
die "This is a released version of parrot ($opt{VERSION}).\nWe need at least r$rev from the svn repository.\n";
}
if ($opt{revision} >= $rev) {
print "Need at least r$rev of parrot, using r$opt{revision}.\n";
last; # that works.
} else {
warn "We need at least revision $rev of parrot but only have $opt{revision}.\n"
}
}
warn $opt{git_describe};
}

warn <<END_WARN
Expand Down Expand Up @@ -96,6 +74,27 @@
}
}

sub parse_git_describe {
my $g = shift;
$g =~ /^REL(?:EASE)?_(\d+)_(\d+)_(\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);
return @c;
}

sub compare_describe_strings {
my ($s1, $s2) = @_;
my @a = parse_git_describe($s1);
my @b = parse_git_describe($s2);
for (0..3) {
my $cmp = $a[$_] <=> $b[$_];
return $cmp if $cmp;
}
return 0;
}



print "Creating Parrot::Installed\n";

Expand Down

0 comments on commit 8f955a7

Please sign in to comment.