From 13a249a6c1dc7e43bbe29791d2ad2bb2b42850d6 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 20 Dec 2013 18:48:11 -0200 Subject: Fix regressions caused by #194. Thank you, integrated testing! --- src/luarocks/deps.lua | 20 ++++++++++---------- test/testing.sh | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 34ef8298..116b4bbb 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua @@ -324,7 +324,7 @@ local function match_dep(dep, blacklist, deps_mode) assert(type(dep) == "table") local versions = cfg.rocks_provided[dep.name] - if not cfg.rocks_provided[dep.name] then + if cfg.rocks_provided[dep.name] then -- provided rocks have higher priority than manifest's rocks versions = { cfg.rocks_provided[dep.name] } else @@ -366,7 +366,7 @@ end -- @param blacklist table or nil: Program versions to not use as valid matches. -- Table where keys are program names and values are tables where keys -- are program versions and values are 'true'. --- @return table, table: A table where keys are dependencies parsed +-- @return table, table, table: A table where keys are dependencies parsed -- in table format and values are tables containing fields 'name' and -- version' representing matches; a table of missing dependencies -- parsed as tables; and a table of "no-upgrade" missing dependencies @@ -378,16 +378,16 @@ function match_deps(rockspec, blacklist, deps_mode) local matched, missing, no_upgrade = {}, {}, {} for _, dep in ipairs(rockspec.dependencies) do - if not cfg.rocks_provided[dep.name] then - local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) - if found then + local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) + if found then + if not cfg.rocks_provided[dep.name] then matched[dep] = found + end + else + if dep.constraints[1] and dep.constraints[1].no_upgrade then + no_upgrade[dep.name] = dep else - if dep.constraints[1] and dep.constraints[1].no_upgrade then - no_upgrade[dep.name] = dep - else - missing[dep.name] = dep - end + missing[dep.name] = dep end end end diff --git a/test/testing.sh b/test/testing.sh index 0386978a..3a199883 100755 --- a/test/testing.sh +++ b/test/testing.sh @@ -397,7 +397,7 @@ fail_admin_remove_missing() { $luarocks_admin --server=testing remove; } fail_deps_mode_invalid_arg() { $luarocks remove luacov --deps-mode; } test_deps_mode_one() { $luarocks build --tree="system" lpeg && $luarocks list && $luarocks build --deps-mode=one --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 1 ]; } -test_deps_mode_order() { $luarocks build --tree="system" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } +test_deps_mode_order() { $luarocks build --tree="system" lpeg && $luarocks build --deps-mode=order --tree="$testing_tree" lxsh && $luarocks_noecho list --tree="$testing_tree" --porcelain lpeg && [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } test_deps_mode_order_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=order --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 1 ]; } test_deps_mode_all_sys() { $luarocks build --tree="$testing_tree" lpeg && $luarocks build --deps-mode=all --tree="$testing_sys_tree" lxsh && [ `$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg | wc -l` = 0 ]; } test_deps_mode_none() { $luarocks build --tree="$testing_tree" --deps-mode=none lxsh; [ `$luarocks_noecho list --tree="$testing_tree" --porcelain lpeg | wc -l` = 0 ]; } -- cgit v1.2.3-55-g6feb