diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2012-11-02 06:55:27 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-11-02 06:55:27 -0200 |
| commit | 0575ba154b102c4a8a4f3b75c5d9747c488ab719 (patch) | |
| tree | 9ce2260c515badd099047b396af578cb1cc89d06 /src | |
| parent | 455fcc2385c4e6be8e1f756d8a6997c4b67650f6 (diff) | |
| download | luarocks-0575ba154b102c4a8a4f3b75c5d9747c488ab719.tar.gz luarocks-0575ba154b102c4a8a4f3b75c5d9747c488ab719.tar.bz2 luarocks-0575ba154b102c4a8a4f3b75c5d9747c488ab719.zip | |
Fix behavior of --nodeps
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/command_line.lua | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index b4b20f84..9e499fc2 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -4,7 +4,6 @@ module("luarocks.command_line", package.seeall) | |||
| 4 | 4 | ||
| 5 | local util = require("luarocks.util") | 5 | local util = require("luarocks.util") |
| 6 | local cfg = require("luarocks.cfg") | 6 | local cfg = require("luarocks.cfg") |
| 7 | local fs = require("luarocks.fs") | ||
| 8 | local path = require("luarocks.path") | 7 | local path = require("luarocks.path") |
| 9 | local dir = require("luarocks.dir") | 8 | local dir = require("luarocks.dir") |
| 10 | local deps = require("luarocks.deps") | 9 | local deps = require("luarocks.deps") |
| @@ -51,7 +50,10 @@ function run_command(...) | |||
| 51 | if flags["only-from"] then flags["only-server"] = flags["only-from"] end | 50 | if flags["only-from"] then flags["only-server"] = flags["only-from"] end |
| 52 | if flags["only-sources-from"] then flags["only-sources"] = flags["only-sources-from"] end | 51 | if flags["only-sources-from"] then flags["only-sources"] = flags["only-sources-from"] end |
| 53 | if flags["to"] then flags["tree"] = flags["to"] end | 52 | if flags["to"] then flags["tree"] = flags["to"] end |
| 54 | if flags["nodeps"] then flags["deps-mode"] = "none" end | 53 | if flags["nodeps"] then |
| 54 | flags["deps-mode"] = "none" | ||
| 55 | table.insert(args, "--deps-mode=none") | ||
| 56 | end | ||
| 55 | 57 | ||
| 56 | cfg.flags = flags | 58 | cfg.flags = flags |
| 57 | 59 | ||
| @@ -86,14 +88,15 @@ function run_command(...) | |||
| 86 | flags["local"] = true | 88 | flags["local"] = true |
| 87 | end | 89 | end |
| 88 | 90 | ||
| 89 | if flags["deps-mode"] and not deps.check_dep_trees_flag(flags["deps-mode"]) then | 91 | if flags["deps-mode"] and not deps.check_deps_mode_flag(flags["deps-mode"]) then |
| 90 | return nil, "Invalid entry for --deps-mode." | 92 | die("Invalid entry for --deps-mode.") |
| 91 | end | 93 | end |
| 92 | 94 | ||
| 93 | if flags["tree"] then | 95 | if flags["tree"] then |
| 94 | if flags["tree"] == true then | 96 | if flags["tree"] == true or flags["tree"] == "" then |
| 95 | die("Argument error: use --tree=<path>") | 97 | die("Argument error: use --tree=<path>") |
| 96 | end | 98 | end |
| 99 | local fs = require("luarocks.fs") | ||
| 97 | local root_dir = fs.absolute_name(flags["tree"]) | 100 | local root_dir = fs.absolute_name(flags["tree"]) |
| 98 | path.use_tree(root_dir) | 101 | path.use_tree(root_dir) |
| 99 | elseif flags["local"] then | 102 | elseif flags["local"] then |
| @@ -142,6 +145,12 @@ function run_command(...) | |||
| 142 | end | 145 | end |
| 143 | 146 | ||
| 144 | if commands[command] then | 147 | if commands[command] then |
| 148 | -- TODO the interface of run should be modified, to receive the | ||
| 149 | -- flags table and the (possibly unpacked) nonflags arguments. | ||
| 150 | -- This would remove redundant parsing of arguments. | ||
| 151 | -- I'm not changing this now to avoid messing with the run() | ||
| 152 | -- interface, which I know some people use (even though | ||
| 153 | -- I never published it as a public API...) | ||
| 145 | local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err) | 154 | local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err) |
| 146 | die(debug.traceback("LuaRocks "..cfg.program_version | 155 | die(debug.traceback("LuaRocks "..cfg.program_version |
| 147 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" | 156 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" |
