Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: lvasiliev@tarantool.org, yaroslav.dynnikov@tarantool.org,
	tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 1/1] luarock: change a way to create manifest
Date: Thu,  9 Jul 2020 19:45:23 +0300	[thread overview]
Message-ID: <3cdf11659eb18f79faecb65f4cbe25022a8d205e.1594312926.git.imeevma@gmail.com> (raw)

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

             reply	other threads:[~2020-07-09 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 16:45 imeevma [this message]
2020-07-09 16:50 ` Yaroslav Dynnikov
2020-07-09 17:13 ` Leonid Vasiliev
2020-07-10  8:28 ` Kirill Yukhin
  -- strict thread matches above, loose matches on Subject: below --
2020-07-09 15:51 imeevma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cdf11659eb18f79faecb65f4cbe25022a8d205e.1594312926.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=lvasiliev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=yaroslav.dynnikov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 1/1] luarock: change a way to create manifest' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox