From c0d695ad303b19602e3342f0bc371b8b1c73d2ae Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Wed, 15 Jan 2014 18:09:23 -0800 Subject: show --modules will output one module per line As suggested by @agladysh in #210 So the output of, say, `luarocks show --modules oauth` will be: ~~~~ OAuth.helpers OAuth OAuth.coreLuaNode OAuth.coreLuaSocket ~~~~ instead of ~~~~ OAuth.helpers OAuth OAuth.coreLuaNode OAuth.coreLuaSocket ~~~~ --- src/luarocks/show.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 2e039dd4..3a765ef3 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua @@ -1,4 +1,3 @@ - --- Module implementing the LuaRocks "show" command. -- Shows information about an installed rock. module("luarocks.show", package.seeall) @@ -128,7 +127,7 @@ function run(...) if flags["rock-tree"] then util.printout(path.rocks_tree_to_string(repo)) elseif flags["rock-dir"] then util.printout(directory) elseif flags["home"] then util.printout(descript.homepage) - elseif flags["modules"] then util.printout(keys_as_string(minfo.modules)) + elseif flags["modules"] then util.printout(keys_as_string(minfo.modules), "\n") elseif flags["deps"] then util.printout(keys_as_string(minfo.dependencies)) elseif flags["rockspec"] then util.printout(rockspec_file) elseif flags["mversion"] then util.printout(version) -- cgit v1.2.3-55-g6feb From cb053191eca0191b330ff5ce1b99da9b04dba30a Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Thu, 16 Jan 2014 01:16:18 -0800 Subject: Use \n as separator to keys_as_string --- src/luarocks/show.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 3a765ef3..49e235d9 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua @@ -127,7 +127,7 @@ function run(...) if flags["rock-tree"] then util.printout(path.rocks_tree_to_string(repo)) elseif flags["rock-dir"] then util.printout(directory) elseif flags["home"] then util.printout(descript.homepage) - elseif flags["modules"] then util.printout(keys_as_string(minfo.modules), "\n") + elseif flags["modules"] then util.printout(keys_as_string(minfo.modules, "\n")) elseif flags["deps"] then util.printout(keys_as_string(minfo.dependencies)) elseif flags["rockspec"] then util.printout(rockspec_file) elseif flags["mversion"] then util.printout(version) -- cgit v1.2.3-55-g6feb From 1029726e99db56614bd6b3d690f65da2b2ccd4e4 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Fri, 17 Jan 2014 14:52:05 +0100 Subject: mention --verbose option in help --- src/luarocks/help.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 2136f5da..2c87e7e4 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua @@ -64,7 +64,8 @@ function run(...) given URL. --tree= Which tree to operate on. --local Use the tree in the user's home directory. - To enable it, see ']]..program..[[ help path'.]]) + To enable it, see ']]..program..[[ help path'. + --verbose Display verbose output of commands executed.]]) print_section("VARIABLES") util.printout([[ Variables from the "variables" table of the configuration file -- cgit v1.2.3-55-g6feb From 7e4e9d0ceadfb0f2a27cbbda32c793e1bb9d0f3f Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Mon, 27 Jan 2014 10:38:23 +0100 Subject: unquoted path fails when spaces are in the filename --- src/luarocks/fs/unix/tools.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 7535d679..84ac369c 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua @@ -325,7 +325,7 @@ local md5_cmd = { function get_md5(file) local cmd = md5_cmd[cfg.md5checker] if not cmd then return nil, "no MD5 checker command configured" end - local pipe = io.popen(cmd.." "..fs.absolute_name(file)) + local pipe = io.popen(cmd.." "..fs.Q(fs.absolute_name(file))) local computed = pipe:read("*a") pipe:close() if computed then -- cgit v1.2.3-55-g6feb From 2078f83cc348c5b149fde1e4614ddc3e5b3d9b93 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Tue, 28 Jan 2014 22:37:08 +0100 Subject: adds a --branch= option. The branchename is passed as BRANCH to the rockspec environment --- src/luarocks/command_line.lua | 7 +++++++ src/luarocks/fetch.lua | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 19d04290..f9fba300 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua @@ -113,6 +113,13 @@ function run_command(...) die("Invalid entry for --deps-mode.") end + if flags["branch"] then + if flags["branch"] == true or flags["branch"] == "" then + die("Argument error: use --branch=") + end + cfg.branch = flags["branch"] + end + if flags["tree"] then if flags["tree"] == true or flags["tree"] == "" then die("Argument error: use --tree=") diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 7960acb4..e0525dde 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua @@ -144,10 +144,15 @@ end function load_local_rockspec(filename, quick) assert(type(filename) == "string") filename = fs.absolute_name(filename) - local rockspec, err = persist.load_into_table(filename) + local rockspec, err = persist.load_into_table(filename, {BRANCH = cfg.branch}) -- temp add BRANCH if not rockspec then return nil, "Could not load rockspec file "..filename.." ("..err..")" end + if rockspec.BRANCH ~= cfg.branch then + return nil, "Invalid rockspec, BRANCH constant was illegally modified by rockspec" + else + rockspec.BRANCH = nil -- remove temporary added field + end local globals = err local ok, err = true, nil -- cgit v1.2.3-55-g6feb From d0aab1fa942409150e242cca18029debf547af9e Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 29 Jan 2014 21:03:20 +0100 Subject: updated the `--branch` option to work through updating the rockspec `source.branch` field Additionally a fix for the `git` module, to use command quoting --- src/luarocks/fetch.lua | 8 +++----- src/luarocks/fetch/git.lua | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index e0525dde..8e08e7ad 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua @@ -144,14 +144,12 @@ end function load_local_rockspec(filename, quick) assert(type(filename) == "string") filename = fs.absolute_name(filename) - local rockspec, err = persist.load_into_table(filename, {BRANCH = cfg.branch}) -- temp add BRANCH + local rockspec, err = persist.load_into_table(filename) if not rockspec then return nil, "Could not load rockspec file "..filename.." ("..err..")" end - if rockspec.BRANCH ~= cfg.branch then - return nil, "Invalid rockspec, BRANCH constant was illegally modified by rockspec" - else - rockspec.BRANCH = nil -- remove temporary added field + if cfg.branch and (type(rockspec.source) == "table") then + rockspec.source.branch = cfg.branch end local globals = err diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index 1845363f..2bba4cdc 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua @@ -12,7 +12,7 @@ local util = require("luarocks.util") -- given tag. -- @return boolean: Whether Git can clone by tag. local function git_can_clone_by_tag(git_cmd) - local version_string = io.popen(git_cmd..' --version'):read() + local version_string = io.popen(fs.Q(git_cmd)..' --version'):read() local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)') major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0 local value = major > 1 or (major == 1 and (minor > 7 or (minor == 7 and tiny >= 10))) @@ -51,7 +51,7 @@ function get_sources(rockspec, extract, dest_dir, depth) local ok, err = fs.change_dir(store_dir) if not ok then return nil, err end - local command = {git_cmd, "clone", depth or "--depth=1", rockspec.source.url, module} + local command = {fs.Q(git_cmd), "clone", depth or "--depth=1", rockspec.source.url, module} local tag_or_branch = rockspec.source.tag or rockspec.source.branch -- If the tag or branch is explicitly set to "master" in the rockspec, then -- we can avoid passing it to Git since it's the default. @@ -69,7 +69,7 @@ function get_sources(rockspec, extract, dest_dir, depth) local ok, err = fs.change_dir(module) if not ok then return nil, err end if tag_or_branch and not git_can_clone_by_tag() then - local checkout_command = {git_cmd, "checkout", tag_or_branch} + local checkout_command = {fs.Q(git_cmd), "checkout", tag_or_branch} if not fs.execute(unpack(checkout_command)) then return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.' end -- cgit v1.2.3-55-g6feb From fd1d38a2d170deb9c7ffd0289a9bb97efac6f6ba Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 29 Jan 2014 21:43:12 +0100 Subject: added help info to build and make commands --- src/luarocks/build.lua | 4 ++++ src/luarocks/make.lua | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 72b5649e..0e58e2e5 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua @@ -32,6 +32,10 @@ or the name of a rock to be fetched from a repository. be made permanent by setting keep_other_versions=true in the configuration file. +--branch= Override the `source.branch` field in the loaded + rockspec. Allows to specify a different branch to + fetch. Particularly for SCM rocks. + ]]..util.deps_mode_help() --- Install files to a given location. diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index 3999e39f..af7e68e6 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua @@ -36,6 +36,10 @@ To install rocks, you'll normally want to use the "install" and be made permanent by setting keep_other_versions=true in the configuration file. +--branch= Override the `source.branch` field in the loaded + rockspec. Allows to specify a different branch to + fetch. Particularly for SCM rocks. + ]] --- Driver function for "make" command. -- cgit v1.2.3-55-g6feb From 340ebd538906dd7c2eb1da2d3cc8dd66ef5ce8b6 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Wed, 29 Jan 2014 22:06:15 +0100 Subject: remove rocksserver settings from windows installer --- install.bat | 3 --- 1 file changed, 3 deletions(-) diff --git a/install.bat b/install.bat index a17aff89..934154d0 100644 --- a/install.bat +++ b/install.bat @@ -816,9 +816,6 @@ if exists(vars.CONFIG_FILE) then end local f = io.open(vars.CONFIG_FILE, "w") f:write([=[ -rocks_servers = { - [[http://luarocks.org/repositories/rocks]] -} rocks_trees = { ]=]) if FORCE_CONFIG then -- cgit v1.2.3-55-g6feb