diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 13:46:57 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 16:32:45 -0300 |
commit | 4bc532627dc59265abaf4d30e9c5c04d71fe7a6f (patch) | |
tree | c120f2fd0d6343217e338e7e7c4e0159a5ac2668 | |
parent | 8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f (diff) | |
download | luarocks-4bc532627dc59265abaf4d30e9c5c04d71fe7a6f.tar.gz luarocks-4bc532627dc59265abaf4d30e9c5c04d71fe7a6f.tar.bz2 luarocks-4bc532627dc59265abaf4d30e9c5c04d71fe7a6f.zip |
manif: remove dead code
-rw-r--r-- | src/luarocks/manif.lua | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index f643bc80..5790ef18 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
@@ -181,50 +181,6 @@ function manif.get_next_provider(item_type, item_name, repo) | |||
181 | end | 181 | end |
182 | end | 182 | end |
183 | 183 | ||
184 | --- Given a name of a module or a command provided by a package, figure out | ||
185 | -- which file provides it. | ||
186 | -- @param name string: package name. | ||
187 | -- @param version string: package version. | ||
188 | -- @param item_type string: "module" or "command". | ||
189 | -- @param item_name string: module or command name. | ||
190 | -- @param root string or nil: A local root dir for a rocks tree. If not given, the default is used. | ||
191 | -- @return (string, string): rock manifest subtree the file comes from ("bin", "lua", or "lib") | ||
192 | -- and path to the providing file relatively to that subtree. | ||
193 | function manif.get_providing_file(name, version, item_type, item_name, repo) | ||
194 | local rocks_dir = path.rocks_dir(repo or cfg.root_dir) | ||
195 | local manifest = manif.load_manifest(rocks_dir) | ||
196 | |||
197 | local entry_table = manifest.repository[name][version][1] | ||
198 | local file_path = entry_table[item_type .. "s"][item_name] | ||
199 | |||
200 | if item_type == "command" then | ||
201 | return "bin", file_path | ||
202 | end | ||
203 | |||
204 | -- A module can be in "lua" or "lib". Decide based on extension first: | ||
205 | -- most likely Lua modules are in "lua/" and C modules are in "lib/". | ||
206 | if file_path:match("%." .. cfg.lua_extension .. "$") then | ||
207 | return "lua", file_path | ||
208 | elseif file_path:match("%." .. cfg.lib_extension .. "$") then | ||
209 | return "lib", file_path | ||
210 | end | ||
211 | |||
212 | -- Fallback to rock manifest scanning. | ||
213 | local rock_manifest = manif.load_rock_manifest(name, version, repo and repo.root) | ||
214 | local subtree = rock_manifest.lib | ||
215 | |||
216 | for path_part in file_path:gmatch("[^/]+") do | ||
217 | if type(subtree) == "table" then | ||
218 | subtree = subtree[path_part] | ||
219 | else | ||
220 | -- Assume it's in "lua/" if it's not in "lib/". | ||
221 | return "lua", file_path | ||
222 | end | ||
223 | end | ||
224 | |||
225 | return type(subtree) == "string" and "lib" or "lua", file_path | ||
226 | end | ||
227 | |||
228 | --- Get all versions of a package listed in a manifest file. | 184 | --- Get all versions of a package listed in a manifest file. |
229 | -- @param name string: a package name. | 185 | -- @param name string: a package name. |
230 | -- @param deps_mode string: "one", to use only the currently | 186 | -- @param deps_mode string: "one", to use only the currently |