Compare commits
2 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
4381bcc53d
|
|||
|
9965f470eb
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -4,3 +4,7 @@
|
|||||||
_build.*
|
_build.*
|
||||||
.pbuild
|
.pbuild
|
||||||
lua*-cosmo-*-build/
|
lua*-cosmo-*-build/
|
||||||
|
*.obscpio
|
||||||
|
*.osc
|
||||||
|
_build.*
|
||||||
|
.pbuild
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
<package>luajit</package>
|
<package>luajit</package>
|
||||||
<package>lua53</package>
|
<package>lua53</package>
|
||||||
<package>lua54</package>
|
<package>lua54</package>
|
||||||
|
<package>lua55</package>
|
||||||
</multibuild>
|
</multibuild>
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
diff -rub cosmo-16.06.04/tests/test_cosmo.lua cosmo-patched/tests/test_cosmo.lua
|
|
||||||
--- cosmo-16.06.04/tests/test_cosmo.lua 2016-06-04 12:59:21.000000000 -0600
|
|
||||||
+++ cosmo-patched/tests/test_cosmo.lua 2022-09-11 08:25:40.964576115 -0600
|
|
||||||
@@ -1,3 +1,4 @@
|
|
||||||
+package.path = "../src/?.lua;" .. package.path
|
|
||||||
local cosmo = require"cosmo"
|
|
||||||
local grammar = require"cosmo.grammar"
|
|
||||||
|
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jan 29 19:18:41 UTC 2026 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Enable building with Lua 5.5.
|
||||||
|
- Remove fix_test.patch, which incorrectly workaround unset
|
||||||
|
LUA_PATH variable.
|
||||||
|
- Add lua55-build.patch to fix compatibility problems with Lua
|
||||||
|
5.5.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Oct 24 14:47:39 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
Fri Oct 24 14:47:39 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ Version: 16.06.04
|
|||||||
Release: 0
|
Release: 0
|
||||||
Summary: A “safe templates” engine for Lua
|
Summary: A “safe templates” engine for Lua
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Other
|
|
||||||
URL: https://github.com/mascarenhas/cosmo
|
URL: https://github.com/mascarenhas/cosmo
|
||||||
Source: cosmo-%{version}.tar.zst
|
Source: cosmo-%{version}.tar.zst
|
||||||
Patch0: fix_test.patch
|
Patch0: lua55-build.patch
|
||||||
BuildRequires: %{flavor}-devel
|
BuildRequires: %{flavor}-devel
|
||||||
BuildRequires: %{flavor}-lpeg
|
BuildRequires: %{flavor}-lpeg
|
||||||
BuildRequires: %{flavor}-luarocks
|
BuildRequires: %{flavor}-luarocks
|
||||||
@@ -59,6 +58,7 @@ sed -i -e '/lpeg >=/d' "rockspec/%{mod_name}-%{rock_version}.rockspec"
|
|||||||
%{luarocks_install} %{mod_name}-%{rock_version}.*.rock
|
%{luarocks_install} %{mod_name}-%{rock_version}.*.rock
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
export LUA_PATH="%{buildroot}%{lua_noarchdir}/?.lua;%{buildroot}%{lua_noarchdir}/?/init.lua;;"
|
||||||
cd tests
|
cd tests
|
||||||
lua test_cosmo.lua
|
lua test_cosmo.lua
|
||||||
|
|
||||||
|
|||||||
106
lua55-build.patch
Normal file
106
lua55-build.patch
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
---
|
||||||
|
src/cosmo.lua | 13 ++++++++-----
|
||||||
|
src/cosmo/fill.lua | 22 +++++++++++++---------
|
||||||
|
2 files changed, 21 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
Index: cosmo-16.06.04/src/cosmo.lua
|
||||||
|
===================================================================
|
||||||
|
--- cosmo-16.06.04.orig/src/cosmo.lua 2016-06-04 20:59:21.000000000 +0200
|
||||||
|
+++ cosmo-16.06.04/src/cosmo.lua 2026-01-29 20:34:37.397380423 +0100
|
||||||
|
@@ -63,10 +63,11 @@
|
||||||
|
end
|
||||||
|
$if_args[===[
|
||||||
|
check_selector(selector_name, selector)
|
||||||
|
- for e, literal in wrap(selector), $args, true do
|
||||||
|
+ for e_val, literal in wrap(selector), $args, true do
|
||||||
|
if literal then
|
||||||
|
- insert(out, tostring(e))
|
||||||
|
+ insert(out, tostring(e_val))
|
||||||
|
else
|
||||||
|
+ local e = e_val
|
||||||
|
if type(e) ~= "table" then
|
||||||
|
e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
else
|
||||||
|
@@ -78,7 +79,8 @@
|
||||||
|
]===],
|
||||||
|
[===[
|
||||||
|
if type(selector) == 'table' then
|
||||||
|
- for _, e in ipairs(selector) do
|
||||||
|
+ for _, e_val in ipairs(selector) do
|
||||||
|
+ local e = e_val
|
||||||
|
if type(e) ~= "table" then
|
||||||
|
e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
else
|
||||||
|
@@ -88,10 +90,11 @@
|
||||||
|
end
|
||||||
|
else
|
||||||
|
check_selector(selector_name, selector)
|
||||||
|
- for e, literal in wrap(selector), nil, true do
|
||||||
|
+ for e_val, literal in wrap(selector), nil, true do
|
||||||
|
if literal then
|
||||||
|
- insert(out, tostring(e))
|
||||||
|
+ insert(out, tostring(e_val))
|
||||||
|
else
|
||||||
|
+ local e = e_val
|
||||||
|
if type(e) ~= "table" then
|
||||||
|
e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
else
|
||||||
|
Index: cosmo-16.06.04/src/cosmo/fill.lua
|
||||||
|
===================================================================
|
||||||
|
--- cosmo-16.06.04.orig/src/cosmo/fill.lua 2016-06-04 20:59:21.000000000 +0200
|
||||||
|
+++ cosmo-16.06.04/src/cosmo/fill.lua 2026-01-29 20:19:31.069205449 +0100
|
||||||
|
@@ -79,6 +79,7 @@
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if args and args ~= "" and args ~= "{}" then
|
||||||
|
+ local proc_e
|
||||||
|
check_selector(selector_name, selector)
|
||||||
|
args = loadstring("local env = (...); return " .. args)(env)
|
||||||
|
for e, literal in coroutine.wrap(selector), args, true do
|
||||||
|
@@ -86,22 +87,24 @@
|
||||||
|
insert(out, tostring(e))
|
||||||
|
else
|
||||||
|
if type(e) ~= "table" then
|
||||||
|
- e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
+ proc_e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
else
|
||||||
|
- e = prepare_env(e, env)
|
||||||
|
+ proc_e = prepare_env(e, env)
|
||||||
|
end
|
||||||
|
- interpreter.template({ env = e, out = out, opts = opts }, subtemplates[e.self._template or 1] or default)
|
||||||
|
+ interpreter.template({ env = proc_e, out = out, opts = opts },
|
||||||
|
+ subtemplates[proc_e.self._template or 1] or default)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if type(selector) == 'table' then
|
||||||
|
for _, e in ipairs(selector) do
|
||||||
|
if type(e) ~= "table" then
|
||||||
|
- e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
+ proc_e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
else
|
||||||
|
- e = prepare_env(e, env)
|
||||||
|
+ proc_e = prepare_env(e, env)
|
||||||
|
end
|
||||||
|
- interpreter.template({ env = e, out = out, opts = opts }, subtemplates[e.self._template or 1] or default)
|
||||||
|
+ interpreter.template({ env = proc_e, out = out, opts = opts },
|
||||||
|
+ subtemplates[proc_e.self._template or 1] or default)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
check_selector(selector_name, selector)
|
||||||
|
@@ -110,11 +113,12 @@
|
||||||
|
insert(out, tostring(e))
|
||||||
|
else
|
||||||
|
if type(e) ~= "table" then
|
||||||
|
- e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
+ proc_e = prepare_env({ it = tostring(e) }, env)
|
||||||
|
else
|
||||||
|
- e = prepare_env(e, env)
|
||||||
|
+ proc_e = prepare_env(e, env)
|
||||||
|
end
|
||||||
|
- interpreter.template({ env = e, out = out, opts = opts }, subtemplates[e.self._template or 1] or default)
|
||||||
|
+ interpreter.template({ env = proc_e, out = out, opts = opts },
|
||||||
|
+ subtemplates[proc_e.self._template or 1] or default)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user