This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push: new c21b8d2 CLI: only used original Lua package path. (#1032) c21b8d2 is described below commit c21b8d2fde98beef5e31482dda3404c798622d1f Author: YuanSheng Wang <membp...@gmail.com> AuthorDate: Thu Jan 9 14:24:37 2020 +0800 CLI: only used original Lua package path. (#1032) --- bin/apisix | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/bin/apisix b/bin/apisix index 5fae3ed..2fe82eb 100755 --- a/bin/apisix +++ b/bin/apisix @@ -17,8 +17,6 @@ -- limitations under the License. -- -local script_path = arg[0] - local function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end @@ -30,36 +28,35 @@ local function excute_cmd(cmd) return data end -local pwd = trim(excute_cmd("pwd")) -if not pwd then - error("failed to fetch current path") -end - excute_cmd("install -d -m 777 /tmp/apisix_cores/") -local apisix_home = "/usr/local/apisix" -package.cpath = "/usr/local/apisix/deps/lib64/lua/5.1/?.so;" - .. "/usr/local/apisix/deps/lib/lua/5.1/?.so;" - .. package.cpath +local pkg_cpath_org = package.cpath +local pkg_path_org = package.path -package.path = "/usr/local/apisix/deps/share/lua/5.1/apisix/lua/?.lua;" - .. "/usr/local/apisix/deps/share/lua/5.1/?.lua;" - .. "/usr/share/lua/5.1/apisix/lua/?.lua;" - .. "/usr/local/share/lua/5.1/apisix/lua/?.lua;" - .. package.path +local apisix_home = "/usr/local/apisix" +local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;" + .. apisix_home .. "/deps/lib/lua/5.1/?.so;;" +local pkg_path = apisix_home .. "/deps/share/lua/5.1/apisix/lua/?.lua;" + .. apisix_home .. "/deps/share/lua/5.1/?.lua;;" -- only for developer, use current folder as working space +local script_path = arg[0] if script_path:sub(1, 2) == './' then - apisix_home = pwd - package.cpath = pwd .. "/deps/lib64/lua/5.1/?.so;" - .. package.cpath + apisix_home = trim(excute_cmd("pwd")) + if not apisix_home then + error("failed to fetch current path") + end - package.path = pwd .. "/lua/?.lua;" - .. pwd .. "/deps/share/lua/5.1/?.lua;" - .. package.path + pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;" + .. apisix_home .. "/deps/lib/lua/5.1/?.so;" + pkg_path = apisix_home .. "/lua/?.lua;" + .. apisix_home .. "/deps/share/lua/5.1/?.lua;;" end -- print("apisix_home: ", apisix_home) +package.cpath = pkg_cpath .. pkg_cpath_org +package.path = pkg_path .. pkg_path_org + do -- skip luajit environment local ok = pcall(require, "table.new") @@ -494,8 +491,8 @@ local function init() -- Using template.render local sys_conf = { - lua_path = package.path, - lua_cpath = package.cpath, + lua_path = pkg_path_org, + lua_cpath = pkg_cpath_org, os_name = exec("uname"), apisix_lua_home = apisix_home, with_module_status = with_module_status,