diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb index 52e0cccd10..49f6b9a1db 100644 --- a/Library/Homebrew/test/test_versions.rb +++ b/Library/Homebrew/test/test_versions.rb @@ -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 diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 796538cfdd..9e2fd32ae0 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -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?