aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2025-05-17 17:47:29 -0300
committerGitHub <noreply@github.com>2025-05-17 17:47:29 -0300
commitb1717345d3e814829f6591751994bfedcdf876b9 (patch)
treeb94b82fcd91f96768d4b9e6ef64e1f9d909a5263
parent78746331c90881bed0dfb1280ecd43ef63af6063 (diff)
downloadluarocks-b1717345d3e814829f6591751994bfedcdf876b9.tar.gz
luarocks-b1717345d3e814829f6591751994bfedcdf876b9.tar.bz2
luarocks-b1717345d3e814829f6591751994bfedcdf876b9.zip
updates for latest Teal (#1796)
-rw-r--r--src/luarocks/cmd/upload.lua5
-rw-r--r--src/luarocks/cmd/upload.tl3
-rw-r--r--src/luarocks/deps.lua10
-rw-r--r--src/luarocks/deps.tl14
-rw-r--r--src/luarocks/tools/patch.lua11
-rw-r--r--src/luarocks/tools/patch.tl13
6 files changed, 28 insertions, 28 deletions
diff --git a/src/luarocks/cmd/upload.lua b/src/luarocks/cmd/upload.lua
index 755dd4e7..e4319bb1 100644
--- a/src/luarocks/cmd/upload.lua
+++ b/src/luarocks/cmd/upload.lua
@@ -1,4 +1,4 @@
1local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local string = _tl_compat and _tl_compat.string or string 1local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local math = _tl_compat and _tl_compat.math or math; local string = _tl_compat and _tl_compat.string or string
2local upload = { Response = { version = {} } } 2local upload = { Response = { version = {} } }
3 3
4 4
@@ -132,7 +132,8 @@ function upload.command(args)
132 return nil, "Invalid response from server." 132 return nil, "Invalid response from server."
133 end 133 end
134 util.printout(("Sending " .. tostring(rock_fname) .. " ...")) 134 util.printout(("Sending " .. tostring(rock_fname) .. " ..."))
135 res, err = api:method("upload_rock/" .. ("%d"):format(res.version.id), nil, { 135 local id = math.tointeger(res.version.id)
136 res, err = api:method("upload_rock/" .. ("%d"):format(id), nil, {
136 rock_file = multipart.new_file(rock_fname), 137 rock_file = multipart.new_file(rock_fname),
137 rock_sig = rock_sigfname and multipart.new_file(rock_sigfname), 138 rock_sig = rock_sigfname and multipart.new_file(rock_sigfname),
138 }) 139 })
diff --git a/src/luarocks/cmd/upload.tl b/src/luarocks/cmd/upload.tl
index 5b6e3314..a12b30c0 100644
--- a/src/luarocks/cmd/upload.tl
+++ b/src/luarocks/cmd/upload.tl
@@ -132,7 +132,8 @@ function upload.command(args: Args): boolean, string, string
132 return nil, "Invalid response from server." 132 return nil, "Invalid response from server."
133 end 133 end
134 util.printout(("Sending " .. tostring(rock_fname) .. " ...")) 134 util.printout(("Sending " .. tostring(rock_fname) .. " ..."))
135 res, err = api:method("upload_rock/" .. ("%d"):format(res.version.id), nil, { 135 local id = math.tointeger(res.version.id)
136 res, err = api:method("upload_rock/" .. ("%d"):format(id), nil, {
136 rock_file = multipart.new_file(rock_fname), 137 rock_file = multipart.new_file(rock_fname),
137 rock_sig = rock_sigfname and multipart.new_file(rock_sigfname), 138 rock_sig = rock_sigfname and multipart.new_file(rock_sigfname),
138 }) as (Response, string) 139 }) as (Response, string)
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index e02d4694..19cf6936 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -1,4 +1,4 @@
1local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local io = _tl_compat and _tl_compat.io or io; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table; local type = type 1local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local io = _tl_compat and _tl_compat.io or io; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local math = _tl_compat and _tl_compat.math or math; local pairs = _tl_compat and _tl_compat.pairs or pairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table; local type = type
2 2
3local deps = {} 3local deps = {}
4 4
@@ -201,7 +201,7 @@ function deps.report_missing_dependencies(name, version, dependencies, deps_mode
201 first_missing_dep = false 201 first_missing_dep = false
202 end 202 end
203 203
204 util.printout((" %s (%s)"):format(tostring(depq), rock_status(depq, get_versions))) 204 util.printout((" %s (%s)"):format(tostring(depq), (rock_status(depq, get_versions))))
205 end 205 end
206 end 206 end
207end 207end
@@ -301,7 +301,7 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock
301 local depq = queries.new(dname, dnamespace, dversion) 301 local depq = queries.new(dname, dnamespace, dversion)
302 302
303 util.printout(("%s %s is pinned to %s (%s)"):format( 303 util.printout(("%s %s is pinned to %s (%s)"):format(
304 name, version, tostring(depq), rock_status(depq, get_versions))) 304 name, version, tostring(depq), (rock_status(depq, get_versions))))
305 305
306 local okfullfill, errfullfill = deps.fulfill_dependency(depq, "none", rocks_provided, verify, depskey) 306 local okfullfill, errfullfill = deps.fulfill_dependency(depq, "none", rocks_provided, verify, depskey)
307 if not okfullfill then 307 if not okfullfill then
@@ -327,7 +327,7 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock
327 for _, depq in ipairs((rockspec)[depskey].queries) do 327 for _, depq in ipairs((rockspec)[depskey].queries) do
328 328
329 util.printout(("%s %s depends on %s (%s)"):format( 329 util.printout(("%s %s depends on %s (%s)"):format(
330 name, version, tostring(depq), rock_status(depq, get_versions))) 330 name, version, tostring(depq), (rock_status(depq, get_versions))))
331 331
332 local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) 332 local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey)
333 if okfulfill then 333 if okfulfill then
@@ -703,7 +703,7 @@ end
703 703
704local function lua_h_exists(d, luaver) 704local function lua_h_exists(d, luaver)
705 local major, minor = luaver:match("(%d+)%.(%d+)") 705 local major, minor = luaver:match("(%d+)%.(%d+)")
706 local luanum = ("%s%02d"):format(major, tonumber(minor)) 706 local luanum = ("%s%02d"):format(major, math.tointeger(minor))
707 707
708 local lua_h = dir.path(d, "lua.h") 708 local lua_h = dir.path(d, "lua.h")
709 local fd = io.open(lua_h) 709 local fd = io.open(lua_h)
diff --git a/src/luarocks/deps.tl b/src/luarocks/deps.tl
index 5ca9c879..f6a6642f 100644
--- a/src/luarocks/deps.tl
+++ b/src/luarocks/deps.tl
@@ -201,7 +201,7 @@ function deps.report_missing_dependencies(name: string, version: string, depende
201 first_missing_dep = false 201 first_missing_dep = false
202 end 202 end
203 203
204 util.printout((" %s (%s)"):format(tostring(depq), rock_status(depq, get_versions))) 204 util.printout((" %s (%s)"):format(tostring(depq), (rock_status(depq, get_versions))))
205 end 205 end
206 end 206 end
207end 207end
@@ -301,7 +301,7 @@ function deps.fulfill_dependencies(rockspec: Rockspec, depskey: DepsKey, deps_mo
301 local depq = queries.new(dname, dnamespace, dversion) 301 local depq = queries.new(dname, dnamespace, dversion)
302 302
303 util.printout(("%s %s is pinned to %s (%s)"):format( 303 util.printout(("%s %s is pinned to %s (%s)"):format(
304 name, version, tostring(depq), rock_status(depq, get_versions))) 304 name, version, tostring(depq), (rock_status(depq, get_versions))))
305 305
306 local okfullfill, errfullfill = deps.fulfill_dependency(depq, "none", rocks_provided, verify, depskey) 306 local okfullfill, errfullfill = deps.fulfill_dependency(depq, "none", rocks_provided, verify, depskey)
307 if not okfullfill then 307 if not okfullfill then
@@ -327,7 +327,7 @@ function deps.fulfill_dependencies(rockspec: Rockspec, depskey: DepsKey, deps_mo
327 for _, depq in ipairs((rockspec as {string: Dependencies})[depskey].queries) do 327 for _, depq in ipairs((rockspec as {string: Dependencies})[depskey].queries) do
328 328
329 util.printout(("%s %s depends on %s (%s)"):format( 329 util.printout(("%s %s depends on %s (%s)"):format(
330 name, version, tostring(depq), rock_status(depq, get_versions))) 330 name, version, tostring(depq), (rock_status(depq, get_versions))))
331 331
332 local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) 332 local okfulfill, found_or_err, _ = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey)
333 if okfulfill then 333 if okfulfill then
@@ -703,7 +703,7 @@ end
703 703
704local function lua_h_exists(d: string, luaver: string): boolean, string, string, integer 704local function lua_h_exists(d: string, luaver: string): boolean, string, string, integer
705 local major, minor = luaver:match("(%d+)%.(%d+)") 705 local major, minor = luaver:match("(%d+)%.(%d+)")
706 local luanum = ("%s%02d"):format(major, tonumber(minor)) 706 local luanum = ("%s%02d"):format(major, math.tointeger(minor))
707 707
708 local lua_h = dir.path(d, "lua.h") 708 local lua_h = dir.path(d, "lua.h")
709 local fd = io.open(lua_h) 709 local fd = io.open(lua_h)
@@ -749,7 +749,7 @@ local function find_lua_incdir(prefix: string, luaver: string, luajitver: string
749end 749end
750 750
751function deps.check_lua_incdir(vars: {string: string}): boolean, string, string 751function deps.check_lua_incdir(vars: {string: string}): boolean, string, string
752 if vars.LUA_INCDIR_OK == "ok" 752 if vars.LUA_INCDIR_OK == "ok"
753 then return true 753 then return true
754 end 754 end
755 755
@@ -777,7 +777,7 @@ function deps.check_lua_incdir(vars: {string: string}): boolean, string, string
777end 777end
778 778
779function deps.check_lua_libdir(vars: {string: string}): boolean, string, string, {string : {string}} 779function deps.check_lua_libdir(vars: {string: string}): boolean, string, string, {string : {string}}
780 if vars.LUA_LIBDIR_OK == "ok" 780 if vars.LUA_LIBDIR_OK == "ok"
781 then return true 781 then return true
782 end 782 end
783 783
@@ -814,7 +814,7 @@ function deps.check_lua_libdir(vars: {string: string}): boolean, string, string,
814 -- if filename isn't versioned, check file contents 814 -- if filename isn't versioned, check file contents
815 local txt = fd:read("*a") 815 local txt = fd:read("*a")
816 ok = txt:find("Lua " .. cfg.lua_version, 1, true) 816 ok = txt:find("Lua " .. cfg.lua_version, 1, true)
817 or txt:find("lua" .. (cfg.lua_version:gsub("%.", "")), 1, true) 817 or txt:find("lua" .. (cfg.lua_version:gsub("%.", "")), 1, true)
818 and true 818 and true
819 if not ok then 819 if not ok then
820 err = "Lua library at " .. filename .. " does not match Lua version " .. cfg.lua_version .. ". You can use `luarocks config variables.LUA_LIBDIR <path>` to set the correct location." 820 err = "Lua library at " .. filename .. " does not match Lua version " .. cfg.lua_version .. ". You can use `luarocks config variables.LUA_LIBDIR <path>` to set the correct location."
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua
index 8dc188a6..d1575cb0 100644
--- a/src/luarocks/tools/patch.lua
+++ b/src/luarocks/tools/patch.lua
@@ -129,14 +129,13 @@ local function file_lines(f)
129 end 129 end
130 end 130 end
131 end 131 end
132 local posi = math.tointeger(pos) 132 if not pos then
133 if not posi then 133 pos = #buffer
134 posi = #buffer
135 elseif chars == '\r\n' then 134 elseif chars == '\r\n' then
136 posi = posi + 1 135 pos = pos + 1
137 end 136 end
138 local line = buffer:sub(pos_beg, posi) 137 local line = buffer:sub(pos_beg, pos)
139 pos_beg = posi + 1 138 pos_beg = pos + 1
140 if #line > 0 then 139 if #line > 0 then
141 return line 140 return line
142 end 141 end
diff --git a/src/luarocks/tools/patch.tl b/src/luarocks/tools/patch.tl
index 83c16ab7..553964e3 100644
--- a/src/luarocks/tools/patch.tl
+++ b/src/luarocks/tools/patch.tl
@@ -114,7 +114,7 @@ local function file_lines(f: FILE): function(): string
114 local buffer = "" 114 local buffer = ""
115 local pos_beg = 1 115 local pos_beg = 1
116 return function(): string 116 return function(): string
117 local pos, chars: string, string 117 local pos, chars: integer, string
118 while 1 do 118 while 1 do
119 pos, chars = buffer:match('()([\r\n].)', pos_beg) 119 pos, chars = buffer:match('()([\r\n].)', pos_beg)
120 if pos or not f then 120 if pos or not f then
@@ -129,14 +129,13 @@ local function file_lines(f: FILE): function(): string
129 end 129 end
130 end 130 end
131 end 131 end
132 local posi = math.tointeger(pos) 132 if not pos then
133 if not posi then 133 pos = #buffer
134 posi = #buffer
135 elseif chars == '\r\n' then 134 elseif chars == '\r\n' then
136 posi = posi + 1 135 pos = pos + 1
137 end 136 end
138 local line = buffer:sub(pos_beg, posi) 137 local line = buffer:sub(pos_beg, pos)
139 pos_beg = posi + 1 138 pos_beg = pos + 1
140 if #line > 0 then 139 if #line > 0 then
141 return line 140 return line
142 end 141 end