Permalink
Browse files

Configure: allow dependencies on non-SVN parrot versions

If PARROT_REVISION contains a number which doesn't look like an SVN
revision number, treat it as a parrot release number instead.  This
lets people build against binary installations of parrot
  • Loading branch information...
Sam Vilain
Sam Vilain committed May 29, 2009
1 parent 6062528 commit 07dc258cd83b7269ddde5323ffefbdf28870a5b7
Showing with 15 additions and 2 deletions.
  1. +15 −2 Configure.pl
View
@@ -20,7 +20,8 @@
# Determine the revision of Parrot we require
open my $REQ, "build/PARROT_REVISION"
|| die "cannot open build/PARROT_REVISION\n";
- my $required = 0+<$REQ>;
+ my $required = <$REQ>;
+ chomp($required);
close $REQ;
# Update/generate parrot build if needed
@@ -51,7 +52,8 @@
if (!%config) {
$parrot_errors .= "Unable to locate parrot_config\n";
}
- elsif ($required > $config{'revision'}) {
+ elsif ( ($required =~ m{^\d+$} and $required < $config{'revision'}) or
+ ( ver_cmp($required, $config{'VERSION'}) < 0 ) ) {
$parrot_errors .= "Parrot revision r$required required (currently r$config{'revision'})\n";
}
@@ -162,6 +164,17 @@ END
return;
}
+sub ver_cmp {
+ my ($ver_a, $ver_b) = @_;
+ my @ver_a = split /\./, $ver_a;
+ my @ver_b = split /\./, $ver_b;
+ while (@ver_a and @ver_b) {
+ my $x = (shift @ver_a) <=> (shift @ver_b);
+ return $x if $x;
+ }
+ return (@ver_a <=> @ver_b);
+}
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4

0 comments on commit 07dc258

Please sign in to comment.