Use /usr/bin/python2 and other "avoid Python 2" improvements

https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build
This commit is contained in:
Petr Lautrbach 2018-02-15 20:01:57 +01:00
parent c5c508337c
commit 7ef4db2ba4

View File

@ -112,7 +112,7 @@ mkdir -p %{buildroot}%{_mandir}/man8
make -C policycoreutils-%{version} LSPP_PRIV=y DESTDIR="%{buildroot}" SBINDIR="%{buildroot}%{_sbindir}" LIBDIR="%{buildroot}%{_libdir}" SEMODULE_PATH="/usr/sbin" LIBSEPOLA="%{_libdir}/libsepol.a" install
make -C selinux-python-%{version} DESTDIR="%{buildroot}" SBINDIR="%{buildroot}%{_sbindir}" LIBDIR="%{buildroot}%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
make -C selinux-python-%{version} PYTHON=%{__python2} DESTDIR="%{buildroot}" SBINDIR="%{buildroot}%{_sbindir}" LIBDIR="%{buildroot}%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
make -C selinux-python-%{version} PYTHON=%{__python3} DESTDIR="%{buildroot}" SBINDIR="%{buildroot}%{_sbindir}" LIBDIR="%{buildroot}%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
make -C selinux-gui-%{version} PYTHON=%{__python3} DESTDIR="%{buildroot}" SBINDIR="%{buildroot}%{_sbindir}" LIBDIR="%{buildroot}%{_libdir}" LIBSEPOLA="%{_libdir}/libsepol.a" install
@ -165,19 +165,20 @@ install -m 755 -p %{SOURCE19} %{buildroot}/%{generatorsdir}/
install -m 755 -p %{SOURCE15} %{buildroot}/%{_libexecdir}/selinux/
ln -s ../selinux-autorelabel-mark.service %{buildroot}/%{_unitdir}/basic.target.wants/
# change /usr/bin/python3 to /usr/bin/python in policycoreutils-python
# change /usr/bin/python3? to /usr/bin/python2 in policycoreutils-python/python2-policycoreutils
find %{buildroot}%{python2_sitelib} %{buildroot}%{python2_sitearch} -type f | xargs \
sed -i '1s%\(#! */usr/bin/python\)3%\1%'
sed -i '1s~#! */usr/bin/python3\?~#!%{__python2}~'
# change /usr/bin/python to %%{__python3} in policycoreutils-python3
find %{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch} -type f | xargs \
sed -i '1s%\(#! *\)/usr/bin/python\([^3].*\|\)$%\1%{__python3}\2%'
sed -i '1s~#! */usr/bin/python\([^3].*\|\)$~#!%{__python3}\1~'
# change /usr/bin/python to %%{__python3} in python-utils
sed -i '1s%\(#! *\)/usr/bin/python\([^3].*\|\)$%\1%{__python3}\2%' \
# change /usr/bin/python to %%{__python3} in policycoreutils-python-utils
sed -i '1s~#! */usr/bin/python\([^3].*\|\)$~#!%{__python3}\1~' \
%{buildroot}%{_sbindir}/semanage \
%{buildroot}%{_bindir}/chcat \
%{buildroot}%{_bindir}/sandbox \
%{buildroot}%{_datadir}/sandbox/start \
%{buildroot}%{_bindir}/audit2allow \
%{buildroot}%{_bindir}/audit2why \
%{buildroot}%{_bindir}/sepolicy \