diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-09-25 15:47:37 -0700 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-09-25 15:47:37 -0700 |
commit | cd53c994a71351c57d76f3eac463a40a3e3f6fed (patch) | |
tree | 6f817b11e6596636d46583af6bfb1a7efb925176 | |
parent | 30b3abcce493c1e212ae533f486c0bdd558f5c2a (diff) | |
parent | 9640b97e9a52ebe0648c5294f2006c32bb36593a (diff) | |
download | luarocks-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.lua | 8 | ||||
-rw-r--r-- | src/luarocks/path.lua | 4 |
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 | ||
101 | local version_suffix = lua_version:gsub ("%.", "_") | ||
101 | local sys_config_file, home_config_file | 102 | local sys_config_file, home_config_file |
102 | local sys_config_ok, home_config_ok = false, false | 103 | local sys_config_ok, home_config_ok = false, false |
104 | sys_config_file = site_config["LUAROCKS_SYSCONFIG_" .. version_suffix] or site_config.LUAROCKS_SYSCONFIG | ||
103 | if detected.windows then | 105 | if 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/" |
108 | else | 110 | else |
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/" |
113 | end | 115 | end |
@@ -126,7 +128,7 @@ else -- nil or false | |||
126 | end | 128 | end |
127 | 129 | ||
128 | if not site_config.LUAROCKS_FORCE_CONFIG then | 130 | if 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 | |||
37 | function root_dir(rocks_dir) | 37 | function 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 .. ".*$") |
42 | end | 42 | end |
43 | 43 | ||
44 | function deploy_bin_dir(tree) | 44 | function deploy_bin_dir(tree) |