diff options
Diffstat (limited to 'src/luarocks/deps.lua')
-rw-r--r-- | src/luarocks/deps.lua | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 0c6bb8d5..116b4bbb 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -323,9 +323,10 @@ end | |||
323 | local function match_dep(dep, blacklist, deps_mode) | 323 | local function match_dep(dep, blacklist, deps_mode) |
324 | assert(type(dep) == "table") | 324 | assert(type(dep) == "table") |
325 | 325 | ||
326 | local versions | 326 | local versions = cfg.rocks_provided[dep.name] |
327 | if dep.name == "lua" then | 327 | if cfg.rocks_provided[dep.name] then |
328 | versions = { cfg.lua_version } | 328 | -- provided rocks have higher priority than manifest's rocks |
329 | versions = { cfg.rocks_provided[dep.name] } | ||
329 | else | 330 | else |
330 | versions = manif_core.get_versions(dep.name, deps_mode) | 331 | versions = manif_core.get_versions(dep.name, deps_mode) |
331 | end | 332 | end |
@@ -360,17 +361,12 @@ local function match_dep(dep, blacklist, deps_mode) | |||
360 | end | 361 | end |
361 | end | 362 | end |
362 | 363 | ||
363 | local whitelist = {} | ||
364 | if cfg.lua_version == "5.2" then | ||
365 | whitelist["bit32"] = true | ||
366 | end | ||
367 | |||
368 | --- Attempt to match dependencies of a rockspec to installed rocks. | 364 | --- Attempt to match dependencies of a rockspec to installed rocks. |
369 | -- @param rockspec table: The rockspec loaded as a table. | 365 | -- @param rockspec table: The rockspec loaded as a table. |
370 | -- @param blacklist table or nil: Program versions to not use as valid matches. | 366 | -- @param blacklist table or nil: Program versions to not use as valid matches. |
371 | -- Table where keys are program names and values are tables where keys | 367 | -- Table where keys are program names and values are tables where keys |
372 | -- are program versions and values are 'true'. | 368 | -- are program versions and values are 'true'. |
373 | -- @return table, table: A table where keys are dependencies parsed | 369 | -- @return table, table, table: A table where keys are dependencies parsed |
374 | -- in table format and values are tables containing fields 'name' and | 370 | -- in table format and values are tables containing fields 'name' and |
375 | -- version' representing matches; a table of missing dependencies | 371 | -- version' representing matches; a table of missing dependencies |
376 | -- parsed as tables; and a table of "no-upgrade" missing dependencies | 372 | -- parsed as tables; and a table of "no-upgrade" missing dependencies |
@@ -382,18 +378,16 @@ function match_deps(rockspec, blacklist, deps_mode) | |||
382 | local matched, missing, no_upgrade = {}, {}, {} | 378 | local matched, missing, no_upgrade = {}, {}, {} |
383 | 379 | ||
384 | for _, dep in ipairs(rockspec.dependencies) do | 380 | for _, dep in ipairs(rockspec.dependencies) do |
385 | if not whitelist[dep.name] then | 381 | local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) |
386 | local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) | 382 | if found then |
387 | if found then | 383 | if not cfg.rocks_provided[dep.name] then |
388 | if dep.name ~= "lua" then | 384 | matched[dep] = found |
389 | matched[dep] = found | 385 | end |
390 | end | 386 | else |
387 | if dep.constraints[1] and dep.constraints[1].no_upgrade then | ||
388 | no_upgrade[dep.name] = dep | ||
391 | else | 389 | else |
392 | if dep.constraints[1] and dep.constraints[1].no_upgrade then | 390 | missing[dep.name] = dep |
393 | no_upgrade[dep.name] = dep | ||
394 | else | ||
395 | missing[dep.name] = dep | ||
396 | end | ||
397 | end | 391 | end |
398 | end | 392 | end |
399 | end | 393 | end |