[Tarantool-patches] [PATCH v2 1/3] Add the chdir option for make

Leonid Vasiliev lvasiliev at tarantool.org
Sun Apr 5 17:50:07 MSK 2020


---
 src/luarocks/cmd/make.lua | 11 ++++++++++-
 src/luarocks/util.lua     |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua
index 4d81386..99b0fb4 100644
--- a/src/luarocks/cmd/make.lua
+++ b/src/luarocks/cmd/make.lua
@@ -59,6 +59,8 @@ only dependencies of the rockspec (see `luarocks help install`).
 --sign              To be used with --pack-binary-rock. Also produce
                     a signature file for the generated .rock file.
 
+--chdir=<path>      Specify a source directory of the rock.
+
 ]]
 
 --- Driver function for "make" command.
@@ -68,6 +70,13 @@ only dependencies of the rockspec (see `luarocks help install`).
 function make.command(flags, rockspec_filename)
    assert(type(rockspec_filename) == "string" or not rockspec_filename)
    
+   if flags["chdir"] then
+      local ok, err = fs.change_dir(flags["chdir"])
+      if not ok then
+         return nil, err
+      end
+   end
+
    if not rockspec_filename then
       local err
       rockspec_filename, err = util.get_default_rockspec()
@@ -78,7 +87,7 @@ function make.command(flags, rockspec_filename)
    if not rockspec_filename:match("rockspec$") then
       return nil, "Invalid argument: 'make' takes a rockspec as a parameter. "..util.see_help("make")
    end
-   
+
    local rockspec, err, errcode = fetch.load_rockspec(rockspec_filename)
    if not rockspec then
       return nil, err
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index abf6d90..8ccda27 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -92,6 +92,7 @@ local supported_flags = {
    ["binary"] = true,
    ["branch"] = "<branch-name>",
    ["build-deps"] = true,
+   ["chdir"] = "<path>",
    ["debug"] = true,
    ["deps"] = true,
    ["deps-mode"] = "<mode>",
-- 
2.7.4



More information about the Tarantool-patches mailing list