diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/build/cmake.lua | 5 | ||||
-rw-r--r-- | src/luarocks/build/cmake.tl | 5 | ||||
-rw-r--r-- | src/luarocks/cmd/upload.lua | 5 | ||||
-rw-r--r-- | src/luarocks/cmd/upload.tl | 3 | ||||
-rw-r--r-- | src/luarocks/core/cfg.lua | 13 | ||||
-rw-r--r-- | src/luarocks/deps.lua | 19 | ||||
-rw-r--r-- | src/luarocks/deps.tl | 23 | ||||
-rw-r--r-- | src/luarocks/fs/unix.lua | 5 | ||||
-rw-r--r-- | src/luarocks/rockspecs.lua | 3 | ||||
-rw-r--r-- | src/luarocks/rockspecs.tl | 3 | ||||
-rw-r--r-- | src/luarocks/tools/patch.lua | 11 | ||||
-rw-r--r-- | src/luarocks/tools/patch.tl | 13 | ||||
-rw-r--r-- | src/luarocks/type/rockspec.lua | 5 | ||||
-rw-r--r-- | src/luarocks/type/rockspec.tl | 7 |
14 files changed, 70 insertions, 50 deletions
diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua index ea132a3e..b9954cf4 100644 --- a/src/luarocks/build/cmake.lua +++ b/src/luarocks/build/cmake.lua | |||
@@ -27,11 +27,6 @@ function cmake.run(rockspec, no_install) | |||
27 | local build = rockspec.build | 27 | local build = rockspec.build |
28 | local variables = build.variables or {} | 28 | local variables = build.variables or {} |
29 | 29 | ||
30 | |||
31 | variables.CMAKE_MODULE_PATH = os.getenv("CMAKE_MODULE_PATH") | ||
32 | variables.CMAKE_LIBRARY_PATH = os.getenv("CMAKE_LIBRARY_PATH") | ||
33 | variables.CMAKE_INCLUDE_PATH = os.getenv("CMAKE_INCLUDE_PATH") | ||
34 | |||
35 | util.variable_substitutions(variables, rockspec.variables) | 30 | util.variable_substitutions(variables, rockspec.variables) |
36 | 31 | ||
37 | local ok, err_msg = fs.is_tool_available(rockspec.variables.CMAKE, "CMake") | 32 | local ok, err_msg = fs.is_tool_available(rockspec.variables.CMAKE, "CMake") |
diff --git a/src/luarocks/build/cmake.tl b/src/luarocks/build/cmake.tl index 9a512d1e..35e64bd6 100644 --- a/src/luarocks/build/cmake.tl +++ b/src/luarocks/build/cmake.tl | |||
@@ -27,11 +27,6 @@ function cmake.run(rockspec: Rockspec, no_install: boolean): boolean, string, st | |||
27 | local build = rockspec.build as cmake.CMakeBuild | 27 | local build = rockspec.build as cmake.CMakeBuild |
28 | local variables = build.variables or {} | 28 | local variables = build.variables or {} |
29 | 29 | ||
30 | -- Pass Env variables | ||
31 | variables.CMAKE_MODULE_PATH=os.getenv("CMAKE_MODULE_PATH") | ||
32 | variables.CMAKE_LIBRARY_PATH=os.getenv("CMAKE_LIBRARY_PATH") | ||
33 | variables.CMAKE_INCLUDE_PATH=os.getenv("CMAKE_INCLUDE_PATH") | ||
34 | |||
35 | util.variable_substitutions(variables, rockspec.variables) | 30 | util.variable_substitutions(variables, rockspec.variables) |
36 | 31 | ||
37 | local ok, err_msg = fs.is_tool_available(rockspec.variables.CMAKE, "CMake") | 32 | local ok, err_msg = fs.is_tool_available(rockspec.variables.CMAKE, "CMake") |
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 @@ | |||
1 | local _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 | 1 | local _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 |
2 | local upload = { Response = { version = {} } } | 2 | local 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/core/cfg.lua b/src/luarocks/core/cfg.lua index 8c2d7d79..1be65c27 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
@@ -413,13 +413,24 @@ local function make_defaults(lua_version, target_cpu, platforms, home) | |||
413 | end | 413 | end |
414 | 414 | ||
415 | if platforms.cygwin then | 415 | if platforms.cygwin then |
416 | defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds | 416 | defaults.lib_extension = "dll" |
417 | defaults.arch = "cygwin-"..target_cpu | 417 | defaults.arch = "cygwin-"..target_cpu |
418 | defaults.cmake_generator = "Unix Makefiles" | 418 | defaults.cmake_generator = "Unix Makefiles" |
419 | defaults.variables.CC = "echo -llua | xargs " .. (os.getenv("CC") or "gcc") | 419 | defaults.variables.CC = "echo -llua | xargs " .. (os.getenv("CC") or "gcc") |
420 | defaults.variables.LD = "echo -llua | xargs " .. (os.getenv("CC") or "gcc") | 420 | defaults.variables.LD = "echo -llua | xargs " .. (os.getenv("CC") or "gcc") |
421 | defaults.variables.LIBFLAG = "-shared" | 421 | defaults.variables.LIBFLAG = "-shared" |
422 | defaults.link_lua_explicitly = true | 422 | defaults.link_lua_explicitly = true |
423 | defaults.external_deps_patterns = { | ||
424 | bin = { "?.exe", "?.bat", "?" }, | ||
425 | lib = { "cyg?.dll", "lib?.so", "lib?.so.*", "lib?.dll.a", "?.dll.a", | ||
426 | "lib?.a", "lib?.dll", "?.dll" }, | ||
427 | include = { "?.h" } | ||
428 | } | ||
429 | defaults.runtime_external_deps_patterns = { | ||
430 | bin = { "?.exe", "?.bat" }, | ||
431 | lib = { "cyg?.dll", "lib?.so", "?.dll", "lib?.dll" }, | ||
432 | include = { "?.h" } | ||
433 | } | ||
423 | end | 434 | end |
424 | 435 | ||
425 | if platforms.msys then | 436 | if platforms.msys then |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index e02d4694..5802601e 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -1,4 +1,4 @@ | |||
1 | local _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 | 1 | local _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 | ||
3 | local deps = {} | 3 | local 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 |
207 | end | 207 | end |
@@ -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,11 +327,14 @@ 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, version_or_err, tree = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) |
333 | if okfulfill then | 333 | if okfulfill then |
334 | deplocks.add(depskey, depq.name, found_or_err) | 334 | deplocks.add(depskey, depq.name, version_or_err) |
335 | if tree and rockspec:format_is_at_least("3.1") then | ||
336 | rockspec.variables[depq.name:upper() .. "_ROCKDIR"] = path.install_dir(depq.name, version_or_err, tree) | ||
337 | end | ||
335 | else | 338 | else |
336 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then | 339 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then |
337 | util.printerr("This version of " .. name .. " is designed for use with") | 340 | util.printerr("This version of " .. name .. " is designed for use with") |
@@ -341,7 +344,7 @@ function deps.fulfill_dependencies(rockspec, depskey, deps_mode, verify, deplock | |||
341 | util.printerr("or look for a suitable version of " .. name .. " with") | 344 | util.printerr("or look for a suitable version of " .. name .. " with") |
342 | util.printerr(" luarocks search " .. name) | 345 | util.printerr(" luarocks search " .. name) |
343 | end | 346 | end |
344 | return nil, found_or_err | 347 | return nil, version_or_err |
345 | end | 348 | end |
346 | end | 349 | end |
347 | 350 | ||
@@ -703,7 +706,7 @@ end | |||
703 | 706 | ||
704 | local function lua_h_exists(d, luaver) | 707 | local function lua_h_exists(d, luaver) |
705 | local major, minor = luaver:match("(%d+)%.(%d+)") | 708 | local major, minor = luaver:match("(%d+)%.(%d+)") |
706 | local luanum = ("%s%02d"):format(major, tonumber(minor)) | 709 | local luanum = ("%s%02d"):format(major, math.tointeger(minor)) |
707 | 710 | ||
708 | local lua_h = dir.path(d, "lua.h") | 711 | local lua_h = dir.path(d, "lua.h") |
709 | local fd = io.open(lua_h) | 712 | local fd = io.open(lua_h) |
diff --git a/src/luarocks/deps.tl b/src/luarocks/deps.tl index 5ca9c879..d127288e 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 |
207 | end | 207 | end |
@@ -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,11 +327,14 @@ 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, version_or_err, tree = deps.fulfill_dependency(depq, deps_mode, rocks_provided, verify, depskey) |
333 | if okfulfill then | 333 | if okfulfill then |
334 | deplocks.add(depskey, depq.name, found_or_err) | 334 | deplocks.add(depskey, depq.name, version_or_err) |
335 | if tree and rockspec:format_is_at_least("3.1") then | ||
336 | rockspec.variables[depq.name:upper() .. "_ROCKDIR"] = path.install_dir(depq.name, version_or_err, tree) | ||
337 | end | ||
335 | else | 338 | else |
336 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then | 339 | if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then |
337 | util.printerr("This version of "..name.." is designed for use with") | 340 | util.printerr("This version of "..name.." is designed for use with") |
@@ -341,7 +344,7 @@ function deps.fulfill_dependencies(rockspec: Rockspec, depskey: DepsKey, deps_mo | |||
341 | util.printerr("or look for a suitable version of "..name.." with") | 344 | util.printerr("or look for a suitable version of "..name.." with") |
342 | util.printerr(" luarocks search "..name) | 345 | util.printerr(" luarocks search "..name) |
343 | end | 346 | end |
344 | return nil, found_or_err | 347 | return nil, version_or_err |
345 | end | 348 | end |
346 | end | 349 | end |
347 | 350 | ||
@@ -703,7 +706,7 @@ end | |||
703 | 706 | ||
704 | local function lua_h_exists(d: string, luaver: string): boolean, string, string, integer | 707 | local function lua_h_exists(d: string, luaver: string): boolean, string, string, integer |
705 | local major, minor = luaver:match("(%d+)%.(%d+)") | 708 | local major, minor = luaver:match("(%d+)%.(%d+)") |
706 | local luanum = ("%s%02d"):format(major, tonumber(minor)) | 709 | local luanum = ("%s%02d"):format(major, math.tointeger(minor)) |
707 | 710 | ||
708 | local lua_h = dir.path(d, "lua.h") | 711 | local lua_h = dir.path(d, "lua.h") |
709 | local fd = io.open(lua_h) | 712 | local fd = io.open(lua_h) |
@@ -749,7 +752,7 @@ local function find_lua_incdir(prefix: string, luaver: string, luajitver: string | |||
749 | end | 752 | end |
750 | 753 | ||
751 | function deps.check_lua_incdir(vars: {string: string}): boolean, string, string | 754 | function deps.check_lua_incdir(vars: {string: string}): boolean, string, string |
752 | if vars.LUA_INCDIR_OK == "ok" | 755 | if vars.LUA_INCDIR_OK == "ok" |
753 | then return true | 756 | then return true |
754 | end | 757 | end |
755 | 758 | ||
@@ -777,7 +780,7 @@ function deps.check_lua_incdir(vars: {string: string}): boolean, string, string | |||
777 | end | 780 | end |
778 | 781 | ||
779 | function deps.check_lua_libdir(vars: {string: string}): boolean, string, string, {string : {string}} | 782 | function deps.check_lua_libdir(vars: {string: string}): boolean, string, string, {string : {string}} |
780 | if vars.LUA_LIBDIR_OK == "ok" | 783 | if vars.LUA_LIBDIR_OK == "ok" |
781 | then return true | 784 | then return true |
782 | end | 785 | end |
783 | 786 | ||
@@ -814,7 +817,7 @@ function deps.check_lua_libdir(vars: {string: string}): boolean, string, string, | |||
814 | -- if filename isn't versioned, check file contents | 817 | -- if filename isn't versioned, check file contents |
815 | local txt = fd:read("*a") | 818 | local txt = fd:read("*a") |
816 | ok = txt:find("Lua " .. cfg.lua_version, 1, true) | 819 | ok = txt:find("Lua " .. cfg.lua_version, 1, true) |
817 | or txt:find("lua" .. (cfg.lua_version:gsub("%.", "")), 1, true) | 820 | or txt:find("lua" .. (cfg.lua_version:gsub("%.", "")), 1, true) |
818 | and true | 821 | and true |
819 | if not ok then | 822 | 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." | 823 | 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/fs/unix.lua b/src/luarocks/fs/unix.lua index 41a9ba8b..2c99ff0d 100644 --- a/src/luarocks/fs/unix.lua +++ b/src/luarocks/fs/unix.lua | |||
@@ -145,13 +145,14 @@ function unix.is_actual_binary(filename) | |||
145 | if not file then | 145 | if not file then |
146 | return true | 146 | return true |
147 | end | 147 | end |
148 | local first = file:read(2) | 148 | local first = file:read() |
149 | file:close() | 149 | file:close() |
150 | if not first then | 150 | if not first then |
151 | util.warning("could not read "..filename) | 151 | util.warning("could not read "..filename) |
152 | return true | 152 | return true |
153 | end | 153 | end |
154 | return first ~= "#!" | 154 | -- only create wrapper for lua scripts with `#!/usr/bin/env lua` or `#!/usr/bin/lua` |
155 | return first:match('^#!.*[ /]lua.*') == first | ||
155 | end | 156 | end |
156 | 157 | ||
157 | function unix.copy_binary(filename, dest) | 158 | function unix.copy_binary(filename, dest) |
diff --git a/src/luarocks/rockspecs.lua b/src/luarocks/rockspecs.lua index 6a9a376c..8a1a528e 100644 --- a/src/luarocks/rockspecs.lua +++ b/src/luarocks/rockspecs.lua | |||
@@ -83,6 +83,9 @@ local function configure_paths(rockspec) | |||
83 | vars.CONFDIR = path.conf_dir(name, version) | 83 | vars.CONFDIR = path.conf_dir(name, version) |
84 | vars.BINDIR = path.bin_dir(name, version) | 84 | vars.BINDIR = path.bin_dir(name, version) |
85 | vars.DOCDIR = path.doc_dir(name, version) | 85 | vars.DOCDIR = path.doc_dir(name, version) |
86 | if rockspec:format_is_at_least("3.1") then | ||
87 | vars.LUA_VERSION = cfg.lua_version | ||
88 | end | ||
86 | rockspec.variables = vars | 89 | rockspec.variables = vars |
87 | end | 90 | end |
88 | 91 | ||
diff --git a/src/luarocks/rockspecs.tl b/src/luarocks/rockspecs.tl index a34c0dbf..9f12649c 100644 --- a/src/luarocks/rockspecs.tl +++ b/src/luarocks/rockspecs.tl | |||
@@ -83,6 +83,9 @@ local function configure_paths(rockspec: Rockspec) | |||
83 | vars.CONFDIR = path.conf_dir(name, version) | 83 | vars.CONFDIR = path.conf_dir(name, version) |
84 | vars.BINDIR = path.bin_dir(name, version) | 84 | vars.BINDIR = path.bin_dir(name, version) |
85 | vars.DOCDIR = path.doc_dir(name, version) | 85 | vars.DOCDIR = path.doc_dir(name, version) |
86 | if rockspec:format_is_at_least("3.1") then | ||
87 | vars.LUA_VERSION = cfg.lua_version | ||
88 | end | ||
86 | rockspec.variables = vars | 89 | rockspec.variables = vars |
87 | end | 90 | end |
88 | 91 | ||
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 |
diff --git a/src/luarocks/type/rockspec.lua b/src/luarocks/type/rockspec.lua index cd4044f6..10b06690 100644 --- a/src/luarocks/type/rockspec.lua +++ b/src/luarocks/type/rockspec.lua | |||
@@ -11,7 +11,7 @@ local type_check = require("luarocks.type_check") | |||
11 | 11 | ||
12 | 12 | ||
13 | 13 | ||
14 | type_rockspec.rockspec_format = "3.0" | 14 | type_rockspec.rockspec_format = "3.1" |
15 | 15 | ||
16 | 16 | ||
17 | 17 | ||
@@ -174,6 +174,9 @@ local rockspec_formats, versions = type_check.declare_schemas({ | |||
174 | }, | 174 | }, |
175 | }, | 175 | }, |
176 | }, | 176 | }, |
177 | |||
178 | ["3.1"] = {}, | ||
179 | |||
177 | }) | 180 | }) |
178 | 181 | ||
179 | 182 | ||
diff --git a/src/luarocks/type/rockspec.tl b/src/luarocks/type/rockspec.tl index 599c13ce..52ad7909 100644 --- a/src/luarocks/type/rockspec.tl +++ b/src/luarocks/type/rockspec.tl | |||
@@ -11,7 +11,7 @@ local type_check = require("luarocks.type_check") | |||
11 | 11 | ||
12 | -- local type TableSchema = type_check.TableSchema | 12 | -- local type TableSchema = type_check.TableSchema |
13 | 13 | ||
14 | type_rockspec.rockspec_format = "3.0" | 14 | type_rockspec.rockspec_format = "3.1" |
15 | 15 | ||
16 | -- Syntax for type-checking tables: | 16 | -- Syntax for type-checking tables: |
17 | -- | 17 | -- |
@@ -173,7 +173,10 @@ local rockspec_formats, versions = type_check.declare_schemas({ | |||
173 | _more = true, | 173 | _more = true, |
174 | }, | 174 | }, |
175 | } | 175 | } |
176 | } | 176 | }, |
177 | |||
178 | ["3.1"] = {}, | ||
179 | |||
177 | }) | 180 | }) |
178 | 181 | ||
179 | -- type_rockspec.order = {"rockspec_format", "package", "version", | 182 | -- type_rockspec.order = {"rockspec_format", "package", "version", |