Skip to contentSkip to conversation

python3-pyyaml fix libyaml detection and enable ptest

PATCH In review Tim Orling 2 participants 4 messages Feb 9, 2024

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

cover python3-pyyaml fix libyaml detection and enable ptest

As pointed out by jdiez in #yocto IRC, python3-pyyaml will "helpfully" detect libyaml in the build environment and compile with Python bindings for the C library. This is non-deterministic and can result in host contamination (pulling in the host's libyaml). Add a PACKAGECONFIG to make compiling with the faster libyaml bindings as the default. Add very basic ptest to ensure the runtime is viable.

The following changes since commit 71ac318a830b37f55cbd63794c55c6adc1904f1f:

yocto-bsp: update reference boards to v6.6.15 (2024-02-08 23:15:18 +0000)

are available in the Git repository at:

https://git.yoctoproject.org/poky-contrib timo/python3-pyyaml-libyaml-ptest
https://git.yoctoproject.org/poky-contrib/log/?h=timo/python3-pyyaml-libyaml-ptest

Tim Orling (2):
python3-pyyaml: add PACKAGECONFIG for libyaml
python3-pyyaml: enable ptest

 .../distro/include/ptest-packagelists.inc     |  1 +
 .../python/python3-pyyaml/run-ptest           |  3 +++
 .../python/python3-pyyaml_6.0.1.bb            | 20 +++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-pyyaml/run-ptest
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/2 python3-pyyaml: add PACKAGECONFIG for libyaml

For some time now, we have probably been susceptible to host contamination or at least non-deterministic behavior when libyaml was available in the build environment.

The symptom is:
ERROR: python3-pyyaml-6.0-r0 do_package_qa: QA Issue:
/usr/lib/python3.11/site-packages/yaml/_yaml.cpython-311-aarch64-linux-gnu.so contained in package python3-pyyaml requires libyaml-0.so.2()(64bit), but no providers found in RDEPENDS:python3-pyyaml? [file-rdeps]

From the documentation:
"""
By default, the setup.py script checks whether LibYAML is installed and if so, builds and installs LibYAML bindings. To skip the check and force installation of LibYAML bindings, use the option --with-libyaml:
python setup.py --with-libyaml install

To disable the check and skip building and installing LibYAML bindings, use --without-libyaml:
python setup.py --without-libyaml install
"""

Instead of leaving this to chance, add PACKAGECONFIG and by default build with the faster libyaml bindings.

---
 meta/recipes-devtools/python/python3-pyyaml_6.0.1.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-devtools/python/python3-pyyaml_6.0.1.bb +3 -0
index 61f7cbc6b36..102e2f2498b 100644
@@ -12,6 +12,9 @@ inherit pypi python_setuptools_build_meta
 SRC_URI += "file://0001-Fix-builds-with-Cython-3.patch"
 SRC_URI[sha256sum] = "bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"
 
+PACKAGECONFIG ?= "libyaml"
+PACKAGECONFIG[libyaml] = "--with-libyaml,--without-libyaml,libyaml"
+
 RDEPENDS:${PN} += "\
     ${PYTHON_PN}-datetime \
     ${PYTHON_PN}-netclient \
Signature · 1 line
2.34.1
#2 lore raw

Patchtest results for [PATCH 1/2] python3-pyyaml: add PACKAGECONFIG for libyaml

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/1-2-python3-pyyaml-add-PACKAGECONFIG-for-libyaml.patch

FAIL: test Signed-off-by presence: Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s" (test_mbox.TestMbox.test_signed_off_by_presence)

PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
PASS: test CVE check ignore (test_metadata.TestMetadata.test_cve_check_ignore)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test lic files chksum modified not mentioned (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test src uri left files (test_metadata.TestMetadata.test_src_uri_left_files)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

author
#3 lore raw

PATCH 2/2 python3-pyyaml: enable ptest

In reply to Tim Orling

Upstream is in the process of migrating testing to pytest, backport test_dump_load.py (the legacy_tests were throwing Errors and Failures). We don't really need to run upstream's test suite, but we do need to verify that our runtime is functional.

https://github.com/yaml/pyyaml/commit/a98fd6088e81d7aca571220c966bbfe2ac43c335

---

All tests pass on qemuarm64 for core-image-ptest-python3-pyyaml via testimage

 meta/conf/distro/include/ptest-packagelists.inc |  1 +
 .../python/python3-pyyaml/run-ptest             |  3 +++
 .../python/python3-pyyaml_6.0.1.bb              | 17 +++++++++++++++++
 3 files changed, 21 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-pyyaml/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index b590640edc2..0192146dbd0 100644
@@ -69,6 +69,7 @@ PTESTS_FAST = "\
     python3-pluggy \
     python3-pyasn1 \
     python3-pytz \
+    python3-pyyaml \
     python3-trove-classifiers \
     python3-wcwidth \
     python3-webcolors \
meta/recipes-devtools/python/python3-pyyaml/run-ptest new file +3 -0
new file mode 100644
index 00000000000..8d2017d39ce
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pytest --automake
meta/recipes-devtools/python/python3-pyyaml_6.0.1.bb +17 -0
index 102e2f2498b..62be059df52 100644
@@ -20,4 +20,21 @@ RDEPENDS:${PN} += "\
     ${PYTHON_PN}-netclient \
 "
 
+inherit ptest
+SRC_URI += "\
+    https://raw.githubusercontent.com/yaml/pyyaml/a98fd6088e81d7aca571220c966bbfe2ac43c335/tests/test_dump_load.py;name=test \
+    file://run-ptest \
+"
+SRC_URI[test.sha256sum] = "b6a8a2825d89fdc8aee226560f66b8196e872012a0ea7118cbef1a832359434a"
+
+RDEPENDS:${PN}-ptest += " \
+	${PYTHON_PN}-pytest \
+	${PYTHON_PN}-unittest-automake-output \
+"
+
+do_install_ptest() {
+	install -d ${D}${PTEST_PATH}/tests
+	cp -rf ${WORKDIR}/test_dump_load.py ${D}${PTEST_PATH}/tests/
+}
+
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1