Accepting request 1171339 from security:SELinux

OBS-URL: https://build.opensuse.org/request/show/1171339
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/setools?expand=0&rev=49
This commit is contained in:
Ana Guerrero 2024-05-02 21:42:58 +00:00 committed by Git OBS Bridge
commit 5b1c14c8c4
6 changed files with 17 additions and 95 deletions

View File

@ -1,84 +0,0 @@
From b1ec8b7b2abe77e996f8272881f1d0887d09a4d5 Mon Sep 17 00:00:00 2001
From: Cathy Hu <cathy.hu@suse.com>
Date: Thu, 18 Apr 2024 14:31:46 +0200
Subject: [PATCH] Make networkx optional again (Fixes #125)
The 5.6.0 update contains a refactoring, which makes the networkx dependency
necessary again for other commands, such as sesearch and seinfo.
This leads to issues when packaging for distributions that do not provide networkx
and want to use setools in a minimal fashion.
Signed-off-by: Cathy Hu <cathy.hu@suse.com>
---
setools/__init__.py | 13 ++++++++-----
setools/dta.py | 8 ++------
setools/infoflow.py | 8 ++------
3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/setools/__init__.py b/setools/__init__.py
index 1efd2cc..2cc5e47 100644
--- a/setools/__init__.py
+++ b/setools/__init__.py
@@ -76,13 +76,16 @@ from .pirqconquery import PirqconQuery
from .pcideviceconquery import PcideviceconQuery
from .devicetreeconquery import DevicetreeconQuery
-# Information Flow Analysis
-from .infoflow import *
+# Information Flow and Domain Transition Analysis
+try:
+ import networkx
+except ImportError:
+ logging.getLogger(__name__).debug("NetworkX failed to import, disabling infoflow and dta.")
+else:
+ from .infoflow import *
+ from .dta import *
from .permmap import PermissionMap, RuleWeight, Mapping
-# Domain Transition Analysis
-from .dta import *
-
# Policy difference
from .diff import PolicyDifference
diff --git a/setools/dta.py b/setools/dta.py
index 5ce50f4..554c545 100644
--- a/setools/dta.py
+++ b/setools/dta.py
@@ -13,12 +13,8 @@ from dataclasses import dataclass, InitVar
import typing
import warnings
-try:
- import networkx as nx
- from networkx.exception import NetworkXError, NetworkXNoPath, NodeNotFound
-
-except ImportError as iex:
- logging.getLogger(__name__).debug(f"{iex.name} failed to import.")
+import networkx as nx
+from networkx.exception import NetworkXError, NetworkXNoPath, NodeNotFound
from . import exception
from .descriptors import CriteriaDescriptor, EdgeAttrDict, EdgeAttrList
diff --git a/setools/infoflow.py b/setools/infoflow.py
index 0d48bbe..0086f4c 100644
--- a/setools/infoflow.py
+++ b/setools/infoflow.py
@@ -11,12 +11,8 @@ from dataclasses import dataclass, InitVar
import typing
import warnings
-try:
- import networkx as nx
- from networkx.exception import NetworkXError, NetworkXNoPath, NodeNotFound
-
-except ImportError as iex:
- logging.getLogger(__name__).debug(f"{iex.name} failed to import.")
+import networkx as nx
+from networkx.exception import NetworkXError, NetworkXNoPath, NodeNotFound
from . import exception
from .descriptors import CriteriaDescriptor, EdgeAttrIntMax, EdgeAttrList
--
2.44.0

View File

@ -1,2 +1,2 @@
Additional functionality for these tools can be gained by installing python3-networkx. This pulls in many dependencies and is
not needed for most people, therefor it's not required or recommended due to the size of the required dependencies
not needed for most people, therefore it's not required or recommended due to the size of the required dependencies.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:68469ae9bd114b42bba4cb41795577ca1e4f50e3e4234817f13ff1a8bbd9ce77
size 265097

3
setools-4.5.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:25e47d00bbffd6046f55409c9ba3b08d9b1d5788cc159ea247d9e0ced8e482e7
size 264998

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu May 2 07:41:11 UTC 2024 - Filippo Bonazzi <filippo.bonazzi@suse.com>
- Update to version 4.5.1:
- Correct annotations of NetworkX types to make it optional again.
- Fix packaging issue for apol's style sheet (apol.css).
- Drop 0001-Make-networkx-optional-again-Fixes-125.patch fixed upstream
- Change networkx Requires to Suggests
-------------------------------------------------------------------
Thu Apr 18 13:21:48 UTC 2024 - Cathy Hu <cathy.hu@suse.com>

View File

@ -20,7 +20,7 @@
%define pythons %python3_primary_provider
Name: setools
Version: 4.5.0
Version: 4.5.1
Release: 0
URL: https://github.com/SELinuxProject/setools
Summary: Policy analysis tools for SELinux
@ -28,8 +28,6 @@ License: GPL-2.0-only
Group: System/Management
Source: https://github.com/SELinuxProject/setools/releases/download/%{version}/%{name}-%{version}.tar.bz2
Source2: README.SUSE
# can be removed again when this is fixed upstream: https://github.com/SELinuxProject/setools/issues/125
Patch0: 0001-Make-networkx-optional-again-Fixes-125.patch
BuildRequires: %{python_module Cython >= 0.29.14}
BuildRequires: %{python_module devel >= 3.10}
BuildRequires: %{python_module setuptools}
@ -71,10 +69,9 @@ License: LGPL-2.0-only
Group: Development/Languages/Python
Requires: %{python3_primary_provider} >= 3.10
Requires: %{python3_primary_provider}-setuptools
# require python-networkx on tumbleweed
%if 0%{?suse_version} > 1600
Requires: %{python3_primary_provider}-networkx
%endif
# Only suggest python-networkx due to its large amount of dependencies
# (see README.SUSE)
Suggests: %{python3_primary_provider}-networkx
Obsoletes: python-setools < %{version}-%{release}
Provides: python-setools = %{version}-%{release}
%if "%{python3_primary_provider}" != "python3"