diff options
-rw-r--r-- | src/luarocks/deps.lua | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index ac294f54..73eab2c2 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -449,53 +449,43 @@ function deps.fulfill_dependencies(rockspec, deps_mode) | |||
449 | end | 449 | end |
450 | end | 450 | end |
451 | 451 | ||
452 | local _, missing, no_upgrade = deps.match_deps(rockspec, nil, deps_mode) | 452 | local first_missing_dep = true |
453 | 453 | ||
454 | if next(no_upgrade) then | 454 | for _, dep in ipairs(rockspec.dependencies) do |
455 | util.printerr("Missing dependencies for "..rockspec.name.." "..rockspec.version..":") | 455 | if not match_dep(dep, nil, deps_mode) then |
456 | for _, dep in pairs(no_upgrade) do | 456 | if first_missing_dep then |
457 | util.printerr(deps.show_dep(dep)) | 457 | util.printout() |
458 | end | 458 | first_missing_dep = false |
459 | if next(missing) then | ||
460 | for _, dep in pairs(missing) do | ||
461 | util.printerr(deps.show_dep(dep)) | ||
462 | end | 459 | end |
463 | end | ||
464 | util.printerr() | ||
465 | for _, dep in pairs(no_upgrade) do | ||
466 | util.printerr("This version of "..rockspec.name.." is designed for use with") | ||
467 | util.printerr(deps.show_dep(dep)..", but is configured to avoid upgrading it") | ||
468 | util.printerr("automatically. Please upgrade "..dep.name.." with") | ||
469 | util.printerr(" luarocks install "..dep.name) | ||
470 | util.printerr("or choose an older version of "..rockspec.name.." with") | ||
471 | util.printerr(" luarocks search "..rockspec.name) | ||
472 | end | ||
473 | return nil, "Failed matching dependencies." | ||
474 | end | ||
475 | 460 | ||
476 | if next(missing) then | 461 | local any_installed = match_dep(search.make_query(dep.name), nil, deps_mode) |
477 | util.printerr() | 462 | local installation_type = cfg.rocks_provided[dep.name] and "provided by VM" or "installed" |
478 | util.printerr("Missing dependencies for "..rockspec.name..":") | 463 | local status = any_installed and any_installed.version.." "..installation_type or "missing" |
479 | for _, dep in pairs(missing) do | 464 | util.printout(("%s %s depends on %s (%s)"):format( |
480 | util.printerr(deps.show_dep(dep)) | 465 | rockspec.name, rockspec.version, deps.show_dep(dep), status)) |
481 | end | 466 | |
482 | util.printerr() | 467 | if dep.constraints[1] and dep.constraints[1].no_upgrade then |
483 | 468 | util.printerr("This version of "..rockspec.name.." is designed for use with") | |
484 | for _, dep in pairs(missing) do | 469 | util.printerr(deps.show_dep(dep)..", but is configured to avoid upgrading it") |
485 | -- Double-check in case dependency was filled during recursion. | 470 | util.printerr("automatically. Please upgrade "..dep.name.." with") |
486 | if not match_dep(dep, nil, deps_mode) then | 471 | util.printerr(" luarocks install "..dep.name) |
487 | local url, err = search.find_suitable_rock(dep) | 472 | util.printerr("or choose an older version of "..rockspec.name.." with") |
488 | if not url then | 473 | util.printerr(" luarocks search "..rockspec.name) |
489 | return nil, "Could not satisfy dependency "..deps.show_dep(dep)..": "..err | 474 | return nil, "Failed matching dependencies" |
490 | end | 475 | end |
491 | util.printout("Installing "..url) | 476 | |
492 | local ok, err, errcode = install.run(url, deps.deps_mode_to_flag(deps_mode)) | 477 | local url, search_err = search.find_suitable_rock(dep) |
493 | if not ok then | 478 | if not url then |
494 | return nil, "Failed installing dependency: "..url.." - "..err, errcode | 479 | return nil, "Could not satisfy dependency "..deps.show_dep(dep)..": "..search_err |
495 | end | 480 | end |
481 | util.printout("Installing "..url) | ||
482 | local ok, install_err, errcode = install.run(url, deps.deps_mode_to_flag(deps_mode)) | ||
483 | if not ok then | ||
484 | return nil, "Failed installing dependency: "..url.." - "..install_err, errcode | ||
496 | end | 485 | end |
497 | end | 486 | end |
498 | end | 487 | end |
488 | |||
499 | return true | 489 | return true |
500 | end | 490 | end |
501 | 491 | ||