Compare commits
5 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
4381bcc53d
|
|||
|
9965f470eb
|
|||
|
9e805e8aa8
|
|||
|
b37964147f
|
|||
|
128dca291a
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -21,3 +21,4 @@
|
|||||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.changes merge=merge-changes
|
||||||
|
|||||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1 +1,10 @@
|
|||||||
.osc
|
.osc
|
||||||
|
*.obscpio
|
||||||
|
*.osc
|
||||||
|
_build.*
|
||||||
|
.pbuild
|
||||||
|
lua*-cosmo-*-build/
|
||||||
|
*.obscpio
|
||||||
|
*.osc
|
||||||
|
_build.*
|
||||||
|
.pbuild
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<multibuild>
|
<multibuild>
|
||||||
<package>lua51</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,22 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
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>
|
||||||
|
|
||||||
|
- Switch off building lua51 build of the package.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 14 23:11:41 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Make the package buildable with LuaJIT.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Apr 1 01:48:59 UTC 2024 - Gordon Leung <pirateclip@protonmail.com>
|
Mon Apr 1 01:48:59 UTC 2024 - Gordon Leung <pirateclip@protonmail.com>
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%define flavor @BUILD_FLAVOR@
|
%define flavor @BUILD_FLAVOR@
|
||||||
%define mod_name cosmo
|
%define mod_name cosmo
|
||||||
%define rock_version 16.06.04-1
|
%define rock_version 16.06.04-1
|
||||||
@@ -23,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
|
||||||
@@ -34,6 +32,7 @@ BuildRequires: lua-macros
|
|||||||
BuildRequires: zstd
|
BuildRequires: zstd
|
||||||
Requires: %{flavor}
|
Requires: %{flavor}
|
||||||
Requires: %{flavor}-lpeg
|
Requires: %{flavor}-lpeg
|
||||||
|
BuildArch: noarch
|
||||||
%lua_provides
|
%lua_provides
|
||||||
%if "%{flavor}" == ""
|
%if "%{flavor}" == ""
|
||||||
Name: lua-%{mod_name}
|
Name: lua-%{mod_name}
|
||||||
@@ -41,7 +40,6 @@ ExclusiveArch: do_not_build
|
|||||||
%else
|
%else
|
||||||
Name: %{flavor}-%{mod_name}
|
Name: %{flavor}-%{mod_name}
|
||||||
%endif
|
%endif
|
||||||
BuildArch: noarch
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Cosmo is a "safe templates" engine. It allows you to fill nested
|
Cosmo is a "safe templates" engine. It allows you to fill nested
|
||||||
@@ -54,19 +52,18 @@ engines, without the downside of allowing arbitrary code in the templates.
|
|||||||
sed -i -e '/lpeg >=/d' "rockspec/%{mod_name}-%{rock_version}.rockspec"
|
sed -i -e '/lpeg >=/d' "rockspec/%{mod_name}-%{rock_version}.rockspec"
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%luarocks_build "rockspec/%{mod_name}-%{rock_version}.rockspec"
|
%{luarocks_build} rockspec/%{mod_name}-%{rock_version}.rockspec
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%luarocks_install *.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
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license %{luarocks_treedir}/%{mod_name}/%{rock_version}/doc/cosmo.md
|
%doc README __rocktree/*
|
||||||
%docdir %{luarocks_treedir}/%{mod_name}/%{rock_version}/doc
|
|
||||||
%{lua_noarchdir}
|
%{lua_noarchdir}
|
||||||
%{luarocks_treedir}/%{mod_name}
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
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