aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-12-04 21:02:38 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-12-04 21:02:38 +0200
commitfe22fa1ff4c2108613e5403d6f8b9f6dc2cc61aa (patch)
tree8ab78177ee2d1724859e5c3fe6a10f603365fe9a /SBO-Lib/lib
parent7ca2de02fc3e5197eec3f9a94b9e4fac420bdda5 (diff)
downloadsbotools2-fe22fa1ff4c2108613e5403d6f8b9f6dc2cc61aa.tar.xz
SBO::Lib::Util: fix version_cmp for #45.
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r--SBO-Lib/lib/SBO/Lib/Util.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/SBO-Lib/lib/SBO/Lib/Util.pm b/SBO-Lib/lib/SBO/Lib/Util.pm
index c4128af..3c98780 100644
--- a/SBO-Lib/lib/SBO/Lib/Util.pm
+++ b/SBO-Lib/lib/SBO/Lib/Util.pm
@@ -520,6 +520,17 @@ sub version_cmp {
if ($v1 =~ /(.+)_\Q$kv\E$/) { $v1 = $1 }
if ($v2 =~ /(.+)_\Q$kv\E$/) { $v2 = $1 }
+ # if $v2 doesn't end in the same thing, strip off locale info from $v1
+ if ($v1 =~ /(.*)_([a-z]{2})_([A-Z]{2})$/) {
+ my $v = $1;
+ if ($v2 !~ /_$2_$3$/) { $v1 = $v; }
+ }
+ # and vice versa...
+ if ($v2 =~ /(.*)_([a-z]{2})_([A-Z]{2})$/) {
+ my $v = $1;
+ if ($v1 !~ /_$2_$3$/) { $v2 = $v; }
+ }
+
versioncmp($v1, $v2);
}