[meta-python][PATCH v2 2/4] python3-patchelf: New recipe


Zoltan Boszormenyi
 

Dummy module to indicate the presence of patchelf.
Used by python3-meson-python.

The CMakeLists.txt file is a crippled copy from this patchelf
python module's sources, removing almost everything, and
adding a dummy install target, so do_install() doesn't fail.

Signed-off-by: Zoltán Böszörményi <zboszor@...>
---
.../python/python3-patchelf/CMakeLists.txt | 7 +++++
.../python/python3-patchelf/patchelf.patch | 11 +++++++
.../python/python3-patchelf_0.17.2.1.bb | 31 +++++++++++++++++++
3 files changed, 49 insertions(+)
create mode 100644 meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt
create mode 100644 meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch
create mode 100644 meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb

diff --git a/meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt b/meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt
new file mode 100644
index 000000000..335bb503f
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.6)
+
+project(PatchelfPythonDistributions)
+
+install(CODE "
+ message(STATUS \"Install patchelf project\")
+")
diff --git a/meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch b/meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch
new file mode 100644
index 000000000..96dbf2180
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch
@@ -0,0 +1,11 @@
+--- patchelf-0.17.2.1/setup.py.old 2023-03-13 10:12:55.951514413 +0100
++++ patchelf-0.17.2.1/setup.py 2023-03-13 10:13:18.877751074 +0100
+@@ -95,8 +95,6 @@
+ version=get_version(),
+ cmdclass=cmdclass,
+
+- scripts=["bin/patchelf"],
+-
+ url="https://github.com/NixOS/patchelf",
+ project_urls={
+ "Source Code": "https://github.com/mayeut/patchelf-pypi",
diff --git a/meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb b/meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb
new file mode 100644
index 000000000..630bd808a
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb
@@ -0,0 +1,31 @@
+# This is a dummy package needed by python3-meson-python
+SUMMARY = "A small utility to modify the dynamic linker and RPATH of ELF executables."
+LICENSE = "GPL-3.0-or-later & Apache-2.0"
+LIC_FILES_CHKSUM = " \
+ file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
+ file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
+"
+
+DEPENDS = "python3-scikit-build-native"
+
+PYPI_PACKAGE = "patchelf"
+PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
+
+inherit pypi python_setuptools_build_meta
+SRC_URI[sha256sum] = "a6eb0dd452ce4127d0d5e1eb26515e39186fa609364274bc1b0b77539cfa7031"
+
+SRC_URI += " \
+ file://CMakeLists.txt \
+ file://patchelf.patch \
+"
+
+addtask do_patchbuild after do_patch before do_configure
+
+do_patchbuild () {
+ rm -f ${S}/CMakeLists.txt
+ cp ${WORKDIR}/CMakeLists.txt ${S}/
+}
+
+RDEPENDS:${PN} = "patchelf"
+
+BBCLASSEXTEND = "native nativesdk"
--
2.39.2


Ross Burton
 

On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@...> wrote:
+# This is a dummy package needed by python3-meson-python
I’m not sure I’d call this a dummy package.

+DEPENDS = "python3-scikit-build-native"
If you’re not building native code with cmake then you don’t need this, just switch skbuild to setuptools.

+SRC_URI += " \
+ file://CMakeLists.txt \
+ file://patchelf.patch \
+"
+
+addtask do_patchbuild after do_patch before do_configure
+
+do_patchbuild () {
+ rm -f ${S}/CMakeLists.txt
+ cp ${WORKDIR}/CMakeLists.txt ${S}/
+}
Use subdir=${S} to put the CMakeLists.txt in the right place instead of doing this.

However, this recipe doesn’t build patchelf and doesn’t have any python code. So what’s the point of it?

If there are packages which depend on this, either patch out that dependency (as we can just DEPEND on patchelf-native) or write the few lines of pyproject.toml to ship an empty package directly.

Ross