diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-08-12 14:35:19 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-08-12 18:00:46 -0300 |
commit | d147560d574dcd9bde5c17eefd49dbbfee5b2505 (patch) | |
tree | 8fc65fb46120becdb000c96ffbd4be9798fc12ff | |
parent | b0fbb1bc377a3563cf995136321f480cc53414ca (diff) | |
download | luarocks-d147560d574dcd9bde5c17eefd49dbbfee5b2505.tar.gz luarocks-d147560d574dcd9bde5c17eefd49dbbfee5b2505.tar.bz2 luarocks-d147560d574dcd9bde5c17eefd49dbbfee5b2505.zip |
refactor: remove local copy of get_provided_item
-rw-r--r-- | src/luarocks/repos.tl | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/luarocks/repos.tl b/src/luarocks/repos.tl index 3af53575..3bfd5849 100644 --- a/src/luarocks/repos.tl +++ b/src/luarocks/repos.tl | |||
@@ -11,18 +11,6 @@ local dir = require("luarocks.dir") | |||
11 | local manif = require("luarocks.manif") | 11 | local manif = require("luarocks.manif") |
12 | local vers = require("luarocks.core.vers") | 12 | local vers = require("luarocks.core.vers") |
13 | 13 | ||
14 | local unpack = unpack or table.unpack -- luacheck: ignore 211 | ||
15 | |||
16 | --- Get type and name of an item (a module or a command) provided by a file. | ||
17 | -- @param deploy_type string: rock manifest subtree the file comes from ("bin", "lua", or "lib"). | ||
18 | -- @param file_path string: path to the file relatively to deploy_type subdirectory. | ||
19 | -- @return (string, string): item type ("module" or "command") and name. | ||
20 | local function get_provided_item(deploy_type: string, file_path: string): string, string | ||
21 | local item_type = deploy_type == "bin" and "command" or "module" | ||
22 | local item_name = item_type == "command" and file_path or path.path_to_module(file_path) | ||
23 | return item_type, item_name | ||
24 | end | ||
25 | |||
26 | -- Tree of files installed by a package are stored | 14 | -- Tree of files installed by a package are stored |
27 | -- in its rock manifest. Some of these files have to | 15 | -- in its rock manifest. Some of these files have to |
28 | -- be deployed to locations where Lua can load them as | 16 | -- be deployed to locations where Lua can load them as |
@@ -92,7 +80,7 @@ end | |||
92 | local function store_package_data(result, rock_manifest, deploy_type) | 80 | local function store_package_data(result, rock_manifest, deploy_type) |
93 | if rock_manifest[deploy_type] then | 81 | if rock_manifest[deploy_type] then |
94 | repos.recurse_rock_manifest_entry(rock_manifest[deploy_type], function(file_path) | 82 | repos.recurse_rock_manifest_entry(rock_manifest[deploy_type], function(file_path) |
95 | local _, item_name = get_provided_item(deploy_type, file_path) | 83 | local _, item_name = manif.get_provided_item(deploy_type, file_path) |
96 | result[item_name] = file_path | 84 | result[item_name] = file_path |
97 | return true | 85 | return true |
98 | end) | 86 | end) |
@@ -244,7 +232,7 @@ local function get_deploy_paths(name, version, deploy_type, file_path, repo) | |||
244 | end | 232 | end |
245 | 233 | ||
246 | local function check_spot_if_available(name, version, deploy_type, file_path) | 234 | local function check_spot_if_available(name, version, deploy_type, file_path) |
247 | local item_type, item_name = get_provided_item(deploy_type, file_path) | 235 | local item_type, item_name = manif.get_provided_item(deploy_type, file_path) |
248 | local cur_name, cur_version = manif.get_current_provider(item_type, item_name) | 236 | local cur_name, cur_version = manif.get_current_provider(item_type, item_name) |
249 | 237 | ||
250 | -- older versions of LuaRocks (< 3) registered "foo.init" files as "foo" | 238 | -- older versions of LuaRocks (< 3) registered "foo.init" files as "foo" |