diff mbox series

[meta-selinux] libselinux-python: add recipe

Message ID 20240105065834.3868016-1-yi.zhao@windriver.com
State New
Headers show
Series [meta-selinux] libselinux-python: add recipe | expand

Commit Message

Yi Zhao Jan. 5, 2024, 6:58 a.m. UTC
We merged libselinux recipe and libselinux-python recipe in commit[1]
because we thought the circular dependency was gone. But unfortunately,
it still exists.

Here are the steps to reproduce:
$ echo "DISTRO_FEATURES:append = \" x11\"" >> conf/local.conf
$ echo "PACKAGECONFIG:append:pn-python3 = \" tk\"" >> conf/local.conf
$ bitbake core-image-selinux -n

So we still need to split the libselinux recipe into two recipes:
libselinux and libselinux-python.

[1] https://git.yoctoproject.org/meta-selinux/commit/?id=62b9c816a5000dc01b28e78213bde26b58cbca9d

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 ...elinux_3.6.bb => libselinux-python_3.6.bb} | 19 +++++-------
 recipes-security/selinux/libselinux_3.6.bb    | 31 ++-----------------
 2 files changed, 10 insertions(+), 40 deletions(-)
 copy recipes-security/selinux/{libselinux_3.6.bb => libselinux-python_3.6.bb} (85%)
diff mbox series

Patch

diff --git a/recipes-security/selinux/libselinux_3.6.bb b/recipes-security/selinux/libselinux-python_3.6.bb
similarity index 85%
copy from recipes-security/selinux/libselinux_3.6.bb
copy to recipes-security/selinux/libselinux-python_3.6.bb
index dab4965..3c5c489 100644
--- a/recipes-security/selinux/libselinux_3.6.bb
+++ b/recipes-security/selinux/libselinux-python_3.6.bb
@@ -8,7 +8,7 @@  LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0"
 
 require selinux_common.inc
 
-inherit lib_package pkgconfig python3targetconfig
+inherit python3targetconfig pkgconfig
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/libselinux:"
 SRC_URI += "\
@@ -22,6 +22,8 @@  S = "${WORKDIR}/git/libselinux"
 DEPENDS = "libsepol libpcre2 swig-native python3-setuptools-scm-native"
 DEPENDS:append:libc-musl = " fts"
 
+RDEPENDS:${PN} = "libselinux python3-core python3-shell"
+
 def get_policyconfigarch(d):
     import re
     target = d.getVar('TARGET_ARCH')
@@ -32,14 +34,17 @@  def get_policyconfigarch(d):
 EXTRA_OEMAKE = "${@get_policyconfigarch(d)}"
 EXTRA_OEMAKE:append:libc-musl = " FTS_LDLIBS=-lfts"
 
-do_compile:append() {
+FILES:${PN} = "${PYTHON_SITEPACKAGES_DIR}/*"
+INSANE_SKIP:${PN} = "dev-so"
+
+do_compile() {
     oe_runmake pywrap -j1 \
         PYLIBVER='python${PYTHON_BASEVERSION}' \
         PYINC='-I${STAGING_INCDIR}/${PYLIBVER}' \
         PYLIBS='-L${STAGING_LIBDIR}/${PYLIBVER} -l${PYLIBVER}'
 }
 
-do_install:append() {
+do_install() {
     oe_runmake install-pywrap \
         DESTDIR=${D} \
         PREFIX=${prefix}
@@ -50,11 +55,3 @@  do_install:append() {
     sed -i -e 's,${WORKDIR},,g' \
         ${D}${PYTHON_SITEPACKAGES_DIR}/selinux-${PV}.dist-info/direct_url.json
 }
-
-PACKAGES += "${PN}-python"
-RDEPENDS:${PN}-python = "python3-core python3-shell"
-
-FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*"
-INSANE_SKIP:${PN}-python = "dev-so"
-
-BBCLASSEXTEND = "native"
diff --git a/recipes-security/selinux/libselinux_3.6.bb b/recipes-security/selinux/libselinux_3.6.bb
index dab4965..b0dcde6 100644
--- a/recipes-security/selinux/libselinux_3.6.bb
+++ b/recipes-security/selinux/libselinux_3.6.bb
@@ -8,18 +8,16 @@  LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0"
 
 require selinux_common.inc
 
-inherit lib_package pkgconfig python3targetconfig
+inherit lib_package pkgconfig
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/libselinux:"
 SRC_URI += "\
-        file://0001-Makefile-fix-python-modules-install-path-for-multili.patch \
-        file://0002-Do-not-use-PYCEXT-and-rely-on-the-installed-file-nam.patch \
         file://0003-libselinux-restore-drop-the-obsolete-LSF-transitiona.patch \
         "
 
 S = "${WORKDIR}/git/libselinux"
 
-DEPENDS = "libsepol libpcre2 swig-native python3-setuptools-scm-native"
+DEPENDS = "libsepol libpcre2"
 DEPENDS:append:libc-musl = " fts"
 
 def get_policyconfigarch(d):
@@ -32,29 +30,4 @@  def get_policyconfigarch(d):
 EXTRA_OEMAKE = "${@get_policyconfigarch(d)}"
 EXTRA_OEMAKE:append:libc-musl = " FTS_LDLIBS=-lfts"
 
-do_compile:append() {
-    oe_runmake pywrap -j1 \
-        PYLIBVER='python${PYTHON_BASEVERSION}' \
-        PYINC='-I${STAGING_INCDIR}/${PYLIBVER}' \
-        PYLIBS='-L${STAGING_LIBDIR}/${PYLIBVER} -l${PYLIBVER}'
-}
-
-do_install:append() {
-    oe_runmake install-pywrap \
-        DESTDIR=${D} \
-        PREFIX=${prefix}
-        PYLIBVER='python${PYTHON_BASEVERSION}' \
-        PYTHONLIBDIR='${PYTHON_SITEPACKAGES_DIR}'
-
-    # Fix buildpaths issue
-    sed -i -e 's,${WORKDIR},,g' \
-        ${D}${PYTHON_SITEPACKAGES_DIR}/selinux-${PV}.dist-info/direct_url.json
-}
-
-PACKAGES += "${PN}-python"
-RDEPENDS:${PN}-python = "python3-core python3-shell"
-
-FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*"
-INSANE_SKIP:${PN}-python = "dev-so"
-
 BBCLASSEXTEND = "native"