aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDominyk Tiller2015-04-03 13:11:50 +0100
committerMike McQuaid2015-04-07 08:26:13 +0100
commit6de372d7fefccbe6db036cbc9a120e2a9921bcd7 (patch)
tree8773f90ca8eec876fcd4ac2a138d3a937c29d2c6 /Library
parent5a0ec0c49181569a595fa62d458c4cf16cf060e9 (diff)
downloadbrew-6de372d7fefccbe6db036cbc9a120e2a9921bcd7.tar.bz2
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>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/bottle_version.rb4
-rw-r--r--Library/Homebrew/test/test_bottle_versions.rb5
2 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/bottle_version.rb b/Library/Homebrew/bottle_version.rb
index 592105086..de210e12b 100644
--- a/Library/Homebrew/bottle_version.rb
+++ b/Library/Homebrew/bottle_version.rb
@@ -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?
diff --git a/Library/Homebrew/test/test_bottle_versions.rb b/Library/Homebrew/test/test_bottle_versions.rb
index 3e2374e67..1ba8ba5d9 100644
--- a/Library/Homebrew/test/test_bottle_versions.rb
+++ b/Library/Homebrew/test/test_bottle_versions.rb
@@ -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