aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre Chapuis <git@catwell.info>2025-12-01 22:25:11 +0100
committerPierre Chapuis <git@catwell.info>2025-12-26 11:06:49 +0100
commit291fc8a34fc186b011c9d6b09a80bf179cae6f62 (patch)
tree9cf8b991a245619405e47f675f88ede6455614ce /src
parentddb1c93bf93c9774cb9d854a665d51c369ea5acd (diff)
downloadluarocks-291fc8a34fc186b011c9d6b09a80bf179cae6f62.tar.gz
luarocks-291fc8a34fc186b011c9d6b09a80bf179cae6f62.tar.bz2
luarocks-291fc8a34fc186b011c9d6b09a80bf179cae6f62.zip
support Lua 5.5
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd/write_rockspec.lua10
-rw-r--r--src/luarocks/cmd/write_rockspec.tl12
-rw-r--r--src/luarocks/core/util.lua2
-rw-r--r--src/luarocks/core/util.tl2
-rw-r--r--src/luarocks/deps.lua6
-rw-r--r--src/luarocks/deps.tl6
-rw-r--r--src/luarocks/fs/lua.lua1
-rw-r--r--src/luarocks/tools/patch.lua1
-rw-r--r--src/luarocks/tools/patch.tl1
-rw-r--r--src/luarocks/util.lua6
-rw-r--r--src/luarocks/util.tl6
11 files changed, 42 insertions, 11 deletions
diff --git a/src/luarocks/cmd/write_rockspec.lua b/src/luarocks/cmd/write_rockspec.lua
index b84c2803..5710c982 100644
--- a/src/luarocks/cmd/write_rockspec.lua
+++ b/src/luarocks/cmd/write_rockspec.lua
@@ -28,12 +28,17 @@ local lua_versions = {
28 "5.2", 28 "5.2",
29 "5.3", 29 "5.3",
30 "5.4", 30 "5.4",
31 "5.5",
31 "5.1,5.2", 32 "5.1,5.2",
32 "5.2,5.3", 33 "5.2,5.3",
33 "5.3,5.4", 34 "5.3,5.4",
35 "5.4,5.5",
34 "5.1,5.2,5.3", 36 "5.1,5.2,5.3",
35 "5.2,5.3,5.4", 37 "5.2,5.3,5.4",
38 "5.3,5.4,5.5",
36 "5.1,5.2,5.3,5.4", 39 "5.1,5.2,5.3,5.4",
40 "5.2,5.3,5.4,5.5",
41 "5.1,5.2,5.3,5.4,5.5",
37} 42}
38 43
39function write_rockspec.cmd_options(parser) 44function write_rockspec.cmd_options(parser)
@@ -110,12 +115,17 @@ local lua_version_dep = {
110 ["5.2"] = "lua ~> 5.2", 115 ["5.2"] = "lua ~> 5.2",
111 ["5.3"] = "lua ~> 5.3", 116 ["5.3"] = "lua ~> 5.3",
112 ["5.4"] = "lua ~> 5.4", 117 ["5.4"] = "lua ~> 5.4",
118 ["5.5"] = "lua ~> 5.5",
113 ["5.1,5.2"] = "lua >= 5.1, < 5.3", 119 ["5.1,5.2"] = "lua >= 5.1, < 5.3",
114 ["5.2,5.3"] = "lua >= 5.2, < 5.4", 120 ["5.2,5.3"] = "lua >= 5.2, < 5.4",
115 ["5.3,5.4"] = "lua >= 5.3, < 5.5", 121 ["5.3,5.4"] = "lua >= 5.3, < 5.5",
122 ["5.4,5.5"] = "lua >= 5.4, < 5.6",
116 ["5.1,5.2,5.3"] = "lua >= 5.1, < 5.4", 123 ["5.1,5.2,5.3"] = "lua >= 5.1, < 5.4",
117 ["5.2,5.3,5.4"] = "lua >= 5.2, < 5.5", 124 ["5.2,5.3,5.4"] = "lua >= 5.2, < 5.5",
125 ["5.3,5.4,5.5"] = "lua >= 5.3, < 5.6",
118 ["5.1,5.2,5.3,5.4"] = "lua >= 5.1, < 5.5", 126 ["5.1,5.2,5.3,5.4"] = "lua >= 5.1, < 5.5",
127 ["5.2,5.3,5.4,5.5"] = "lua >= 5.2, < 5.6",
128 ["5.1,5.2,5.3,5.4,5.5"] = "lua >= 5.1, < 5.6",
119} 129}
120 130
121local simple_scm_protocols = { 131local simple_scm_protocols = {
diff --git a/src/luarocks/cmd/write_rockspec.tl b/src/luarocks/cmd/write_rockspec.tl
index 7354a683..2ec4eea9 100644
--- a/src/luarocks/cmd/write_rockspec.tl
+++ b/src/luarocks/cmd/write_rockspec.tl
@@ -28,12 +28,17 @@ local lua_versions = {
28 "5.2", 28 "5.2",
29 "5.3", 29 "5.3",
30 "5.4", 30 "5.4",
31 "5.5",
31 "5.1,5.2", 32 "5.1,5.2",
32 "5.2,5.3", 33 "5.2,5.3",
33 "5.3,5.4", 34 "5.3,5.4",
35 "5.4,5.5",
34 "5.1,5.2,5.3", 36 "5.1,5.2,5.3",
35 "5.2,5.3,5.4", 37 "5.2,5.3,5.4",
36 "5.1,5.2,5.3,5.4" 38 "5.3,5.4,5.5",
39 "5.1,5.2,5.3,5.4",
40 "5.2,5.3,5.4,5.5",
41 "5.1,5.2,5.3,5.4,5.5",
37} 42}
38 43
39function write_rockspec.cmd_options(parser: Parser) 44function write_rockspec.cmd_options(parser: Parser)
@@ -110,12 +115,17 @@ local lua_version_dep = {
110 ["5.2"] = "lua ~> 5.2", 115 ["5.2"] = "lua ~> 5.2",
111 ["5.3"] = "lua ~> 5.3", 116 ["5.3"] = "lua ~> 5.3",
112 ["5.4"] = "lua ~> 5.4", 117 ["5.4"] = "lua ~> 5.4",
118 ["5.5"] = "lua ~> 5.5",
113 ["5.1,5.2"] = "lua >= 5.1, < 5.3", 119 ["5.1,5.2"] = "lua >= 5.1, < 5.3",
114 ["5.2,5.3"] = "lua >= 5.2, < 5.4", 120 ["5.2,5.3"] = "lua >= 5.2, < 5.4",
115 ["5.3,5.4"] = "lua >= 5.3, < 5.5", 121 ["5.3,5.4"] = "lua >= 5.3, < 5.5",
122 ["5.4,5.5"] = "lua >= 5.4, < 5.6",
116 ["5.1,5.2,5.3"] = "lua >= 5.1, < 5.4", 123 ["5.1,5.2,5.3"] = "lua >= 5.1, < 5.4",
117 ["5.2,5.3,5.4"] = "lua >= 5.2, < 5.5", 124 ["5.2,5.3,5.4"] = "lua >= 5.2, < 5.5",
125 ["5.3,5.4,5.5"] = "lua >= 5.3, < 5.6",
118 ["5.1,5.2,5.3,5.4"] = "lua >= 5.1, < 5.5", 126 ["5.1,5.2,5.3,5.4"] = "lua >= 5.1, < 5.5",
127 ["5.2,5.3,5.4,5.5"] = "lua >= 5.2, < 5.6",
128 ["5.1,5.2,5.3,5.4,5.5"] = "lua >= 5.1, < 5.6",
119} 129}
120 130
121local simple_scm_protocols = { 131local simple_scm_protocols = {
diff --git a/src/luarocks/core/util.lua b/src/luarocks/core/util.lua
index a6ff0fcb..40ba213d 100644
--- a/src/luarocks/core/util.lua
+++ b/src/luarocks/core/util.lua
@@ -96,7 +96,7 @@ function util.show_table(t, tname, top_indent)
96 else 96 else
97 cart = cart .. " = {\n" 97 cart = cart .. " = {\n"
98 for k, v in pairs(value) do 98 for k, v in pairs(value) do
99 k = basic_serialize(k) 99 local k = basic_serialize(k)
100 local fname = ("%s[%s]"):format(name, k) 100 local fname = ("%s[%s]"):format(name, k)
101 field = ("[%s]"):format(k) 101 field = ("[%s]"):format(k)
102 102
diff --git a/src/luarocks/core/util.tl b/src/luarocks/core/util.tl
index b1bbea05..1a6fefca 100644
--- a/src/luarocks/core/util.tl
+++ b/src/luarocks/core/util.tl
@@ -96,7 +96,7 @@ function util.show_table(t: {any:any}, tname: string, top_indent: string): strin
96 else 96 else
97 cart = cart .. " = {\n" 97 cart = cart .. " = {\n"
98 for k, v in pairs(value) do 98 for k, v in pairs(value) do
99 k = basic_serialize(k) 99 local k = basic_serialize(k)
100 local fname = ("%s[%s]"):format(name, k) 100 local fname = ("%s[%s]"):format(name, k)
101 field = ("[%s]"):format(k) 101 field = ("[%s]"):format(k)
102 -- three spaces between levels 102 -- three spaces between levels
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 13b531f6..3eded47a 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -713,7 +713,11 @@ local function lua_h_exists(d, luaver)
713 if fd then 713 if fd then
714 local data = fd:read("*a") 714 local data = fd:read("*a")
715 fd:close() 715 fd:close()
716 if data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then 716 if major == "5" and minor == "5" then
717 if data:match("LUA_VERSION_MINOR_N%s5") and data:match("LUA_VERSION_MAJOR_N%s5") then
718 return d ~= nil
719 end
720 elseif data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then
717 return d ~= nil 721 return d ~= nil
718 end 722 end
719 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2 723 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2
diff --git a/src/luarocks/deps.tl b/src/luarocks/deps.tl
index 98fad54d..85980347 100644
--- a/src/luarocks/deps.tl
+++ b/src/luarocks/deps.tl
@@ -713,7 +713,11 @@ local function lua_h_exists(d: string, luaver: string): boolean, string, string,
713 if fd then 713 if fd then
714 local data = fd:read("*a") 714 local data = fd:read("*a")
715 fd:close() 715 fd:close()
716 if data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then 716 if major == "5" and minor == "5" then
717 if data:match("LUA_VERSION_MINOR_N%s5") and data:match("LUA_VERSION_MAJOR_N%s5") then
718 return d ~= nil
719 end
720 elseif data:match("LUA_VERSION_NUM%s*" .. tostring(luanum)) then
717 return d ~= nil 721 return d ~= nil
718 end 722 end
719 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2 723 return nil, "Lua header lua.h found at " .. d .. " does not match Lua version " .. luaver .. ". You can use `luarocks config variables.LUA_INCDIR <path>` to set the correct location.", "dependency", 2
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 0f1ee55e..45324c77 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -213,6 +213,7 @@ function fs_lua.modules(at)
213 local path = package.path:sub(-1, -1) == ";" and package.path or package.path .. ";" 213 local path = package.path:sub(-1, -1) == ";" and package.path or package.path .. ";"
214 local paths = {} 214 local paths = {}
215 for location in path:gmatch("(.-);") do 215 for location in path:gmatch("(.-);") do
216 local location = location
216 if location:lower() == "?.lua" then 217 if location:lower() == "?.lua" then
217 location = "./?.lua" 218 location = "./?.lua"
218 end 219 end
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua
index d1575cb0..5b00e9b1 100644
--- a/src/luarocks/tools/patch.lua
+++ b/src/luarocks/tools/patch.lua
@@ -188,6 +188,7 @@ function patch.read_patch(filename, data)
188 local lineno = 0 188 local lineno = 0
189 189
190 for line in file_lines(fp) do 190 for line in file_lines(fp) do
191 local line = line
191 lineno = lineno + 1 192 lineno = lineno + 1
192 if state == 'header' then 193 if state == 'header' then
193 if startswith(line, "--- ") then 194 if startswith(line, "--- ") then
diff --git a/src/luarocks/tools/patch.tl b/src/luarocks/tools/patch.tl
index 553964e3..2cfd3841 100644
--- a/src/luarocks/tools/patch.tl
+++ b/src/luarocks/tools/patch.tl
@@ -188,6 +188,7 @@ function patch.read_patch(filename: string, data: string): Files, boolean
188 local lineno = 0 188 local lineno = 0
189 189
190 for line in file_lines(fp) do 190 for line in file_lines(fp) do
191 local line = line
191 lineno = lineno + 1 192 lineno = lineno + 1
192 if state == 'header' then 193 if state == 'header' then
193 if startswith(line, "--- ") then 194 if startswith(line, "--- ") then
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index ffa53b09..b35c63ce 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -160,7 +160,7 @@ function util.variable_substitutions(tbl, vars)
160end 160end
161 161
162function util.lua_versions(sort) 162function util.lua_versions(sort)
163 local versions = { "5.1", "5.2", "5.3", "5.4" } 163 local versions = { "5.1", "5.2", "5.3", "5.4", "5.5" }
164 local i = 0 164 local i = 0
165 if sort == "descending" then 165 if sort == "descending" then
166 i = #versions + 1 166 i = #versions + 1
@@ -286,7 +286,7 @@ local function collect_rockspecs(versions, paths, unnamed_paths, subdir)
286 local vers = require("luarocks.core.vers") 286 local vers = require("luarocks.core.vers")
287 if fs.is_dir(subdir) then 287 if fs.is_dir(subdir) then
288 for file in fs.dir(subdir) do 288 for file in fs.dir(subdir) do
289 file = dir.path(subdir, file) 289 local file = dir.path(subdir, file)
290 290
291 if file:match("rockspec$") and fs.is_file(file) then 291 if file:match("rockspec$") and fs.is_file(file) then
292 local rock, version = path.parse_name(file) 292 local rock, version = path.parse_name(file)
@@ -550,7 +550,7 @@ function util.get_rocks_provided(rockspec)
550 rocks_provided["bit32"] = lv .. "-1" 550 rocks_provided["bit32"] = lv .. "-1"
551 end 551 end
552 552
553 if lv == "5.3" or lv == "5.4" then 553 if lv == "5.3" or lv == "5.4" or lv == "5.5" then
554 rocks_provided["utf8"] = lv .. "-1" 554 rocks_provided["utf8"] = lv .. "-1"
555 end 555 end
556 556
diff --git a/src/luarocks/util.tl b/src/luarocks/util.tl
index b68883e5..f2fb5a5a 100644
--- a/src/luarocks/util.tl
+++ b/src/luarocks/util.tl
@@ -160,7 +160,7 @@ function util.variable_substitutions<K>(tbl: {K: string}, vars: {string: string}
160end 160end
161 161
162function util.lua_versions(sort?: string): function(): string 162function util.lua_versions(sort?: string): function(): string
163 local versions = { "5.1", "5.2", "5.3", "5.4" } 163 local versions = { "5.1", "5.2", "5.3", "5.4", "5.5" }
164 local i = 0 164 local i = 0
165 if sort == "descending" then 165 if sort == "descending" then
166 i = #versions + 1 166 i = #versions + 1
@@ -286,7 +286,7 @@ local function collect_rockspecs(versions: {string: string}, paths: {string: str
286 local vers = require("luarocks.core.vers") 286 local vers = require("luarocks.core.vers")
287 if fs.is_dir(subdir) then 287 if fs.is_dir(subdir) then
288 for file in fs.dir(subdir) do 288 for file in fs.dir(subdir) do
289 file = dir.path(subdir, file) 289 local file = dir.path(subdir, file)
290 290
291 if file:match("rockspec$") and fs.is_file(file) then 291 if file:match("rockspec$") and fs.is_file(file) then
292 local rock, version = path.parse_name(file) 292 local rock, version = path.parse_name(file)
@@ -550,7 +550,7 @@ function util.get_rocks_provided(rockspec?: Rockspec): {string: string}
550 rocks_provided["bit32"] = lv.."-1" 550 rocks_provided["bit32"] = lv.."-1"
551 end 551 end
552 552
553 if lv == "5.3" or lv == "5.4" then 553 if lv == "5.3" or lv == "5.4" or lv == "5.5" then
554 rocks_provided["utf8"] = lv.."-1" 554 rocks_provided["utf8"] = lv.."-1"
555 end 555 end
556 556