aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2025-06-17 19:02:44 -0300
committerHisham Muhammad <hisham@gobolinux.org>2025-06-17 19:02:44 -0300
commit2cdf35e769dd904759d50a6589474d6a52605916 (patch)
treed0d6ef766c35b6cbcdb75731e8f90c54f92dc2ba
parent63d46313ff9386322f2382a879d1db01b0a3ac52 (diff)
downloadluarocks-2cdf35e769dd904759d50a6589474d6a52605916.tar.gz
luarocks-2cdf35e769dd904759d50a6589474d6a52605916.tar.bz2
luarocks-2cdf35e769dd904759d50a6589474d6a52605916.zip
rockspec: re-add deprecated function type().
Removing this broke the behavior of some luarocks.build plugins. LuaRocks does not have a stable public API, but since this function was returned as part of the function signature, we'll revert this as a deprecated function, to be removed in LuaRocks 4.0. Closes #1800.
-rw-r--r--src/luarocks/rockspecs.lua16
-rw-r--r--src/luarocks/rockspecs.tl16
2 files changed, 30 insertions, 2 deletions
diff --git a/src/luarocks/rockspecs.lua b/src/luarocks/rockspecs.lua
index 8a1a528e..7f137b87 100644
--- a/src/luarocks/rockspecs.lua
+++ b/src/luarocks/rockspecs.lua
@@ -24,6 +24,19 @@ local vendored_build_type_set = {
24 ["none"] = true, 24 ["none"] = true,
25} 25}
26 26
27local rockspec_mt_funcs = {}
28
29local rockspec_mt = {}
30rockspec_mt.__index = rockspec_mt_funcs
31
32function rockspec_mt_funcs.type()
33 util.warning("The function rockspec.type() is no longer " ..
34 "necessary and is now deprecated. Please update your " ..
35 "plugin to remove calls to this function.")
36
37 return "rockspec"
38end
39
27 40
28 41
29 42
@@ -181,7 +194,8 @@ function rockspecs.from_persisted_table(filename, rockspec, globals, quick)
181 configure_paths(rockspec) 194 configure_paths(rockspec)
182 end 195 end
183 196
184 return rockspec 197
198 return setmetatable(rockspec, rockspec_mt)
185end 199end
186 200
187return rockspecs 201return rockspecs
diff --git a/src/luarocks/rockspecs.tl b/src/luarocks/rockspecs.tl
index 9f12649c..7f31f786 100644
--- a/src/luarocks/rockspecs.tl
+++ b/src/luarocks/rockspecs.tl
@@ -24,6 +24,19 @@ local vendored_build_type_set: {string: boolean} = {
24 ["none"] = true, 24 ["none"] = true,
25} 25}
26 26
27local rockspec_mt_funcs = {}
28
29local rockspec_mt: metatable<Rockspec> = {}
30rockspec_mt.__index = rockspec_mt_funcs
31
32function rockspec_mt_funcs.type(): string
33 util.warning("The function rockspec.type() is no longer " ..
34 "necessary and is now deprecated. Please update your " ..
35 "plugin to remove calls to this function.")
36
37 return "rockspec"
38end
39
27--- Perform platform-specific overrides on a table. 40--- Perform platform-specific overrides on a table.
28-- Overrides values of table with the contents of the appropriate 41-- Overrides values of table with the contents of the appropriate
29-- subset of its "platforms" field. The "platforms" field should 42-- subset of its "platforms" field. The "platforms" field should
@@ -181,7 +194,8 @@ function rockspecs.from_persisted_table(filename: string, rockspec: Rockspec, gl
181 configure_paths(rockspec) 194 configure_paths(rockspec)
182 end 195 end
183 196
184 return rockspec 197 -- TODO remove this on LuaRocks 4.0
198 return setmetatable(rockspec, rockspec_mt)
185end 199end
186 200
187return rockspecs 201return rockspecs