diff options
-rw-r--r-- | src/luarocks/command_line.lua | 19 | ||||
-rwxr-xr-x | test/testing.sh | 6 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index d16ef8e2..63b918b5 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -98,9 +98,22 @@ function run_command(...) | |||
98 | if flags["tree"] == true or flags["tree"] == "" then | 98 | if flags["tree"] == true or flags["tree"] == "" then |
99 | die("Argument error: use --tree=<path>") | 99 | die("Argument error: use --tree=<path>") |
100 | end | 100 | end |
101 | local fs = require("luarocks.fs") | 101 | local named = false |
102 | local root_dir = fs.absolute_name(flags["tree"]) | 102 | for _, tree in ipairs(cfg.rocks_trees) do |
103 | path.use_tree(root_dir) | 103 | if type(tree) == "table" and flags["tree"] == tree.name then |
104 | if not tree.root then | ||
105 | die("Configuration error: tree '"..tree.name.."' has no 'root' field.") | ||
106 | end | ||
107 | path.use_tree(dir.normalize(tree.root)) | ||
108 | named = true | ||
109 | break | ||
110 | end | ||
111 | end | ||
112 | if not named then | ||
113 | local fs = require("luarocks.fs") | ||
114 | local root_dir = fs.absolute_name(flags["tree"]) | ||
115 | path.use_tree(root_dir) | ||
116 | end | ||
104 | elseif flags["local"] then | 117 | elseif flags["local"] then |
105 | path.use_tree(cfg.home_tree) | 118 | path.use_tree(cfg.home_tree) |
106 | else | 119 | else |
diff --git a/test/testing.sh b/test/testing.sh index 0fa40e53..d3ab3308 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
@@ -59,7 +59,7 @@ mkdir -p "$testing_cache" | |||
59 | cat <<EOF > $testing_dir/testing_config.lua | 59 | cat <<EOF > $testing_dir/testing_config.lua |
60 | rocks_trees = { | 60 | rocks_trees = { |
61 | "$testing_tree", | 61 | "$testing_tree", |
62 | "$testing_sys_tree", | 62 | { name = "system", root = "$testing_sys_tree" }, |
63 | } | 63 | } |
64 | rocks_servers = { | 64 | rocks_servers = { |
65 | "$testing_server" | 65 | "$testing_server" |
@@ -398,8 +398,8 @@ test_admin_remove() { if [ "$travis" ]; then return; fi; $luarocks_admin --serve | |||
398 | fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } | 398 | fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } |
399 | 399 | ||
400 | fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } | 400 | fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } |
401 | test_deps_mode_one() { $luarocks build --tree="$testing_sys_tree" lpeg && $luarocks list && $luarocks build --deps-mode=one --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ]; } | 401 | test_deps_mode_one() { $luarocks build --tree="system" lpeg && $luarocks list && $luarocks build --deps-mode=one --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ]; } |
402 | test_deps_mode_order() { $luarocks build --tree="$testing_sys_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } | 402 | test_deps_mode_order() { $luarocks build --tree="system" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } |
403 | test_deps_mode_order_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 1 ]; } | 403 | test_deps_mode_order_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 1 ]; } |
404 | test_deps_mode_all_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 0 ]; } | 404 | test_deps_mode_all_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 0 ]; } |
405 | test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } | 405 | test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } |