From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (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 17D524696C3 for ; Thu, 2 Apr 2020 18:53:01 +0300 (MSK) Received: by smtp45.i.mail.ru with esmtpa (envelope-from ) id 1jK29M-0006Se-Jb for tarantool-patches@dev.tarantool.org; Thu, 02 Apr 2020 18:53:00 +0300 From: lvasiliev References: <89247698259e0863d662c63df0abefbf31e2fcfe.1584358124.git.lvasiliev@tarantool.org> <20200331232128.GQ22874@tarantool.org> Message-ID: <2e5791f6-2f70-d82d-6398-00284a31d684@tarantool.org> Date: Thu, 2 Apr 2020 18:52:59 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH v2 2/2] luarocks: Add a kludge for option force of luarocks remove List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org @Changelog Fixed the tarantoolctl rocks remove flag --force (https://github.com/tarantool/tarantool/issues/3632) On 01.04.2020 13:02, lvasiliev wrote: > Hi, thanks for the review. You're darn right! > > diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in > index b26dd10..f84c702 100755 > --- a/extra/dist/tarantoolctl.in > +++ b/extra/dist/tarantoolctl.in > @@ -949,7 +949,7 @@ local function rocks() >          table.insert(positional_arguments, "--all") >      end > > -    if positional_arguments[1] == "remove" and find_arg("force") then > +    if positional_arguments[1] == "remove" and > keyword_arguments["force"] then >          table.insert(positional_arguments, "--force") >      end > > On 01.04.2020 2:21, Igor Munkin wrote: >> Leonid, >> >> Thanks for the patch! Please consider the comment below. >> >> On 16.03.20, Leonid Vasiliev wrote: >>> From: Leonid >>> >>> Fixed the tarantoolctl rocks remove flag --force >>> >>> Forwarding of the --force flag to tarantoolctl rocks module was added. >>> (Command: tarantoolctl rocks remove --force) >>> >>> Fixes: #3632 >>> --- >>>   extra/dist/tarantoolctl.in | 5 +++++ >>>   1 file changed, 5 insertions(+) >>> >>> diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in >>> index 372838edd..c6c3ecb8f 100755 >>> --- a/extra/dist/tarantoolctl.in >>> +++ b/extra/dist/tarantoolctl.in >>> @@ -950,6 +950,10 @@ local function rocks() >>>           table.insert(positional_arguments, "--all") >>>       end >>> +    if positional_arguments[1] == "remove" and find_arg("force") then >> >> This is a bad check. Consider the following example (I patched the >> tarantoolctl.in a little for it): >> | $ export LUA_PATH="$LUA_PATH;third_party/luarocks/src/?.lua;;" >> | $ ./extra/dist/tarantoolctl rocks install try/force-scm-1.rockspec >> | >> | force scm-1 is now installed in /home/imun/.luarocks >> | $ git diff >> | diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in >> | index 2b95e2957..2378dee2b 100755 >> | --- a/extra/dist/tarantoolctl.in >> | +++ b/extra/dist/tarantoolctl.in >> | @@ -950,6 +950,7 @@ local function rocks() >> |      end >> | >> |      if positional_arguments[1] == "remove" and find_arg("force") then >> | +        print('WARN: --force option is set for remove') >> |          table.insert(positional_arguments, "--force") >> |      end >> | >> | $ ./extra/dist/tarantoolctl rocks remove force >> | WARN: --force option is set for remove >> | Checking stability of dependencies in the absence of >> | force scm-1... >> | >> | Removing force scm-1... >> | Removal successful. >> >> You need to check whether 'force' key exists in keyword_arguments, not >> to search 'force' substring in arg tables values. >> >>> +        table.insert(positional_arguments, "--force") >>> +    end >>> + >>>       -- Tweak help messages >>>       util.see_help = function(command, program) >>>           -- TODO: print extended help message here >> >> >> >>> -- >>> 2.17.1 >>> >>