diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2022-08-28 10:29:29 +0800 |
---|---|---|
committer | Joe MacDonald <joe@deserted.net> | 2022-08-28 13:54:59 -0400 |
commit | f355a62016027aa80032d7151fc373a5b46b0f30 (patch) | |
tree | 0046e8384a5679b47fec620e2397305eea6a365d | |
parent | 420efa1ba2b8358f452f5316b92bb637dfc42f2c (diff) | |
download | meta-selinux-f355a62016027aa80032d7151fc373a5b46b0f30.tar.gz |
selinux-python: upgrade 3.3 -> 3.4
* Backport a patch to fix chcat runtime error.
* Refresh patch.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
-rw-r--r-- | recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch | 173 | ||||
-rw-r--r-- | recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch | 4 | ||||
-rw-r--r-- | recipes-security/selinux/selinux-python_3.4.bb (renamed from recipes-security/selinux/selinux-python_3.3.bb) | 51 |
3 files changed, 201 insertions, 27 deletions
diff --git a/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch b/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch new file mode 100644 index 0000000..b83300d --- /dev/null +++ b/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch | |||
@@ -0,0 +1,173 @@ | |||
1 | From 4693794ff8c52f87a4abdb68fe9dae6618023c03 Mon Sep 17 00:00:00 2001 | ||
2 | From: Vit Mojzis <vmojzis@redhat.com> | ||
3 | Date: Fri, 24 Jun 2022 16:24:25 +0200 | ||
4 | Subject: [PATCH] gettext: handle unsupported languages properly | ||
5 | |||
6 | With "fallback=True" gettext.translation behaves the same as | ||
7 | gettext.install and uses NullTranslations in case the | ||
8 | translation file for given language was not found (as opposed to | ||
9 | throwing an exception). | ||
10 | |||
11 | Fixes: | ||
12 | # LANG is set to any "unsupported" language, e.g. en_US.UTF-8 | ||
13 | $ chcat --help | ||
14 | Traceback (most recent call last): | ||
15 | File "/usr/bin/chcat", line 39, in <module> | ||
16 | t = gettext.translation(PROGNAME, | ||
17 | File "/usr/lib64/python3.9/gettext.py", line 592, in translation | ||
18 | raise FileNotFoundError(ENOENT, | ||
19 | FileNotFoundError: [Errno 2] No translation file found for domain: 'selinux-python' | ||
20 | |||
21 | Signed-off-by: Vit Mojzis <vmojzis@redhat.com> | ||
22 | Reviewed-by: Daniel Burgener <dburgener@linux.microsoft.com> | ||
23 | Acked-by: Petr Lautrbach <plautrba@redhat.com> | ||
24 | |||
25 | Upstream-Status: Backport | ||
26 | [https://github.com/SELinuxProject/selinux/commit/344463076b2a91e1d2c7f5cc3835dc1a53a05e88] | ||
27 | |||
28 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
29 | --- | ||
30 | chcat/chcat | 5 +++-- | ||
31 | semanage/semanage | 3 ++- | ||
32 | semanage/seobject.py | 3 ++- | ||
33 | sepolgen/src/sepolgen/sepolgeni18n.py | 4 +++- | ||
34 | sepolicy/sepolicy.py | 3 ++- | ||
35 | sepolicy/sepolicy/__init__.py | 3 ++- | ||
36 | sepolicy/sepolicy/generate.py | 3 ++- | ||
37 | sepolicy/sepolicy/gui.py | 3 ++- | ||
38 | sepolicy/sepolicy/interface.py | 3 ++- | ||
39 | 9 files changed, 20 insertions(+), 10 deletions(-) | ||
40 | |||
41 | diff --git a/chcat/chcat b/chcat/chcat | ||
42 | index e779fcc..952cb81 100755 | ||
43 | --- a/chcat/chcat | ||
44 | +++ b/chcat/chcat | ||
45 | @@ -38,9 +38,10 @@ try: | ||
46 | kwargs['unicode'] = True | ||
47 | t = gettext.translation(PROGNAME, | ||
48 | localedir="/usr/share/locale", | ||
49 | - **kwargs) | ||
50 | + **kwargs, | ||
51 | + fallback=True) | ||
52 | _ = t.gettext | ||
53 | -except ImportError: | ||
54 | +except: | ||
55 | try: | ||
56 | import builtins | ||
57 | builtins.__dict__['_'] = str | ||
58 | diff --git a/semanage/semanage b/semanage/semanage | ||
59 | index 8f4e44a..f45061a 100644 | ||
60 | --- a/semanage/semanage | ||
61 | +++ b/semanage/semanage | ||
62 | @@ -38,7 +38,8 @@ try: | ||
63 | kwargs['unicode'] = True | ||
64 | t = gettext.translation(PROGNAME, | ||
65 | localedir="/usr/share/locale", | ||
66 | - **kwargs) | ||
67 | + **kwargs, | ||
68 | + fallback=True) | ||
69 | _ = t.gettext | ||
70 | except: | ||
71 | try: | ||
72 | diff --git a/semanage/seobject.py b/semanage/seobject.py | ||
73 | index ff8f4e9..0782c08 100644 | ||
74 | --- a/semanage/seobject.py | ||
75 | +++ b/semanage/seobject.py | ||
76 | @@ -42,7 +42,8 @@ try: | ||
77 | kwargs['unicode'] = True | ||
78 | t = gettext.translation(PROGNAME, | ||
79 | localedir="/usr/share/locale", | ||
80 | - **kwargs) | ||
81 | + **kwargs, | ||
82 | + fallback=True) | ||
83 | _ = t.gettext | ||
84 | except: | ||
85 | try: | ||
86 | diff --git a/sepolgen/src/sepolgen/sepolgeni18n.py b/sepolgen/src/sepolgen/sepolgeni18n.py | ||
87 | index 56ebd80..1ff307d 100644 | ||
88 | --- a/sepolgen/src/sepolgen/sepolgeni18n.py | ||
89 | +++ b/sepolgen/src/sepolgen/sepolgeni18n.py | ||
90 | @@ -19,7 +19,9 @@ | ||
91 | |||
92 | try: | ||
93 | import gettext | ||
94 | - t = gettext.translation( 'selinux-python' ) | ||
95 | + t = gettext.translation("selinux-python", | ||
96 | + localedir="/usr/share/locale", | ||
97 | + fallback=True) | ||
98 | _ = t.gettext | ||
99 | except: | ||
100 | def _(str): | ||
101 | diff --git a/sepolicy/sepolicy.py b/sepolicy/sepolicy.py | ||
102 | index 7ebe0ef..c7a70e0 100755 | ||
103 | --- a/sepolicy/sepolicy.py | ||
104 | +++ b/sepolicy/sepolicy.py | ||
105 | @@ -36,7 +36,8 @@ try: | ||
106 | kwargs['unicode'] = True | ||
107 | t = gettext.translation(PROGNAME, | ||
108 | localedir="/usr/share/locale", | ||
109 | - **kwargs) | ||
110 | + **kwargs, | ||
111 | + fallback=True) | ||
112 | _ = t.gettext | ||
113 | except: | ||
114 | try: | ||
115 | diff --git a/sepolicy/sepolicy/__init__.py b/sepolicy/sepolicy/__init__.py | ||
116 | index 7208234..9c3caa0 100644 | ||
117 | --- a/sepolicy/sepolicy/__init__.py | ||
118 | +++ b/sepolicy/sepolicy/__init__.py | ||
119 | @@ -31,7 +31,8 @@ try: | ||
120 | kwargs['unicode'] = True | ||
121 | t = gettext.translation(PROGNAME, | ||
122 | localedir="/usr/share/locale", | ||
123 | - **kwargs) | ||
124 | + **kwargs, | ||
125 | + fallback=True) | ||
126 | _ = t.gettext | ||
127 | except: | ||
128 | try: | ||
129 | diff --git a/sepolicy/sepolicy/generate.py b/sepolicy/sepolicy/generate.py | ||
130 | index 67189fc..3717d5d 100644 | ||
131 | --- a/sepolicy/sepolicy/generate.py | ||
132 | +++ b/sepolicy/sepolicy/generate.py | ||
133 | @@ -56,7 +56,8 @@ try: | ||
134 | kwargs['unicode'] = True | ||
135 | t = gettext.translation(PROGNAME, | ||
136 | localedir="/usr/share/locale", | ||
137 | - **kwargs) | ||
138 | + **kwargs, | ||
139 | + fallback=True) | ||
140 | _ = t.gettext | ||
141 | except: | ||
142 | try: | ||
143 | diff --git a/sepolicy/sepolicy/gui.py b/sepolicy/sepolicy/gui.py | ||
144 | index b026374..5bdbfeb 100644 | ||
145 | --- a/sepolicy/sepolicy/gui.py | ||
146 | +++ b/sepolicy/sepolicy/gui.py | ||
147 | @@ -49,7 +49,8 @@ try: | ||
148 | kwargs['unicode'] = True | ||
149 | t = gettext.translation(PROGNAME, | ||
150 | localedir="/usr/share/locale", | ||
151 | - **kwargs) | ||
152 | + **kwargs, | ||
153 | + fallback=True) | ||
154 | _ = t.gettext | ||
155 | except: | ||
156 | try: | ||
157 | diff --git a/sepolicy/sepolicy/interface.py b/sepolicy/sepolicy/interface.py | ||
158 | index 599f97f..43f8644 100644 | ||
159 | --- a/sepolicy/sepolicy/interface.py | ||
160 | +++ b/sepolicy/sepolicy/interface.py | ||
161 | @@ -38,7 +38,8 @@ try: | ||
162 | kwargs['unicode'] = True | ||
163 | t = gettext.translation(PROGNAME, | ||
164 | localedir="/usr/share/locale", | ||
165 | - **kwargs) | ||
166 | + **kwargs, | ||
167 | + fallback=True) | ||
168 | _ = t.gettext | ||
169 | except: | ||
170 | try: | ||
171 | -- | ||
172 | 2.25.1 | ||
173 | |||
diff --git a/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch b/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch index 4e91df7..bd14450 100644 --- a/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch +++ b/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From df40fadfb251cc2aebdbd2e216f99a8ae7da7763 Mon Sep 17 00:00:00 2001 | 1 | From d43220e336edf8ccaaa7bd3eb9c13874ed34d468 Mon Sep 17 00:00:00 2001 |
2 | From: Xin Ouyang <Xin.Ouyang@windriver.com> | 2 | From: Xin Ouyang <Xin.Ouyang@windriver.com> |
3 | Date: Mon, 23 Sep 2013 21:17:59 +0800 | 3 | Date: Mon, 23 Sep 2013 21:17:59 +0800 |
4 | Subject: [PATCH] sepolicy: fix install path for new pymodule sepolicy | 4 | Subject: [PATCH] sepolicy: fix install path for new pymodule sepolicy |
@@ -26,5 +26,5 @@ index 3361be4..5842321 100644 | |||
26 | install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy | 26 | install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy |
27 | (cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen) | 27 | (cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen) |
28 | -- | 28 | -- |
29 | 2.17.1 | 29 | 2.25.1 |
30 | 30 | ||
diff --git a/recipes-security/selinux/selinux-python_3.3.bb b/recipes-security/selinux/selinux-python_3.4.bb index 8f76718..cc279f2 100644 --- a/recipes-security/selinux/selinux-python_3.3.bb +++ b/recipes-security/selinux/selinux-python_3.4.bb | |||
@@ -10,40 +10,41 @@ require selinux_common.inc | |||
10 | 10 | ||
11 | inherit python3native | 11 | inherit python3native |
12 | 12 | ||
13 | SRC_URI += "file://fix-sepolicy-install-path.patch" | 13 | SRC_URI += "file://fix-sepolicy-install-path.patch \ |
14 | file://0001-gettext-handle-unsupported-languages-properly.patch \ | ||
15 | " | ||
14 | 16 | ||
15 | S = "${WORKDIR}/git/python" | 17 | S = "${WORKDIR}/git/python" |
16 | 18 | ||
17 | EXTRA_OEMAKE += "LIBSEPOLA=${STAGING_LIBDIR}/libsepol.a" | 19 | DEPENDS = "libsepol libselinux gettext-native" |
18 | 20 | ||
19 | DEPENDS += "python3 libsepol libselinux" | 21 | RDEPENDS:${PN} = "\ |
20 | RDEPENDS:${BPN}-audit2allow += "\ | ||
21 | python3-core \ | ||
22 | libselinux-python \ | ||
23 | ${BPN}-sepolgen \ | ||
24 | " | ||
25 | RDEPENDS:${BPN}-chcat += "\ | ||
26 | python3-core \ | 22 | python3-core \ |
27 | python3-codecs \ | 23 | python3-codecs \ |
28 | python3-shell \ | 24 | python3-io \ |
25 | python3-ipy \ | ||
29 | python3-stringold \ | 26 | python3-stringold \ |
27 | python3-syslog \ | ||
30 | python3-unixadmin \ | 28 | python3-unixadmin \ |
31 | libselinux-python \ | 29 | libselinux-python \ |
32 | ${BPN} \ | 30 | libsemanage-python \ |
31 | setools \ | ||
33 | " | 32 | " |
34 | RDEPENDS:${BPN} += "\ | 33 | RDEPENDS:${PN}-audit2allow = "\ |
34 | python3-core \ | ||
35 | libselinux-python \ | ||
36 | ${PN}-sepolgen \ | ||
37 | " | ||
38 | RDEPENDS:${PN}-chcat = "\ | ||
35 | python3-core \ | 39 | python3-core \ |
36 | python3-codecs \ | 40 | python3-codecs \ |
37 | python3-io \ | 41 | python3-shell \ |
38 | python3-ipy \ | ||
39 | python3-stringold \ | 42 | python3-stringold \ |
40 | python3-syslog \ | ||
41 | python3-unixadmin \ | 43 | python3-unixadmin \ |
42 | libselinux-python \ | 44 | libselinux-python \ |
43 | libsemanage-python \ | 45 | ${PN} \ |
44 | setools \ | ||
45 | " | 46 | " |
46 | RDEPENDS:${BPN}-semanage += "\ | 47 | RDEPENDS:${PN}-semanage = "\ |
47 | python3-core \ | 48 | python3-core \ |
48 | python3-ipy \ | 49 | python3-ipy \ |
49 | python3-compression \ | 50 | python3-compression \ |
@@ -51,16 +52,16 @@ RDEPENDS:${BPN}-semanage += "\ | |||
51 | python3-misc \ | 52 | python3-misc \ |
52 | libselinux-python \ | 53 | libselinux-python \ |
53 | audit-python \ | 54 | audit-python \ |
54 | ${BPN} \ | 55 | ${PN} \ |
55 | " | 56 | " |
56 | RDEPENDS:${BPN}-sepolicy += "\ | 57 | RDEPENDS:${PN}-sepolicy = "\ |
57 | python3-core \ | 58 | python3-core \ |
58 | python3-codecs \ | 59 | python3-codecs \ |
59 | python3-syslog \ | 60 | python3-syslog \ |
60 | python3-multiprocessing \ | 61 | python3-multiprocessing \ |
61 | ${BPN} \ | 62 | ${PN} \ |
62 | " | 63 | " |
63 | RDEPENDS:${BPN}-sepolgen-ifgen += "\ | 64 | RDEPENDS:${PN}-sepolgen-ifgen = "\ |
64 | python3-core \ | 65 | python3-core \ |
65 | libselinux-python \ | 66 | libselinux-python \ |
66 | " | 67 | " |
@@ -85,16 +86,16 @@ FILES:${PN}-semanage = "\ | |||
85 | ${datadir}/bash-completion/completions/semanage \ | 86 | ${datadir}/bash-completion/completions/semanage \ |
86 | " | 87 | " |
87 | # The ${bindir}/sepolgen is a symlink to ${bindir}/sepolicy | 88 | # The ${bindir}/sepolgen is a symlink to ${bindir}/sepolicy |
88 | FILES:${PN}-sepolicy += "\ | 89 | FILES:${PN}-sepolicy = "\ |
89 | ${bindir}/sepolgen \ | 90 | ${bindir}/sepolgen \ |
90 | ${bindir}/sepolicy \ | 91 | ${bindir}/sepolicy \ |
91 | ${datadir}/bash-completion/completions/sepolicy \ | 92 | ${datadir}/bash-completion/completions/sepolicy \ |
92 | " | 93 | " |
93 | FILES:${PN}-sepolgen-ifgen += "\ | 94 | FILES:${PN}-sepolgen-ifgen = "\ |
94 | ${bindir}/sepolgen-ifgen \ | 95 | ${bindir}/sepolgen-ifgen \ |
95 | ${bindir}/sepolgen-ifgen-attr-helper \ | 96 | ${bindir}/sepolgen-ifgen-attr-helper \ |
96 | " | 97 | " |
97 | FILES:${PN}-sepolgen += "\ | 98 | FILES:${PN}-sepolgen = "\ |
98 | ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolgen* \ | 99 | ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolgen* \ |
99 | ${localstatedir}/lib/sepolgen/perm_map \ | 100 | ${localstatedir}/lib/sepolgen/perm_map \ |
100 | " | 101 | " |