diff options
Diffstat (limited to '')
-rw-r--r-- | src/luarocks/deps.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index e02d4694..13b531f6 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local io = _tl_compat and _tl_compat.io or io; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table; local type = type | 1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local io = _tl_compat and _tl_compat.io or io; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local math = _tl_compat and _tl_compat.math or math; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table; local type = type |
2 | 2 | ||
3 | local deps = {} | 3 | local deps = {} |
4 | 4 | ||
@@ -201,7 +201,7 @@ function deps.report_missing_dependencies(name, version, dependencies, deps_mode | |||
201 | first_missing_dep = false | 201 | first_missing_dep = false |
202 | end | 202 | end |
203 | 203 | ||
204 | util.printout((" %s (%s)"):format(tostring(depq), rock_status(depq, get_versions))) | 204 | util.printout((" %s (%s)"):format(tostring(depq), (rock_status(depq, get_versions)))) |
205 | end | 205 | end |
206 | end | 206 | end |
207 | end | 207 | end |
@@ -301,7 +301,7 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock | |||
301 | local depq = queries.new(dname, dnamespace, dversion) | 301 | local depq = queries.new(dname, dnamespace, dversion) |
302 | 302 | ||
303 | util.printout(("%s %s is pinned to %s (%s)"):format( | 303 | util.printout(("%s %s is pinned to %s (%s)"):format( |
304 | name, version, tostring(depq), rock_status(depq, get_versions))) | 304 | name, version, tostring(depq), (rock_status(depq, get_versions)))) |
305 | 305 | ||
306 | local okfullfill, errfullfill = deps.fulfill_dependency(depq, "none", rocks_provided, verify, depskey) | 306 | local okfullfill, errfullfill = deps.fulfill_dependency(depq, "none", rocks_provided, verify, depskey) |
307 | if not okfullfill then | 307 | if not okfullfill then |
@@ -327,11 +327,14 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock | |||
327 | for _, depq in ipairs((rockspec)[depskey].queries) do | 327 | for _, depq in ipairs((rockspec)[depskey].queries) do |
328 | 328 | ||
329 | util.printout(("%s %s depends on %s (%s)"):format( | 329 | util.printout(("%s %s depends on %s (%s)"):format( |
330 | name, version, tostring(depq), rock_status(depq, get_versions))) | 330 | name, version, tostring(depq), (rock_status(depq, get_versions)))) |
331 | 331 | ||
332 | local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) | 332 | local okfulfill, version_or_err, tree = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) |
333 | if okfulfill then | 333 | if okfulfill then |
334 | deplocks.add(depskey, depq.name, found_or_err) | 334 | deplocks.add(depskey, depq.name, version_or_err) |
335 | if tree and rockspec:format_is_at_least("3.1") then | ||
336 | rockspec.variables[depq.name:upper() .. "_ROCKDIR"] = path.install_dir(depq.name, version_or_err, tree) | ||
337 | end | ||
335 | else | 338 | else |
336 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then | 339 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then |
337 | util.printerr("This version of " .. name .. " is designed for use with") | 340 | util.printerr("This version of " .. name .. " is designed for use with") |
@@ -341,7 +344,7 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock | |||
341 | util.printerr("or look for a suitable version of " .. name .. " with") | 344 | util.printerr("or look for a suitable version of " .. name .. " with") |
342 | util.printerr(" luarocks search " .. name) | 345 | util.printerr(" luarocks search " .. name) |
343 | end | 346 | end |
344 | return nil, found_or_err | 347 | return nil, version_or_err |
345 | end | 348 | end |
346 | end | 349 | end |
347 | 350 | ||
@@ -703,7 +706,7 @@ end | |||
703 | 706 | ||
704 | local function lua_h_exists(d, luaver) | 707 | local function lua_h_exists(d, luaver) |
705 | local major, minor = luaver:match("(%d+)%.(%d+)") | 708 | local major, minor = luaver:match("(%d+)%.(%d+)") |
706 | local luanum = ("%s%02d"):format(major, tonumber(minor)) | 709 | local luanum = ("%s%02d"):format(major, math.tointeger(minor)) |
707 | 710 | ||
708 | local lua_h = dir.path(d, "lua.h") | 711 | local lua_h = dir.path(d, "lua.h") |
709 | local fd = io.open(lua_h) | 712 | local fd = io.open(lua_h) |
@@ -808,7 +811,7 @@ function deps.check_lua_libdir(vars) | |||
808 | local err | 811 | local err |
809 | if ok then | 812 | if ok then |
810 | local filename = dir.path(vars.LUA_LIBDIR, vars.LUA_LIBDIR_FILE) | 813 | local filename = dir.path(vars.LUA_LIBDIR, vars.LUA_LIBDIR_FILE) |
811 | local fd = io.open(filename, "r") | 814 | local fd = io.open(filename, "rb") |
812 | if fd then | 815 | if fd then |
813 | if not vars.LUA_LIBDIR_FILE:match((cfg.lua_version:gsub("%.", "%%.?"))) then | 816 | if not vars.LUA_LIBDIR_FILE:match((cfg.lua_version:gsub("%.", "%%.?"))) then |
814 | 817 | ||