diff options
author | Reuben Thomas <rrt@sc3d.org> | 2012-09-25 23:32:02 +0100 |
---|---|---|
committer | Reuben Thomas <rrt@sc3d.org> | 2012-09-25 23:32:02 +0100 |
commit | 9640b97e9a52ebe0648c5294f2006c32bb36593a (patch) | |
tree | 6f817b11e6596636d46583af6bfb1a7efb925176 /src | |
parent | 392d92bd4493d8d08ce05157a04c512be588ae68 (diff) | |
download | luarocks-9640b97e9a52ebe0648c5294f2006c32bb36593a.tar.gz luarocks-9640b97e9a52ebe0648c5294f2006c32bb36593a.tar.bz2 luarocks-9640b97e9a52ebe0648c5294f2006c32bb36593a.zip |
Improve support for parallel rocks trees with different Lua versions.
Add support for LUAROCKS_SYSCONFIG_X_Y and LUAROCKS_CONFIG_X_Y,
similar to LUA_PATH_5_2, but for any verison of Lua.
Allow repository paths to contain extra components under
"lib/luarocks", so for example you can have "lib/luarocks/5.1/rocks"
and "lib/luarocks/5.2/rocks".
Diffstat (limited to 'src')
-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) |