erlang: fix version detection and bottles.

This commit is contained in:
Mike McQuaid 2012-08-25 10:20:48 -07:00
parent 9e8bf8413d
commit d9a18d4c1e
2 changed files with 13 additions and 5 deletions

View File

@ -93,6 +93,10 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected 'R13B', 'http://erlang.org/download/otp_src_R13B.tar.gz'
end
def test_another_erlang_version_style
assert_version_detected 'R15B01', 'https://github.com/erlang/otp/tarball/OTP_R15B01'
end
def test_p7zip_version_style
assert_version_detected '9.04',
'http://kent.dl.sourceforge.net/sourceforge/p7zip/p7zip_9.04_src_all.tar.bz2'
@ -203,6 +207,10 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected 'R15B', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B.lion.bottle.tar.gz'
end
def test_another_erlang_bottle_style
assert_version_detected 'R15B01', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B01.mountainlion.bottle.tar.gz'
end
def test_old_bottle_style
assert_version_detected '4.7.3', 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz'
end

View File

@ -127,6 +127,10 @@ class Version
m = %r[github.com/.+/(?:zip|tar)ball/v?((\d+\.)+\d+_(\d+))$].match(spec.to_s)
return m.captures.first unless m.nil?
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)
m = /[-_](R\d+[AB]\d*)/.match(spec.to_s)
return m.captures.first unless m.nil?
# e.g. boost_1_39_0
m = /((\d+_)+\d+)$/.match(stem)
return m.captures.first.gsub('_', '.') unless m.nil?
@ -164,14 +168,10 @@ class Version
m = /_((\d+\.)+\d+[abc]?)[.]orig$/.match(stem)
return m.captures.first unless m.nil?
# e.g. erlang-R14B03-bottle.tar.gz (old erlang bottle style)
# e.g. http://www.openssl.org/source/openssl-0.9.8s.tar.gz
m = /-([^-]+)/.match(stem)
return m.captures.first unless m.nil?
# e.g. opt_src_R13B (erlang)
m = /otp_src_(.+)/.match(stem)
return m.captures.first unless m.nil?
# e.g. astyle_1.23_macosx.tar.gz
m = /_([^_]+)/.match(stem)
return m.captures.first unless m.nil?