diff mbox series

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

Message ID 20230315080429.2722555-2-zboszor@gmail.com
State Under Review
Headers show
Series [meta-python,1/4] python_setuptools_build_meta_mesonpy.bbclass: New class | expand

Commit Message

Böszörményi Zoltán March 15, 2023, 8:04 a.m. UTC
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@gmail.com>
---
 .../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

Comments

Ross Burton March 15, 2023, 12:42 p.m. UTC | #1
On 15 Mar 2023, at 08:04, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> +++ 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

I note the words “dummy package”

> +DEPENDS = "python3-scikit-build-native"

Where is this dependency from?

> +PYPI_PACKAGE = "patchelf"
> +PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
> +
> +inherit pypi python_setuptools_build_meta

Why is it downloading stuff?

Why is any of this needed?  Can’t we just comment out the requirement for patchelf, or write a proper stub package?

Ross
Böszörményi Zoltán March 15, 2023, 2:18 p.m. UTC | #2
2023. 03. 15. 13:42 keltezéssel, Ross Burton írta:
> On 15 Mar 2023, at 08:04, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>> +++ 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
> I note the words “dummy package”

See the sources of https://pypi.org/project/patchelf/
There is none, only the build system.

The build system would have just built patchelf, and
installed into ${bindir} which would conflict with the
existing patchelf recipe.

>> +DEPENDS = "python3-scikit-build-native"
> Where is this dependency from?

 From its build system. The meta build complains.
The scikit-build recipe I previously sent was already merged,
so it may be used.

>> +PYPI_PACKAGE = "patchelf"
>> +PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
>> +
>> +inherit pypi python_setuptools_build_meta
> Why is it downloading stuff?
>
> Why is any of this needed?  Can’t we just comment out the requirement for patchelf, or write a proper stub package?

It means less patching in modules depending on this
particular module, like meson-python.

Do you prefer patching out this dependency from meson-python
and any other that may depend on it?
Böszörményi Zoltán March 15, 2023, 5:49 p.m. UTC | #3
2023. 03. 15. 15:18 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 03. 15. 13:42 keltezéssel, Ross Burton írta:
>> On 15 Mar 2023, at 08:04, Zoltan Boszormenyi via lists.openembedded.org 
>> <zboszor=gmail.com@lists.openembedded.org> wrote:
>>> +++ 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
>> I note the words “dummy package”
>
> See the sources of https://pypi.org/project/patchelf/
> There is none, only the build system.
>
> The build system would have just built patchelf, and
> installed into ${bindir} which would conflict with the
> existing patchelf recipe.
>
>>> +DEPENDS = "python3-scikit-build-native"
>> Where is this dependency from?
>
> From its build system.

Actually, it's in mesonpy/__init__.py:

class _depstr:
     """Namespace that holds the requirement strings for dependencies we *might*
     need at runtime. Having them in one place makes it easier to update.
     """
     patchelf = 'patchelf >= 0.11.0'
     ninja = f'ninja >= {_NINJA_REQUIRED_VERSION}'

> The meta build complains.

meson-python uses itself as the build backend to built itself,
so the build really does complain if the patchelf dummy
module is not present. ¯\_(ツ)_/¯

> The scikit-build recipe I previously sent was already merged,
> so it may be used.
>
>>> +PYPI_PACKAGE = "patchelf"
>>> +PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
>>> +
>>> +inherit pypi python_setuptools_build_meta
>> Why is it downloading stuff?
>>
>> Why is any of this needed?  Can’t we just comment out the requirement for patchelf, or 
>> write a proper stub package?
>
> It means less patching in modules depending on this
> particular module, like meson-python.
>
> Do you prefer patching out this dependency from meson-python
> and any other that may depend on it?
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#101562): https://lists.openembedded.org/g/openembedded-devel/message/101562
> Mute This Topic: https://lists.openembedded.org/mt/97622994/3617728
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Böszörményi Zoltán March 15, 2023, 6:23 p.m. UTC | #4
2023. 03. 15. 18:49 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 03. 15. 15:18 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
>> 2023. 03. 15. 13:42 keltezéssel, Ross Burton írta:
>>> On 15 Mar 2023, at 08:04, Zoltan Boszormenyi via lists.openembedded.org 
>>> <zboszor=gmail.com@lists.openembedded.org> wrote:
>>>> +++ 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
>>> I note the words “dummy package”
>>
>> See the sources of https://pypi.org/project/patchelf/
>> There is none, only the build system.
>>
>> The build system would have just built patchelf, and
>> installed into ${bindir} which would conflict with the
>> existing patchelf recipe.
>>
>>>> +DEPENDS = "python3-scikit-build-native"
>>> Where is this dependency from?
>>
>> From its build system.

patchelf's pyproject.toml references it, in turn
the scikit-build uses cmake to build things.
The easiest way was to replace the original CMakeLists.txt
with a crippled one to only print a line when installing.

The below part is the patchelf dependency in mesonpy,
sorry for my confusion.

> Actually, it's in mesonpy/__init__.py:
>
> class _depstr:
>     """Namespace that holds the requirement strings for dependencies we *might*
>     need at runtime. Having them in one place makes it easier to update.
>     """
>     patchelf = 'patchelf >= 0.11.0'
>     ninja = f'ninja >= {_NINJA_REQUIRED_VERSION}'
>
>> The meta build complains.
>
> meson-python uses itself as the build backend to built itself,
> so the build really does complain if the patchelf dummy
> module is not present. ¯\_(ツ)_/¯
>
>> The scikit-build recipe I previously sent was already merged,
>> so it may be used.
>>
>>>> +PYPI_PACKAGE = "patchelf"
>>>> +PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
>>>> +
>>>> +inherit pypi python_setuptools_build_meta
>>> Why is it downloading stuff?
>>>
>>> Why is any of this needed?  Can’t we just comment out the requirement for patchelf, or 
>>> write a proper stub package?
>>
>> It means less patching in modules depending on this
>> particular module, like meson-python.
>>
>> Do you prefer patching out this dependency from meson-python
>> and any other that may depend on it?
>>
>>
>>
>>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#101565): https://lists.openembedded.org/g/openembedded-devel/message/101565
> Mute This Topic: https://lists.openembedded.org/mt/97622994/3617728
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

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"