aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-09-25 15:47:37 -0700
committerHisham Muhammad <hisham@gobolinux.org>2012-09-25 15:47:37 -0700
commitcd53c994a71351c57d76f3eac463a40a3e3f6fed (patch)
tree6f817b11e6596636d46583af6bfb1a7efb925176
parent30b3abcce493c1e212ae533f486c0bdd558f5c2a (diff)
parent9640b97e9a52ebe0648c5294f2006c32bb36593a (diff)
downloadluarocks-cd53c994a71351c57d76f3eac463a40a3e3f6fed.tar.gz
luarocks-cd53c994a71351c57d76f3eac463a40a3e3f6fed.tar.bz2
luarocks-cd53c994a71351c57d76f3eac463a40a3e3f6fed.zip
Merge pull request #98 from rrthomas/master
Improve support for parallel rocks trees with different Lua versions
-rw-r--r--src/luarocks/cfg.lua8
-rw-r--r--src/luarocks/path.lua4
2 files changed, 7 insertions, 5 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 41adb4e5..dfef7d99 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -98,16 +98,18 @@ end
98 98
99-- Path configuration: 99-- Path configuration:
100 100
101local version_suffix = lua_version:gsub ("%.", "_")
101local sys_config_file, home_config_file 102local sys_config_file, home_config_file
102local sys_config_ok, home_config_ok = false, false 103local sys_config_ok, home_config_ok = false, false
104sys_config_file = site_config["LUAROCKS_SYSCONFIG_" .. version_suffix] or site_config.LUAROCKS_SYSCONFIG
103if detected.windows then 105if detected.windows then
104 home = os.getenv("APPDATA") or "c:" 106 home = os.getenv("APPDATA") or "c:"
105 sys_config_file = site_config.LUAROCKS_SYSCONFIG or "c:/luarocks/config.lua" 107 sys_config_file = sys_config_file or "c:/luarocks/config.lua"
106 home_config_file = home.."/luarocks/config.lua" 108 home_config_file = home.."/luarocks/config.lua"
107 home_tree = home.."/luarocks/" 109 home_tree = home.."/luarocks/"
108else 110else
109 home = os.getenv("HOME") or "" 111 home = os.getenv("HOME") or ""
110 sys_config_file = site_config.LUAROCKS_SYSCONFIG or "/etc/luarocks/config.lua" 112 sys_config_file = sys_config_file or "/etc/luarocks/config.lua"
111 home_config_file = home.."/.luarocks/config.lua" 113 home_config_file = home.."/.luarocks/config.lua"
112 home_tree = home.."/.luarocks/" 114 home_tree = home.."/.luarocks/"
113end 115end
@@ -126,7 +128,7 @@ else -- nil or false
126end 128end
127 129
128if not site_config.LUAROCKS_FORCE_CONFIG then 130if not site_config.LUAROCKS_FORCE_CONFIG then
129 home_config_file = os.getenv("LUAROCKS_CONFIG") or home_config_file 131 home_config_file = os.getenv("LUAROCKS_CONFIG_" .. version_suffix) or os.getenv("LUAROCKS_CONFIG") or home_config_file
130 local home_overrides, err = persist.load_into_table(home_config_file, { home = home }) 132 local home_overrides, err = persist.load_into_table(home_config_file, { home = home })
131 if home_overrides then 133 if home_overrides then
132 home_config_ok = true 134 home_config_ok = true
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua
index bbd928a0..798f15a9 100644
--- a/src/luarocks/path.lua
+++ b/src/luarocks/path.lua
@@ -37,8 +37,8 @@ end
37function root_dir(rocks_dir) 37function root_dir(rocks_dir)
38 assert(type(rocks_dir) == "string") 38 assert(type(rocks_dir) == "string")
39 39
40 local suffix = dir.path("lib", "luarocks", "rocks") 40 local suffix = dir.path("lib", "luarocks")
41 return rocks_dir:match("(.*)" .. suffix .. "$") 41 return rocks_dir:match("(.*)" .. suffix .. ".*$")
42end 42end
43 43
44function deploy_bin_dir(tree) 44function deploy_bin_dir(tree)