From 7ef4db2ba4c0e623e574f40eafdf306f613c6fb9 Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Thu, 15 Feb 2018 20:01:57 +0100 Subject: [PATCH] Use /usr/bin/python2 and other "avoid Python 2" improvements https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build --- policycoreutils.spec | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/policycoreutils.spec b/policycoreutils.spec index 015bec2..086eeac 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -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 \