gcc5: add regex

Fixes the bottle regex problem seen in
https://github.com/Homebrew/homebrew-versions/pull/678.

I don’t know whether it’s a good regex, or an awful regex, but it works
and passes `brew tests` and a bottled install. Open to improvements if
anyone has them.

Closes Homebrew/homebrew#38333.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Dominyk Tiller 2015-04-03 13:11:50 +01:00 committed by Mike McQuaid
parent 5a0ec0c491
commit 6de372d7fe
2 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,10 @@ class BottleVersion < Version
spec = Pathname.new(spec) unless spec.is_a? Pathname
stem = spec.stem
# e.g. 5-20150215 from gcc5-5-20150215.yosemite.bottle.tar.gz
m = /[a-z]{3}\d-(\d{1}-\d{8})/.match(stem)
return m.captures.first unless m.nil?
# e.g. perforce-2013.1.610569-x86_64.mountain_lion.bottle.tar.gz
m = /-([\d\.]+-x86(_64)?)/.match(stem)
return m.captures.first unless m.nil?

View File

@ -80,4 +80,9 @@ class BottleVersionParsingTests < Homebrew::TestCase
assert_version_detected '11-062',
'apparix-11-062.yosemite.bottle.tar.gz'
end
def test_gcc_versions_style
assert_version_detected '5-20150215',
'gcc5-5-20150215.yosemite.bottle.tar.gz'
end
end