aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-05-14 19:09:15 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-05-14 19:09:15 +0300
commit2b02e999c5b04148fd88a67a2be93378c7225956 (patch)
tree8db5099016a7f55495524c5499ae9e00b65c2237
parenta26862545e0eccbbc5fba15edd2a00dedf069a3f (diff)
downloadluarocks-2b02e999c5b04148fd88a67a2be93378c7225956.tar.gz
luarocks-2b02e999c5b04148fd88a67a2be93378c7225956.tar.bz2
luarocks-2b02e999c5b04148fd88a67a2be93378c7225956.zip
Return missing deps listing in `luarocks install` output
-rw-r--r--src/luarocks/deps.lua25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 73eab2c2..3c580623 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -410,6 +410,13 @@ local function values_set(tbl)
410 return set 410 return set
411end 411end
412 412
413local function rock_status(name, deps_mode)
414 local search = require("luarocks.search")
415 local installed = match_dep(search.make_query(name), nil, deps_mode)
416 local installation_type = cfg.rocks_provided[name] and "provided by VM" or "installed"
417 return installed and installed.version.." "..installation_type or "not installed"
418end
419
413--- Check dependencies of a rock and attempt to install any missing ones. 420--- Check dependencies of a rock and attempt to install any missing ones.
414-- Packages are installed using the LuaRocks "install" command. 421-- Packages are installed using the LuaRocks "install" command.
415-- Aborts the program if a dependency could not be fulfilled. 422-- Aborts the program if a dependency could not be fulfilled.
@@ -454,15 +461,25 @@ function deps.fulfill_dependencies(rockspec, deps_mode)
454 for _, dep in ipairs(rockspec.dependencies) do 461 for _, dep in ipairs(rockspec.dependencies) do
455 if not match_dep(dep, nil, deps_mode) then 462 if not match_dep(dep, nil, deps_mode) then
456 if first_missing_dep then 463 if first_missing_dep then
464 util.printout(("Missing dependencies for %s %s:"):format(rockspec.name, rockspec.version))
465 first_missing_dep = false
466 end
467
468 util.printout((" %s (%s)"):format(deps.show_dep(dep), rock_status(dep.name, deps_mode)))
469 end
470 end
471
472 first_missing_dep = true
473
474 for _, dep in ipairs(rockspec.dependencies) do
475 if not match_dep(dep, nil, deps_mode) then
476 if first_missing_dep then
457 util.printout() 477 util.printout()
458 first_missing_dep = false 478 first_missing_dep = false
459 end 479 end
460 480
461 local any_installed = match_dep(search.make_query(dep.name), nil, deps_mode)
462 local installation_type = cfg.rocks_provided[dep.name] and "provided by VM" or "installed"
463 local status = any_installed and any_installed.version.." "..installation_type or "missing"
464 util.printout(("%s %s depends on %s (%s)"):format( 481 util.printout(("%s %s depends on %s (%s)"):format(
465 rockspec.name, rockspec.version, deps.show_dep(dep), status)) 482 rockspec.name, rockspec.version, deps.show_dep(dep), rock_status(dep.name, deps_mode)))
466 483
467 if dep.constraints[1] and dep.constraints[1].no_upgrade then 484 if dep.constraints[1] and dep.constraints[1].no_upgrade then
468 util.printerr("This version of "..rockspec.name.." is designed for use with") 485 util.printerr("This version of "..rockspec.name.." is designed for use with")