diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/core/manif.tl | 38 | ||||
| -rw-r--r-- | src/luarocks/core/path-original.lua (renamed from src/luarocks/core/path-incomplete.lua) | 82 | ||||
| -rw-r--r-- | src/luarocks/core/path.lua | 78 | ||||
| -rw-r--r-- | src/luarocks/core/path.tl | 6 | ||||
| -rw-r--r-- | src/luarocks/core/vers.lua | 17 | ||||
| -rw-r--r-- | src/luarocks/core/vers.tl | 17 |
6 files changed, 112 insertions, 126 deletions
diff --git a/src/luarocks/core/manif.tl b/src/luarocks/core/manif.tl index 2ae908e0..6f7fd458 100644 --- a/src/luarocks/core/manif.tl +++ b/src/luarocks/core/manif.tl | |||
| @@ -3,33 +3,24 @@ | |||
| 3 | local record manif | 3 | local record manif |
| 4 | end | 4 | end |
| 5 | 5 | ||
| 6 | local record Command | 6 | local persist = require("luarocks.core.persist") --! |
| 7 | name: string | 7 | local cfg = require("luarocks.core.cfg") |
| 8 | version: string | 8 | local dir = require("luarocks.core.dir") |
| 9 | end | 9 | local util = require("luarocks.core.util") |
| 10 | 10 | local vers = require("luarocks.core.vers") | |
| 11 | local record Lua_version | 11 | local path = require("luarocks.core.path") |
| 12 | major: integer | 12 | -------------------------------------------------------------------------------- |
| 13 | minor: integer | ||
| 14 | string: string | ||
| 15 | end | ||
| 16 | 13 | ||
| 17 | local record Constraints | 14 | local record Constraints |
| 18 | op: string | 15 | op: string |
| 19 | lua_version: {Lua_version} | 16 | version: {vers.Version} |
| 20 | end | 17 | end |
| 21 | 18 | ||
| 22 | local record DependencyVersion | 19 | local record DependencyVersion |
| 23 | version: string | ||
| 24 | constraints: {Constraints} | 20 | constraints: {Constraints} |
| 25 | name: string | 21 | name: string |
| 26 | end | 22 | end |
| 27 | 23 | ||
| 28 | local record Dependency | ||
| 29 | name: string | ||
| 30 | version: {DependencyVersion} --! multiple versions in the same dependency | ||
| 31 | end | ||
| 32 | |||
| 33 | local record Module | 24 | local record Module |
| 34 | name: string --! ["tl.tl"] = {"tl/0.15.3-1"} | 25 | name: string --! ["tl.tl"] = {"tl/0.15.3-1"} |
| 35 | name_version: string --! or file location | 26 | name_version: string --! or file location |
| @@ -48,19 +39,12 @@ end | |||
| 48 | 39 | ||
| 49 | local record Manifest --! | 40 | local record Manifest --! |
| 50 | arch: string --! only for repository | 41 | arch: string --! only for repository |
| 51 | commands: {Command} | 42 | commands: {string:{string}} |
| 52 | dependencies: {Dependency} | 43 | dependencies: {string: {string: DependencyVersion}} |
| 53 | modules: {Module} | 44 | modules: {Module} |
| 54 | repository: {Repository} --! no repository for repositoyry | 45 | repository: {Repository} --! no repository for repositoyry |
| 55 | end | 46 | end |
| 56 | 47 | ||
| 57 | local persist = require("luarocks.core.persist") --! | ||
| 58 | local cfg = require("luarocks.core.cfg") | ||
| 59 | local dir = require("luarocks.core.dir") | ||
| 60 | local util = require("luarocks.core.util") | ||
| 61 | local vers = require("luarocks.core.vers") | ||
| 62 | local path = require("luarocks.core.path") | ||
| 63 | -------------------------------------------------------------------------------- | ||
| 64 | 48 | ||
| 65 | -- Table with repository identifiers as keys and tables mapping | 49 | -- Table with repository identifiers as keys and tables mapping |
| 66 | -- Lua versions to cached loaded manifests as values. | 50 | -- Lua versions to cached loaded manifests as values. |
diff --git a/src/luarocks/core/path-incomplete.lua b/src/luarocks/core/path-original.lua index 59ab9c7f..2f037b41 100644 --- a/src/luarocks/core/path-incomplete.lua +++ b/src/luarocks/core/path-original.lua | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local package = _tl_compat and _tl_compat.package or package; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table | ||
| 2 | 1 | ||
| 2 | --- Core LuaRocks-specific path handling functions. | ||
| 3 | local path = {} | 3 | local path = {} |
| 4 | 4 | ||
| 5 | |||
| 6 | local cfg = require("luarocks.core.cfg") | 5 | local cfg = require("luarocks.core.cfg") |
| 7 | local dir = require("luarocks.core.dir") | 6 | local dir = require("luarocks.core.dir") |
| 8 | 7 | local require = nil | |
| 9 | |||
| 10 | 8 | ||
| 11 | local dir_sep = package.config:sub(1, 1) | 9 | local dir_sep = package.config:sub(1, 1) |
| 12 | 10 | -------------------------------------------------------------------------------- | |
| 13 | 11 | ||
| 14 | function path.rocks_dir(tree) | 12 | function path.rocks_dir(tree) |
| 15 | if tree == nil then | 13 | if tree == nil then |
| @@ -18,30 +16,33 @@ function path.rocks_dir(tree) | |||
| 18 | if type(tree) == "string" then | 16 | if type(tree) == "string" then |
| 19 | return dir.path(tree, cfg.rocks_subdir) | 17 | return dir.path(tree, cfg.rocks_subdir) |
| 20 | end | 18 | end |
| 19 | assert(type(tree) == "table") | ||
| 21 | return tree.rocks_dir or dir.path(tree.root, cfg.rocks_subdir) | 20 | return tree.rocks_dir or dir.path(tree.root, cfg.rocks_subdir) |
| 22 | end | 21 | end |
| 23 | 22 | ||
| 24 | 23 | --- Produce a versioned version of a filename. | |
| 25 | 24 | -- @param file string: filename (must start with prefix) | |
| 26 | 25 | -- @param prefix string: Path prefix for file | |
| 27 | 26 | -- @param name string: Rock name | |
| 28 | 27 | -- @param version string: Rock version | |
| 29 | 28 | -- @return string: a pathname with the same directory parts and a versioned basename. | |
| 30 | function path.versioned_name(file, prefix, name, version) | 29 | function path.versioned_name(file, prefix, name, version) |
| 31 | assert(not name:match(dir_sep)) | 30 | assert(type(file) == "string") |
| 31 | assert(type(name) == "string" and not name:match(dir_sep)) | ||
| 32 | assert(type(version) == "string") | ||
| 32 | 33 | ||
| 33 | local rest = file:sub(#prefix + 1):gsub("^" .. dir_sep .. "*", "") | 34 | local rest = file:sub(#prefix+1):gsub("^" .. dir_sep .. "*", "") |
| 34 | local name_version = (name .. "_" .. version):gsub("%-", "_"):gsub("%.", "_") | 35 | local name_version = (name.."_"..version):gsub("%-", "_"):gsub("%.", "_") |
| 35 | return dir.path(prefix, name_version .. "-" .. rest) | 36 | return dir.path(prefix, name_version.."-"..rest) |
| 36 | end | 37 | end |
| 37 | 38 | ||
| 38 | 39 | --- Convert a pathname to a module identifier. | |
| 39 | 40 | -- In Unix, for example, a path "foo/bar/baz.lua" is converted to | |
| 40 | 41 | -- "foo.bar.baz"; "bla/init.lua" returns "bla.init"; "foo.so" returns "foo". | |
| 41 | 42 | -- @param file string: Pathname of module | |
| 42 | 43 | -- @return string: The module identifier, or nil if given path is | |
| 43 | 44 | -- not a conformant module path (the function does not check if the | |
| 44 | 45 | -- path actually exists). | |
| 45 | function path.path_to_module(file) | 46 | function path.path_to_module(file) |
| 46 | assert(type(file) == "string") | 47 | assert(type(file) == "string") |
| 47 | 48 | ||
| @@ -65,7 +66,7 @@ function path.path_to_module(file) | |||
| 65 | 66 | ||
| 66 | if not name then name = file end | 67 | if not name then name = file end |
| 67 | 68 | ||
| 68 | 69 | -- remove any beginning and trailing slashes-converted-to-dots | |
| 69 | name = name:gsub("^%.+", ""):gsub("%.+$", "") | 70 | name = name:gsub("^%.+", ""):gsub("%.+$", "") |
| 70 | 71 | ||
| 71 | return name | 72 | return name |
| @@ -85,20 +86,20 @@ function path.deploy_lib_dir(tree) | |||
| 85 | return dir.path(tree, cfg.lib_modules_path) | 86 | return dir.path(tree, cfg.lib_modules_path) |
| 86 | else | 87 | else |
| 87 | assert(type(tree) == "table") | 88 | assert(type(tree) == "table") |
| 88 | return tostring(tree.lib_dir) or dir.path(tree.root, cfg.lib_modules_path) | 89 | return tree.lib_dir or dir.path(tree.root, cfg.lib_modules_path) |
| 89 | end | 90 | end |
| 90 | end | 91 | end |
| 91 | 92 | ||
| 92 | local is_src_extension = { [".lua"] = true, [".tl"] = true, [".tld"] = true, [".moon"] = true } | 93 | local is_src_extension = { [".lua"] = true, [".tl"] = true, [".tld"] = true, [".moon"] = true } |
| 93 | 94 | ||
| 94 | 95 | --- Return the pathname of the file that would be loaded for a module, indexed. | |
| 95 | 96 | -- @param file_name string: module file name as in manifest (eg. "socket/core.so") | |
| 96 | 97 | -- @param name string: name of the package (eg. "luasocket") | |
| 97 | 98 | -- @param version string: version number (eg. "2.0.2-1") | |
| 98 | 99 | -- @param tree string: repository path (eg. "/usr/local") | |
| 99 | 100 | -- @param i number: the index, 1 if version is the current default, > 1 otherwise. | |
| 100 | 101 | -- This is done this way for use by select_module in luarocks.loader. | |
| 101 | 102 | -- @return string: filename of the module (eg. "/usr/local/lib/lua/5.1/socket/core.so") | |
| 102 | function path.which_i(file_name, name, version, tree, i) | 103 | function path.which_i(file_name, name, version, tree, i) |
| 103 | local deploy_dir | 104 | local deploy_dir |
| 104 | local extension = file_name:match("%.[a-z]+$") | 105 | local extension = file_name:match("%.[a-z]+$") |
| @@ -119,17 +120,18 @@ function path.rocks_tree_to_string(tree) | |||
| 119 | if type(tree) == "string" then | 120 | if type(tree) == "string" then |
| 120 | return tree | 121 | return tree |
| 121 | else | 122 | else |
| 122 | return tostring(tree.root) | 123 | assert(type(tree) == "table") |
| 124 | return tree.root | ||
| 123 | end | 125 | end |
| 124 | end | 126 | end |
| 125 | 127 | ||
| 126 | 128 | --- Apply a given function to the active rocks trees based on chosen dependency mode. | |
| 127 | 129 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | |
| 128 | 130 | -- "all" for all trees, "order" for all trees with priority >= the current default, | |
| 129 | 131 | -- "none" for no trees (this function becomes a nop). | |
| 130 | 132 | -- @param fn function: function to be applied, with the tree dir (string) as the first | |
| 131 | 133 | -- argument and the remaining varargs of map_trees as the following arguments. | |
| 132 | 134 | -- @return a table with all results of invocations of fn collected. | |
| 133 | function path.map_trees(deps_mode, fn, ...) | 135 | function path.map_trees(deps_mode, fn, ...) |
| 134 | local result = {} | 136 | local result = {} |
| 135 | local current = cfg.root_dir or cfg.rocks_trees[1] | 137 | local current = cfg.root_dir or cfg.rocks_trees[1] |
diff --git a/src/luarocks/core/path.lua b/src/luarocks/core/path.lua index 2f037b41..20a90f79 100644 --- a/src/luarocks/core/path.lua +++ b/src/luarocks/core/path.lua | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local package = _tl_compat and _tl_compat.package or package; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table | ||
| 1 | 2 | ||
| 2 | --- Core LuaRocks-specific path handling functions. | ||
| 3 | local path = {} | 3 | local path = {} |
| 4 | 4 | ||
| 5 | |||
| 5 | local cfg = require("luarocks.core.cfg") | 6 | local cfg = require("luarocks.core.cfg") |
| 6 | local dir = require("luarocks.core.dir") | 7 | local dir = require("luarocks.core.dir") |
| 7 | local require = nil | 8 | |
| 9 | |||
| 8 | 10 | ||
| 9 | local dir_sep = package.config:sub(1, 1) | 11 | local dir_sep = package.config:sub(1, 1) |
| 10 | -------------------------------------------------------------------------------- | 12 | |
| 11 | 13 | ||
| 12 | function path.rocks_dir(tree) | 14 | function path.rocks_dir(tree) |
| 13 | if tree == nil then | 15 | if tree == nil then |
| @@ -16,33 +18,30 @@ function path.rocks_dir(tree) | |||
| 16 | if type(tree) == "string" then | 18 | if type(tree) == "string" then |
| 17 | return dir.path(tree, cfg.rocks_subdir) | 19 | return dir.path(tree, cfg.rocks_subdir) |
| 18 | end | 20 | end |
| 19 | assert(type(tree) == "table") | ||
| 20 | return tree.rocks_dir or dir.path(tree.root, cfg.rocks_subdir) | 21 | return tree.rocks_dir or dir.path(tree.root, cfg.rocks_subdir) |
| 21 | end | 22 | end |
| 22 | 23 | ||
| 23 | --- Produce a versioned version of a filename. | 24 | |
| 24 | -- @param file string: filename (must start with prefix) | 25 | |
| 25 | -- @param prefix string: Path prefix for file | 26 | |
| 26 | -- @param name string: Rock name | 27 | |
| 27 | -- @param version string: Rock version | 28 | |
| 28 | -- @return string: a pathname with the same directory parts and a versioned basename. | 29 | |
| 29 | function path.versioned_name(file, prefix, name, version) | 30 | function path.versioned_name(file, prefix, name, version) |
| 30 | assert(type(file) == "string") | 31 | assert(not name:match(dir_sep)) |
| 31 | assert(type(name) == "string" and not name:match(dir_sep)) | ||
| 32 | assert(type(version) == "string") | ||
| 33 | 32 | ||
| 34 | local rest = file:sub(#prefix+1):gsub("^" .. dir_sep .. "*", "") | 33 | local rest = file:sub(#prefix + 1):gsub("^" .. dir_sep .. "*", "") |
| 35 | local name_version = (name.."_"..version):gsub("%-", "_"):gsub("%.", "_") | 34 | local name_version = (name .. "_" .. version):gsub("%-", "_"):gsub("%.", "_") |
| 36 | return dir.path(prefix, name_version.."-"..rest) | 35 | return dir.path(prefix, name_version .. "-" .. rest) |
| 37 | end | 36 | end |
| 38 | 37 | ||
| 39 | --- Convert a pathname to a module identifier. | 38 | |
| 40 | -- In Unix, for example, a path "foo/bar/baz.lua" is converted to | 39 | |
| 41 | -- "foo.bar.baz"; "bla/init.lua" returns "bla.init"; "foo.so" returns "foo". | 40 | |
| 42 | -- @param file string: Pathname of module | 41 | |
| 43 | -- @return string: The module identifier, or nil if given path is | 42 | |
| 44 | -- not a conformant module path (the function does not check if the | 43 | |
| 45 | -- path actually exists). | 44 | |
| 46 | function path.path_to_module(file) | 45 | function path.path_to_module(file) |
| 47 | assert(type(file) == "string") | 46 | assert(type(file) == "string") |
| 48 | 47 | ||
| @@ -66,7 +65,7 @@ function path.path_to_module(file) | |||
| 66 | 65 | ||
| 67 | if not name then name = file end | 66 | if not name then name = file end |
| 68 | 67 | ||
| 69 | -- remove any beginning and trailing slashes-converted-to-dots | 68 | |
| 70 | name = name:gsub("^%.+", ""):gsub("%.+$", "") | 69 | name = name:gsub("^%.+", ""):gsub("%.+$", "") |
| 71 | 70 | ||
| 72 | return name | 71 | return name |
| @@ -92,14 +91,14 @@ end | |||
| 92 | 91 | ||
| 93 | local is_src_extension = { [".lua"] = true, [".tl"] = true, [".tld"] = true, [".moon"] = true } | 92 | local is_src_extension = { [".lua"] = true, [".tl"] = true, [".tld"] = true, [".moon"] = true } |
| 94 | 93 | ||
| 95 | --- Return the pathname of the file that would be loaded for a module, indexed. | 94 | |
| 96 | -- @param file_name string: module file name as in manifest (eg. "socket/core.so") | 95 | |
| 97 | -- @param name string: name of the package (eg. "luasocket") | 96 | |
| 98 | -- @param version string: version number (eg. "2.0.2-1") | 97 | |
| 99 | -- @param tree string: repository path (eg. "/usr/local") | 98 | |
| 100 | -- @param i number: the index, 1 if version is the current default, > 1 otherwise. | 99 | |
| 101 | -- This is done this way for use by select_module in luarocks.loader. | 100 | |
| 102 | -- @return string: filename of the module (eg. "/usr/local/lib/lua/5.1/socket/core.so") | 101 | |
| 103 | function path.which_i(file_name, name, version, tree, i) | 102 | function path.which_i(file_name, name, version, tree, i) |
| 104 | local deploy_dir | 103 | local deploy_dir |
| 105 | local extension = file_name:match("%.[a-z]+$") | 104 | local extension = file_name:match("%.[a-z]+$") |
| @@ -120,18 +119,17 @@ function path.rocks_tree_to_string(tree) | |||
| 120 | if type(tree) == "string" then | 119 | if type(tree) == "string" then |
| 121 | return tree | 120 | return tree |
| 122 | else | 121 | else |
| 123 | assert(type(tree) == "table") | ||
| 124 | return tree.root | 122 | return tree.root |
| 125 | end | 123 | end |
| 126 | end | 124 | end |
| 127 | 125 | ||
| 128 | --- Apply a given function to the active rocks trees based on chosen dependency mode. | 126 | |
| 129 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | 127 | |
| 130 | -- "all" for all trees, "order" for all trees with priority >= the current default, | 128 | |
| 131 | -- "none" for no trees (this function becomes a nop). | 129 | |
| 132 | -- @param fn function: function to be applied, with the tree dir (string) as the first | 130 | |
| 133 | -- argument and the remaining varargs of map_trees as the following arguments. | 131 | |
| 134 | -- @return a table with all results of invocations of fn collected. | 132 | |
| 135 | function path.map_trees(deps_mode, fn, ...) | 133 | function path.map_trees(deps_mode, fn, ...) |
| 136 | local result = {} | 134 | local result = {} |
| 137 | local current = cfg.root_dir or cfg.rocks_trees[1] | 135 | local current = cfg.root_dir or cfg.rocks_trees[1] |
diff --git a/src/luarocks/core/path.tl b/src/luarocks/core/path.tl index 5834ef53..35f66e0c 100644 --- a/src/luarocks/core/path.tl +++ b/src/luarocks/core/path.tl | |||
| @@ -28,7 +28,7 @@ end | |||
| 28 | -- @param version string: Rock version | 28 | -- @param version string: Rock version |
| 29 | -- @return string: a pathname with the same directory parts and a versioned basename. | 29 | -- @return string: a pathname with the same directory parts and a versioned basename. |
| 30 | function path.versioned_name(file: string, prefix: string, name: string, version: string): string | 30 | function path.versioned_name(file: string, prefix: string, name: string, version: string): string |
| 31 | assert(name:match(dir_sep)) --! | 31 | assert(not name:match(dir_sep)) --! |
| 32 | 32 | ||
| 33 | local rest = file:sub(#prefix+1):gsub("^" .. dir_sep .. "*", "") | 33 | local rest = file:sub(#prefix+1):gsub("^" .. dir_sep .. "*", "") |
| 34 | local name_version = (name.."_"..version):gsub("%-", "_"):gsub("%.", "_") | 34 | local name_version = (name.."_"..version):gsub("%-", "_"):gsub("%.", "_") |
| @@ -85,7 +85,7 @@ function path.deploy_lib_dir(tree: string | Tree): string | |||
| 85 | return dir.path(tree, cfg.lib_modules_path) | 85 | return dir.path(tree, cfg.lib_modules_path) |
| 86 | else | 86 | else |
| 87 | assert(type(tree) == "table") | 87 | assert(type(tree) == "table") |
| 88 | return tostring(tree.lib_dir) or dir.path(tree.root, cfg.lib_modules_path) | 88 | return tree.lib_dir or dir.path(tree.root, cfg.lib_modules_path) |
| 89 | end | 89 | end |
| 90 | end | 90 | end |
| 91 | 91 | ||
| @@ -119,7 +119,7 @@ function path.rocks_tree_to_string(tree: string | Tree): string | |||
| 119 | if tree is string then | 119 | if tree is string then |
| 120 | return tree | 120 | return tree |
| 121 | else | 121 | else |
| 122 | return tostring(tree.root) | 122 | return tree.root |
| 123 | end | 123 | end |
| 124 | end | 124 | end |
| 125 | 125 | ||
diff --git a/src/luarocks/core/vers.lua b/src/luarocks/core/vers.lua index a5a1a0a9..097e8199 100644 --- a/src/luarocks/core/vers.lua +++ b/src/luarocks/core/vers.lua | |||
| @@ -1,4 +1,12 @@ | |||
| 1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local math = _tl_compat and _tl_compat.math or math; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local vers = {} | 1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local math = _tl_compat and _tl_compat.math or math; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local vers = {Version = {}, } |
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | |||
| 2 | 10 | ||
| 3 | 11 | ||
| 4 | local util = require("luarocks.core.util") | 12 | local util = require("luarocks.core.util") |
| @@ -16,13 +24,6 @@ local deltas = { | |||
| 16 | 24 | ||
| 17 | 25 | ||
| 18 | 26 | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | local version_mt = { | 27 | local version_mt = { |
| 27 | 28 | ||
| 28 | 29 | ||
diff --git a/src/luarocks/core/vers.tl b/src/luarocks/core/vers.tl index 8953a730..7b2659e4 100644 --- a/src/luarocks/core/vers.tl +++ b/src/luarocks/core/vers.tl | |||
| @@ -1,4 +1,12 @@ | |||
| 1 | local record vers | 1 | local record vers |
| 2 | record Version | ||
| 3 | {number} -- next version of Teal: "is {number}" | ||
| 4 | string: string | ||
| 5 | revision: number | ||
| 6 | metamethod __eq: function(Version, Version): boolean | ||
| 7 | metamethod __lt: function(Version, Version): boolean | ||
| 8 | metamethod __le: function(Version, Version): boolean | ||
| 9 | end | ||
| 2 | end | 10 | end |
| 3 | 11 | ||
| 4 | local util = require("luarocks.core.util") | 12 | local util = require("luarocks.core.util") |
| @@ -14,14 +22,7 @@ local deltas: {string: integer} = { | |||
| 14 | alpha = -1000000 | 22 | alpha = -1000000 |
| 15 | } | 23 | } |
| 16 | 24 | ||
| 17 | local record Version | 25 | local type Version = vers.Version |
| 18 | {number} -- next version of Teal: "is {number}" | ||
| 19 | string: string | ||
| 20 | revision: number | ||
| 21 | metamethod __eq: function(Version, Version): boolean | ||
| 22 | metamethod __lt: function(Version, Version): boolean | ||
| 23 | metamethod __le: function(Version, Version): boolean | ||
| 24 | end | ||
| 25 | 26 | ||
| 26 | local version_mt: metatable<Version> = { | 27 | local version_mt: metatable<Version> = { |
| 27 | --- Equality comparison for versions. | 28 | --- Equality comparison for versions. |
