bitbake.conf: Add conditional host tool getent
PATCH 1/3 bitbake.conf: Add conditional host tool getent
From: Vyacheslav Yurkov <[email protected]>
In case of systemd init mananger, it's required for the native build. Even though we don't build systemd natively, we might build some of its binaries, which need to run on the host system.
--- meta/conf/bitbake.conf | 3 +++ 1 file changed, 3 insertions(+)
meta/conf/bitbake.conf +3 -0
@@ -532,6 +532,9 @@ HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLAS # Used by archiver.bbclass when compression is xz HOSTTOOLS += "${@'xz' if (('archiver.bbclass' in (d.getVar('BBINCLUDED') or '')) and (d.getVarFlag('ARCHIVER_MODE', 'compression') == 'xz')) else ''}" +# Native build of systemd tools requires getent utility +HOSTTOOLS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'getent', '', d)}" + # Link to these if present HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh sudo"
PATCH 2/3 meson.bbclass: Add an option to specify install tags
From: Vyacheslav Yurkov <[email protected]>
The feature is available since meson 0.60.0. You can specify comma-separated list of install tags (not targets).
--- meta/classes-recipe/meson.bbclass | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes-recipe/meson.bbclass +7 -1
@@ -22,6 +22,9 @@ MESON_SOURCEPATH = "${S}" # The target to build in do_compile. If unset the default targets are built. MESON_TARGET ?= "" +# Since 0.60.0 you can specify custom tags to install +MESON_INSTALL_TAGS ?= "" + def noprefix(var, d): return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1)
@@ -182,7 +185,10 @@ meson_do_compile() { } meson_do_install() { - meson install --destdir ${D} --no-rebuild + if [ "x${MESON_INSTALL_TAGS}" != "x" ] ; then + meson_install_tags="--tags ${MESON_INSTALL_TAGS}" + fi + meson install --destdir ${D} --no-rebuild $meson_install_tags } EXPORT_FUNCTIONS do_configure do_compile do_install
PATCH 3/3 systemd: Build the systemctl executable
In reply to [email protected]From: Vyacheslav Yurkov <[email protected]>
Instead of the python re-implementation build the actual systemctl from the systemd source tree.
--- .../systemd/systemd-systemctl-native.bb | 20 +- ...-meson-add-install-tag-for-systemctl.patch | 24 ++ .../systemd/systemd-systemctl/systemctl | 366 ------------------ 3 files changed, 32 insertions(+), 378 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl
meta/recipes-core/systemd/systemd-systemctl-native.bb +8 -12
@@ -1,17 +1,13 @@ -SUMMARY = "Wrapper for enabling systemd services" +SUMMARY = "Systemctl executable from systemd" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +require systemd.inc +DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native" -inherit native +inherit pkgconfig meson native -SRC_URI = "file://systemctl" +SRC_URI = "file://0001-meson-add-install-tag-for-systemctl.patch" -S = "${WORKDIR}/sources" -UNPACKDIR = "${S}" - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${S}/systemctl ${D}${bindir} -} +MESON_TARGET = "systemctl:executable" +MESON_INSTALL_TAGS = "systemctl" +EXTRA_OEMESON:append = " -Dlink-systemctl-shared=false"
meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch new file +24 -0
@@ -0,0 +1,24 @@ +From fe2eb1dde51648b0e5825766e2f27a859de8521c Mon Sep 17 00:00:00 2001 +From: Vyacheslav Yurkov <[email protected]> +Date: Sun, 2 Feb 2025 10:13:38 +0100 +Subject: [PATCH] meson: add install tag for systemctl + +Upstream-Status: Submitted + +Signed-off-by: Vyacheslav Yurkov <[email protected]> +--- + src/systemctl/meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build +index 88f73bf502..46218dc8ef 100644 +--- a/src/systemctl/meson.build ++++ b/src/systemctl/meson.build +@@ -61,6 +61,7 @@ executables += [ + libzstd_cflags, + threads, + ], ++ 'install_tag' : 'systemctl', + }, + fuzz_template + { + 'sources' : [
meta/recipes-core/systemd/systemd-systemctl/systemctl deleted +0 -366
366 lines not on this page · raw message
Patchtest results for [PATCH 3/3] systemd: Build the systemctl executable
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/3-3-systemd-Build-the-systemctl-executable.patch
FAIL: test Upstream-Status presence: Upstream-Status is Submitted, but it is not mentioned where (test_patch.TestPatch.test_upstream_status_presence_format)
FAIL: test lic files chksum modified not mentioned: LIC_FILES_CHKSUM changed without "License-Update:" tag and description in commit message (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
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 CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Signed-off-by presence (test_patch.TestPatch.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
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)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)
SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
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)
---
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!
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
In reply to [email protected]Hi,
Quoted 4 lines · Vyacheslav Yurkov via lists.openembedded.org
From: Vyacheslav Yurkov <[email protected]>
Instead of the python re-implementation build the actual systemctl from the systemd source tree.
Could you elaborate why? Some usecase or feature not supported by the python wrapper? Which one?
Maybe it makes sense to have a self or runtime test for this usecase.
Then the native toolchain set seems to be increasing. While systemd-boot-native is also trying to be simple for ukify.py, it could expand if tools like systemd-measure for TPM calculations would get added. And systemd-sbsign instead of sbsign for secureboot signatures.
Maybe it would make sense to cambine all in a full systemd-native recipe?
Quoted 45 lines
Signed-off-by Vyacheslav Yurkov <[email protected]>--- .../systemd/systemd-systemctl-native.bb | 20 +- ...-meson-add-install-tag-for-systemctl.patch | 24 ++ .../systemd/systemd-systemctl/systemctl | 366 ------------------ 3 files changed, 32 insertions(+), 378 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctlmeta/recipes-core/systemd/systemd-systemctl-native.bb +8
-12@@ -1,17 +1,13 @@ -SUMMARY = "Wrapper for enabling systemd services" +SUMMARY = "Systemctl executable from systemd" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +require systemd.inc +DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native" -inherit native +inherit pkgconfig meson native -SRC_URI = "file://systemctl" +SRC_URI = "file://0001-meson-add-install-tag-for-systemctl.patch" -S = "${WORKDIR}/sources" -UNPACKDIR = "${S}" - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${S}/systemctl ${D}${bindir} -} +MESON_TARGET = "systemctl:executable" +MESON_INSTALL_TAGS = "systemctl" +EXTRA_OEMESON:append = " -Dlink-systemctl-shared=false"meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch new file +0
-0
meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch line 6
Quoted 6 lines
meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch new file +6
-0@@ -0,0 +1,24 @@ +From fe2eb1dde51648b0e5825766e2f27a859de8521c Mon Sep 17 00:00:00 2001 +From: Vyacheslav Yurkov <[email protected]> +Date: Sun, 2 Feb 2025 10:13:38 +0100 +Subject: [PATCH] meson: add install tag for systemctl + +Upstream-Status: Submitted
Would be nice to link the URL here.
Cheers,
-Mikko
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
Quoted 2 lines · Mikko Rapeli via lists.openembedded.org
Could you elaborate why? Some usecase or feature not supported by the python wrapper? Which one?
You got this backwards Mikko. It's you who should elaborate why we should continue using a custom replacement.
As long as this change passes the autobuilder, it works as intended, and needs no further justification.
Alex
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
Hi,
Quoted 10 lines · Alexander Kanavin
Quoted 2 lines · Mikko Rapeli via lists.openembedded.org
Could you elaborate why? Some usecase or feature not supported by the python wrapper? Which one?
You got this backwards Mikko. It's you who should elaborate why we should continue using a custom replacement.
As long as this change passes the autobuilder, it works as intended, and needs no further justification.
So changes without justification are fine then? I'm not against this change, I would just like to understand why it's needed or proposed right now. A reason could be just to reduce custom patches in oe-core. That would tell me that no actual usecase is currently broken, apart from ukify.py and secureboot for which I've sent a patch separately and which was seen in meta-arm side testing.
Cheers,
-Mikko
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
Quoted 5 lines · Mikko Rapeli
So changes without justification are fine then? I'm not against this change, I would just like to understand why it's needed or proposed right now. A reason could be just to reduce custom patches in oe-core. That would tell me that no actual usecase is currently broken, apart from
ukify.pyand secureboot for which I've sent a patch separately and which was seen in meta-arm side testing.
Yes, reducing the amount of custom code is sufficient justification in itself. If you need it explicitly spelled out, there you go.
My favourite patches are those that remove code. We need more of these, and I always welcome them.
Alex
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
Hi,
Quoted 9 lines · Alexander Kanavin
Quoted 5 lines · Mikko Rapeli
So changes without justification are fine then? I'm not against this change, I would just like to understand why it's needed or proposed right now. A reason could be just to reduce custom patches in oe-core. That would tell me that no actual usecase is currently broken, apart from
ukify.pyand secureboot for which I've sent a patch separately and which was seen in meta-arm side testing.Yes, reducing the amount of custom code is sufficient justification in itself. If you need it explicitly spelled out, there you go.
I would like these to be explicitly written in commit messages. It is hard to guess the reasons even when I'm actively following mailing lists and irc, and even harder much later when all I have is git log and a bisect pointing to specific commit or its cherry-pick on a stable branch.
Cheers,
-Mikko
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
In reply to [email protected]Quoted 2 lines · Vyacheslav Yurkov via lists.openembedded.org
Instead of the python re-implementation build the actual systemctl from the systemd source tree.
Very glad to see this - I tried some time ago but the dependency tree at the time was quite invasive to remove so I gave up.
Have you verified that the final rootfs is identical (or in fact better) with those compared to our reimplementation?
Quoted 1 line
+DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
I’d hope you can remove some more of those dependencies as we just need systemctl?
Quoted 1 line
+Upstream-Status: Submitted
Submitted where?
Thanks
Ross
Re: [OE-core] [PATCH 3/3] systemd: Build the systemctl executable
Quoted 7 lines · Ross Burton via lists.openembedded.org
Quoted 2 lines · Vyacheslav Yurkov via lists.openembedded.org
Instead of the python re-implementation build the actual systemctl from the systemd source tree.
Very glad to see this - I tried some time ago but the dependency tree at the time was quite invasive to remove so I gave up.
As did I, before I did the shell -> python port. In theory I agree this is a good thing.
Quoted 6 lines
Have you verified that the final rootfs is identical (or in fact better) with those compared to our reimplementation?
Quoted 1 line
+DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
I’d hope you can remove some more of those dependencies as we just need systemctl?
The getent HOSTTOOLS in the other patch concerns me - that feels like it could easily be a host contamination problem.
Quoted 4 lines
Quoted 1 line
+Upstream-Status: Submitted
Submitted where?
A nervousness I have with this, is this makes a systemd enabled image significantly dependent on systemd at build time, and the history of systemd taking patches which don't match their use cases (which I don't believe this does) is frankly very poor.
Signature · 1 line
Alex Kiernan