libpwquality: Add option to disable python bindings

Message ID 20220628204736.2743017-1-noah.t.brewer@gmail.com
State New
Headers show
Series libpwquality: Add option to disable python bindings | expand

Commit Message

noah.t.brewer@gmail.com June 28, 2022, 8:47 p.m. UTC
From: Noah Brewer <noah.t.brewer@gmail.com>

Remove python3-core from RDEPENDS when the appropriate PACKAGECONFIG
is set using the remove operator. Use bbappend file to set PACKAGECONFIG
to disable python bindings and to remove python3-core from RDEPENDS.

Signed-off-by: Noah Brewer <noah.t.brewer@gmail.com>
---
 meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jose Quaresma June 28, 2022, 10:11 p.m. UTC | #1
Hi Noah,

Noah Brewer <noah.t.brewer@gmail.com> escreveu no dia terça, 28/06/2022
à(s) 21:48:

> From: Noah Brewer <noah.t.brewer@gmail.com>
>
> Remove python3-core from RDEPENDS when the appropriate PACKAGECONFIG
> is set using the remove operator. Use bbappend file to set PACKAGECONFIG
> to disable python bindings and to remove python3-core from RDEPENDS.
>
> Signed-off-by: Noah Brewer <noah.t.brewer@gmail.com>
> ---
>  meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
> b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
> index f892cc650..ea3787792 100644
> --- a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
> +++ b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
> @@ -32,9 +32,11 @@ EXTRA_OECONF +=
> "--with-python-rev=${PYTHON_BASEVERSION} \
>                   --libdir=${libdir} \
>  "
>
> -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam',
> '', d)}"
> +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam',
> '', d)} python-bindings"
> +PACKAGECONFIG[python-bindings] = "--enable-python-bindings=yes,
> --enable-python-bindings=no"
>  PACKAGECONFIG[pam] = "--enable-pam, --disable-pam, libpam"
>
> +RDEPENDS:${PN}:remove = "${@bb.utils.contains('PACKAGECONFIG',
> 'python-bindings', '', '${PYTHON_PN}-core', d)}"
>

We can't override the remove operator so if you use remove no one can undo
that.
Please use inverted logic with RDEPENDS:${PN}:append so it is possible to
use remove if needed in bbappend.

Anyway we can add RDEPENDS with the PACKAGECONFIG (it is the argument
number 4)
https://docs.yoctoproject.org/ref-manual/variables.html?highlight=packageconfig#term-PACKAGECONFIG

+PACKAGECONFIG[python-bindings] = "--enable-python-bindings=yes,
--enable-python-bindings=no,,python3-core"

Jose

 FILES:${PN} += "${libdir}/security/pam_pwquality.so"
>  FILES:${PN}-dbg += "${libdir}/security/.debug"
>  FILES:${PN}-staticdev += "${libdir}/security/pam_pwquality.a"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#97609):
> https://lists.openembedded.org/g/openembedded-devel/message/97609
> Mute This Topic: https://lists.openembedded.org/mt/92052665/5052612
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

Patch

diff --git a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
index f892cc650..ea3787792 100644
--- a/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
+++ b/meta-oe/recipes-extended/libpwquality/libpwquality_1.4.4.bb
@@ -32,9 +32,11 @@  EXTRA_OECONF += "--with-python-rev=${PYTHON_BASEVERSION} \
                  --libdir=${libdir} \
 "
 
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} python-bindings"
+PACKAGECONFIG[python-bindings] = "--enable-python-bindings=yes, --enable-python-bindings=no"
 PACKAGECONFIG[pam] = "--enable-pam, --disable-pam, libpam"
 
+RDEPENDS:${PN}:remove = "${@bb.utils.contains('PACKAGECONFIG', 'python-bindings', '', '${PYTHON_PN}-core', d)}"
 FILES:${PN} += "${libdir}/security/pam_pwquality.so"
 FILES:${PN}-dbg += "${libdir}/security/.debug"
 FILES:${PN}-staticdev += "${libdir}/security/pam_pwquality.a"