aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2014-01-29 20:44:42 -0200
committerHisham Muhammad <hisham@gobolinux.org>2014-01-29 20:44:42 -0200
commit981a8c95f4511d51afa55352901185a313a0597c (patch)
tree0991769ba52ce814d59c4d135da8fbdef05ce34a
parent6e65663977ad648a778b31e37844801f6c1cb09c (diff)
parenta4a97950c92425168c457aa731d4af2f7a694288 (diff)
downloadluarocks-981a8c95f4511d51afa55352901185a313a0597c.tar.gz
luarocks-981a8c95f4511d51afa55352901185a313a0597c.tar.bz2
luarocks-981a8c95f4511d51afa55352901185a313a0597c.zip
Merge branch 'master' of github.com:keplerproject/luarocks
-rw-r--r--install.bat3
-rw-r--r--src/luarocks/build.lua4
-rw-r--r--src/luarocks/command_line.lua7
-rw-r--r--src/luarocks/fetch.lua3
-rw-r--r--src/luarocks/fetch/git.lua6
-rw-r--r--src/luarocks/fs/unix/tools.lua2
-rw-r--r--src/luarocks/help.lua3
-rw-r--r--src/luarocks/make.lua4
-rw-r--r--src/luarocks/show.lua3
9 files changed, 25 insertions, 10 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
816end 816end
817local f = io.open(vars.CONFIG_FILE, "w") 817local f = io.open(vars.CONFIG_FILE, "w")
818f:write([=[ 818f:write([=[
819rocks_servers = {
820 [[http://luarocks.org/repositories/rocks]]
821}
822rocks_trees = { 819rocks_trees = {
823]=]) 820]=])
824if FORCE_CONFIG then 821if FORCE_CONFIG then
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.
32 be made permanent by setting keep_other_versions=true 32 be made permanent by setting keep_other_versions=true
33 in the configuration file. 33 in the configuration file.
34 34
35--branch=<name> Override the `source.branch` field in the loaded
36 rockspec. Allows to specify a different branch to
37 fetch. Particularly for SCM rocks.
38
35]]..util.deps_mode_help() 39]]..util.deps_mode_help()
36 40
37--- Install files to a given location. 41--- Install files to a given location.
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(...)
113 die("Invalid entry for --deps-mode.") 113 die("Invalid entry for --deps-mode.")
114 end 114 end
115 115
116 if flags["branch"] then
117 if flags["branch"] == true or flags["branch"] == "" then
118 die("Argument error: use --branch=<branch-name>")
119 end
120 cfg.branch = flags["branch"]
121 end
122
116 if flags["tree"] then 123 if flags["tree"] then
117 if flags["tree"] == true or flags["tree"] == "" then 124 if flags["tree"] == true or flags["tree"] == "" then
118 die("Argument error: use --tree=<path>") 125 die("Argument error: use --tree=<path>")
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index 7960acb4..8e08e7ad 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -148,6 +148,9 @@ function load_local_rockspec(filename, quick)
148 if not rockspec then 148 if not rockspec then
149 return nil, "Could not load rockspec file "..filename.." ("..err..")" 149 return nil, "Could not load rockspec file "..filename.." ("..err..")"
150 end 150 end
151 if cfg.branch and (type(rockspec.source) == "table") then
152 rockspec.source.branch = cfg.branch
153 end
151 local globals = err 154 local globals = err
152 155
153 local ok, err = true, nil 156 local ok, err = true, nil
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")
12-- given tag. 12-- given tag.
13-- @return boolean: Whether Git can clone by tag. 13-- @return boolean: Whether Git can clone by tag.
14local function git_can_clone_by_tag(git_cmd) 14local function git_can_clone_by_tag(git_cmd)
15 local version_string = io.popen(git_cmd..' --version'):read() 15 local version_string = io.popen(fs.Q(git_cmd)..' --version'):read()
16 local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)') 16 local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)')
17 major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0 17 major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0
18 local value = major > 1 or (major == 1 and (minor > 7 or (minor == 7 and tiny >= 10))) 18 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)
51 local ok, err = fs.change_dir(store_dir) 51 local ok, err = fs.change_dir(store_dir)
52 if not ok then return nil, err end 52 if not ok then return nil, err end
53 53
54 local command = {git_cmd, "clone", depth or "--depth=1", rockspec.source.url, module} 54 local command = {fs.Q(git_cmd), "clone", depth or "--depth=1", rockspec.source.url, module}
55 local tag_or_branch = rockspec.source.tag or rockspec.source.branch 55 local tag_or_branch = rockspec.source.tag or rockspec.source.branch
56 -- If the tag or branch is explicitly set to "master" in the rockspec, then 56 -- If the tag or branch is explicitly set to "master" in the rockspec, then
57 -- we can avoid passing it to Git since it's the default. 57 -- we can avoid passing it to Git since it's the default.
@@ -69,7 +69,7 @@ function get_sources(rockspec, extract, dest_dir, depth)
69 local ok, err = fs.change_dir(module) 69 local ok, err = fs.change_dir(module)
70 if not ok then return nil, err end 70 if not ok then return nil, err end
71 if tag_or_branch and not git_can_clone_by_tag() then 71 if tag_or_branch and not git_can_clone_by_tag() then
72 local checkout_command = {git_cmd, "checkout", tag_or_branch} 72 local checkout_command = {fs.Q(git_cmd), "checkout", tag_or_branch}
73 if not fs.execute(unpack(checkout_command)) then 73 if not fs.execute(unpack(checkout_command)) then
74 return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.' 74 return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.'
75 end 75 end
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 = {
325function get_md5(file) 325function get_md5(file)
326 local cmd = md5_cmd[cfg.md5checker] 326 local cmd = md5_cmd[cfg.md5checker]
327 if not cmd then return nil, "no MD5 checker command configured" end 327 if not cmd then return nil, "no MD5 checker command configured" end
328 local pipe = io.popen(cmd.." "..fs.absolute_name(file)) 328 local pipe = io.popen(cmd.." "..fs.Q(fs.absolute_name(file)))
329 local computed = pipe:read("*a") 329 local computed = pipe:read("*a")
330 pipe:close() 330 pipe:close()
331 if computed then 331 if computed then
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(...)
64 given URL. 64 given URL.
65 --tree=<tree> Which tree to operate on. 65 --tree=<tree> Which tree to operate on.
66 --local Use the tree in the user's home directory. 66 --local Use the tree in the user's home directory.
67 To enable it, see ']]..program..[[ help path'.]]) 67 To enable it, see ']]..program..[[ help path'.
68 --verbose Display verbose output of commands executed.]])
68 print_section("VARIABLES") 69 print_section("VARIABLES")
69 util.printout([[ 70 util.printout([[
70 Variables from the "variables" table of the configuration file 71 Variables from the "variables" table of the configuration file
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
36 be made permanent by setting keep_other_versions=true 36 be made permanent by setting keep_other_versions=true
37 in the configuration file. 37 in the configuration file.
38 38
39--branch=<name> Override the `source.branch` field in the loaded
40 rockspec. Allows to specify a different branch to
41 fetch. Particularly for SCM rocks.
42
39]] 43]]
40 44
41--- Driver function for "make" command. 45--- Driver function for "make" command.
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua
index 2e039dd4..49e235d9 100644
--- a/src/luarocks/show.lua
+++ b/src/luarocks/show.lua
@@ -1,4 +1,3 @@
1
2--- Module implementing the LuaRocks "show" command. 1--- Module implementing the LuaRocks "show" command.
3-- Shows information about an installed rock. 2-- Shows information about an installed rock.
4module("luarocks.show", package.seeall) 3module("luarocks.show", package.seeall)
@@ -128,7 +127,7 @@ function run(...)
128 if flags["rock-tree"] then util.printout(path.rocks_tree_to_string(repo)) 127 if flags["rock-tree"] then util.printout(path.rocks_tree_to_string(repo))
129 elseif flags["rock-dir"] then util.printout(directory) 128 elseif flags["rock-dir"] then util.printout(directory)
130 elseif flags["home"] then util.printout(descript.homepage) 129 elseif flags["home"] then util.printout(descript.homepage)
131 elseif flags["modules"] then util.printout(keys_as_string(minfo.modules)) 130 elseif flags["modules"] then util.printout(keys_as_string(minfo.modules, "\n"))
132 elseif flags["deps"] then util.printout(keys_as_string(minfo.dependencies)) 131 elseif flags["deps"] then util.printout(keys_as_string(minfo.dependencies))
133 elseif flags["rockspec"] then util.printout(rockspec_file) 132 elseif flags["rockspec"] then util.printout(rockspec_file)
134 elseif flags["mversion"] then util.printout(version) 133 elseif flags["mversion"] then util.printout(version)