RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/lua-rpm-macros#2165bb7a44bd3cd71eee2c053e38cc7482b81661
This commit is contained in:
Petr Šabata 2020-10-15 18:45:25 +02:00
parent 3acdd75287
commit 119183b383
7 changed files with 142 additions and 0 deletions

0
.gitignore vendored
View File

16
LICENSE Normal file
View File

@ -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.

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# lua-rpm-macros
The lua-rpm-macros package

92
lua-rpm-macros.spec Normal file
View File

@ -0,0 +1,92 @@
%if 0%{?el8}
# RHEL'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
%if 0%{?fedora} >= 33
# requires RPM >= 4.16
%bcond_without requires_generator
%else
%bcond_with requires_generator
%endif
Name: lua-rpm-macros
Version: 1
Release: 2%{?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}
%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: redhat-rpm-config
%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 31 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 1-2
- Also move lua.attr requires generator
* Fri Aug 28 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 1-1
- Initial package

19
lua.attr Normal file
View File

@ -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:]]+/.+

2
macros.lua Normal file
View File

@ -0,0 +1,2 @@
%lua_libdir %{_libdir}/lua/%{lua_version}
%lua_pkgdir %{_datadir}/lua/%{lua_version}

10
macros.lua-srpm Normal file
View File

@ -0,0 +1,10 @@
%lua_version %{lua: print(string.sub(_VERSION, 5))}
%lua_requires \
%if 0%{?fedora} >= 16 || 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}