Compare commits
12 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
adf544bb37
|
|||
|
6e7d7d058f
|
|||
|
8ee4d34fad
|
|||
|
c1d442702b
|
|||
|
d4f21b0c0c
|
|||
|
984b4bf4f2
|
|||
|
21cfcf02e2
|
|||
|
22fe4289a4
|
|||
|
db9766d6bd
|
|||
|
df6ced835e
|
|||
|
efd19cb701
|
|||
|
91f3720965
|
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
|
||||||
|
|||||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1 +1,9 @@
|
|||||||
.osc
|
.osc
|
||||||
|
_scmsync.obsinfo
|
||||||
|
_buildconfig-*
|
||||||
|
_buildinfo-*.xml
|
||||||
|
lua-macros-*-build/
|
||||||
|
*.obscpio
|
||||||
|
*.osc
|
||||||
|
_build.*
|
||||||
|
.pbuild
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
mtime: 1762129307
|
|
||||||
commit: 521e3b1dc4df1038c5dbf9a8b71c2a16fcd44edd1bb7e3027630f6fc0d491129
|
|
||||||
url: https://src.opensuse.org/lua/lua-macros.git
|
|
||||||
revision: 521e3b1dc4df1038c5dbf9a8b71c2a16fcd44edd1bb7e3027630f6fc0d491129
|
|
||||||
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:182077e211465ff49575196507026d6f1ef603009e70d488c4b8bdb00b91f9cc
|
|
||||||
size 864
|
|
||||||
@@ -1,16 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
Mon Nov 3 00:20:49 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
|
||||||
|
|
||||||
- Finally broke %lua_provides to be working. I got stumped by the
|
|
||||||
craziness of rpm which runs Lua interpreter with locales and
|
|
||||||
crazy reformatting of integers.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Mon Oct 20 21:30:36 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
|
||||||
|
|
||||||
- Rewrite %luarocks_install to use a shell script
|
|
||||||
install-lua-rock.sh, which is packaged as well.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Oct 14 23:16:09 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
Tue Oct 14 23:16:09 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ License: MIT
|
|||||||
Group: Development/Languages/Other
|
Group: Development/Languages/Other
|
||||||
URL: https://www.lua.org
|
URL: https://www.lua.org
|
||||||
Source0: macros.lua
|
Source0: macros.lua
|
||||||
Source1: install-lua-rock.sh
|
|
||||||
%if 0%{?suse_version} > 1600
|
%if 0%{?suse_version} > 1600
|
||||||
Requires: lua-interpreter
|
Requires: lua-interpreter
|
||||||
%elif 0%{?suse_version} >= 1500
|
%elif 0%{?suse_version} >= 1500
|
||||||
@@ -47,11 +46,9 @@ cp -p %{SOURCE0} .
|
|||||||
:
|
:
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -Dm644 %{SOURCE0} %{buildroot}%{_rpmmacrodir}/macros.lua
|
install -Dm644 macros.lua %{buildroot}%{_rpmmacrodir}/macros.lua
|
||||||
install -Dm755 %{SOURCE1} %{buildroot}%{_rpmconfigdir}/install-lua-rock.sh
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%{_rpmmacrodir}/macros.lua
|
%{_rpmmacrodir}/macros.lua
|
||||||
%{_rpmconfigdir}/install-lua-rock.sh
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
76
macros.lua
76
macros.lua
@@ -6,12 +6,12 @@ local f = io.popen("lua -e 'print(_VERSION)'")
|
|||||||
local output = f:read("*a")
|
local output = f:read("*a")
|
||||||
f:close()
|
f:close()
|
||||||
local ver = output:match("Lua (%d%.%d)")
|
local ver = output:match("Lua (%d%.%d)")
|
||||||
print(ver)
|
print(ver:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
}
|
}
|
||||||
%lua_version_nodots %{lua:
|
%lua_version_nodots %{lua:
|
||||||
local ver = rpm.expand("%{lua_version}")
|
local ver = rpm.expand("%{lua_version}")
|
||||||
local nodots = ver:gsub("%.", "")
|
local nodots = ver:gsub("%.", "")
|
||||||
print(nodots)
|
print(nodots:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
}
|
}
|
||||||
# compiled modules should go here
|
# compiled modules should go here
|
||||||
%lua_archdir %{lua:
|
%lua_archdir %{lua:
|
||||||
@@ -44,14 +44,14 @@ print(rpm.expand("%{_datadir}/lua/%{lua_version}"))
|
|||||||
print(result)
|
print(result)
|
||||||
}
|
}
|
||||||
%lua_version_default %{lua:
|
%lua_version_default %{lua:
|
||||||
local result = "5.4"
|
local result = 5.4
|
||||||
local ver = rpm.expand("%{?suse_version}")
|
local ver = rpm.expand("%{?suse_version}")
|
||||||
if #ver > 0 then
|
if #ver > 0 then
|
||||||
ver = tonumber(ver)
|
ver = tonumber(ver)
|
||||||
if ver < 1500 then
|
if ver < 1500 then
|
||||||
result = "5.1"
|
result = 5.1
|
||||||
elseif ver < 1600 then
|
elseif ver < 1600 then
|
||||||
result = "5.3"
|
result = 5.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print(result)
|
print(result)
|
||||||
@@ -63,39 +63,48 @@ print(result)
|
|||||||
print(nodots)
|
print(nodots)
|
||||||
}
|
}
|
||||||
# Lua default version
|
# Lua default version
|
||||||
# This REQUIRES macro %%{mod_name} to be defined.
|
# This REQUIRES macro %{mod_name} to be defined.
|
||||||
# -e: Exclude lua prefix
|
# Optionally you can define macro `lua_provides_type`, which can
|
||||||
# -n: Specify name
|
# have two different values:
|
||||||
%lua_provides(en:) %{lua:
|
# 'exclude-prefix' which excludes lua prefix, or
|
||||||
|
# anything else which is used as the provided symbol
|
||||||
|
%lua_provides %{lua:
|
||||||
local mod_name = rpm.expand("%{?mod_name}")
|
local mod_name = rpm.expand("%{?mod_name}")
|
||||||
if mod_name == "" or mod_name == "%{?mod_name}" then
|
if mod_name == "" then
|
||||||
print("-- Error: %%{mod_name} is not defined!")
|
print("-- Error: %{mod_name} is not defined!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local lua_ver_nodots = rpm.expand("%{lua_version_nodots}")
|
local current_ver = rpm.expand("%{lua_version_nodots}"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
local lua_ver_default_nodots = rpm.expand("%{lua_version_default_nodots}")
|
local default_ver = rpm.expand("%{lua_version_default_nodots}"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
local flavor = rpm.expand("%{flavor}")
|
|
||||||
local version = rpm.expand("%{version}")
|
|
||||||
local release = rpm.expand("%{release}")
|
|
||||||
|
|
||||||
local provides_name
|
local output = ""
|
||||||
if rpm.expand("%{-n*}") ~= "" then
|
|
||||||
provides_name = rpm.expand("%{-n*}")
|
-- Check if we are building for the default Lua version
|
||||||
elseif rpm.expand("%{-e:1}") == "1" then
|
if current_ver == default_ver then
|
||||||
provides_name = mod_name
|
|
||||||
else
|
local package_type = rpm.expand("%{?lua_provides_type}"):gsub("^%s*(.-)%s*$", "%1")
|
||||||
provides_name = "lua-" .. mod_name
|
local package_name = mod_name
|
||||||
|
|
||||||
|
-- Check for type defined externally (e.g., via --define 'lua_provides_type package-name')
|
||||||
|
if package_type == "exclude-prefix" then
|
||||||
|
-- Use name without "lua-" prefix
|
||||||
|
package_name = mod_name
|
||||||
|
elseif package_type ~= "" then
|
||||||
|
-- Use custom name defined by package_type
|
||||||
|
package_name = package_type
|
||||||
|
else
|
||||||
|
-- Default: Use 'lua-' prefix
|
||||||
|
package_name = "lua-" .. mod_name
|
||||||
|
end
|
||||||
|
|
||||||
|
local version = rpm.expand("%{version}")
|
||||||
|
local release = rpm.expand("%{release}")
|
||||||
|
|
||||||
|
output = "Provides: " .. package_name .. " = " .. version .. "-" .. release .. " Obsoletes: " .. package_name .. " < " .. version .. "-" .. release
|
||||||
end
|
end
|
||||||
|
|
||||||
if lua_ver_nodots == lua_ver_default_nodots then
|
print(output)
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# LuaRocks
|
# LuaRocks
|
||||||
@@ -105,4 +114,7 @@ luarocks --lua-version "%{lua_version}" make --deps-mode none --pack-binary-rock
|
|||||||
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
%luarocks_treedir %{_prefix}/lib/luarocks/rocks-%{lua_version}
|
||||||
|
|
||||||
%luarocks_install \
|
%luarocks_install \
|
||||||
%{_rpmconfigdir}/install-lua-rock.sh "%{lua_version}" "%{buildroot}%{_prefix}" "%{buildroot}%{luarocks_treedir}/%{mod_name}"
|
/bin/sh -c 'luarocks --lua-version="%{lua_version}" --tree="%{buildroot}%{_prefix}" install --deps-mode=none --no-manifest "$@" && \
|
||||||
|
source_dir="%{buildroot}%{luarocks_treedir}/%{mod_name}/%{rock_version}" && \
|
||||||
|
[ -d "${source_dir}" ] && [ "$(ls -A "${source_dir}" | wc -l)" -gt 0 ] && \
|
||||||
|
mv -v "${source_dir}" __rocktree' --
|
||||||
|
|||||||
Reference in New Issue
Block a user