aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/install.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/install.lua')
-rw-r--r--src/luarocks/install.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua
index 708d6abe..e633ea23 100644
--- a/src/luarocks/install.lua
+++ b/src/luarocks/install.lua
@@ -23,10 +23,11 @@ or a filename of a locally available rock.
23 23
24--- Install a binary rock. 24--- Install a binary rock.
25-- @param rock_file string: local or remote filename of a rock. 25-- @param rock_file string: local or remote filename of a rock.
26-- @param no_deps boolean: true if dependency check needs to be skipped 26-- @param deps_mode: string: Which trees to check dependencies for:
27-- "none", "one", "order" or "all".
27-- @return boolean or (nil, string, [string]): True if succeeded or 28-- @return boolean or (nil, string, [string]): True if succeeded or
28-- nil and an error message and an optional error code. 29-- nil and an error message and an optional error code.
29function install_binary_rock(rock_file, no_deps) 30function install_binary_rock(rock_file, deps_mode)
30 assert(type(rock_file) == "string") 31 assert(type(rock_file) == "string")
31 32
32 local name, version, arch = path.parse_name(rock_file) 33 local name, version, arch = path.parse_name(rock_file)
@@ -54,7 +55,7 @@ function install_binary_rock(rock_file, no_deps)
54 return nil, "Failed loading rockspec for installed package: "..err, errcode 55 return nil, "Failed loading rockspec for installed package: "..err, errcode
55 end 56 end
56 57
57 if no_deps then 58 if deps_mode == "none" then
58 util.printerr("Warning: skipping dependency checks.") 59 util.printerr("Warning: skipping dependency checks.")
59 else 60 else
60 ok, err, errcode = deps.check_external_deps(rockspec, "install") 61 ok, err, errcode = deps.check_external_deps(rockspec, "install")
@@ -67,8 +68,8 @@ function install_binary_rock(rock_file, no_deps)
67 if err then return nil, err end 68 if err then return nil, err end
68 end 69 end
69 70
70 if not no_deps then 71 if deps_mode ~= "none" then
71 ok, err, errcode = deps.fulfill_dependencies(rockspec) 72 ok, err, errcode = deps.fulfill_dependencies(rockspec, deps_mode)
72 if err then return nil, err, errcode end 73 if err then return nil, err, errcode end
73 end 74 end
74 75
@@ -88,7 +89,7 @@ function install_binary_rock(rock_file, no_deps)
88 ok, err = repos.run_hook(rockspec, "post_install") 89 ok, err = repos.run_hook(rockspec, "post_install")
89 if err then return nil, err end 90 if err then return nil, err end
90 91
91 ok, err = manif.update_manifest(name, version) 92 ok, err = manif.update_manifest(name, version, nil, deps_mode)
92 if err then return nil, err end 93 if err then return nil, err end
93 94
94 local license = "" 95 local license = ""
@@ -126,9 +127,9 @@ function run(...)
126 if name:match("%.rockspec$") or name:match("%.src%.rock$") then 127 if name:match("%.rockspec$") or name:match("%.src%.rock$") then
127 util.printout("Using "..name.."... switching to 'build' mode") 128 util.printout("Using "..name.."... switching to 'build' mode")
128 local build = require("luarocks.build") 129 local build = require("luarocks.build")
129 return build.run(name, flags["local"] and "--local") 130 return build.run(name, deps.get_deps_mode(flags), flags["local"] and "--local")
130 elseif name:match("%.rock$") then 131 elseif name:match("%.rock$") then
131 return install_binary_rock(name, flags["nodeps"]) 132 return install_binary_rock(name, deps.get_deps_mode(flags))
132 else 133 else
133 local search = require("luarocks.search") 134 local search = require("luarocks.search")
134 local results, err = search.find_suitable_rock(search.make_query(name:lower(), version)) 135 local results, err = search.find_suitable_rock(search.make_query(name:lower(), version))