diff options
| author | Hisham <hisham@gobolinux.org> | 2016-02-01 09:53:41 +0100 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-02-01 09:53:41 +0100 |
| commit | 6dc745a70be16e99ca2bc3b389f92336f49b05ec (patch) | |
| tree | 21876afa41b977f2b6cb491bd0b76e15c5db2cf7 | |
| parent | faf7b4d2688a8d6027c062a9f0ebd7baee9ab5f5 (diff) | |
| download | luarocks-6dc745a70be16e99ca2bc3b389f92336f49b05ec.tar.gz luarocks-6dc745a70be16e99ca2bc3b389f92336f49b05ec.tar.bz2 luarocks-6dc745a70be16e99ca2bc3b389f92336f49b05ec.zip | |
Make search order deterministic.
| -rw-r--r-- | src/luarocks/loader.lua | 7 |
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. |
| 8 | local loaders = package.loaders or package.searchers | 8 | local loaders = package.loaders or package.searchers |
| 9 | local package, require, ipairs, pairs, table, type, next, tostring, error = | 9 | local 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 |
| 11 | local unpack = unpack or table.unpack | 11 | local unpack = unpack or table.unpack |
| 12 | 12 | ||
| 13 | --module("luarocks.loader") | 13 | --module("luarocks.loader") |
| @@ -20,6 +20,7 @@ cfg.init_package_paths() | |||
| 20 | local path = require("luarocks.path") | 20 | local path = require("luarocks.path") |
| 21 | local manif_core = require("luarocks.manif_core") | 21 | local manif_core = require("luarocks.manif_core") |
| 22 | local deps = require("luarocks.deps") | 22 | local deps = require("luarocks.deps") |
| 23 | local util = require("luarocks.util") | ||
| 23 | 24 | ||
| 24 | loader.context = {} | 25 | loader.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 |
