aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/deps.lua35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index e0b8a42d..f24dc507 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -360,6 +360,11 @@ local function match_dep(dep, blacklist, deps_mode)
360 end 360 end
361end 361end
362 362
363local whitelist = {}
364if cfg.lua_version == "5.2" then
365 whitelist["bit32"] = true
366end
367
363--- Attempt to match dependencies of a rockspec to installed rocks. 368--- Attempt to match dependencies of a rockspec to installed rocks.
364-- @param rockspec table: The rockspec loaded as a table. 369-- @param rockspec table: The rockspec loaded as a table.
365-- @param blacklist table or nil: Program versions to not use as valid matches. 370-- @param blacklist table or nil: Program versions to not use as valid matches.
@@ -367,24 +372,28 @@ end
367-- are program versions and values are 'true'. 372-- are program versions and values are 'true'.
368-- @return table, table: A table where keys are dependencies parsed 373-- @return table, table: A table where keys are dependencies parsed
369-- in table format and values are tables containing fields 'name' and 374-- in table format and values are tables containing fields 'name' and
370-- version' representing matches, and a table of missing dependencies 375-- version' representing matches; a table of missing dependencies
371-- parsed as tables. 376-- parsed as tables; and a table of "no-upgrade" missing dependencies
377-- (to be used in plugin modules so that a plugin does not force upgrade of
378-- its parent application).
372function match_deps(rockspec, blacklist, deps_mode) 379function match_deps(rockspec, blacklist, deps_mode)
373 assert(type(rockspec) == "table") 380 assert(type(rockspec) == "table")
374 assert(type(blacklist) == "table" or not blacklist) 381 assert(type(blacklist) == "table" or not blacklist)
375 local matched, missing, no_upgrade = {}, {}, {} 382 local matched, missing, no_upgrade = {}, {}, {}
376 383
377 for _, dep in ipairs(rockspec.dependencies) do 384 for _, dep in ipairs(rockspec.dependencies) do
378 local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) 385 if not whitelist[dep.name] then
379 if found then 386 local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode)
380 if dep.name ~= "lua" then 387 if found then
381 matched[dep] = found 388 if dep.name ~= "lua" then
382 end 389 matched[dep] = found
383 else 390 end
384 if dep.constraints[1] and dep.constraints[1].no_upgrade then
385 no_upgrade[dep.name] = dep
386 else 391 else
387 missing[dep.name] = dep 392 if dep.constraints[1] and dep.constraints[1].no_upgrade then
393 no_upgrade[dep.name] = dep
394 else
395 missing[dep.name] = dep
396 end
388 end 397 end
389 end 398 end
390 end 399 end
@@ -441,7 +450,7 @@ function fulfill_dependencies(rockspec, deps_mode)
441 end 450 end
442 end 451 end
443 452
444 local matched, missing, no_upgrade = match_deps(rockspec, nil, deps_mode) 453 local _, missing, no_upgrade = match_deps(rockspec, nil, deps_mode)
445 454
446 if next(no_upgrade) then 455 if next(no_upgrade) then
447 util.printerr("Missing dependencies for "..rockspec.name.." "..rockspec.version..":") 456 util.printerr("Missing dependencies for "..rockspec.name.." "..rockspec.version..":")