Skip to content

Commit f403523

Browse files
fffoniongszr
authored andcommitted
fix(upgrate-tests): use system lua for luarocks
1 parent 746f301 commit f403523

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/lua
2+
package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[/usr/local/etc/luarocks]], LUA_VERSION = "5.1" }
3+
package.path=[[/usr/local/share/lua/5.1/?.lua;]] .. package.path
4+
local list = package.searchers or package.loaders; table.insert(list, 1, function(name) if name:match("^luarocks%.") then return loadfile([[/usr/local/share/lua/5.1/]] .. name:gsub([[%.]], [[/]]) .. [[.lua]]) end end)
5+
6+
-- Load cfg first so that the loader knows it is running inside LuaRocks
7+
local cfg = require("luarocks.core.cfg")
8+
9+
local loader = require("luarocks.loader")
10+
local cmd = require("luarocks.cmd")
11+
12+
local description = "LuaRocks main command-line interface"
13+
14+
local commands = {
15+
init = "luarocks.cmd.init",
16+
pack = "luarocks.cmd.pack",
17+
unpack = "luarocks.cmd.unpack",
18+
build = "luarocks.cmd.build",
19+
install = "luarocks.cmd.install",
20+
search = "luarocks.cmd.search",
21+
list = "luarocks.cmd.list",
22+
remove = "luarocks.cmd.remove",
23+
make = "luarocks.cmd.make",
24+
download = "luarocks.cmd.download",
25+
path = "luarocks.cmd.path",
26+
show = "luarocks.cmd.show",
27+
new_version = "luarocks.cmd.new_version",
28+
lint = "luarocks.cmd.lint",
29+
write_rockspec = "luarocks.cmd.write_rockspec",
30+
purge = "luarocks.cmd.purge",
31+
doc = "luarocks.cmd.doc",
32+
upload = "luarocks.cmd.upload",
33+
config = "luarocks.cmd.config",
34+
which = "luarocks.cmd.which",
35+
test = "luarocks.cmd.test",
36+
}
37+
38+
cmd.run_command(description, commands, "luarocks.cmd.external", ...)

scripts/upgrade-tests/test-upgrade-path.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ function prepare_container() {
7575
docker exec $1 apt-get install -y build-essential curl m4 unzip git
7676
docker exec $1 bash -c "ln -sf /usr/local/kong/include/* /usr/include"
7777
docker exec $1 bash -c "ln -sf /usr/local/kong/lib/* /usr/lib"
78+
# the following two lines will not be needed on 3.11+
79+
docker exec -u 0 $1 apt-get install -y lua5.1
80+
docker cp scripts/upgrade-tests/luarocks-system-lua $1:/usr/local/bin/luarocks
7881
}
7982

8083
function build_containers() {

0 commit comments

Comments
 (0)