aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2021-09-24 11:21:34 +0900
committerGitHub <noreply@github.com>2021-09-23 23:21:34 -0300
commit0263e1281a560bb931074d8944507d4bf7bcd407 (patch)
treef8959676de402b4c6eb81542563472261b7fef81
parent9218cee6f13155c7d4f5a2f12336b6bfd5dfce2b (diff)
downloadluarocks-0263e1281a560bb931074d8944507d4bf7bcd407.tar.gz
luarocks-0263e1281a560bb931074d8944507d4bf7bcd407.tar.bz2
luarocks-0263e1281a560bb931074d8944507d4bf7bcd407.zip
fix check_external_dependency_at (#1355)
Fix a problem where 'files' were being sorted even though they should have been inspected in the order of external_deps_patterns.
-rw-r--r--src/luarocks/deps.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 5b02c68b..63803374 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -373,7 +373,7 @@ end
373-- @param files The array of constructed names 373-- @param files The array of constructed names
374local function add_all_patterns(file, patterns, files) 374local function add_all_patterns(file, patterns, files)
375 for _, pattern in ipairs(patterns) do 375 for _, pattern in ipairs(patterns) do
376 table.insert(files, (pattern:gsub("?", file))) 376 table.insert(files, {#files + 1, (pattern:gsub("?", file))})
377 end 377 end
378end 378end
379 379
@@ -425,7 +425,7 @@ local function add_patterns_for_file(files, file, patterns)
425 add_all_patterns(matched, patterns, files) 425 add_all_patterns(matched, patterns, files)
426 end 426 end
427 end 427 end
428 table.insert(files, file) 428 table.insert(files, {#files + 1, file})
429 end 429 end
430end 430end
431 431
@@ -460,16 +460,17 @@ local function check_external_dependency_at(prefix, name, ext_files, vars, dirs,
460 460
461 local found = false 461 local found = false
462 table.sort(files, function(a, b) 462 table.sort(files, function(a, b)
463 if (not a:match("%*")) and b:match("%*") then 463 if (not a[2]:match("%*")) and b[2]:match("%*") then
464 return true 464 return true
465 elseif a:match("%*") and (not b:match("%*")) then 465 elseif a[2]:match("%*") and (not b[2]:match("%*")) then
466 return false 466 return false
467 else 467 else
468 return a < b 468 return a[1] < b[1]
469 end 469 end
470 end) 470 end)
471 for _, f in ipairs(files) do 471 for _, fa in ipairs(files) do
472 472
473 f = fa[2]
473 -- small convenience hack 474 -- small convenience hack
474 if f:match("%.so$") or f:match("%.dylib$") or f:match("%.dll$") then 475 if f:match("%.so$") or f:match("%.dylib$") or f:match("%.dll$") then
475 f = f:gsub("%.[^.]+$", "."..cfg.external_lib_extension) 476 f = f:gsub("%.[^.]+$", "."..cfg.external_lib_extension)