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.lua27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua
index e99b4ce0..0a779b86 100644
--- a/src/luarocks/install.lua
+++ b/src/luarocks/install.lua
@@ -23,9 +23,10 @@ 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-- @return boolean or (nil, string, [string]): True if succeeded or 27-- @return boolean or (nil, string, [string]): True if succeeded or
27-- nil and an error message and an optional error code. 28-- nil and an error message and an optional error code.
28function install_binary_rock(rock_file) 29function install_binary_rock(rock_file, no_deps)
29 assert(type(rock_file) == "string") 30 assert(type(rock_file) == "string")
30 31
31 local name, version, arch = path.parse_name(rock_file) 32 local name, version, arch = path.parse_name(rock_file)
@@ -53,8 +54,12 @@ function install_binary_rock(rock_file)
53 return nil, "Failed loading rockspec for installed package: "..err, errcode 54 return nil, "Failed loading rockspec for installed package: "..err, errcode
54 end 55 end
55 56
56 ok, err, errcode = deps.check_external_deps(rockspec, "install") 57 if no_deps then
57 if err then return nil, err, errcode end 58 util.printerr("Warning: skipping dependency checks.")
59 else
60 ok, err, errcode = deps.check_external_deps(rockspec, "install")
61 if err then return nil, err, errcode end
62 end
58 63
59 -- For compatibility with .rock files built with LuaRocks 1 64 -- For compatibility with .rock files built with LuaRocks 1
60 if not fs.exists(path.rock_manifest_file(name, version)) then 65 if not fs.exists(path.rock_manifest_file(name, version)) then
@@ -62,10 +67,17 @@ function install_binary_rock(rock_file)
62 if err then return nil, err end 67 if err then return nil, err end
63 end 68 end
64 69
65 ok, err, errcode = deps.fulfill_dependencies(rockspec) 70 if not no_deps then
66 if err then return nil, err, errcode end 71 ok, err, errcode = deps.fulfill_dependencies(rockspec)
72 if err then return nil, err, errcode end
73 end
74
75 local wrap_bin_scripts = true
76 if rockspec.deploy and rockspec.deploy.wrap_bin_scripts == false then
77 wrap_bin_scripts = false
78 end
67 79
68 ok, err = rep.deploy_files(name, version) 80 ok, err = rep.deploy_files(name, version, rep.should_wrap_bin_scripts(rockspec))
69 if err then return nil, err end 81 if err then return nil, err end
70 82
71 util.remove_scheduled_function(rollback) 83 util.remove_scheduled_function(rollback)
@@ -112,10 +124,11 @@ function run(...)
112 if not ok then return nil, err end 124 if not ok then return nil, err end
113 125
114 if name:match("%.rockspec$") or name:match("%.src%.rock$") then 126 if name:match("%.rockspec$") or name:match("%.src%.rock$") then
127 util.printout("Using "..name.."... switching to 'build' mode")
115 local build = require("luarocks.build") 128 local build = require("luarocks.build")
116 return build.run(name, flags["local"] and "--local") 129 return build.run(name, flags["local"] and "--local")
117 elseif name:match("%.rock$") then 130 elseif name:match("%.rock$") then
118 return install_binary_rock(name) 131 return install_binary_rock(name, flags["nodeps"])
119 else 132 else
120 local search = require("luarocks.search") 133 local search = require("luarocks.search")
121 local results, err = search.find_suitable_rock(search.make_query(name:lower(), version)) 134 local results, err = search.find_suitable_rock(search.make_query(name:lower(), version))