Fix more version misdetections for URLs with archs
Closes Homebrew/homebrew#36368. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
06f6fd5b83
commit
a9c4091de7
@ -353,7 +353,13 @@ class VersionParsingTests < Homebrew::TestCase
|
|||||||
def test_with_arch
|
def test_with_arch
|
||||||
assert_version_detected '4.0.18-1',
|
assert_version_detected '4.0.18-1',
|
||||||
'http://ftpmirror.gnu.org/mtools/mtools-4.0.18-1.i686.rpm'
|
'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',
|
assert_version_detected '2.8',
|
||||||
'http://ftpmirror.gnu.org/libtasn1/libtasn1-2.8-x86.zip'
|
'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
|
||||||
end
|
end
|
||||||
|
|||||||
@ -273,8 +273,9 @@ class Version
|
|||||||
return m.captures.first.gsub('_', '.') unless m.nil?
|
return m.captures.first.gsub('_', '.') unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar-4.5.1-1
|
# e.g. foobar-4.5.1-1
|
||||||
|
# e.g. unrtf_0.20.4-1
|
||||||
# e.g. ruby-1.9.1-p243
|
# 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?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. lame-398-1
|
# e.g. lame-398-1
|
||||||
@ -299,8 +300,11 @@ class Version
|
|||||||
return m.captures.first unless m.nil?
|
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/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
|
# 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?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar4.5.1
|
# e.g. foobar4.5.1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user