libsemanage/python-semanage.spec

100 lines
3.4 KiB
RPMSpec
Raw Normal View History

#
# spec file for package python-semanage
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define soversion 2
%define libname libsemanage%{soversion}
%define libsepol_ver 3.5
%define libselinux_ver 3.5
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-semanage
Version: 3.5
Release: 0
Summary: Python bindings for SELinux's policy management library
License: LGPL-2.1-only
Group: Development/Languages/Python
URL: https://github.com/SELinuxProject/selinux
Source0: https://github.com/SELinuxProject/selinux/releases/download/%{version}/libsemanage-%{version}.tar.gz
Source1: https://github.com/SELinuxProject/selinux/releases/download/%{version}/libsemanage-%{version}.tar.gz.asc
Source2: libsemanage.keyring
Source3: baselibs.conf
# PATCH-FIX-UPSTREAM bsc#1133102 LTO: Update map file to include new symbols and remove wildcards
# For now we need to disable this. This breaks e.g. shadow and also other packages in security:SELinux
# Patch0: libsemanage-update-map-file.patch
BuildRequires: %{python_module devel}
BuildRequires: audit-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: libbz2-devel
BuildRequires: libselinux-devel >= %{libselinux_ver}
BuildRequires: libsepol-devel >= %{libsepol_ver}
BuildRequires: python-rpm-macros
BuildRequires: swig
# Ensure same version
Requires: %{libname} = %{version}
%python_subpackages
%description
This package contains the Python bindings for developing
SELinux policy management applications.
%prep
%setup -q -n libsemanage-%{version}
# Replace /usr/libexec with whatever the distro defines as libexecdir - across all files
grep /usr/libexec . -rl | xargs sed -i "s|/usr/libexec|%{_libexecdir}|g"
%build
%make_build clean
%{python_expand # loop over possible pythons
%make_build PYTHON=$python CFLAGS="%{optflags} -fno-semantic-interposition -ffat-lto-objects" swigify
%make_build PYTHON=$python CFLAGS="%{optflags} -fno-semantic-interposition -ffat-lto-objects" \
LIBDIR="%{_libdir}" \
LIBEXECDIR="%{_libexecdir}" \
SHLIBDIR="%{_lib}" \
pywrap
}
%install
mkdir -p %{buildroot}/%{_lib}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
%{python_expand # loop over possible pythons
%make_install install-pywrap PYTHON="$python" \
Accepting request 638795 from home:pmonrealgonzalez:branches:security:SELinux - update to version 2.8 * semanage fcontext -l now also lists home directory entries from file_contexts.homedirs. * libsemanage no longer deletes the tmp directory if there is an error while committing the policy transaction, so that any temporary files can be further inspected for debugging purposes (e.g. to examine a particular line of the generated CIL module). The tmp directory will be deleted upon the next transaction, so no manual removal is needed. * When overriding PREFIX, BINDIR, SBINDIR, SHLIBDIR, LIBEXECDIR, etc., DESTDIR has to be removed from the definition. For example on Arch Linux, SBINDIR="${pkgdir}/usr/bin" was changed to SBINDIR="/usr/bin". * PYSITEDIR has been renamed PYTHONLIBDIR (and its definition changed). - Clened with spec-cleaner - update to version 2.8 * semanage fcontext -l now also lists home directory entries from file_contexts.homedirs. * libsemanage no longer deletes the tmp directory if there is an error while committing the policy transaction, so that any temporary files can be further inspected for debugging purposes (e.g. to examine a particular line of the generated CIL module). The tmp directory will be deleted upon the next transaction, so no manual removal is needed. * When overriding PREFIX, BINDIR, SBINDIR, SHLIBDIR, LIBEXECDIR, etc., DESTDIR has to be removed from the definition. For example on Arch Linux, SBINDIR="${pkgdir}/usr/bin" was changed to SBINDIR="/usr/bin". * PYSITEDIR has been renamed PYTHONLIBDIR (and its definition changed). - Clened with spec-cleaner OBS-URL: https://build.opensuse.org/request/show/638795 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/libsemanage?expand=0&rev=66
2018-10-01 09:40:16 +02:00
LIBDIR="%{_libdir}" \
LIBEXECDIR="%{_libexecdir}" \
SHLIBDIR="%{_libdir}"
}
# remove files contained in other packages
rm -rf %{buildroot}%{_sysconfdir}
%if "%{_lib}" == "lib64"
rm -rf %{buildroot}%{_libexecdir}
%else
rm -rf %{buildroot}%{_libexecdir}/selinux
%endif
rm -rf %{buildroot}%{_includedir}
rm -f %{buildroot}%{_libdir}/libsemanage.*
rm -rf %{buildroot}%{_libdir}/pkgconfig
rm -rf %{buildroot}%{_mandir}
%files %{python_files}
%{python_sitearch}/*
%changelog