7 Commits

Author SHA256 Message Date
ac17f4cf3e Macro lua_exec for testing 2026-02-26 10:52:15 +01:00
e5f755e16c %lua_value returns just a replaced string, not a tuple 2026-02-25 23:27:42 +01:00
7d61c4bc5b Add %lua_value macro, useful for alternatives. 2026-01-29 21:20:56 +01:00
801cef32c6 fix lua comments 2026-01-28 14:55:11 +01:00
095740495a feat: add lua_value macro
Useful for handling alternatives
2026-01-28 13:35:42 +01:00
a281d195cb Add missing %changelog entry. 2025-11-07 10:29:57 +01:00
Michal Suchanek
227b626ed0 macros.lua: Fix parsing on older SLE releases
Older RPM versions don't like blank lines in lua macros.
2025-11-06 19:15:00 +01:00
2 changed files with 52 additions and 3 deletions

View File

@@ -1,3 +1,25 @@
-------------------------------------------------------------------
Thu Feb 26 01:34:55 UTC 2026 - Matej Cepl <mcepl@cepl.eu>
- Macro lua_exec for testing
-------------------------------------------------------------------
Wed Feb 25 22:27:05 UTC 2026 - Matej Cepl <mcepl@cepl.eu>
- %lua_value should return just a replaced string, not a tuple
like :gsub() method does.
-------------------------------------------------------------------
Thu Jan 29 20:20:41 UTC 2026 - Matej Cepl <mcepl@cepl.eu>
- Add %lua_value macro, useful for alternatives.
-------------------------------------------------------------------
Thu Nov 6 19:08:52 UTC 2025 - Michal Suchanek <msuchanek@suse.de>
- macros.lua: Fix parsing on older SLE releases. Older RPM
versions don't like blank lines in lua macros.
-------------------------------------------------------------------
Mon Nov 3 00:20:49 UTC 2025 - Matej Cepl <mcepl@cepl.eu>

View File

@@ -13,6 +13,16 @@ print(ver)
local nodots = ver:gsub("%.", "")
print(nodots)
}
%lua_value %{lua:
local flavor = rpm.expand("%{flavor}")
if flavor == "luajit" then
print("52")
else
print((flavor:gsub("lua", "")))
end
}
# compiled modules should go here
%lua_archdir %{lua:
local handle = io.popen("pkgconf --variable=INSTALL_CMOD lua 2>/dev/null")
@@ -21,6 +31,7 @@ print(ver)
result = result:gsub("^%s*(.-)%s*$", "%1")
print(result)
}
# pure Lua modules should go here
%lua_noarchdir %{lua:
local output = ""
@@ -35,6 +46,7 @@ if output:len() > 0 then
end
print(rpm.expand("%{_datadir}/lua/%{lua_version}"))
}
# lua includes folder
%lua_incdir %{lua:
local handle = io.popen("pkgconf --variable=includedir lua 2>/dev/null")
@@ -43,6 +55,7 @@ print(rpm.expand("%{_datadir}/lua/%{lua_version}"))
result = result:gsub("^%s*(.-)%s*$", "%1")
print(result)
}
%lua_version_default %{lua:
local result = "5.4"
local ver = rpm.expand("%{?suse_version}")
@@ -56,12 +69,23 @@ if #ver > 0 then
end
print(result)
}
# Define a conditional that evaluates true when building for the default Lua version
%lua_version_default_nodots %{lua:
local ver = rpm.expand("%{lua_version_default}")
local nodots = ver:gsub("%.", "")
print(nodots)
}
%lua_exec %{lua:
local flavor = rpm.expand("%{flavor}")
if flavor == "luajit" then
print("luajit")
else
print("lua" .. rpm.expand("%{lua_version}"))
end
}
# Lua default version
# This REQUIRES macro %%{mod_name} to be defined.
# -e: Exclude lua prefix
@@ -73,12 +97,13 @@ if mod_name == "" or mod_name == "%{?mod_name}" then
return
end
--
local lua_ver_nodots = rpm.expand("%{lua_version_nodots}")
local lua_ver_default_nodots = rpm.expand("%{lua_version_default_nodots}")
local flavor = rpm.expand("%{flavor}")
local version = rpm.expand("%{version}")
local release = rpm.expand("%{release}")
--
local provides_name
if rpm.expand("%{-n*}") ~= "" then
provides_name = rpm.expand("%{-n*}")
@@ -87,12 +112,12 @@ elseif rpm.expand("%{-e:1}") == "1" then
else
provides_name = "lua-" .. mod_name
end
--
if lua_ver_nodots == lua_ver_default_nodots then
print("Provides: " .. provides_name .. " = " .. version .. "-" .. release .. "\\n")
print("Obsoletes: " .. provides_name .. " < " .. version .. "-" .. release .. "\\n")
end
--
if flavor == "luajit" then
print("Obsoletes: lua51-" .. mod_name .. " <= " .. version .. "-" .. release .. "\\n")
end
@@ -106,3 +131,5 @@ luarocks --lua-version "%{lua_version}" make --deps-mode none --pack-binary-rock
%luarocks_install \
%{_rpmconfigdir}/install-lua-rock.sh "%{lua_version}" "%{buildroot}%{_prefix}" "%{buildroot}%{luarocks_treedir}/%{mod_name}"
# vi: ft=spec