diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb index 52352ce8d0..e520ad55ef 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 f946452085..63bccdba48 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