aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-09-21 11:06:57 -0700
committerHisham Muhammad <hisham@gobolinux.org>2022-04-16 16:50:37 -0300
commit8757ab5a663accbd139c9cf10c4878ecd82e3f05 (patch)
tree6ceeda04530d99ae3e551b03409c23e6a3d13aca
parent19eedb476cbcd88606f4699fb1a57fb365b31251 (diff)
downloadluarocks-8757ab5a663accbd139c9cf10c4878ecd82e3f05.tar.gz
luarocks-8757ab5a663accbd139c9cf10c4878ecd82e3f05.tar.bz2
luarocks-8757ab5a663accbd139c9cf10c4878ecd82e3f05.zip
search: avoid mixing up version and repo in pick_installed_rock
-rw-r--r--src/luarocks/search.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua
index 8a79d990..e76d4591 100644
--- a/src/luarocks/search.lua
+++ b/src/luarocks/search.lua
@@ -370,7 +370,6 @@ function search.pick_installed_rock(query, given_tree)
370 return nil, table.concat(out) 370 return nil, table.concat(out)
371 end 371 end
372 372
373 local version = nil
374 local repo_url 373 local repo_url
375 374
376 local name, versions 375 local name, versions
@@ -380,15 +379,12 @@ function search.pick_installed_rock(query, given_tree)
380 name, versions = util.sortedpairs(result_tree)() 379 name, versions = util.sortedpairs(result_tree)()
381 end 380 end
382 381
383 --question: what do we do about multiple versions? This should 382 local version, repositories = util.sortedpairs(versions, vers.compare_versions)()
384 --give us the latest version on the last repo (which is usually the global one) 383 for _, rp in ipairs(repositories) do repo_url = rp.repo end
385 for vs, repositories in util.sortedpairs(versions, vers.compare_versions) do
386 if not version then version = vs end
387 for _, rp in ipairs(repositories) do repo_url = rp.repo end
388 end
389 384
390 local repo = tree_map[repo_url] 385 local repo = tree_map[repo_url]
391 return name, version, repo, repo_url 386 return name, version, repo, repo_url
392end 387end
393 388
394return search 389return search
390