aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2019-09-02 14:32:54 -0300
committerHisham Muhammad <hisham@gobolinux.org>2019-09-03 14:56:49 -0300
commit96b6b9ca9cf77922863d440247850b6b7c4bb9ae (patch)
treef090af9c1d03c21bf3ba8f6d556b17f7630e3a57 /src
parent989c58dff675532cf6378ade3790fd7e28e5bc07 (diff)
downloadluarocks-96b6b9ca9cf77922863d440247850b6b7c4bb9ae.tar.gz
luarocks-96b6b9ca9cf77922863d440247850b6b7c4bb9ae.tar.bz2
luarocks-96b6b9ca9cf77922863d440247850b6b7c4bb9ae.zip
build: fix --branch flag
The `--branch` flag is optional and takes a string argument. The `--branch` flag does not make sense for `luarocks make` because it does not fetch sources, it builds/installs based on whatever is in the current directory. This also adds tests that verify the behavior, but these don't run in Travis CI because of issues running a Git daemon there. They were verified locally.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/build.lua15
-rw-r--r--src/luarocks/cmd/build.lua6
-rw-r--r--src/luarocks/cmd/install.lua2
-rw-r--r--src/luarocks/cmd/make.lua6
4 files changed, 9 insertions, 20 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua
index 2ac7dd3a..948c5f53 100644
--- a/src/luarocks/build.lua
+++ b/src/luarocks/build.lua
@@ -18,7 +18,7 @@ build.opts = util.opts_table("build.opts", {
18 deps_mode = "string", 18 deps_mode = "string",
19 build_only_deps = "boolean", 19 build_only_deps = "boolean",
20 namespace = "string?", 20 namespace = "string?",
21 branch = "boolean", 21 branch = "string?",
22 verify = "boolean", 22 verify = "boolean",
23}) 23})
24 24
@@ -337,18 +337,7 @@ local function write_rock_dir_files(rockspec, opts)
337end 337end
338 338
339--- Build and install a rock given a rockspec. 339--- Build and install a rock given a rockspec.
340-- @param rockspec_file string: local or remote filename of a rockspec. 340-- @param opts table: build options table
341-- @param need_to_fetch boolean: true if sources need to be fetched,
342-- false if the rockspec was obtained from inside a source rock.
343-- @param minimal_mode boolean: true if there's no need to fetch,
344-- unpack or change dir (this is used by "luarocks make"). Implies
345-- need_to_fetch = false.
346-- @param deps_mode string: Dependency mode: "one" for the current default tree,
347-- "all" for all trees, "order" for all trees with priority >= the current default,
348-- "none" for no trees.
349-- @param build_only_deps boolean: true to build the listed dependencies only.
350-- @param namespace string?: a namespace for the rockspec
351-- @param branch string?: a forced branch to use
352-- @return (string, string) or (nil, string, [string]): Name and version of 341-- @return (string, string) or (nil, string, [string]): Name and version of
353-- installed rock if succeeded or nil and an error message followed by an error code. 342-- installed rock if succeeded or nil and an error message followed by an error code.
354function build.build_rockspec(rockspec, opts) 343function build.build_rockspec(rockspec, opts)
diff --git a/src/luarocks/cmd/build.lua b/src/luarocks/cmd/build.lua
index 57e722b5..ea47cbb0 100644
--- a/src/luarocks/cmd/build.lua
+++ b/src/luarocks/cmd/build.lua
@@ -31,6 +31,10 @@ function cmd_build.add_to_parser(parser)
31 31
32 cmd:flag("--only-deps", "Installs only the dependencies of the rock.") 32 cmd:flag("--only-deps", "Installs only the dependencies of the rock.")
33 cmd:flag("--no-doc", "Installs the rock without its documentation.") 33 cmd:flag("--no-doc", "Installs the rock without its documentation.")
34 cmd:option("--branch", "Override the `source.branch` field in the loaded "..
35 "rockspec. Allows to specify a different branch to fetch. Particularly "..
36 'for "dev" rocks.')
37 :argname("<name>")
34 make.cmd_options(cmd) 38 make.cmd_options(cmd)
35end 39end
36 40
@@ -131,7 +135,7 @@ function cmd_build.command(args)
131 deps_mode = deps.get_deps_mode(args), 135 deps_mode = deps.get_deps_mode(args),
132 build_only_deps = not not args.only_deps, 136 build_only_deps = not not args.only_deps,
133 namespace = args.namespace, 137 namespace = args.namespace,
134 branch = not not args.branch, 138 branch = args.branch,
135 verify = not not args.verify, 139 verify = not not args.verify,
136 }) 140 })
137 141
diff --git a/src/luarocks/cmd/install.lua b/src/luarocks/cmd/install.lua
index 4020918e..be4b0104 100644
--- a/src/luarocks/cmd/install.lua
+++ b/src/luarocks/cmd/install.lua
@@ -42,7 +42,7 @@ function install.add_to_parser(parser)
42 util.deps_mode_option(cmd) 42 util.deps_mode_option(cmd)
43 -- luarocks build options 43 -- luarocks build options
44 parser:flag("--pack-binary-rock"):hidden(true) 44 parser:flag("--pack-binary-rock"):hidden(true)
45 parser:flag("--branch"):hidden(true) 45 parser:option("--branch"):hidden(true)
46 parser:flag("--sign"):hidden(true) 46 parser:flag("--sign"):hidden(true)
47end 47end
48 48
diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua
index 480ec48d..3ff5c277 100644
--- a/src/luarocks/cmd/make.lua
+++ b/src/luarocks/cmd/make.lua
@@ -26,10 +26,6 @@ function make.cmd_options(parser)
26 "previously installed versions if it would break dependencies.") 26 "previously installed versions if it would break dependencies.")
27 parser:flag("--force-fast", "Like --force, but performs a forced removal ".. 27 parser:flag("--force-fast", "Like --force, but performs a forced removal "..
28 "without reporting dependency issues.") 28 "without reporting dependency issues.")
29 parser:option("--branch", "Override the `source.branch` field in the loaded "..
30 "rockspec. Allows to specify a different branch to fetch. Particularly "..
31 'for "dev" rocks.')
32 :argname("<name>")
33 parser:flag("--verify", "Verify signature of the rockspec or src.rock being ".. 29 parser:flag("--verify", "Verify signature of the rockspec or src.rock being "..
34 "built. If the rockspec or src.rock is being downloaded, LuaRocks will ".. 30 "built. If the rockspec or src.rock is being downloaded, LuaRocks will "..
35 "attempt to download the signature as well. Otherwise, the signature ".. 31 "attempt to download the signature as well. Otherwise, the signature "..
@@ -95,7 +91,7 @@ function make.command(args)
95 deps_mode = deps.get_deps_mode(args), 91 deps_mode = deps.get_deps_mode(args),
96 build_only_deps = false, 92 build_only_deps = false,
97 namespace = args.namespace, 93 namespace = args.namespace,
98 branch = not not args.branch, 94 branch = args.branch,
99 verify = not not args.verify, 95 verify = not not args.verify,
100 }) 96 })
101 97