Fix mangling python shebangs

- use pathfix.py instead of sed
- clean up '*~' files

Fixes:
policycoreutils has broken dependencies in the rawhide tree:
On i386:
        python2-policycoreutils-2.7-11.fc28.i686 requires /usr/bin/python22
On armhfp:
        python2-policycoreutils-2.7-11.fc28.armv7hl requires /usr/bin/python22
This commit is contained in:
Petr Lautrbach 2018-02-20 12:20:29 +01:00
parent 2c47aaddd8
commit d3d971ba91

View File

@ -9,7 +9,7 @@
Summary: SELinux policy core utilities
Name: policycoreutils
Version: 2.7
Release: 12%{?dist}
Release: 13%{?dist}
License: GPLv2
# https://github.com/SELinuxProject/selinux/wiki/Releases
Source0: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20170804/policycoreutils-2.7.tar.gz
@ -166,28 +166,31 @@ 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/python2 in policycoreutils-python/python2-policycoreutils
find %{buildroot}%{python2_sitelib} %{buildroot}%{python2_sitearch} -type f | xargs \
sed -i '1s~#! */usr/bin/python3\?~#!%{__python2}~'
pathfix.py -i "%{__python2} -Es" -p %{buildroot}%{python2_sitelib} %{buildroot}%{python2_sitearch}
# 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].*\|\)$~#!%{__python3}\1~'
pathfix.py -i "%{__python3} -Es" -p %{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch}
# change /usr/bin/python to %%{__python3} in policycoreutils-python-utils
sed -i '1s~#! */usr/bin/python\([^3].*\|\)$~#!%{__python3}\1~' \
pathfix.py -i "%{__python3} -Es" -p \
%{buildroot}%{_sbindir}/semanage \
%{buildroot}%{_bindir}/chcat \
%{buildroot}%{_bindir}/sandbox \
%{buildroot}%{_datadir}/sandbox/start \
%{buildroot}%{_bindir}/audit2allow \
%{buildroot}%{_bindir}/audit2why \
%{buildroot}%{_bindir}/sepolicy \
%{buildroot}%{_bindir}/sepolgen{,-ifgen} \
%{buildroot}%{_bindir}/sepolgen-ifgen \
%{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.py \
%{buildroot}%{_datadir}/system-config-selinux/selinux_server.py \
%{buildroot}%{_datadir}/system-config-selinux/polgengui.py \
%nil
# clean up ~ files from pathfix - https://bugzilla.redhat.com/show_bug.cgi?id=1546990
find %{buildroot}%{python2_sitelib} %{buildroot}%{python2_sitearch} \
%{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch} \
%{buildroot}%{_sbindir} %{buildroot}%{_bindir} %{buildroot}%{_datadir} \
-type f -name '*~' | xargs rm -f
%find_lang %{name}
%package python-utils
@ -487,6 +490,9 @@ The policycoreutils-restorecond package contains the restorecond service.
%systemd_postun_with_restart restorecond.service
%changelog
* Tue Feb 20 2018 Petr Lautrbach <plautrba@redhat.com> - 2.7-13
- Fix mangling of python shebangs
* Mon Feb 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7-12
- Rename the python3 subpackage to have prefix, not suffix
- Use python3 prefixes in requires where possible