2.0.0-4 - Sanitize/generalize approach to Python byte-compilation

...so that also out-of-Python-path *.py files
  (%%{_datadir}/pacemaker/tests/cts/CTSlab.py in particular) get the
  expected treatment now

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
Jan Pokorný 2018-08-23 17:33:55 +02:00
parent 6e88051f14
commit 1471429b4d
No known key found for this signature in database
GPG Key ID: 61BBB23A9E8F8DE2

View File

@ -14,7 +14,7 @@
## can be incremented to build packages reliably considered "newer"
## than previously built packages with the same pcmkversion)
%global pcmkversion 2.0.0
%global specversion 3
%global specversion 4
## Upstream commit (or git tag, such as "Pacemaker-" plus the
## {pcmkversion} macro for an official release) to use for this package
@ -55,11 +55,20 @@
## overridable with "rpmbuild --define 'pcmk_gnutls_priorities PRIORITY-SPEC'"
%define gnutls_priorities %{?pcmk_gnutls_priorities}%{!?pcmk_gnutls_priorities:@SYSTEM}
## Turn off auto-compilation of Python files outside site-packages directory,
## so that the -libs-devel package is multilib-compliant (no *.py[co] files)
## (py_auto_byte_compile macro: https://bugzilla.redhat.com/574437)
## XXX keep an eye on https://pagure.io/packaging-committee/issue/755
%undefine py_auto_byte_compile
# Python-related definitions
## Turn off auto-compilation of Python files outside Python specific paths,
## so there's no risk that unexpected "__python" macro gets picked to do the
## RPM-native byte-compiling there (only "{_datadir}/pacemaker/tests" affected)
## -- distro-dependent tricks or automake's fallback to be applied there
%if %{defined _python_bytecompile_extra}
%global _python_bytecompile_extra 0
%else
### the statement effectively means no RPM-native byte-compiling will occur at
### all, so distro-dependent tricks for Python-specific packages to be applied
%global __os_install_post %(echo '%{__os_install_post}' | {
sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g'; })
%endif
## Values that differ by Python major version
%global python_path /usr/bin/python%{?python3_pkgversion}%{!?python3_pkgversion:3}
@ -378,7 +387,13 @@ make %{_smp_mflags} V=1 all
[ -f .CHECKED ] && rm -f -- .CHECKED
%install
make DESTDIR=%{buildroot} docdir=%{pcmk_docdir} V=1 install
# skip automake-native Python byte-compilation, since RPM-native one (possibly
# distro-confined to Python-specific directories, which is currently the only
# relevant place, anyway) assures proper intrinsic alignment with wider system
# (such as with py_byte_compile macro, which is concurrent Fedora/EL specific)
make install \
DESTDIR=%{buildroot} V=1 docdir=%{pcmk_docdir} \
%{?_python_bytecompile_extra:%{?py_byte_compile:am__py_compile=true}}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
install -m 644 daemons/pacemakerd/pacemaker.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/pacemaker
@ -414,6 +429,14 @@ rm -f %{buildroot}/%{_sbindir}/ipmiservicelogd
rm -f %{buildroot}/%{_initrddir}/pacemaker
rm -f %{buildroot}/%{_initrddir}/pacemaker_remote
# Byte-compile Python sources where suitable and the distro procedures known
%if %{defined py_byte_compile} && %{defined python_path}
%{py_byte_compile %{python_path} %{buildroot}%{_datadir}/pacemaker/tests}
%if !%{defined _python_bytecompile_extra}
%{py_byte_compile %{python_path} %{buildroot}%{py_site}/cts}
%endif
%endif
%if %{with coverage}
GCOV_BASE=%{buildroot}/%{_var}/lib/pacemaker/gcov
mkdir -p $GCOV_BASE
@ -676,6 +699,11 @@ exit 0
%license %{nagios_name}-%{nagios_hash}/COPYING
%changelog
* Thu Aug 23 2018 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 2.0.0-4
- Sanitize/generalize approach to Python byte-compilation, so that also
out-of-Python-path *.py files (%%{_datadir}/pacemaker/tests/cts/CTSlab.py
in particular) get the expected treatment now
* Wed Aug 15 2018 Jan Pokorný <jpokorny+rpm-pacemaker@redhat.com> - 2.0.0-3
- Fix Python 3.7 incompatibility (otherwise missed in bytecompilation phase,
see rhbz#1616219)