Notification time stamped 2020-09-01 00:21:45 UTC
From 2165bb7a44bd3cd71eee2c053e38cc7482b81661 Mon Sep 17 00:00:00 2001
From: Michel Alexandre Salim <salimma(a)fedoraproject.org>
Date: Sep 01 2020 00:21:24 +0000
Subject: Initial import
Signed-off-by: Michel Alexandre Salim <salimma(a)fedoraproject.org>
---
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..1b61d22
--- /dev/null
+++ b/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/lua-rpm-macros.spec b/lua-rpm-macros.spec
new file mode 100644
index 0000000..24fce33
--- /dev/null
+++ b/lua-rpm-macros.spec
@@ -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(a)fedoraproject.org> - 1-2
+- Also move lua.attr requires generator
+
+* Fri Aug 28 2020 Michel Alexandre Salim <salimma(a)fedoraproject.org> - 1-1
+- Initial package
diff --git a/lua.attr b/lua.attr
new file mode 100644
index 0000000..a433266
--- /dev/null
+++ b/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/macros.lua b/macros.lua
new file mode 100644
index 0000000..b867749
--- /dev/null
+++ b/macros.lua
@@ -0,0 +1,2 @@
+%lua_libdir %{_libdir}/lua/%{lua_version}
+%lua_pkgdir %{_datadir}/lua/%{lua_version}
diff --git a/macros.lua-srpm b/macros.lua-srpm
new file mode 100644
index 0000000..da3c185
--- /dev/null
+++ b/macros.lua-srpm
@@ -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}
https://src.fedoraproject.org/rpms/lua-rpm-macros/c/2165bb7a44bd3cd71eee2...