Blame SOURCES/1002-Do-not-export-use-setools.InfoFlowAnalysis-and-setoo.patch

85d1e6
From e47d19f4985098ca316eea4a383510d419ec6055 Mon Sep 17 00:00:00 2001
85d1e6
From: Vit Mojzis <vmojzis@redhat.com>
85d1e6
Date: Fri, 26 Apr 2019 15:27:25 +0200
85d1e6
Subject: [PATCH 1/2] Do not export/use setools.InfoFlowAnalysis and
85d1e6
 setools.DomainTransitionAnalysis
85d1e6
85d1e6
dta and infoflow modules require networkx which brings lot of dependencies.
85d1e6
These dependencies are not necessary for setools module itself as it's
85d1e6
used in policycoreutils.
85d1e6
85d1e6
Therefore it's better to use setools.infoflow.InfoFlowAnalysis and
85d1e6
setools.dta.DomainTransitionAnalysis and let the package containing
85d1e6
sedta and seinfoflow to require python3-networkx
85d1e6
---
85d1e6
 sedta                       | 5 +++--
85d1e6
 seinfoflow                  | 4 ++--
85d1e6
 setools/__init__.py         | 4 ----
85d1e6
 setoolsgui/apol/dta.py      | 2 +-
85d1e6
 setoolsgui/apol/infoflow.py | 2 +-
85d1e6
 tests/dta.py                | 2 +-
85d1e6
 tests/infoflow.py           | 2 +-
85d1e6
 7 files changed, 9 insertions(+), 12 deletions(-)
85d1e6
85d1e6
diff --git a/sedta b/sedta
85d1e6
index 57070098fe10..51890ea8ea73 100755
85d1e6
--- a/sedta
85d1e6
+++ b/sedta
85d1e6
@@ -23,9 +23,10 @@ import logging
85d1e6
 import signal
85d1e6
 
85d1e6
 import setools
85d1e6
+import setools.dta
85d1e6
 
85d1e6
 
85d1e6
-def print_transition(trans: setools.DomainTransition) -> None:
85d1e6
+def print_transition(trans: setools.dta.DomainTransition) -> None:
85d1e6
     if trans.transition:
85d1e6
         print("Domain transition rule(s):")
85d1e6
         for t in trans.transition:
85d1e6
@@ -114,7 +115,7 @@ else:
85d1e6
 
85d1e6
 try:
85d1e6
     p = setools.SELinuxPolicy(args.policy)
85d1e6
-    g = setools.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
85d1e6
+    g = setools.dta.DomainTransitionAnalysis(p, reverse=args.reverse, exclude=args.exclude)
85d1e6
 
85d1e6
     if args.shortest_path or args.all_paths:
85d1e6
         if args.shortest_path:
85d1e6
diff --git a/seinfoflow b/seinfoflow
85d1e6
index 0ddcfdc7c1fb..8321718b2640 100755
85d1e6
--- a/seinfoflow
85d1e6
+++ b/seinfoflow
85d1e6
@@ -17,7 +17,7 @@
85d1e6
 # along with SETools.  If not, see <http://www.gnu.org/licenses/>.
85d1e6
 #
85d1e6
 
85d1e6
-import setools
85d1e6
+import setools.infoflow
85d1e6
 import argparse
85d1e6
 import sys
85d1e6
 import logging
85d1e6
@@ -102,7 +102,7 @@ elif args.booleans is not None:
85d1e6
 try:
85d1e6
     p = setools.SELinuxPolicy(args.policy)
85d1e6
     m = setools.PermissionMap(args.map)
85d1e6
-    g = setools.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude,
85d1e6
+    g = setools.infoflow.InfoFlowAnalysis(p, m, min_weight=args.min_weight, exclude=args.exclude,
85d1e6
                                  booleans=booleans)
85d1e6
 
85d1e6
     if args.shortest_path or args.all_paths:
