diff mbox series

[2/2] python3-libarchive-c: Avoid using find_library python API

Message ID 20241019184824.1338594-2-raj.khem@gmail.com
State New
Headers show
Series [1/2] python3-packaging: Ignore old glibc tests on musl | expand

Commit Message

Khem Raj Oct. 19, 2024, 6:48 p.m. UTC
find_library API depends on platform to provide ldconfig, ld, gcc, objdump
etc, so either we add these dependencies or avoid them by computing the
libarchive library name during build, which we can be done.

This ensures that ffi module works with musl as well as glibc equally
as musl does not provide ldconfig like glibc does

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/python/python3-libarchive-c_5.1.bb | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alexander Kanavin Oct. 21, 2024, 10:27 a.m. UTC | #1
Can this be a proper patch please?

Alex

On Sat, 19 Oct 2024 at 20:48, Khem Raj via lists.openembedded.org
<raj.khem=gmail.com@lists.openembedded.org> wrote:
>
> find_library API depends on platform to provide ldconfig, ld, gcc, objdump
> etc, so either we add these dependencies or avoid them by computing the
> libarchive library name during build, which we can be done.
>
> This ensures that ffi module works with musl as well as glibc equally
> as musl does not provide ldconfig like glibc does
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/python/python3-libarchive-c_5.1.bb | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb b/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> index 3116c6b62ec..510e2d9159c 100644
> --- a/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> +++ b/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> @@ -16,6 +16,14 @@ inherit pypi setuptools3 ptest
>
>  SRC_URI[sha256sum] = "7bcce24ea6c0fa3bc62468476c6d2f6264156db2f04878a372027c10615a2721"
>
> +DEPENDS += "patchelf-native libarchive"
> +# Avoid using find_library API which needs ldconfig and ld/objdump
> +# https://docs.python.org/3/library/ctypes.html#ctypes-reference
> +#
> +do_configure:append() {
> +    sed -i -e "s|find_library('archive')|'${libdir}/$(patchelf --print-soname ${STAGING_LIBDIR}/libarchive.so)'|" ${S}/libarchive/ffi.py
> +}
> +
>  RDEPENDS:${PN} += "\
>    libarchive \
>    python3-ctypes \
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#206086): https://lists.openembedded.org/g/openembedded-core/message/206086
> Mute This Topic: https://lists.openembedded.org/mt/109104795/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj Oct. 21, 2024, 9:21 p.m. UTC | #2
On Mon, Oct 21, 2024 at 3:27 AM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> Can this be a proper patch please?


I have thought of it. sadly It can not be patched with a single patch as
libdir is not uniform across all combos we may build

>
>
> Alex
>
> On Sat, 19 Oct 2024 at 20:48, Khem Raj via lists.openembedded.org
> <raj.khem=gmail.com@lists.openembedded.org> wrote:
> >
> > find_library API depends on platform to provide ldconfig, ld, gcc,
> objdump
> > etc, so either we add these dependencies or avoid them by computing the
> > libarchive library name during build, which we can be done.
> >
> > This ensures that ffi module works with musl as well as glibc equally
> > as musl does not provide ldconfig like glibc does
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-devtools/python/python3-libarchive-c_5.1.bb | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> b/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> > index 3116c6b62ec..510e2d9159c 100644
> > --- a/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> > +++ b/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
> > @@ -16,6 +16,14 @@ inherit pypi setuptools3 ptest
> >
> >  SRC_URI[sha256sum] =
> "7bcce24ea6c0fa3bc62468476c6d2f6264156db2f04878a372027c10615a2721"
> >
> > +DEPENDS += "patchelf-native libarchive"
> > +# Avoid using find_library API which needs ldconfig and ld/objdump
> > +# https://docs.python.org/3/library/ctypes.html#ctypes-reference
> > +#
> > +do_configure:append() {
> > +    sed -i -e "s|find_library('archive')|'${libdir}/$(patchelf
> --print-soname ${STAGING_LIBDIR}/libarchive.so)'|" ${S}/libarchive/ffi.py
> > +}
> > +
> >  RDEPENDS:${PN} += "\
> >    libarchive \
> >    python3-ctypes \
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#206086):
> https://lists.openembedded.org/g/openembedded-core/message/206086
> > Mute This Topic: https://lists.openembedded.org/mt/109104795/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb b/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
index 3116c6b62ec..510e2d9159c 100644
--- a/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
+++ b/meta/recipes-devtools/python/python3-libarchive-c_5.1.bb
@@ -16,6 +16,14 @@  inherit pypi setuptools3 ptest
 
 SRC_URI[sha256sum] = "7bcce24ea6c0fa3bc62468476c6d2f6264156db2f04878a372027c10615a2721"
 
+DEPENDS += "patchelf-native libarchive"
+# Avoid using find_library API which needs ldconfig and ld/objdump
+# https://docs.python.org/3/library/ctypes.html#ctypes-reference
+#
+do_configure:append() {
+    sed -i -e "s|find_library('archive')|'${libdir}/$(patchelf --print-soname ${STAGING_LIBDIR}/libarchive.so)'|" ${S}/libarchive/ffi.py
+}
+
 RDEPENDS:${PN} += "\
   libarchive \
   python3-ctypes \