# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif %define setools_pre_ver alpha2.1.9b28cbe3c7 Name: setools Version: 4.0.0 Release: 0%{?setools_pre_ver:.%{setools_pre_ver}}%{?dist}.2 Summary: Policy analysis tools for SELinux License: GPLv2 URL: https://github.com/TresysTechnology/setools/wiki # git archive --format=tar --prefix=setools-4.0.0-alpha2.1.9b28cbe3c7/ 9b28cbe3c7 Source0: https://github.com/TresysTechnology/setools/archive/%{version}%{?setools_pre_ver:-%{setools_pre_ver}}.tar.gz Obsoletes: setools < 4.0.0 BuildRequires: flex, bison, pkgconfig bzip2-devel BuildRequires: glibc-devel gcc BuildRequires: libselinux-devel, libsepol-devel, libsepol-static BuildRequires: swig # BuildArch: BuildRequires: python2-devel %if %{with python3} Requires: %{name}-python3 = %{version}-%{release} BuildRequires: python3-devel %endif # with python3 %description SETools is a collection of graphical tools, command-line tools, and Python modules designed to facilitate SELinux policy analysis. %if %{with python3} %package python2 Summary: Policy analysis tools for SELinux %description python2 SETools is a collection of graphical tools, command-line tools, and Python 2 modules designed to facilitate SELinux policy analysis. %package python3 Summary: Policy analysis tools for SELinux Obsoletes: setools-libs < 4.0.0 %description python3 SETools is a collection of graphical tools, command-line tools, and Python 3 modules designed to facilitate SELinux policy analysis. %endif # with python3 %package gui Summary: Policy analysis graphical tools for SELinux Requires: python-qt5 %description gui SETools is a collection of graphical tools, command-line tools, and Python modules designed to facilitate SELinux policy analysis. %prep %setup -c mv %{name}-%{version}%{?setools_pre_ver:-%{setools_pre_ver}} python2 %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="%{optflags}" %{__python2} setup.py build popd %if %{with python3} pushd python3 # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="%{optflags}" %{__python3} setup.py build popd %endif # with python3 %install rm -rf %{buildroot} # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if %{with python3} pushd python3 %{__python3} setup.py install --root %{buildroot} popd %endif # with python3 pushd python2 %{__python2} setup.py install --root %{buildroot} popd %check %if %{?_with_check:1}%{!?_with_check:0} pushd python2 %{__python2} setup.py test popd %if %{with python3} pushd python3 %{__python2} setup.py test popd %endif %endif %files %{_bindir}/sedta %{_bindir}/seinfo %{_bindir}/seinfoflow %{_bindir}/sesearch %files -n setools-python2 %doc # For noarch packages: sitelib # %{python2_sitelib}/* # For arch-specific packages: sitearch %{python2_sitearch}/* %if %{with python3} %files -n setools-python3 %doc # For noarch packages: sitelib # %{python3_sitelib}/* # For arch-specific packages: sitearch %{python3_sitearch}/* %endif # with python3 %files gui %{_bindir}/apol %{_datarootdir} %changelog * Wed Jul 01 2015 Petr Lautrbach 4.0.0-0.alpha2.1.9b28cbe3c7.2 - initial release