Permalink
Browse files

Item14309: Detect decimal version as newer than SVN version

  • Loading branch information...
gac410 committed Jan 26, 2017
1 parent 913c0b3 commit d3079655bd5d83ac581caf3146ea6e43d0e773b9
Showing with 28 additions and 0 deletions.
  1. +11 −0 UnitTestContrib/test/unit/DependencyTests.pm
  2. +17 −0 core/lib/Foswiki/Configure/Dependency.pm
@@ -586,6 +586,17 @@ sub test_compare_extension_versions {
[ 1, '1.2.3', undef, '>', '7429' ],
[ 1, '1.2.3', undef, '<', '13213' ],
+ # svn installed, tuple requested - svn is obsolete, so always return true
+ # Except when the "tuple" is a simple integer.
+ [ 1, '2.4.1', '$Rev: 15237 (2012-07-31) $', '<', 2.50 ],
+ [ 1, '2.4.1', '$Rev: 15237 (2012-07-31) $', '>', 2.50 ],
+ [ 1, '2.4.1', '$Rev: 15237 (2012-07-31) $', '<', 16000 ],
+ [ 0, '2.4.1', '$Rev: 15237 (2012-07-31) $', '<', 13000 ],
+
+ # Special case, even though "Release" 2.4.1 is > 2.4.0
+ # the VERSION string is the authority.
+ [ 1, '2.4.1', '$Rev: 15237 (2012-07-31) $', '<', '2.4.0' ],
+
# Decimal rev installed, compared to svn rev requested
# Always true - assume migration from rev to triplet
[ 1, '1.2', '1.2', '>', '7429' ],
@@ -440,6 +440,8 @@ sub _compare_extension_versions {
# $b - what we are comparing to (from DEPENDENCIES or configure FastReport)
my ( $this, $op, $reqVer ) = @_;
+ #print STDERR "Requiring $op $reqVer\n";
+
my $aRELEASE = $this->{installedRelease};
my $aVERSION = $this->{installedVersion};
@@ -488,6 +490,8 @@ sub _compare_extension_versions {
}
}
if ( $reqType eq 'svn' ) {
+
+ #print STDERR "reqType is svn\n";
unless ( $baseType eq 'svn' ) {
#print STDERR "Try a different comparison\n";
@@ -501,6 +505,8 @@ sub _compare_extension_versions {
}
if ( $reqType eq 'date' ) {
+
+ #print STDERR "reqType is date\n";
unless ( $baseType eq 'date' ) {
# Inconsistent VERSION, so try RELEASE
@@ -568,11 +574,22 @@ sub _compare_extension_versions {
return 0 if ( $atuple[2] < 1 || $btuple[2] < 1 );
}
+ if ( $baseType eq 'svn' && $reqType ne 'svn' ) {
+
+ # Anything to SVN other than SVN or Integers needs to succeed.
+ return 1 unless $reqVer =~ m/^\d+$/; #keep going for integers
+ }
+
# We can't figure out the types, so just return false.
return 0 if ( $baseType eq 'unknown' || $reqType eq 'unknown' );
+ #print STDERR "have basetype $baseType reqType $reqType\n";
+
# Do the comparisons
( my $a, $b ) = _digitise_tuples( \@atuple, \@btuple );
+
+ #print STDERR "Doing the comparison $a $string_op $b\n";
+
my $comparison = "'$a' $string_op '$b'";
my $result = eval($comparison);

0 comments on commit d307965

Please sign in to comment.