diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.gitignore diff --git a/.lua-rpm-macros.metadata b/.lua-rpm-macros.metadata new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.lua-rpm-macros.metadata diff --git a/SOURCES/LICENSE b/SOURCES/LICENSE new file mode 100644 index 0000000..1b61d22 --- /dev/null +++ b/SOURCES/LICENSE @@ -0,0 +1,16 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/SOURCES/lua.attr b/SOURCES/lua.attr new file mode 100644 index 0000000..a433266 --- /dev/null +++ b/SOURCES/lua.attr @@ -0,0 +1,19 @@ +%__lua_requires() %{lua: + -- Match buildroot paths of the form + -- /PATH/OF/BUILDROOT/usr/lib(64)/lua/MAJOR.MINOR/ and + -- /PATH/OF/BUILDROOT/usr/share/pythonMAJOR.MINOR/ + -- generating a line of the form: + -- lua(abi) = MAJOR.MINOR + local path = rpm.expand('%1') + local datadir = rpm.expand('%_datadir') + local libdir = rpm.expand('%_libdir') + for i, dir in ipairs({datadir, libdir}) do + if path:match(dir .. '/lua/%d+%.%d+/.*') then + local requires = path:gsub('.*' .. dir .. '/lua/(%d+%.%d+)/.*', 'lua(abi) = %1') + print(requires) + break + end + end +} + +%__lua_path ^(%{_datadir}|%{_libdir})/lua/[[:digit:]]+\\.[[:digit:]]+/.+ diff --git a/SOURCES/macros.lua b/SOURCES/macros.lua new file mode 100644 index 0000000..b867749 --- /dev/null +++ b/SOURCES/macros.lua @@ -0,0 +1,2 @@ +%lua_libdir %{_libdir}/lua/%{lua_version} +%lua_pkgdir %{_datadir}/lua/%{lua_version} diff --git a/SOURCES/macros.lua-srpm b/SOURCES/macros.lua-srpm new file mode 100644 index 0000000..8c6592b --- /dev/null +++ b/SOURCES/macros.lua-srpm @@ -0,0 +1,10 @@ +%lua_version %{lua: print(string.sub(_VERSION, 5))} + +%lua_requires \ +%if 0%{?fedora} || 0%{?rhel} >= 7 \ +Requires: lua(abi) = %{lua_version} \ +%else \ +Requires: lua >= %{lua_version} \ +Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)} \ +%endif \ +%{nil} diff --git a/SPECS/lua-rpm-macros.spec b/SPECS/lua-rpm-macros.spec new file mode 100644 index 0000000..e1fb1fa --- /dev/null +++ b/SPECS/lua-rpm-macros.spec @@ -0,0 +1,116 @@ +%if 0%{?el8} +# RHEL8's lua-devel ships macros.lua and lua.attr +# skip shipping lua-rpm-macros so we don't conflict +%bcond_with rpm_macros +%else +%bcond_without rpm_macros +%endif + +# Versions of lua-devel where the macros were removed +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 +%global lua_conflict 5.4.0-7 +%endif +# TODO add new versions if this gets backported + +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9 +# requires RPM >= 4.16 +%bcond_without requires_generator +%else +%bcond_with requires_generator +%endif + +Name: lua-rpm-macros +Version: 1 +Release: 6%{?dist} +Summary: The common Lua RPM macros + +License: MIT + +# Macros: +Source101: macros.lua +Source102: macros.lua-srpm + +# RPM requires generator +Source103: lua.attr + +# license text +Source200: LICENSE + +BuildArch: noarch + +# for lua_libdir and lua_pkgdir +Requires: lua-srpm-macros = %{version}-%{release} + +# files were moved from here +%{?lua_conflict:Conflicts: lua-devel < %{lua_conflict}} + +%description +This package contains Lua RPM macros. + +You should not need to install this package manually as lua-devel requires it. + + +%package -n lua-srpm-macros +Summary: RPM macros for building Lua source packages + +# For directory structure +Requires: rpm + +%description -n lua-srpm-macros +RPM macros for building Lua source packages. + + +%prep +%autosetup -c -T +cp -a %{sources} . +%if %{without rpm_macros} +rm macros.lua +%endif + + +%build + + +%install +mkdir -p %{buildroot}%{rpmmacrodir} +install -pm 644 macros.* %{buildroot}%{rpmmacrodir}/ +%if %{with requires_generator} +install -Dpm 0644 lua.attr %{buildroot}/%{_fileattrsdir}/lua.attr +%endif + + +%if %{with rpm_macros} +%files +%license LICENSE +%if %{with requires_generator} +%{_fileattrsdir}/lua.attr +%endif +%{rpmmacrodir}/macros.lua +%endif + +%files -n lua-srpm-macros +%license LICENSE +%{rpmmacrodir}/macros.lua-srpm + + +%changelog +* Mon Aug 09 2021 Mohan Boddu - 1-6 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Apr 16 2021 Mohan Boddu - 1-5 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Sep 01 2020 Miro Hrončok - 1-3 +- Modify several conditionals to support RHEL 9+ and drop ancient Fedora 17 +- Add explicit conflict with older lua-devel +- Require rpm, not redhat-rpm-config + +* Mon Aug 31 2020 Michel Alexandre Salim - 1-2 +- Also move lua.attr requires generator + +* Fri Aug 28 2020 Michel Alexandre Salim - 1-1 +- Initial package