Whenever a rock is installed it's being added to the repository
manifest. And if a manifest doesn't exist yet, luarocks creates
one by scanning the directory.
It causes a problem when *.all.rock with dependencies is installed
into an empty directory. Luarocks unpacks the all.rock before
installing dependencies, and it's modules are captured during
manifest creation. After the installation finishes, luarocks adds
the all.rock to the manifest once again (now intentionally),
detects collision of module names and renames them uniquely, like
"cartridge_1_2_0_1". As a result, "require()" function doesn't
work.
This patch changes the way of manifest creation: instead of
scanning repo luarocks creates an empty one.
Closes tarantool/tarantool#4704
---
https://github.com/tarantool/tarantool/issues/4704
https://github.com/tarantool/luarocks/tree/imeevma/gh-4704-fix-rock-name
@ChangeLog:
* Don't ruin rock name when freshly installing *.all.rock with
dependencies.
src/luarocks/manif.lua | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua
index 34ae02d..79a4278 100644
--- a/src/luarocks/manif.lua
+++ b/src/luarocks/manif.lua
@@ -444,11 +444,10 @@ function manif.add_to_manifest(name, version, repo, deps_mode)
local manifest, err = manif_core.load_local_manifest(rocks_dir)
if not manifest then
- util.printerr("No existing manifest. Attempting to rebuild...")
- -- Manifest built by `manif.make_manifest` should already
- -- include information about given name and version,
- -- no need to update it.
- return manif.make_manifest(rocks_dir, deps_mode)
+ util.printerr("No existing manifest. Creating an empty one...")
+ -- Create an empty manifest.
+ manifest, err = { repository = {}, modules = {}, commands = {} }, nil
+ manif_core.cache_manifest(rocks_dir, nil, manifest)
end
local results = {[name] = {[version] = {{arch = "installed", repo = rocks_dir}}}}
--
2.25.1