summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2023-03-11 21:13:04 +0800
committerJoe MacDonald <joe@deserted.net>2023-03-27 09:34:02 -0400
commitff424dc4cfb6e214df1f17ef549aa809bcbac13e (patch)
tree14fa8b8549cf67864cca83a2c13fd7c3dbc9d61d
parent1f4cefc8821f88627db3c3630cf0f5c7c643bfc1 (diff)
downloadmeta-selinux-ff424dc4cfb6e214df1f17ef549aa809bcbac13e.tar.gz
selinux-python: upgrade 3.4 -> 3.5
License-Update: Rename COPYING to LICENSE. No content changes. * Refresh patch. * Drop backport patch. * Add dependency python3-setuptools-scm-native to fix build error. 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.patch173
-rw-r--r--recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch8
-rw-r--r--recipes-security/selinux/selinux-python_3.5.bb (renamed from recipes-security/selinux/selinux-python_3.4.bb)24
3 files changed, 19 insertions, 186 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
deleted file mode 100644
index b83300d..0000000
--- a/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch
+++ /dev/null
@@ -1,173 +0,0 @@
1From 4693794ff8c52f87a4abdb68fe9dae6618023c03 Mon Sep 17 00:00:00 2001
2From: Vit Mojzis <vmojzis@redhat.com>
3Date: Fri, 24 Jun 2022 16:24:25 +0200
4Subject: [PATCH] gettext: handle unsupported languages properly
5
6With "fallback=True" gettext.translation behaves the same as
7gettext.install and uses NullTranslations in case the
8translation file for given language was not found (as opposed to
9throwing an exception).
10
11Fixes:
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
21Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
22Reviewed-by: Daniel Burgener <dburgener@linux.microsoft.com>
23Acked-by: Petr Lautrbach <plautrba@redhat.com>
24
25Upstream-Status: Backport
26[https://github.com/SELinuxProject/selinux/commit/344463076b2a91e1d2c7f5cc3835dc1a53a05e88]
27
28Signed-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
41diff --git a/chcat/chcat b/chcat/chcat
42index 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
58diff --git a/semanage/semanage b/semanage/semanage
59index 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:
72diff --git a/semanage/seobject.py b/semanage/seobject.py
73index 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:
86diff --git a/sepolgen/src/sepolgen/sepolgeni18n.py b/sepolgen/src/sepolgen/sepolgeni18n.py
87index 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):
101diff --git a/sepolicy/sepolicy.py b/sepolicy/sepolicy.py
102index 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:
115diff --git a/sepolicy/sepolicy/__init__.py b/sepolicy/sepolicy/__init__.py
116index 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:
129diff --git a/sepolicy/sepolicy/generate.py b/sepolicy/sepolicy/generate.py
130index 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:
143diff --git a/sepolicy/sepolicy/gui.py b/sepolicy/sepolicy/gui.py
144index 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:
157diff --git a/sepolicy/sepolicy/interface.py b/sepolicy/sepolicy/interface.py
158index 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--
1722.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 bd14450..5eb2e54 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 @@
1From d43220e336edf8ccaaa7bd3eb9c13874ed34d468 Mon Sep 17 00:00:00 2001 1From 2a0c2489e9d245502e7a9dc5878da01f9d64db2a Mon Sep 17 00:00:00 2001
2From: Xin Ouyang <Xin.Ouyang@windriver.com> 2From: Xin Ouyang <Xin.Ouyang@windriver.com>
3Date: Mon, 23 Sep 2013 21:17:59 +0800 3Date: Mon, 23 Sep 2013 21:17:59 +0800
4Subject: [PATCH] sepolicy: fix install path for new pymodule sepolicy 4Subject: [PATCH] sepolicy: fix install path for new pymodule sepolicy
@@ -13,15 +13,15 @@ Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
13 1 file changed, 1 insertion(+), 1 deletion(-) 13 1 file changed, 1 insertion(+), 1 deletion(-)
14 14
15diff --git a/sepolicy/Makefile b/sepolicy/Makefile 15diff --git a/sepolicy/Makefile b/sepolicy/Makefile
16index 3361be4..5842321 100644 16index 4e9e93d..512aab5 100644
17--- a/sepolicy/Makefile 17--- a/sepolicy/Makefile
18+++ b/sepolicy/Makefile 18+++ b/sepolicy/Makefile
19@@ -27,7 +27,7 @@ test: 19@@ -27,7 +27,7 @@ test:
20 @$(PYTHON) test_sepolicy.py -v 20 @$(PYTHON) test_sepolicy.py -v
21 21
22 install: 22 install:
23- $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) 23- $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
24+ $(PYTHON) setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) --install-lib=$(PYTHONLIBDIR) --no-compile $(PYTHON_SETUP_ARGS) 24+ $(PYTHON) -m pip install --prefix=$(PREFIX) --root $(DESTDIR) --ignore-installed --no-deps $(PYTHON_SETUP_ARGS) .
25 [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) 25 [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
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)
diff --git a/recipes-security/selinux/selinux-python_3.4.bb b/recipes-security/selinux/selinux-python_3.5.bb
index cc279f2..9ff63db 100644
--- a/recipes-security/selinux/selinux-python_3.4.bb
+++ b/recipes-security/selinux/selinux-python_3.5.bb
@@ -4,19 +4,18 @@ This package contains Python modules sepolgen, sepolicy; And the \
4SELinux utilities audit2allow, chcat, semanage ..." 4SELinux utilities audit2allow, chcat, semanage ..."
5SECTION = "base" 5SECTION = "base"
6LICENSE = "GPL-2.0-or-later" 6LICENSE = "GPL-2.0-or-later"
7LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=393a5ca445f6965873eca0259a17f833" 7LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=393a5ca445f6965873eca0259a17f833"
8 8
9require selinux_common.inc 9require selinux_common.inc
10 10
11inherit python3native 11inherit python3targetconfig
12 12
13SRC_URI += "file://fix-sepolicy-install-path.patch \ 13SRC_URI += "file://fix-sepolicy-install-path.patch \
14 file://0001-gettext-handle-unsupported-languages-properly.patch \
15 " 14 "
16 15
17S = "${WORKDIR}/git/python" 16S = "${WORKDIR}/git/python"
18 17
19DEPENDS = "libsepol libselinux gettext-native" 18DEPENDS = "libsepol libselinux gettext-native python3-setuptools-scm-native"
20 19
21RDEPENDS:${PN} = "\ 20RDEPENDS:${PN} = "\
22 python3-core \ 21 python3-core \
@@ -96,19 +95,26 @@ FILES:${PN}-sepolgen-ifgen = "\
96 ${bindir}/sepolgen-ifgen-attr-helper \ 95 ${bindir}/sepolgen-ifgen-attr-helper \
97" 96"
98FILES:${PN}-sepolgen = "\ 97FILES:${PN}-sepolgen = "\
99 ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolgen* \ 98 ${PYTHON_SITEPACKAGES_DIR}/sepolgen* \
100 ${localstatedir}/lib/sepolgen/perm_map \ 99 ${localstatedir}/lib/sepolgen/perm_map \
101" 100"
102 101
103FILES:${PN} += "\ 102FILES:${PN} += "\
104 ${libdir}/python${PYTHON_BASEVERSION}/site-packages/seobject.py* \ 103 ${PYTHON_SITEPACKAGES_DIR}/seobject.py* \
105 ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy*.egg-info \ 104 ${PYTHON_SITEPACKAGES_DIR}/sepolicy*.dist-info \
106 ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy/* \ 105 ${PYTHON_SITEPACKAGES_DIR}/sepolicy/* \
107" 106"
108 107
109do_install() { 108do_install() {
110 oe_runmake DESTDIR="${D}" \ 109 oe_runmake DESTDIR="${D}" \
111 PYLIBVER='python${PYTHON_BASEVERSION}' \ 110 PYLIBVER='python${PYTHON_BASEVERSION}' \
112 PYTHONLIBDIR='${libdir}/python${PYTHON_BASEVERSION}/site-packages' \ 111 PYTHONLIBDIR='${PYTHON_SITEPACKAGES_DIR}' \
113 install 112 install
113
114 # Remove .pyc files
115 find ${D} -name *.pyc -delete
116
117 # Fix buildpaths issue
118 sed -i -e 's,${WORKDIR},,g' \
119 ${D}${PYTHON_SITEPACKAGES_DIR}/sepolicy-${PV}.dist-info/direct_url.json
114} 120}