perforce: add version detection regex.

This commit is contained in:
Mike McQuaid 2013-06-20 13:07:59 +01:00
parent a783946b6d
commit 01e5e428eb
2 changed files with 9 additions and 0 deletions

View File

@ -297,4 +297,9 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected '2.4c', assert_version_detected '2.4c',
'http://loop-aes.sourceforge.net/aespipe/aespipe-v2.4c.tar.bz2' 'http://loop-aes.sourceforge.net/aespipe/aespipe-v2.4c.tar.bz2'
end end
def test_perforce_style
assert_version_detected '2013.1.610569-x86_64',
'/usr/local/perforce-2013.1.610569-x86_64.mountain_lion.bottle.tar.gz'
end
end end

View File

@ -237,6 +237,10 @@ class Version
m = /[-_]([Rr]\d+[AaBb]\d*(?:-\d+)?)/.match(spec_s) m = /[-_]([Rr]\d+[AaBb]\d*(?:-\d+)?)/.match(spec_s)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. perforce-2013.1.610569-x86_64
m = /-([\d\.]+-x86(_64)?)/.match(stem)
return m.captures.first unless m.nil?
# e.g. boost_1_39_0 # e.g. boost_1_39_0
m = /((?:\d+_)+\d+)$/.match(stem) m = /((?:\d+_)+\d+)$/.match(stem)
return m.captures.first.gsub('_', '.') unless m.nil? return m.captures.first.gsub('_', '.') unless m.nil?