Skip to content
Snippets Groups Projects
Commit cc7a047e authored by Baptiste Fontaine's avatar Baptiste Fontaine
Browse files

version: parse opam archives


Closes Homebrew/homebrew#44544.

Signed-off-by: default avatarBaptiste Fontaine <batifon@yahoo.fr>
parent 5f29dee1
No related branches found
No related tags found
No related merge requests found
......@@ -350,4 +350,15 @@ class VersionParsingTests < Homebrew::TestCase
assert_version_detected "4.0.18",
"http://ftpmirror.gnu.org/mtools/mtools_4.0.18_i386.deb"
end
def test_opam_version
assert_version_detected "2.18.3",
"https://opam.ocaml.org/archives/lablgtk.2.18.3+opam.tar.gz"
assert_version_detected "1.9",
"https://opam.ocaml.org/archives/sha.1.9+opam.tar.gz"
assert_version_detected "0.99.2",
"https://opam.ocaml.org/archives/ppx_tools.0.99.2+opam.tar.gz"
assert_version_detected "1.0.2",
"https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz"
end
end
......@@ -328,6 +328,13 @@ class Version
m = /-(\d+\.\d+(?:\.\d+)?)-w(?:in)?(?:32|64)$/.match(stem)
return m.captures.first unless m.nil?
# Opam packages
# e.g. https://opam.ocaml.org/archives/sha.1.9+opam.tar.gz
# e.g. https://opam.ocaml.org/archives/lablgtk.2.18.3+opam.tar.gz
# e.g. https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz
m = /\.(\d+\.\d+(?:\.\d+)?)\+opam$/.match(stem)
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment