Hi,

On Tue, Feb 04, 2025 at 11:53:15AM +0100, Vyacheslav Yurkov via 
lists.openembedded.org wrote:
> 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!

> 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/systemctl
> 
> diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb 
> b/meta/recipes-core/systemd/systemd-systemctl-native.bb
> index ffa024caef..57bb1ab830 100644
> --- a/meta/recipes-core/systemd/systemd-systemctl-native.bb
> +++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb
> @@ -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"

Hmm, doesn't this overwrite SRC_URI from systemd.inc?

SRC_URI += "file://...patch" would amend the patch file.

> -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.

> diff --git 
> a/meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch
>  
> b/meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch
> new file mode 100644
> index 0000000000..a9b3e62708
> --- /dev/null
> +++ 
> b/meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch
> @@ -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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210790): 
https://lists.openembedded.org/g/openembedded-core/message/210790
Mute This Topic: https://lists.openembedded.org/mt/110989706/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to