From 80404ed338b063555d58794a34997019311bc855 Mon Sep 17 00:00:00 2001
From: Kyle McLamb
Date: Thu, 11 Jun 2015 21:18:44 -0400
Subject: [PATCH] Check for manifest in versioned rocks trees first
When a versioned rocks tree and a non-versioned rocks tree coexist,
prefer the versioned one.
* On a machine with a single rocks tree, versioned or no, this has no effect.
* On a machine with both, and the unversioned tree points to the right
lua version, this has no effect.
* But on a machine where the unversioned tree points to another version
of lua, the right manifest file will be read instead of the wrong one.
---
datafile/openers/luarocks.lua | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/datafile/openers/luarocks.lua b/datafile/openers/luarocks.lua
index b6726f4..3e40571 100644
--- a/datafile/openers/luarocks.lua
+++ b/datafile/openers/luarocks.lua
@@ -19,10 +19,10 @@ function luarocks.opener(file, mode, context)
local prefix, luaver, modpath = source:match("@(.*)/share/lua/([^/]*)/(.*)")
if prefix and luaver and modpath then
local modname = path.path_to_module(modpath):gsub("\\","."):gsub("/",".")
- local rocks_dir = prefix.."/lib/luarocks/rocks"
+ local rocks_dir = prefix.."/lib/luarocks/rocks-"..luaver
local manifest, err = manif_core.load_local_manifest(rocks_dir)
- if not manifest then
- rocks_dir = prefix.."/lib/luarocks/rocks-"..luaver
+ if not manifest then -- look for generic rocks_dir
+ rocks_dir = prefix.."/lib/luarocks/rocks"
manifest, err = manif_core.load_local_manifest(rocks_dir)
end
if not manifest then