Include brp-python-hardlink in python-srpm-macros since it is no longer in RPM 4.17+
See def9a339d2
This commit is contained in:
parent
d905710a8d
commit
bc2b51d6d3
25
brp-python-hardlink
Normal file
25
brp-python-hardlink
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If using normal root, avoid changing anything.
|
||||
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
hardlink_if_same() {
|
||||
if cmp -s "$1" "$2" ; then
|
||||
ln -f "$1" "$2"
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# Hardlink identical *.pyc, *.pyo, and *.opt-[12].pyc.
|
||||
# Originally from PLD's rpm-build-macros
|
||||
find "$RPM_BUILD_ROOT" -type f -name "*.pyc" -not -name "*.opt-[12].pyc" | while read pyc ; do
|
||||
hardlink_if_same "$pyc" "${pyc%c}o"
|
||||
o1pyc="${pyc%pyc}opt-1.pyc"
|
||||
hardlink_if_same "$pyc" "$o1pyc"
|
||||
o2pyc="${pyc%pyc}opt-2.pyc"
|
||||
hardlink_if_same "$pyc" "$o2pyc" || hardlink_if_same "$o1pyc" "$o2pyc"
|
||||
done
|
||||
exit 0
|
@ -49,6 +49,11 @@
|
||||
# Alternatively, it can be overridden in spec (e.g. to "3.8") when building for alternate Python stacks.
|
||||
%python3_pkgversion 3
|
||||
|
||||
|
||||
# BRP scripts, they need to be included in redhat-rpm-macros, in %%__os_install_post
|
||||
%__brp_python_hardlink %{_rpmconfigdir}/redhat/brp-python-hardlink
|
||||
|
||||
|
||||
# === Macros for Build/Requires tags using Python dist tags ===
|
||||
# - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||
# - These macros need to be in macros.python-srpm, because BuildRequires tags
|
||||
|
@ -16,8 +16,16 @@ Source201: python.lua
|
||||
%global compileall2_version 0.7.1
|
||||
Source301: https://github.com/fedora-python/compileall2/raw/v%{compileall2_version}/compileall2.py
|
||||
|
||||
# macros and lua: MIT, compileall2.py: PSFv2
|
||||
License: MIT and Python
|
||||
# BRP scripts
|
||||
# This one is from https://github.com/rpm-software-management/python-rpm-packaging/blob/main/scripts/brp-python-hardlink
|
||||
# But we don't use a link in case it changes in upstream, there are no "versions" there yet
|
||||
# This was removed from RPM 4.17+ so we maintain it here instead
|
||||
Source401: brp-python-hardlink
|
||||
|
||||
# macros and lua: MIT
|
||||
# compileall2.py: PSFv2
|
||||
# brp-python-hardlink: GPLv2+
|
||||
License: MIT and Python and GPLv2+
|
||||
|
||||
# The package version MUST be always the same as %%{__default_python3_version}.
|
||||
# To have only one source of truth, we load the macro and use it.
|
||||
@ -31,7 +39,7 @@ elseif posix.stat('macros.python-srpm') then
|
||||
end
|
||||
}
|
||||
Version: %{__default_python3_version}
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -89,6 +97,16 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm python.lua
|
||||
mkdir -p %{buildroot}%{_rpmconfigdir}/redhat
|
||||
install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
|
||||
install -m 755 brp-* %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
|
||||
|
||||
# We define our own BRPs here to use the ones from the %%{buildroot},
|
||||
# that way, this package can be built when it includes them for the first time.
|
||||
# It also ensures that:
|
||||
# - our BRPs can execute
|
||||
# - if our BRPs affect this package, we don't need to build it twice
|
||||
%global __brp_python_hardlink %{buildroot}%{__brp_python_hardlink}
|
||||
|
||||
|
||||
%check
|
||||
# no macros in comments
|
||||
@ -102,6 +120,7 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
%files -n python-srpm-macros
|
||||
%{rpmmacrodir}/macros.python-srpm
|
||||
%{_rpmconfigdir}/redhat/compileall2.py
|
||||
%{_rpmconfigdir}/redhat/brp-python-hardlink
|
||||
%{_rpmluadir}/fedora/srpm/python.lua
|
||||
|
||||
%files -n python3-rpm-macros
|
||||
@ -109,6 +128,9 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jun 30 2021 Miro Hrončok <mhroncok@redhat.com> - 3.10-4
|
||||
- Include brp-python-hardlink in python-srpm-macros since it is no longer in RPM 4.17+
|
||||
|
||||
* Mon Jun 28 2021 Miro Hrončok <mhroncok@redhat.com> - 3.10-3
|
||||
- %%pytest: Set $PYTEST_ADDOPTS when %%{__pytest_addopts} is defined
|
||||
- Related: rhzb#1935212
|
||||
|
Loading…
Reference in New Issue
Block a user