From 05e359c230c57c2125b3831d366910250ab35f29ee6a96a156f78d36028d54fd Mon Sep 17 00:00:00 2001 From: Johannes Segitz Date: Mon, 11 Nov 2019 07:10:34 +0000 Subject: [PATCH] Accepting request 744477 from home:mcepl:branches:security:SELinux - Add python3.8-compat.patch to allow build with Python 3.8 Still doesn't work perfectly because of gh#SELinuxProject/setools#31 (I had to remove -Werror) - Update to the upstream version 4.2.2: - Remove source policy references from man pages, as loading source policies is no longer supported. - Fixed a performance regression in alias loading after alias dereferencing fixes in 4.2.1. OBS-URL: https://build.opensuse.org/request/show/744477 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/setools?expand=0&rev=69 --- 4.2.1.tar.gz | 3 -- 4.2.2.tar.gz | 3 ++ python3.8-compat.patch | 67 ++++++++++++++++++++++++++++++++++++++++++ setools.changes | 15 ++++++++++ setools.spec | 8 +++-- 5 files changed, 91 insertions(+), 5 deletions(-) delete mode 100644 4.2.1.tar.gz create mode 100644 4.2.2.tar.gz create mode 100644 python3.8-compat.patch diff --git a/4.2.1.tar.gz b/4.2.1.tar.gz deleted file mode 100644 index 38cf57b..0000000 --- a/4.2.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:da08f9b044d0054acfec8e0c450430f4757ba1843d858ddfd71b756c92db47df -size 365096 diff --git a/4.2.2.tar.gz b/4.2.2.tar.gz new file mode 100644 index 0000000..fc2ee1b --- /dev/null +++ b/4.2.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:826ab1974579357c8ec7c01aa0a2997b46beb85b8ad915898273c9619cd27a80 +size 364717 diff --git a/python3.8-compat.patch b/python3.8-compat.patch new file mode 100644 index 0000000..3cb419e --- /dev/null +++ b/python3.8-compat.patch @@ -0,0 +1,67 @@ +--- a/setup.py ++++ b/setup.py +@@ -12,7 +12,6 @@ import os + import shutil + from os.path import join + from itertools import chain +-from contextlib import suppress + from Cython.Build import cythonize + + +@@ -48,12 +47,16 @@ class CleanCommand(clean): + dirs_to_remove.append(join(root, d)) + + for file in files_to_remove: +- with suppress(Exception): ++ try: + os.unlink(file) ++ except Exception: ++ pass + + for dir_ in dirs_to_remove: +- with suppress(Exception): ++ try: + shutil.rmtree(dir_, ignore_errors=True) ++ except Exception: ++ pass + + clean.run(self) + +@@ -81,12 +84,14 @@ class QtHelpCommand(Command): + lib_dirs = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib'] + include_dirs = [] + +-with suppress(KeyError): ++try: + userspace_src = os.environ["USERSPACE_SRC"] + include_dirs.insert(0, userspace_src + "/libsepol/include") + include_dirs.insert(1, userspace_src + "/libselinux/include") + lib_dirs.insert(0, userspace_src + "/libsepol/src") + lib_dirs.insert(1, userspace_src + "/libselinux/src") ++except KeyError: ++ pass + + if sys.platform.startswith('darwin'): + macros=[('DARWIN',1)] +@@ -100,12 +105,19 @@ if enable_coverage: + + cython_annotate = bool(os.environ.get("SETOOLS_ANNOTATE", False)) + ++linked_libraries = ['selinux', 'sepol'] ++py_ver = sys.version_info[:2] ++if py_ver >= (3, 8): ++ linked_libraries.append('python{:d}.{:d}{}'.format(py_ver[0], ++ py_ver[1], ++ sys.abiflags)) ++ + ext_py_mods = [Extension('setools.policyrep', ['setools/policyrep.pyx'], + include_dirs=include_dirs, +- libraries=['selinux', 'sepol'], ++ libraries=linked_libraries, + library_dirs=lib_dirs, + define_macros=macros, +- extra_compile_args=['-Werror', '-Wextra', ++ extra_compile_args=['-Wextra', + '-Waggregate-return', + '-Wfloat-equal', + '-Wformat', '-Wformat=2', diff --git a/setools.changes b/setools.changes index e617b83..74635c5 100644 --- a/setools.changes +++ b/setools.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Thu Oct 31 12:02:30 CET 2019 - Matej Cepl + +- Add python3.8-compat.patch to allow build with Python 3.8 + Still doesn't work though because of gh#SELinuxProject/setools#31 + +------------------------------------------------------------------- +Thu Oct 31 09:38:27 CET 2019 - Matej Cepl + +- Update to the upstream version 4.2.2: + - Remove source policy references from man pages, as loading + source policies is no longer supported. + - Fixed a performance regression in alias loading after alias + dereferencing fixes in 4.2.1. + ------------------------------------------------------------------- Tue Feb 5 08:01:41 UTC 2019 - jsegitz@suse.com diff --git a/setools.spec b/setools.spec index 5221dac..8a18121 100644 --- a/setools.spec +++ b/setools.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -22,13 +22,16 @@ %define skip_python2 1 Name: setools -Version: 4.2.1 +Version: 4.2.2 Release: 0 Url: https://github.com/SELinuxProject/setools Summary: Policy analysis tools for SELinux License: GPL-2.0-only Group: System/Management Source: https://github.com/SELinuxProject/setools/archive/%{version}.tar.gz +# PATCH-FIX-UPSTREAM python3.8-compat.patch mcepl@suse.com +# allow build with Python 3.8 +Patch0: python3.8-compat.patch BuildRequires: %{python_module Cython} BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} @@ -99,6 +102,7 @@ This package includes the following graphical tools: %prep %setup -q -n %{name}-%{version} +%autopatch -p1 %build %python_build