85d1e6
diff --git a/setools/__init__.py b/setools/__init__.py
85d1e6
index d72d343e7e79..642485b9018d 100644
85d1e6
--- a/setools/__init__.py
85d1e6
+++ b/setools/__init__.py
85d1e6
@@ -91,12 +91,8 @@ from .pcideviceconquery import PcideviceconQuery
85d1e6
 from .devicetreeconquery import DevicetreeconQuery
85d1e6
 
85d1e6
 # Information Flow Analysis
85d1e6
-from .infoflow import InfoFlowAnalysis
85d1e6
 from .permmap import PermissionMap, RuleWeight, Mapping
85d1e6
 
85d1e6
-# Domain Transition Analysis
85d1e6
-from .dta import DomainTransitionAnalysis, DomainEntrypoint, DomainTransition
85d1e6
-
85d1e6
 # Policy difference
85d1e6
 from .diff import PolicyDifference
85d1e6
 
85d1e6
diff --git a/setoolsgui/apol/dta.py b/setoolsgui/apol/dta.py
85d1e6
index 62dbf04d9a5e..0ea000e790f0 100644
85d1e6
--- a/setoolsgui/apol/dta.py
85d1e6
+++ b/setoolsgui/apol/dta.py
85d1e6
@@ -24,7 +24,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
85d1e6
 from PyQt5.QtGui import QPalette, QTextCursor
85d1e6
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
85d1e6
     QTreeWidgetItem
85d1e6
-from setools import DomainTransitionAnalysis
85d1e6
+from setools.dta import DomainTransitionAnalysis
85d1e6
 
85d1e6
 from ..logtosignal import LogHandlerToSignal
85d1e6
 from .analysistab import AnalysisSection, AnalysisTab
85d1e6
diff --git a/setoolsgui/apol/infoflow.py b/setoolsgui/apol/infoflow.py
85d1e6
index 28009aa2329c..92d350bf727c 100644
85d1e6
--- a/setoolsgui/apol/infoflow.py
85d1e6
+++ b/setoolsgui/apol/infoflow.py
85d1e6
@@ -26,7 +26,7 @@ from PyQt5.QtCore import pyqtSignal, Qt, QStringListModel, QThread
85d1e6
 from PyQt5.QtGui import QPalette, QTextCursor
85d1e6
 from PyQt5.QtWidgets import QCompleter, QHeaderView, QMessageBox, QProgressDialog, \
85d1e6
     QTreeWidgetItem
85d1e6
-from setools import InfoFlowAnalysis
85d1e6
+from setools.infoflow import InfoFlowAnalysis
85d1e6
 from setools.exception import UnmappedClass, UnmappedPermission
85d1e6
 
85d1e6
 from ..logtosignal import LogHandlerToSignal
85d1e6
diff --git a/tests/dta.py b/tests/dta.py
85d1e6
index a0cc9381469c..177e6fb0b961 100644
85d1e6
--- a/tests/dta.py
85d1e6
+++ b/tests/dta.py
85d1e6
@@ -18,7 +18,7 @@
85d1e6
 import os
85d1e6
 import unittest
85d1e6
 
85d1e6
-from setools import DomainTransitionAnalysis
85d1e6
+from setools.dta import DomainTransitionAnalysis
85d1e6
 from setools import TERuletype as TERT
85d1e6
 from setools.exception import InvalidType
85d1e6
 from setools.policyrep import Type
85d1e6
diff --git a/tests/infoflow.py b/tests/infoflow.py
85d1e6
index aa0e44a7e4f8..fca2848aeca5 100644
85d1e6
--- a/tests/infoflow.py
85d1e6
+++ b/tests/infoflow.py
85d1e6
@@ -18,7 +18,7 @@
85d1e6
 import os
85d1e6
 import unittest
85d1e6
 
85d1e6
-from setools import InfoFlowAnalysis
85d1e6
+from setools.infoflow import InfoFlowAnalysis
85d1e6
 from setools import TERuletype as TERT
85d1e6
 from setools.exception import InvalidType
85d1e6
 from setools.permmap import PermissionMap
85d1e6
-- 
85d1e6
2.30.0
85d1e6