summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2019-03-07 16:32:59 +0800
committerArmin Kuster <akuster808@gmail.com>2019-03-08 14:51:55 -0800
commit70802667abf5f93339a0bb2f0c1f033896b11e39 (patch)
tree86feedebf89a2f3f1b9363aabb0b747e8848384e
parentb081fdc80788d88bca7e3fad53e55d5bfb35642b (diff)
downloadmeta-security-70802667abf5f93339a0bb2f0c1f033896b11e39.tar.gz
openscap-daemon: backport patch to fix build error with python 3.7
Fixes build error: | Traceback (most recent call last): | File "setup.py", line 25, in <module> | from openscap_daemon import version | File "/buildarea/build/tmp/work/core2-64-poky-linux/openscap-daemon/0.1.10-r0/git/openscap_daemon/__init__.py", line 22, in <module> | from openscap_daemon.system import System | File "/buildarea/build/tmp/work/core2-64-poky-linux/openscap-daemon/0.1.10-r0/git/openscap_daemon/system.py", line 29 | from openscap_daemon import async | ^ | SyntaxError: invalid syntax Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-security-compliance/recipes-openscap/openscap-daemon/files/0001-Renamed-module-and-variables-to-get-rid-of-async.patch130
-rw-r--r--meta-security-compliance/recipes-openscap/openscap-daemon/openscap-daemon_0.1.10.bb4
2 files changed, 133 insertions, 1 deletions
diff --git a/meta-security-compliance/recipes-openscap/openscap-daemon/files/0001-Renamed-module-and-variables-to-get-rid-of-async.patch b/meta-security-compliance/recipes-openscap/openscap-daemon/files/0001-Renamed-module-and-variables-to-get-rid-of-async.patch
new file mode 100644
index 0000000..2a518bf
--- /dev/null
+++ b/meta-security-compliance/recipes-openscap/openscap-daemon/files/0001-Renamed-module-and-variables-to-get-rid-of-async.patch
@@ -0,0 +1,130 @@
1From c34349720a57997d30946286756e2ba9dbab6ace Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
3Date: Mon, 2 Jul 2018 11:21:19 +0200
4Subject: [PATCH] Renamed module and variables to get rid of async.
5
6async is a reserved word in Python 3.7.
7
8Upstream-Status: Backport
9[https://github.com/OpenSCAP/openscap-daemon/commit/c34349720a57997d30946286756e2ba9dbab6ace]
10
11Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
12---
13 openscap_daemon/{async.py => async_tools.py} | 0
14 openscap_daemon/dbus_daemon.py | 2 +-
15 openscap_daemon/system.py | 16 ++++++++--------
16 tests/unit/test_basic_update.py | 3 ++-
17 4 files changed, 11 insertions(+), 10 deletions(-)
18 rename openscap_daemon/{async.py => async_tools.py} (100%)
19
20diff --git a/openscap_daemon/async.py b/openscap_daemon/async_tools.py
21similarity index 100%
22rename from openscap_daemon/async.py
23rename to openscap_daemon/async_tools.py
24diff --git a/openscap_daemon/dbus_daemon.py b/openscap_daemon/dbus_daemon.py
25index e6eadf9..cb6a8b6 100644
26--- a/openscap_daemon/dbus_daemon.py
27+++ b/openscap_daemon/dbus_daemon.py
28@@ -81,7 +81,7 @@ class OpenSCAPDaemonDbus(dbus.service.Object):
29 @dbus.service.method(dbus_interface=dbus_utils.DBUS_INTERFACE,
30 in_signature="", out_signature="a(xsi)")
31 def GetAsyncActionsStatus(self):
32- return self.system.async.get_status()
33+ return self.system.async_manager.get_status()
34
35 @dbus.service.method(dbus_interface=dbus_utils.DBUS_INTERFACE,
36 in_signature="s", out_signature="(sssn)")
37diff --git a/openscap_daemon/system.py b/openscap_daemon/system.py
38index 2012f6e..85c2680 100644
39--- a/openscap_daemon/system.py
40+++ b/openscap_daemon/system.py
41@@ -26,7 +26,7 @@ import logging
42 from openscap_daemon.task import Task
43 from openscap_daemon.config import Configuration
44 from openscap_daemon import oscap_helpers
45-from openscap_daemon import async
46+from openscap_daemon import async_tools
47
48
49 class ResultsNotAvailable(Exception):
50@@ -40,7 +40,7 @@ TASK_ACTION_PRIORITY = 10
51
52 class System(object):
53 def __init__(self, config_file):
54- self.async = async.AsyncManager()
55+ self.async_manager = async_tools.AsyncManager()
56
57 logging.info("Loading configuration from '%s'.", config_file)
58 self.config = Configuration()
59@@ -90,7 +90,7 @@ class System(object):
60 input_file, tailoring_file, None
61 )
62
63- class AsyncEvaluateSpecAction(async.AsyncAction):
64+ class AsyncEvaluateSpecAction(async_tools.AsyncAction):
65 def __init__(self, system, spec):
66 super(System.AsyncEvaluateSpecAction, self).__init__()
67
68@@ -113,7 +113,7 @@ class System(object):
69 return "Evaluate Spec '%s'" % (self.spec)
70
71 def evaluate_spec_async(self, spec):
72- return self.async.enqueue(
73+ return self.async_manager.enqueue(
74 System.AsyncEvaluateSpecAction(
75 self,
76 spec
77@@ -488,7 +488,7 @@ class System(object):
78
79 return ret
80
81- class AsyncUpdateTaskAction(async.AsyncAction):
82+ class AsyncUpdateTaskAction(async_tools.AsyncAction):
83 def __init__(self, system, task_id, reference_datetime):
84 super(System.AsyncUpdateTaskAction, self).__init__()
85
86@@ -536,7 +536,7 @@ class System(object):
87
88 if task.should_be_updated(reference_datetime):
89 self.tasks_scheduled.add(task.id_)
90- self.async.enqueue(
91+ self.async_manager.enqueue(
92 System.AsyncUpdateTaskAction(
93 self,
94 task.id_,
95@@ -662,7 +662,7 @@ class System(object):
96 fix_type
97 )
98
99- class AsyncEvaluateCVEScannerWorkerAction(async.AsyncAction):
100+ class AsyncEvaluateCVEScannerWorkerAction(async_tools.AsyncAction):
101 def __init__(self, system, worker):
102 super(System.AsyncEvaluateCVEScannerWorkerAction, self).__init__()
103
104@@ -680,7 +680,7 @@ class System(object):
105 return "Evaluate CVE Scanner Worker '%s'" % (self.worker)
106
107 def evaluate_cve_scanner_worker_async(self, worker):
108- return self.async.enqueue(
109+ return self.async_manager.enqueue(
110 System.AsyncEvaluateCVEScannerWorkerAction(
111 self,
112 worker
113diff --git a/tests/unit/test_basic_update.py b/tests/unit/test_basic_update.py
114index 6f683e6..7f953f7 100755
115--- a/tests/unit/test_basic_update.py
116+++ b/tests/unit/test_basic_update.py
117@@ -37,8 +37,9 @@ class BasicUpdateTest(unit_test_harness.APITest):
118 print(self.system.tasks)
119 self.system.schedule_tasks()
120
121- while len(self.system.async.actions) > 0:
122+ while len(self.system.async_manager.actions) > 0:
123 time.sleep(1)
124
125+
126 if __name__ == "__main__":
127 BasicUpdateTest.run()
128--
1292.7.4
130
diff --git a/meta-security-compliance/recipes-openscap/openscap-daemon/openscap-daemon_0.1.10.bb b/meta-security-compliance/recipes-openscap/openscap-daemon/openscap-daemon_0.1.10.bb
index a6a9373..ca6e030 100644
--- a/meta-security-compliance/recipes-openscap/openscap-daemon/openscap-daemon_0.1.10.bb
+++ b/meta-security-compliance/recipes-openscap/openscap-daemon/openscap-daemon_0.1.10.bb
@@ -9,7 +9,9 @@ LICENSE = "LGPL-2.1"
9DEPENDS = "python3-dbus" 9DEPENDS = "python3-dbus"
10 10
11SRCREV = "f25b16afb6ac761fea13132ff406fba4cdfd2b76" 11SRCREV = "f25b16afb6ac761fea13132ff406fba4cdfd2b76"
12SRC_URI = "git://github.com/OpenSCAP/openscap-daemon.git" 12SRC_URI = "git://github.com/OpenSCAP/openscap-daemon.git \
13 file://0001-Renamed-module-and-variables-to-get-rid-of-async.patch \
14 "
13 15
14inherit setuptools3 16inherit setuptools3
15 17