aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/deps.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/deps.lua')
-rw-r--r--src/luarocks/deps.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index d5a64e52..6f986575 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -17,10 +17,11 @@ local rep = require("luarocks.rep")
17local search = require("luarocks.search") 17local search = require("luarocks.search")
18local install = require("luarocks.install") 18local install = require("luarocks.install")
19local cfg = require("luarocks.cfg") 19local cfg = require("luarocks.cfg")
20local manif = require("luarocks.manif") 20local manif_core = require("luarocks.manif_core")
21local fs = require("luarocks.fs") 21local fs = require("luarocks.fs")
22local fetch = require("luarocks.fetch") 22local fetch = require("luarocks.fetch")
23local path = require("luarocks.path") 23local path = require("luarocks.path")
24local dir = require("luarocks.dir")
24 25
25local operators = { 26local operators = {
26 ["=="] = "==", 27 ["=="] = "==",
@@ -320,7 +321,7 @@ local function match_dep(dep, blacklist)
320 if dep.name == "lua" then 321 if dep.name == "lua" then
321 versions = { "5.1" } 322 versions = { "5.1" }
322 else 323 else
323 versions = manif.get_versions(dep.name) 324 versions = manif_core.get_versions(dep.name)
324 end 325 end
325 if not versions then 326 if not versions then
326 return nil 327 return nil
@@ -399,8 +400,9 @@ end
399-- Packages are installed using the LuaRocks "install" command. 400-- Packages are installed using the LuaRocks "install" command.
400-- Aborts the program if a dependency could not be fulfilled. 401-- Aborts the program if a dependency could not be fulfilled.
401-- @param rockspec table: A rockspec in table format. 402-- @param rockspec table: A rockspec in table format.
402-- @return boolean or (nil, string): True if no errors occurred, or 403-- @return boolean or (nil, string, [string]): True if no errors occurred, or
403-- nil and an error message if any test failed. 404-- nil and an error message if any test failed, followed by an optional
405-- error code.
404function fulfill_dependencies(rockspec) 406function fulfill_dependencies(rockspec)
405 407
406 if rockspec.supported_platforms then 408 if rockspec.supported_platforms then
@@ -469,9 +471,9 @@ function fulfill_dependencies(rockspec)
469 if not rock then 471 if not rock then
470 return nil, "Could not find a rock to satisfy dependency: "..show_dep(dep) 472 return nil, "Could not find a rock to satisfy dependency: "..show_dep(dep)
471 end 473 end
472 local ok, err = install.run(rock) 474 local ok, err, errcode = install.run(rock)
473 if not ok then 475 if not ok then
474 return nil, "Failed installing dependency: "..rock.." - "..err 476 return nil, "Failed installing dependency: "..rock.." - "..err, errcode
475 end 477 end
476 end 478 end
477 end 479 end
@@ -521,7 +523,7 @@ function check_external_deps(rockspec, mode)
521 prefix = extdir 523 prefix = extdir
522 end 524 end
523 for dirname, dirdata in pairs(dirs) do 525 for dirname, dirdata in pairs(dirs) do
524 dirdata.dir = vars[name.."_"..dirname] or fs.make_path(prefix, dirdata.subdir) 526 dirdata.dir = vars[name.."_"..dirname] or dir.path(prefix, dirdata.subdir)
525 local file = files[dirdata.testfile] 527 local file = files[dirdata.testfile]
526 if file then 528 if file then
527 local files = {} 529 local files = {}
@@ -535,10 +537,11 @@ function check_external_deps(rockspec, mode)
535 local found = false 537 local found = false
536 failed_file = nil 538 failed_file = nil
537 for _, f in pairs(files) do 539 for _, f in pairs(files) do
540 -- small convenience hack
538 if f:match("%.so$") or f:match("%.dylib$") or f:match("%.dll$") then 541 if f:match("%.so$") or f:match("%.dylib$") or f:match("%.dll$") then
539 f = f:gsub("%.[^.]+$", "."..cfg.external_lib_extension) 542 f = f:gsub("%.[^.]+$", "."..cfg.external_lib_extension)
540 end 543 end
541 local testfile = fs.make_path(dirdata.dir, f) 544 local testfile = dir.path(dirdata.dir, f)
542 if fs.exists(testfile) then 545 if fs.exists(testfile) then
543 found = true 546 found = true
544 break 547 break
@@ -565,7 +568,7 @@ function check_external_deps(rockspec, mode)
565 end 568 end
566 end 569 end
567 if not ok then 570 if not ok then
568 return nil, "Could not find expected file "..failed_file.." for "..name.." -- you may have to install "..name.." in your system and/or set the "..name.."_DIR variable" 571 return nil, "Could not find expected file "..failed_file.." for "..name.." -- you may have to install "..name.." in your system and/or set the "..name.."_DIR variable", "dependency"
569 end 572 end
570 end 573 end
571 end 574 end