%{?scl:%scl_package libselinux-python} %{!?scl:%global pkg_name %{name}} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Summary: SELinux SCL Python36 python bindings Name: %{?scl_prefix}libselinux-python Version: 2.5 Release: 14.1%{?dist} License: Public Domain Group: System Environment/Libraries # https://github.com/SELinuxProject/selinux/wiki/Releases Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160223/libselinux-2.5.tar.gz Url: https://github.com/SELinuxProject/selinux/wiki # HEAD 0713edcc60b6c9e487f149af8ecc66206c9274b6 Patch1: libselinux-rhel.patch %{?scl:Requires: %{scl}-runtime} %{?scl:BuildRequires: %{scl}-runtime} BuildRequires: %{?scl_prefix}selinux-links %{?scl_prefix}pkgconfig %{?scl_prefix}python %{?scl_prefix}python-devel libsepol-static >= %{libsepolver} swig pcre-devel xz-devel Requires: libsepol%{?_isa} >= %{libsepolver} pcre %{?scl_prefix}selinux-links Conflicts: filesystem < 3 Conflicts: selinux-policy-base < 3.13.1-66 Conflicts: systemd < 219-20 BuildRoot: %{_tmppath}/%{pkg_name}-%{version}-%{release}-root-%(%{__id_u} -n) %description Security-enhanced Linux is a feature of the Linux® kernel and a number of utilities with enhanced security functionality designed to add mandatory access controls to Linux. The Security-enhanced Linux kernel contains new architectural components originally developed to improve the security of the Flask operating system. These architectural components provide general support for the enforcement of many kinds of mandatory access control policies, including those based on the concepts of Type Enforcement®, Role-based Access Control, and Multi-level Security. libselinux provides an API for SELinux applications to get and set process and file security contexts and to obtain security policy decisions. Required for any applications that use the SELinux API. %prep %{?scl:scl enable %{scl} - << \EOF} set -ex %setup -q -n libselinux-2.5 %patch1 -p1 -b .rhel %{?scl:EOF} %build set -ex export LDFLAGS="%{?__global_ldflags}" # FIXME: export DISABLE_RPM="y" make clean make LIBDIR="%{_libdir}" CFLAGS="-g %{optflags}" %{?_smp_mflags} swigify make LIBDIR="%{_libdir}" CFLAGS="-g %{optflags}" %{?_smp_mflags} all %{?scl:scl enable %{scl} - << \EOF} # To support building the Python wrapper against multiple Python runtimes # Define a function, for how to perform a "build" of the python wrapper against # a specific runtime: BuildPythonWrapper() { BinaryName=$1 # Perform the build from the upstream Makefile: make \ PYTHON=$BinaryName \ LIBDIR="%{_libdir}" CFLAGS="-g %{optflags}" %{?_smp_mflags} \ pywrap } BuildPythonWrapper %{__python3} %{?scl:EOF} %install %{?scl:scl enable %{scl} - << \EOF} set -ex InstallPythonWrapper() { BinaryName=$1 make \ PYTHON=$BinaryName \ LIBDIR="%{_libdir}" CFLAGS="-g %{optflags}" %{?_smp_mflags} \ pywrap make \ PYTHON=$BinaryName \ DESTDIR="%{buildroot}" LIBDIR="%{buildroot}%{_libdir}" \ SHLIBDIR="%{buildroot}/%{_lib}" BINDIR="%{buildroot}%{_bindir}" \ SBINDIR="%{buildroot}%{_sbindir}" \ install-pywrap } rm -rf %{buildroot} mkdir -p %{buildroot}/%{_prefix}/lib/tmpfiles.d mkdir -p %{buildroot}/%{_libdir} mkdir -p %{buildroot}%{_includedir} mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}/var/run/setrans InstallPythonWrapper %{__python3} # Nuke the files we don't want to distribute rm -f %{buildroot}%{_sbindir}/compute_* rm -f %{buildroot}%{_sbindir}/deftype rm -f %{buildroot}%{_sbindir}/execcon rm -f %{buildroot}%{_sbindir}/getenforcemode rm -f %{buildroot}%{_sbindir}/getfilecon rm -f %{buildroot}%{_sbindir}/getpidcon rm -f %{buildroot}%{_sbindir}/mkdircon rm -f %{buildroot}%{_sbindir}/policyvers rm -f %{buildroot}%{_sbindir}/setfilecon rm -f %{buildroot}%{_sbindir}/selinuxconfig rm -f %{buildroot}%{_sbindir}/selinuxdisable rm -f %{buildroot}%{_sbindir}/getseuser rm -f %{buildroot}%{_sbindir}/togglesebool rm -f %{buildroot}%{_sbindir}/selinux_check_securetty_context %{?scl:EOF} %clean %{?scl:scl enable %{scl} - << \EOF} set -ex rm -rf %{buildroot} %{?scl:EOF} %files %defattr(-,root,root,-) %dir %{python3_sitearch}/selinux %dir %{python3_sitearch}/selinux/__pycache__ %{python3_sitearch}/selinux/*.py* %{python3_sitearch}/selinux/*.so %{python3_sitearch}/selinux/__pycache__/* %changelog * Sat Apr 20 2019 Martin Juhl - 2.5-14.1 - First release