sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit fe22fa1ff4c2108613e5403d6f8b9f6dc2cc61aa
parent 7ca2de02fc3e5197eec3f9a94b9e4fac420bdda5
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Sun,  4 Dec 2016 21:02:38 +0200

SBO::Lib::Util: fix version_cmp for #45.

Diffstat:
MSBO-Lib/lib/SBO/Lib/Util.pm | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git 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); }