From ff424dc4cfb6e214df1f17ef549aa809bcbac13e Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Sat, 11 Mar 2023 21:13:04 +0800 Subject: 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 Signed-off-by: Joe MacDonald --- ...ext-handle-unsupported-languages-properly.patch | 173 --------------------- .../selinux-python/fix-sepolicy-install-path.patch | 8 +- recipes-security/selinux/selinux-python_3.4.bb | 114 -------------- recipes-security/selinux/selinux-python_3.5.bb | 120 ++++++++++++++ 4 files changed, 124 insertions(+), 291 deletions(-) delete mode 100644 recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch delete mode 100644 recipes-security/selinux/selinux-python_3.4.bb create mode 100644 recipes-security/selinux/selinux-python_3.5.bb 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 @@ -From 4693794ff8c52f87a4abdb68fe9dae6618023c03 Mon Sep 17 00:00:00 2001 -From: Vit Mojzis -Date: Fri, 24 Jun 2022 16:24:25 +0200 -Subject: [PATCH] gettext: handle unsupported languages properly - -With "fallback=True" gettext.translation behaves the same as -gettext.install and uses NullTranslations in case the -translation file for given language was not found (as opposed to -throwing an exception). - -Fixes: - # LANG is set to any "unsupported" language, e.g. en_US.UTF-8 - $ chcat --help - Traceback (most recent call last): - File "/usr/bin/chcat", line 39, in - t = gettext.translation(PROGNAME, - File "/usr/lib64/python3.9/gettext.py", line 592, in translation - raise FileNotFoundError(ENOENT, - FileNotFoundError: [Errno 2] No translation file found for domain: 'selinux-python' - -Signed-off-by: Vit Mojzis -Reviewed-by: Daniel Burgener -Acked-by: Petr Lautrbach - -Upstream-Status: Backport -[https://github.com/SELinuxProject/selinux/commit/344463076b2a91e1d2c7f5cc3835dc1a53a05e88] - -Signed-off-by: Yi Zhao ---- - chcat/chcat | 5 +++-- - semanage/semanage | 3 ++- - semanage/seobject.py | 3 ++- - sepolgen/src/sepolgen/sepolgeni18n.py | 4 +++- - sepolicy/sepolicy.py | 3 ++- - sepolicy/sepolicy/__init__.py | 3 ++- - sepolicy/sepolicy/generate.py | 3 ++- - sepolicy/sepolicy/gui.py | 3 ++- - sepolicy/sepolicy/interface.py | 3 ++- - 9 files changed, 20 insertions(+), 10 deletions(-) - -diff --git a/chcat/chcat b/chcat/chcat -index e779fcc..952cb81 100755 ---- a/chcat/chcat -+++ b/chcat/chcat -@@ -38,9 +38,10 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext --except ImportError: -+except: - try: - import builtins - builtins.__dict__['_'] = str -diff --git a/semanage/semanage b/semanage/semanage -index 8f4e44a..f45061a 100644 ---- a/semanage/semanage -+++ b/semanage/semanage -@@ -38,7 +38,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: -diff --git a/semanage/seobject.py b/semanage/seobject.py -index ff8f4e9..0782c08 100644 ---- a/semanage/seobject.py -+++ b/semanage/seobject.py -@@ -42,7 +42,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: -diff --git a/sepolgen/src/sepolgen/sepolgeni18n.py b/sepolgen/src/sepolgen/sepolgeni18n.py -index 56ebd80..1ff307d 100644 ---- a/sepolgen/src/sepolgen/sepolgeni18n.py -+++ b/sepolgen/src/sepolgen/sepolgeni18n.py -@@ -19,7 +19,9 @@ - - try: - import gettext -- t = gettext.translation( 'selinux-python' ) -+ t = gettext.translation("selinux-python", -+ localedir="/usr/share/locale", -+ fallback=True) - _ = t.gettext - except: - def _(str): -diff --git a/sepolicy/sepolicy.py b/sepolicy/sepolicy.py -index 7ebe0ef..c7a70e0 100755 ---- a/sepolicy/sepolicy.py -+++ b/sepolicy/sepolicy.py -@@ -36,7 +36,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: -diff --git a/sepolicy/sepolicy/__init__.py b/sepolicy/sepolicy/__init__.py -index 7208234..9c3caa0 100644 ---- a/sepolicy/sepolicy/__init__.py -+++ b/sepolicy/sepolicy/__init__.py -@@ -31,7 +31,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: -diff --git a/sepolicy/sepolicy/generate.py b/sepolicy/sepolicy/generate.py -index 67189fc..3717d5d 100644 ---- a/sepolicy/sepolicy/generate.py -+++ b/sepolicy/sepolicy/generate.py -@@ -56,7 +56,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: -diff --git a/sepolicy/sepolicy/gui.py b/sepolicy/sepolicy/gui.py -index b026374..5bdbfeb 100644 ---- a/sepolicy/sepolicy/gui.py -+++ b/sepolicy/sepolicy/gui.py -@@ -49,7 +49,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: -diff --git a/sepolicy/sepolicy/interface.py b/sepolicy/sepolicy/interface.py -index 599f97f..43f8644 100644 ---- a/sepolicy/sepolicy/interface.py -+++ b/sepolicy/sepolicy/interface.py -@@ -38,7 +38,8 @@ try: - kwargs['unicode'] = True - t = gettext.translation(PROGNAME, - localedir="/usr/share/locale", -- **kwargs) -+ **kwargs, -+ fallback=True) - _ = t.gettext - except: - try: --- -2.25.1 - 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 @@ -From d43220e336edf8ccaaa7bd3eb9c13874ed34d468 Mon Sep 17 00:00:00 2001 +From 2a0c2489e9d245502e7a9dc5878da01f9d64db2a Mon Sep 17 00:00:00 2001 From: Xin Ouyang Date: Mon, 23 Sep 2013 21:17:59 +0800 Subject: [PATCH] sepolicy: fix install path for new pymodule sepolicy @@ -13,15 +13,15 @@ Signed-off-by: Yi Zhao 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sepolicy/Makefile b/sepolicy/Makefile -index 3361be4..5842321 100644 +index 4e9e93d..512aab5 100644 --- a/sepolicy/Makefile +++ b/sepolicy/Makefile @@ -27,7 +27,7 @@ test: @$(PYTHON) test_sepolicy.py -v install: -- $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) -+ $(PYTHON) setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) --install-lib=$(PYTHONLIBDIR) --no-compile $(PYTHON_SETUP_ARGS) +- $(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) . ++ $(PYTHON) -m pip install --prefix=$(PREFIX) --root $(DESTDIR) --ignore-installed --no-deps $(PYTHON_SETUP_ARGS) . [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy (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.4.bb deleted file mode 100644 index cc279f2..0000000 --- a/recipes-security/selinux/selinux-python_3.4.bb +++ /dev/null @@ -1,114 +0,0 @@ -SUMMARY = "Python modules and various SELinux utilities." -DESCRIPTION = "\ -This package contains Python modules sepolgen, sepolicy; And the \ -SELinux utilities audit2allow, chcat, semanage ..." -SECTION = "base" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=393a5ca445f6965873eca0259a17f833" - -require selinux_common.inc - -inherit python3native - -SRC_URI += "file://fix-sepolicy-install-path.patch \ - file://0001-gettext-handle-unsupported-languages-properly.patch \ - " - -S = "${WORKDIR}/git/python" - -DEPENDS = "libsepol libselinux gettext-native" - -RDEPENDS:${PN} = "\ - python3-core \ - python3-codecs \ - python3-io \ - python3-ipy \ - python3-stringold \ - python3-syslog \ - python3-unixadmin \ - libselinux-python \ - libsemanage-python \ - setools \ -" -RDEPENDS:${PN}-audit2allow = "\ - python3-core \ - libselinux-python \ - ${PN}-sepolgen \ -" -RDEPENDS:${PN}-chcat = "\ - python3-core \ - python3-codecs \ - python3-shell \ - python3-stringold \ - python3-unixadmin \ - libselinux-python \ - ${PN} \ -" -RDEPENDS:${PN}-semanage = "\ - python3-core \ - python3-ipy \ - python3-compression \ - python3-xml \ - python3-misc \ - libselinux-python \ - audit-python \ - ${PN} \ -" -RDEPENDS:${PN}-sepolicy = "\ - python3-core \ - python3-codecs \ - python3-syslog \ - python3-multiprocessing \ - ${PN} \ -" -RDEPENDS:${PN}-sepolgen-ifgen = "\ - python3-core \ - libselinux-python \ -" - -PACKAGES =+ "\ - ${PN}-audit2allow \ - ${PN}-sepolgen-ifgen \ - ${PN}-chcat \ - ${PN}-semanage \ - ${PN}-sepolgen \ - ${PN}-sepolicy \ -" -FILES:${PN}-audit2allow = "\ - ${bindir}/audit2allow \ - ${bindir}/audit2why \ -" -FILES:${PN}-chcat = "\ - ${bindir}/chcat \ -" -FILES:${PN}-semanage = "\ - ${sbindir}/semanage \ - ${datadir}/bash-completion/completions/semanage \ -" -# The ${bindir}/sepolgen is a symlink to ${bindir}/sepolicy -FILES:${PN}-sepolicy = "\ - ${bindir}/sepolgen \ - ${bindir}/sepolicy \ - ${datadir}/bash-completion/completions/sepolicy \ -" -FILES:${PN}-sepolgen-ifgen = "\ - ${bindir}/sepolgen-ifgen \ - ${bindir}/sepolgen-ifgen-attr-helper \ -" -FILES:${PN}-sepolgen = "\ - ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolgen* \ - ${localstatedir}/lib/sepolgen/perm_map \ -" - -FILES:${PN} += "\ - ${libdir}/python${PYTHON_BASEVERSION}/site-packages/seobject.py* \ - ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy*.egg-info \ - ${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy/* \ -" - -do_install() { - oe_runmake DESTDIR="${D}" \ - PYLIBVER='python${PYTHON_BASEVERSION}' \ - PYTHONLIBDIR='${libdir}/python${PYTHON_BASEVERSION}/site-packages' \ - install -} diff --git a/recipes-security/selinux/selinux-python_3.5.bb b/recipes-security/selinux/selinux-python_3.5.bb new file mode 100644 index 0000000..9ff63db --- /dev/null +++ b/recipes-security/selinux/selinux-python_3.5.bb @@ -0,0 +1,120 @@ +SUMMARY = "Python modules and various SELinux utilities." +DESCRIPTION = "\ +This package contains Python modules sepolgen, sepolicy; And the \ +SELinux utilities audit2allow, chcat, semanage ..." +SECTION = "base" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=393a5ca445f6965873eca0259a17f833" + +require selinux_common.inc + +inherit python3targetconfig + +SRC_URI += "file://fix-sepolicy-install-path.patch \ + " + +S = "${WORKDIR}/git/python" + +DEPENDS = "libsepol libselinux gettext-native python3-setuptools-scm-native" + +RDEPENDS:${PN} = "\ + python3-core \ + python3-codecs \ + python3-io \ + python3-ipy \ + python3-stringold \ + python3-syslog \ + python3-unixadmin \ + libselinux-python \ + libsemanage-python \ + setools \ +" +RDEPENDS:${PN}-audit2allow = "\ + python3-core \ + libselinux-python \ + ${PN}-sepolgen \ +" +RDEPENDS:${PN}-chcat = "\ + python3-core \ + python3-codecs \ + python3-shell \ + python3-stringold \ + python3-unixadmin \ + libselinux-python \ + ${PN} \ +" +RDEPENDS:${PN}-semanage = "\ + python3-core \ + python3-ipy \ + python3-compression \ + python3-xml \ + python3-misc \ + libselinux-python \ + audit-python \ + ${PN} \ +" +RDEPENDS:${PN}-sepolicy = "\ + python3-core \ + python3-codecs \ + python3-syslog \ + python3-multiprocessing \ + ${PN} \ +" +RDEPENDS:${PN}-sepolgen-ifgen = "\ + python3-core \ + libselinux-python \ +" + +PACKAGES =+ "\ + ${PN}-audit2allow \ + ${PN}-sepolgen-ifgen \ + ${PN}-chcat \ + ${PN}-semanage \ + ${PN}-sepolgen \ + ${PN}-sepolicy \ +" +FILES:${PN}-audit2allow = "\ + ${bindir}/audit2allow \ + ${bindir}/audit2why \ +" +FILES:${PN}-chcat = "\ + ${bindir}/chcat \ +" +FILES:${PN}-semanage = "\ + ${sbindir}/semanage \ + ${datadir}/bash-completion/completions/semanage \ +" +# The ${bindir}/sepolgen is a symlink to ${bindir}/sepolicy +FILES:${PN}-sepolicy = "\ + ${bindir}/sepolgen \ + ${bindir}/sepolicy \ + ${datadir}/bash-completion/completions/sepolicy \ +" +FILES:${PN}-sepolgen-ifgen = "\ + ${bindir}/sepolgen-ifgen \ + ${bindir}/sepolgen-ifgen-attr-helper \ +" +FILES:${PN}-sepolgen = "\ + ${PYTHON_SITEPACKAGES_DIR}/sepolgen* \ + ${localstatedir}/lib/sepolgen/perm_map \ +" + +FILES:${PN} += "\ + ${PYTHON_SITEPACKAGES_DIR}/seobject.py* \ + ${PYTHON_SITEPACKAGES_DIR}/sepolicy*.dist-info \ + ${PYTHON_SITEPACKAGES_DIR}/sepolicy/* \ +" + +do_install() { + oe_runmake DESTDIR="${D}" \ + PYLIBVER='python${PYTHON_BASEVERSION}' \ + PYTHONLIBDIR='${PYTHON_SITEPACKAGES_DIR}' \ + install + + # Remove .pyc files + find ${D} -name *.pyc -delete + + # Fix buildpaths issue + sed -i -e 's,${WORKDIR},,g' \ + ${D}${PYTHON_SITEPACKAGES_DIR}/sepolicy-${PV}.dist-info/direct_url.json +} -- cgit v1.2.3-54-g00ecf