aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-01-29 23:56:40 +0100
committerMike McQuaid2015-01-30 08:55:49 +0000
commita9c4091de733e54cc73bab7e0fe0b729f5f6bde6 (patch)
tree023b76dc8d7b64c973ec019f745a48875fe18e6a /Library
parent06f6fd5b839fa1903dc0e67146a948cc189e591c (diff)
downloadbrew-a9c4091de733e54cc73bab7e0fe0b729f5f6bde6.tar.bz2
Fix more version misdetections for URLs with archs
Closes Homebrew/homebrew#36368. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_versions.rb6
-rw-r--r--Library/Homebrew/version.rb8
2 files changed, 12 insertions, 2 deletions
diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb
index 52352ce8d..e520ad55e 100644
--- a/Library/Homebrew/test/test_versions.rb
+++ b/Library/Homebrew/test/test_versions.rb
@@ -353,7 +353,13 @@ class VersionParsingTests < Homebrew::TestCase
def test_with_arch
assert_version_detected '4.0.18-1',
'http://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm'
+ assert_version_detected '5.5.7-5',
+ 'http://ftpmirror.gnu.org/autogen/autogen-5.5.7-5.i386.rpm'
assert_version_detected '2.8',
'http://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x86.zip'
+ assert_version_detected '2.8',
+ 'http://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x64.zip'
+ assert_version_detected '4.0.18',
+ 'http://ftpmirror.gnu.org/mtools/mtools_4.0.18_i386.deb'
end
end
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index f94645208..63bccdba4 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -273,8 +273,9 @@ class Version
return m.captures.first.gsub('_', '.') unless m.nil?
# e.g. foobar-4.5.1-1
+ # e.g. unrtf_0.20.4-1
# e.g. ruby-1.9.1-p243
- m = /-((?:\d+\.)*\d\.\d+-(?:p|rc|RC)?\d+)(?:[-._](?:bin|dist|stable|src|sources))?$/.match(stem)
+ m = /[-_]((?:\d+\.)*\d\.\d+-(?:p|rc|RC)?\d+)(?:[-._](?:bin|dist|stable|src|sources))?$/.match(stem)
return m.captures.first unless m.nil?
# e.g. lame-398-1
@@ -299,8 +300,11 @@ class Version
return m.captures.first unless m.nil?
# e.g. http://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm
+ # e.g. http://ftpmirror.gnu.org/autogen/autogen-5.5.7-5.i386.rpm
# e.g. http://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x86.zip
- m = /-(\d+\.\d+(?:\.\d+)?(?:-\d+)?)[-_.](?:i686|x86(?:[-_](?:32|64))?)$/.match(stem)
+ # e.g. http://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x64.zip
+ # e.g. http://ftpmirror.gnu.org/mtools/mtools_4.0.18_i386.deb
+ m = /[-_](\d+\.\d+(?:\.\d+)?(?:-\d+)?)[-_.](?:i[36]86|x86|x64(?:[-_](?:32|64))?)$/.match(stem)
return m.captures.first unless m.nil?
# e.g. foobar4.5.1