aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-02-01 09:53:41 +0100
committerHisham <hisham@gobolinux.org>2016-02-01 09:53:41 +0100
commit6dc745a70be16e99ca2bc3b389f92336f49b05ec (patch)
tree21876afa41b977f2b6cb491bd0b76e15c5db2cf7 /src
parentfaf7b4d2688a8d6027c062a9f0ebd7baee9ab5f5 (diff)
downloadluarocks-6dc745a70be16e99ca2bc3b389f92336f49b05ec.tar.gz
luarocks-6dc745a70be16e99ca2bc3b389f92336f49b05ec.tar.bz2
luarocks-6dc745a70be16e99ca2bc3b389f92336f49b05ec.zip
Make search order deterministic.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/loader.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/luarocks/loader.lua b/src/luarocks/loader.lua
index 1eaa6721..ba15613e 100644
--- a/src/luarocks/loader.lua
+++ b/src/luarocks/loader.lua
@@ -6,8 +6,8 @@
6-- used to load previous modules, so that the loader chooses versions 6-- used to load previous modules, so that the loader chooses versions
7-- that are declared to be compatible with the ones loaded earlier. 7-- that are declared to be compatible with the ones loaded earlier.
8local loaders = package.loaders or package.searchers 8local loaders = package.loaders or package.searchers
9local package, require, ipairs, pairs, table, type, next, tostring, error = 9local package, require, ipairs, table, type, next, tostring, error =
10 package, require, ipairs, pairs, table, type, next, tostring, error 10 package, require, ipairs, table, type, next, tostring, error
11local unpack = unpack or table.unpack 11local unpack = unpack or table.unpack
12 12
13--module("luarocks.loader") 13--module("luarocks.loader")
@@ -20,6 +20,7 @@ cfg.init_package_paths()
20local path = require("luarocks.path") 20local path = require("luarocks.path")
21local manif_core = require("luarocks.manif_core") 21local manif_core = require("luarocks.manif_core")
22local deps = require("luarocks.deps") 22local deps = require("luarocks.deps")
23local util = require("luarocks.util")
23 24
24loader.context = {} 25loader.context = {}
25 26
@@ -79,7 +80,7 @@ function loader.add_context(name, version)
79 for _, tree in ipairs(loader.rocks_trees) do 80 for _, tree in ipairs(loader.rocks_trees) do
80 local entries = tree.manifest.repository[pkg] 81 local entries = tree.manifest.repository[pkg]
81 if entries then 82 if entries then
82 for version, pkgs in pairs(entries) do 83 for version, pkgs in util.sortedpairs(entries, deps.compare_versions) do
83 if (not constraints) or deps.match_constraints(deps.parse_version(version), constraints) then 84 if (not constraints) or deps.match_constraints(deps.parse_version(version), constraints) then
84 loader.add_context(pkg, version) 85 loader.add_context(pkg, version)
85 end 86 end