diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2020-11-05 14:04:58 +0800 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2020-11-15 11:03:39 -0800 |
commit | 080778ca97bd3b246237d8927d6e0ea96a738e04 (patch) | |
tree | b23c2d4a9605cc51e111b27c5cb1aff3d1025ae9 /meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-fix-deprecated-getiterator-function.patch | |
parent | c40e8f8d9dbdd7e2052033d9d50ebf8e4d883c69 (diff) | |
download | meta-security-080778ca97bd3b246237d8927d6e0ea96a738e04.tar.gz |
scap-security-guide: fix build with Python 3.9
The getchildren and getiterator functions are deprecated in Python 3.9.
Backport 3 patches to fix the build issue.
Fixes:
File
"/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/scap-security-guide/0.1.44+gitAUTOINC+5fdfdcb2e9-r0/git/ssg/build_stig.py",
line 41, in add_references
index = rule.getchildren().index(ref)
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-fix-deprecated-getiterator-function.patch')
-rw-r--r-- | meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-fix-deprecated-getiterator-function.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-fix-deprecated-getiterator-function.patch b/meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-fix-deprecated-getiterator-function.patch new file mode 100644 index 0000000..84271c4 --- /dev/null +++ b/meta-security-compliance/recipes-openscap/scap-security-guide/files/0002-fix-deprecated-getiterator-function.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | From b0adc1d53780def4a95e310b6d26bb91ee97177e Mon Sep 17 00:00:00 2001 | ||
2 | From: Vojtech Polasek <vpolasek@redhat.com> | ||
3 | Date: Mon, 8 Jun 2020 13:27:41 +0200 | ||
4 | Subject: [PATCH] fix deprecated getiterator function | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | [https://github.com/ComplianceAsCode/content/commit/b0adc1d53780def4a95e310b6d26bb91ee97177e] | ||
8 | |||
9 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
10 | --- | ||
11 | ssg/build_cpe.py | 6 +++--- | ||
12 | ssg/id_translate.py | 2 +- | ||
13 | 2 files changed, 4 insertions(+), 4 deletions(-) | ||
14 | |||
15 | diff --git a/ssg/build_cpe.py b/ssg/build_cpe.py | ||
16 | index 2e5d24a5d..8c046777a 100644 | ||
17 | --- a/ssg/build_cpe.py | ||
18 | +++ b/ssg/build_cpe.py | ||
19 | @@ -17,7 +17,7 @@ def extract_subelement(objects, sub_elem_type): | ||
20 | """ | ||
21 | |||
22 | for obj in objects: | ||
23 | - for subelement in obj.getiterator(): | ||
24 | + for subelement in obj.iter(): | ||
25 | if subelement.get(sub_elem_type): | ||
26 | sub_element = subelement.get(sub_elem_type) | ||
27 | return sub_element | ||
28 | @@ -44,12 +44,12 @@ def extract_referred_nodes(tree_with_refs, tree_with_ids, attrname): | ||
29 | reflist = [] | ||
30 | elementlist = [] | ||
31 | |||
32 | - for element in tree_with_refs.getiterator(): | ||
33 | + for element in tree_with_refs.iter(): | ||
34 | value = element.get(attrname) | ||
35 | if value is not None: | ||
36 | reflist.append(value) | ||
37 | |||
38 | - for element in tree_with_ids.getiterator(): | ||
39 | + for element in tree_with_ids.iter(): | ||
40 | if element.get("id") in reflist: | ||
41 | elementlist.append(element) | ||
42 | |||
43 | diff --git a/ssg/id_translate.py b/ssg/id_translate.py | ||
44 | index 72b07be18..ba9225904 100644 | ||
45 | --- a/ssg/id_translate.py | ||
46 | +++ b/ssg/id_translate.py | ||
47 | @@ -64,7 +64,7 @@ class IDTranslator(object): | ||
48 | ) | ||
49 | |||
50 | def translate(self, tree, store_defname=False): | ||
51 | - for element in tree.getiterator(): | ||
52 | + for element in tree.iter(): | ||
53 | idname = element.get("id") | ||
54 | if idname: | ||
55 | # store the old name if requested (for OVAL definitions) | ||
56 | -- | ||
57 | 2.17.1 | ||
58 | |||