diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 13:32:11 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 13:32:11 -0300 |
commit | 2b56388e76952be52d849415b1ebae74b6dc4607 (patch) | |
tree | 822582b92e176aacbdefa26ea715bac8b5b7c743 | |
parent | a84b7698b7a320fd883cbb9b96703475e9ac6fa9 (diff) | |
download | luarocks-2b56388e76952be52d849415b1ebae74b6dc4607.tar.gz luarocks-2b56388e76952be52d849415b1ebae74b6dc4607.tar.bz2 luarocks-2b56388e76952be52d849415b1ebae74b6dc4607.zip |
manif.writer: be more resilient to a mismatched "x.init" module name in manifest
Old versions of LuaRocks might get confused with modules called "x.init".
This makes the manifest writer more resilient to that.
-rw-r--r-- | src/luarocks/manif/writer.lua | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/luarocks/manif/writer.lua b/src/luarocks/manif/writer.lua index 8e07702c..fd891844 100644 --- a/src/luarocks/manif/writer.lua +++ b/src/luarocks/manif/writer.lua | |||
@@ -55,17 +55,26 @@ local function remove_package_items(storage, name, version, items) | |||
55 | local package_identifier = name.."/"..version | 55 | local package_identifier = name.."/"..version |
56 | 56 | ||
57 | for item_name, path in pairs(items) do -- luacheck: ignore 431 | 57 | for item_name, path in pairs(items) do -- luacheck: ignore 431 |
58 | local all_identifiers = storage[item_name] | 58 | local key = item_name |
59 | local all_identifiers = storage[key] | ||
60 | if not all_identifiers then | ||
61 | key = key .. ".init" | ||
62 | all_identifiers = storage[key] | ||
63 | end | ||
59 | 64 | ||
60 | for i, identifier in ipairs(all_identifiers) do | 65 | if all_identifiers then |
61 | if identifier == package_identifier then | 66 | for i, identifier in ipairs(all_identifiers) do |
62 | table.remove(all_identifiers, i) | 67 | if identifier == package_identifier then |
63 | break | 68 | table.remove(all_identifiers, i) |
69 | break | ||
70 | end | ||
64 | end | 71 | end |
65 | end | ||
66 | 72 | ||
67 | if #all_identifiers == 0 then | 73 | if #all_identifiers == 0 then |
68 | storage[item_name] = nil | 74 | storage[key] = nil |
75 | end | ||
76 | else | ||
77 | util.warning("Cannot find entry for " .. item_name .. " in manifest -- corrupted manifest?") | ||
69 | end | 78 | end |
70 | end | 79 | end |
71 | end | 80 | end |