bitbake.conf: Add conditional host tool getent
PATCH v2 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 v2 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 v2 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. The python script was used when systemd didn't provide an option to build individual executables. It is possible in the meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.
--- .../systemd/systemd-systemctl-native.bb | 20 +- ...-meson-add-install-tag-for-systemctl.patch | 25 ++ .../systemd/systemd-systemctl/systemctl | 366 ------------------ 3 files changed, 33 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 +25 -0
@@ -0,0 +1,25 @@ +From fbf1ae3b7bd074a8d3bfb741f54b8539123399f1 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: Backport +[https://github.com/systemd/systemd/commit/b1e5a7aa3f1e552c56d5adbeed6ff67d88d1e103] + +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 v2 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/v2-3-3-systemd-Build-the-systemctl-executable.patch
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 Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
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 v2 3/3] systemd: Build the systemctl executable
In reply to [email protected]Hi,
Quoted 7 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. The python script was used when systemd didn't provide an option to build individual executables. It is possible in the meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.
Good reason, no objections!
Quoted 18 lines
Signed-off-by Vyacheslav Yurkov <[email protected]>--- .../systemd/systemd-systemctl-native.bb | 20 +- ...-meson-add-install-tag-for-systemctl.patch | 25 ++ .../systemd/systemd-systemctl/systemctl | 366 ------------------ 3 files changed, 33 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 +1
-2@@ -1,17 +1,13 @@ -SUMMARY = "Wrapper for enabling systemd services" +SUMMARY = "Systemctl executable from systemd" -LICENSE = "MIT"
meta/recipes-core/systemd/systemd-systemctl-native.bb line 9
Quoted 10 lines
meta/recipes-core/systemd/systemd-systemctl-native.bb +4
-3-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"
Hmm, doesn't this overwrite SRC_URI from systemd.inc?
SRC_URI += "file://...patch" would amend the patch file.
meta/recipes-core/systemd/systemd-systemctl-native.bb line 13
Quoted 10 lines
meta/recipes-core/systemd/systemd-systemctl-native.bb +3
-7-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"
I wonder why this tag support is needed since MESON_TARGET already compiles only the correct executable with static linking. Is it there just to let meson handle the install step of a single systemctl executable?
Or does it install more files, like config files too?
I'm comparing this to a draft systemd-boot-native recipe for ukify which I had and which sets the build target but installs manually:
MESON_TARGET = "ukify"
EXTRA_OEMESON += "-Dnobody-user=nobody \
-Dnobody-group=nogroup \
-Drootlibdir=${rootlibdir} \
-Drootprefix=${rootprefix} \
-Ddefault-locale=C \
-Dmode=release \
-Dsystem-alloc-uid-min=101 \
-Dsystem-uid-max=999 \
-Dsystem-alloc-gid-min=101 \
-Dsystem-gid-max=999 \"
do_install() {
install -d ${D}${bindir}/
install -m 0755 ${S}/src/ukify/ukify.py ${D}${bindir}/ukify
}So the custom do_install() step could be avoided if systemd meson config would have "install_tag" for ukify too?
Current systemd-boot-native recipe installs/copies the unmodified ukify.py from source tree and uses that in native. It doesn't run meson build for it and thus things like version details are incorrect. Also some additional tools like systemd-measure, systemd-sbsign etc are not compiled so some usecases may not be supported atm. If those would also include the install tags, then they could be compiled and installed too, I presume.
meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch line 7
Quoted 13 lines
meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch new file +7
-0@@ -0,0 +1,25 @@ +From fbf1ae3b7bd074a8d3bfb741f54b8539123399f1 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: Backport +[https://github.com/systemd/systemd/commit/b1e5a7aa3f1e552c56d5adbeed6ff67d88d1e103]
Thanks for getting this upstreamed!
Cheers,
-Mikko
Re: [OE-core] [PATCH v2 3/3] systemd: Build the systemctl executable
Quoted 3 lines · Mikko Rapeli
Hmm, doesn't this overwrite
SRC_URIfrom systemd.inc?
SRC_URI+= "file://...patch" would amend the patch file.
Good catch!
Quoted 15 lines
meta/recipes-core/systemd/systemd-systemctl-native.bb line 13
Quoted 10 lines
meta/recipes-core/systemd/systemd-systemctl-native.bb +3
-7-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"I wonder why this tag support is needed since
MESON_TARGETalready compiles only the correct executable with static linking. Is it there just to let meson handle the install step of a single systemctl executable?
Quoted 1 line
Or does it install more files, like config files too?
Correct. It installs much more when no tags specified :)
Quoted 18 lines
I'm comparing this to a draft systemd-boot-native recipe for ukify which I had and which sets the build target but installs manually:
MESON_TARGET= "ukify"EXTRA_OEMESON += "-Dnobody-user=nobody \ -Dnobody-group=nogroup \ -Drootlibdir=${rootlibdir} \ -Drootprefix=${rootprefix} \ -Ddefault-locale=C \ -Dmode=release \ -Dsystem-alloc-uid-min=101 \ -Dsystem-uid-max=999 \ -Dsystem-alloc-gid-min=101 \ -Dsystem-gid-max=999 \"
Quoted 7 lines
do_install() { install -d ${D}${bindir}/ install -m 0755 ${S}/src/ukify/ukify.py ${D}${bindir}/ukify }So the custom
do_install()step could be avoided if systemd meson config would have "install_tag" for ukify too?
Correct. There's more discussion here https://github.com/systemd/systemd/pull/36243 , but if we need more tags, they can be added.
Quoted 7 lines
Current systemd-boot-native recipe installs/copies the unmodified
ukify.pyfrom source tree and uses that in native. It doesn't run meson build for it and thus things like version details are incorrect. Also some additional tools like systemd-measure, systemd-sbsign etc are not compiled so some usecases may not be supported atm. If those would also include the install tags, then they could be compiled and installed too, I presume.
Yes, that would be an option as well
Slava
Re: [OE-core] [PATCH v2 3/3] systemd: Build the systemctl executable
In reply to [email protected]2025. 02. 04. 11:53 keltezéssel, Vyacheslav Yurkov via lists.openembedded.org írta:
Quoted 7 lines
From: Vyacheslav Yurkov <[email protected]>
Instead of the python re-implementation build the actual systemctl from the systemd source tree. The python script was used when systemd didn't provide an option to build individual executables. It is possible in the meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation.
Finally, "systemctl --set-default mytarget" can be used in images. Thank you!
Quoted 22 lines · Vyacheslav Yurkov via lists.openembedded.org
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.
Signed-off-by Vyacheslav Yurkov <[email protected]>---
meta/conf/bitbake.conf | 3 +++1 file changed, 3 insertions(+)meta/conf/bitbake.conf +0
-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 xzHOSTTOOLS += "${@'xz' if (('archiver.bbclass' in (
d.getVar('BBINCLUDED')or '')) and (d.getVarFlag('ARCHIVER_MODE', 'compression')== 'xz')) else ''}"meta/conf/bitbake.conf +3
-0+# Native build of systemd tools requires getent utility +HOSTTOOLS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'getent', '', d)}" +
Quoted 2 lines
# Link to these if present
HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh sudo"
I'm a bit nervous about relying on getent being present. It comes from glibc and I'm a bit concerned about the host implications of depending upon that. It certainly gives us a very specific host dependency (unlike more generic things like coreutils).
Do we have any more information about where/why systemctl is using it and whether we really do need it?
Cheers,
Richard
I don't think systemctl actually needs it. But I believe the patch disabling it won't be suitable for upstream.
Will send a v3 later today that doesn't modify HOSTTOOLS.
Slava
Quoted 44 lines · On Tue, Feb 4, 2025, 12:03 Richard Purdie <…
meta/conf/bitbake.conf HOSTTOOLS += "${@'ip ping ps scp ssh stty' if
Quoted 16 lines · Vyacheslav Yurkov via lists.openembedded.org
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.
Signed-off-by Vyacheslav Yurkov <[email protected]>--- meta/conf/bitbake.conf | 3 +++ 1 file changed, 3 insertions(+)meta/conf/bitbake.conf +0
-0@@ -532,6 +532,9 @@ HOSTTOOLS += "${@'ip ping ps scp ssh stty' if(bb.utils.contains_any('IMAGE_CLAS
meta/conf/bitbake.conf HOSTTOOLS += "${@'ip ping ps scp ssh stty' if · line 533
Quoted 2 lines
meta/conf/bitbake.conf +0
-0# 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 ''}"meta/conf/bitbake.conf HOSTTOOLS += "${@'ip ping ps scp ssh stty' if · line 535
Quoted 3 lines
meta/conf/bitbake.conf +2
-0+# Native build of systemd tools requires getent utility +HOSTTOOLS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd','getent', '', d)}"
meta/conf/bitbake.conf HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLAS
Quoted 3 lines
meta/conf/bitbake.conf +1
-0+ # Link to these if present HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigzsftp socat ssh sudo"
I'm a bit nervous about relying on getent being present. It comes from glibc and I'm a bit concerned about the host implications of depending upon that. It certainly gives us a very specific host dependency (unlike more generic things like coreutils).
Do we have any more information about where/why systemctl is using it and whether we really do need it?
Cheers,
Richard