From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2E204445320 for ; Thu, 9 Jul 2020 19:50:33 +0300 (MSK) Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1jtZkm-0005E7-Jp for tarantool-patches@dev.tarantool.org; Thu, 09 Jul 2020 19:50:32 +0300 Received: by mail-lj1-f170.google.com with SMTP id h19so3141594ljg.13 for ; Thu, 09 Jul 2020 09:50:32 -0700 (PDT) MIME-Version: 1.0 References: <3cdf11659eb18f79faecb65f4cbe25022a8d205e.1594312926.git.imeevma@gmail.com> In-Reply-To: <3cdf11659eb18f79faecb65f4cbe25022a8d205e.1594312926.git.imeevma@gmail.com> From: Yaroslav Dynnikov Date: Thu, 9 Jul 2020 19:50:21 +0300 Message-ID: Content-Type: multipart/alternative; boundary="000000000000cb2a9605aa0505e7" Subject: Re: [Tarantool-patches] [PATCH v2 1/1] luarock: change a way to create manifest List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mergen Imeev Cc: Yaroslav Dynnikov , tml --000000000000cb2a9605aa0505e7 Content-Type: text/plain; charset="UTF-8" Perfect, LGTM. Best regards Yaroslav Dynnikov On Thu, 9 Jul 2020 at 19:45, wrote: > 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 > > --000000000000cb2a9605aa0505e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Perfect, LGTM.

<= div dir=3D"ltr">
Best regards
Yaroslav= Dynnikov


On Thu, 9 Jul 2= 020 at 19:45, <imeevma@tarantoo= l.org> wrote:
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:
=C2=A0* Don't ruin rock name when freshly installing *.all.rock with =C2=A0 =C2=A0dependencies.

=C2=A0src/luarocks/manif.lua | 9 ++++-----
=C2=A01 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, d= eps_mode)

=C2=A0 =C2=A0 local manifest, err =3D manif_core.load_local_manifest(rocks_= dir)
=C2=A0 =C2=A0 if not manifest then
-=C2=A0 =C2=A0 =C2=A0 util.printerr("No existing manifest. Attempting = to rebuild...")
-=C2=A0 =C2=A0 =C2=A0 -- Manifest built by `manif.make_manifest` should alr= eady
-=C2=A0 =C2=A0 =C2=A0 -- include information about given name and version,<= br> -=C2=A0 =C2=A0 =C2=A0 -- no need to update it.
-=C2=A0 =C2=A0 =C2=A0 return manif.make_manifest(rocks_dir, deps_mode)
+=C2=A0 =C2=A0 =C2=A0 util.printerr("No existing manifest. Creating an= empty one...")
+=C2=A0 =C2=A0 =C2=A0 -- Create an empty manifest.
+=C2=A0 =C2=A0 =C2=A0 manifest, err =3D { repository =3D {}, modules =3D {}= , commands =3D {} }, nil
+=C2=A0 =C2=A0 =C2=A0 manif_core.cache_manifest(rocks_dir, nil, manifest) =C2=A0 =C2=A0 end

=C2=A0 =C2=A0 local results =3D {[name] =3D {[version] =3D {{arch =3D "= ;installed", repo =3D rocks_dir}}}}
--
2.25.1

--000000000000cb2a9605aa0505e7--