Skip to contentSkip to conversation

systemd: Build the systemctl executable

PATCH Superseded [email protected] 4 participants 5 messages Feb 7, 2025 – Feb 10, 2025 Arm/Amlogic Meson SoC support

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 systemd: Build the systemctl executable

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.

License-Update: Base recipe is used

---
 .../systemd/systemd-systemctl-native.bb       |  23 +-
 ...-meson-add-install-tag-for-systemctl.patch |  25 ++
 ...2-meson-Bypass-certain-config-checks.patch |  64 +++
 .../systemd/systemd-systemctl/systemctl       | 366 ------------------
 4 files changed, 100 insertions(+), 378 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch
 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch
 delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl
meta/recipes-core/systemd/systemd-systemctl-native.bb +11 -12
index ffa024caef..30b28477c0 100644
@@ -1,17 +1,16 @@
-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:append = " \
+    file://0001-meson-add-install-tag-for-systemctl.patch \
+    file://0002-meson-Bypass-certain-config-checks.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
new file mode 100644
index 0000000000..a9b3e62708
@@ -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/0002-meson-Bypass-certain-config-checks.patch new file +64 -0

64 lines not on this page · raw message

meta/recipes-core/systemd/systemd-systemctl/systemctl deleted +0 -366

366 lines not on this page · raw message

#1 lore raw
Quoted 16 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.

License-Update: Base recipe is used

---
 .../systemd/systemd-systemctl-native.bb       |  23 +- ...-meson-add-install-tag-for-systemctl.patch |  25 ++ ...2-meson-Bypass-certain-config-checks.patch |  64 +++ .../systemd/systemd-systemctl/systemctl       | 366 ------------------

Quoted 4 lines
 4 files changed, 100 insertions(+), 378 deletions(-)

 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl

Unfortunately this showed circular dependency errors in testing:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/76/builds/933

Cheers,

Richard

#2 lore raw
Quoted 21 lines · Richard Purdie
Quoted 17 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.

License-Update: Base recipe is used

---
  .../systemd/systemd-systemctl-native.bb       |  23 +-
  ...-meson-add-install-tag-for-systemctl.patch |  25 ++
  ...2-meson-Bypass-certain-config-checks.patch |  64 +++
  .../systemd/systemd-systemctl/systemctl       | 366 ------------------
  4 files changed, 100 insertions(+), 378 deletions(-)
Quoted 3 lines

 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl

Quoted 7 lines

Unfortunately this showed circular dependency errors in testing:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/76/builds/933

Cheers,

Richard

I believe the failure comes from util-linux. Any idea how to "inherit" conditionally only for target builds? (without creating a separate native recipe).

Slava

#3 lore raw

Hi,

Quoted 26 lines · Vyacheslav Yurkov via lists.openembedded.org
Quoted 25 lines · Richard Purdie
Quoted 15 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.

License-Update: Base recipe is used

---
�.../systemd/systemd-systemctl-native.bb������ |� 23 +- �...-meson-add-install-tag-for-systemctl.patch |� 25 ++ �...2-meson-Bypass-certain-config-checks.patch |� 64 +++

Quoted 5 lines
 �.../systemd/systemd-systemctl/systemctl������ | 366 ------------------

�4 files changed, 100 insertions(+), 378 deletions(-)
�create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch �create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch �delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl

Unfortunately this showed circular dependency errors in testing:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/76/builds/933

Quoted 7 lines
Quoted 3 lines

Cheers,

Richard

I believe the failure comes from util-linux. Any idea how to "inherit" conditionally only for target builds? (without creating a separate native recipe).

Set a variable conditionally and use that with "inherit".

FOO = ""
FOO:class-target = "bar"

inherit ${FOO}

Cheers,

-Mikko

#4 lore raw
Quoted 37 lines · Mikko Rapeli via lists.openembedded.org

Hi,

Quoted 26 lines · Vyacheslav Yurkov via lists.openembedded.org
Quoted 25 lines · Richard Purdie
Quoted 17 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.

License-Update: Base recipe is used

---
   .../systemd/systemd-systemctl-native.bb       |  23 +-
   ...-meson-add-install-tag-for-systemctl.patch |  25 ++
   ...2-meson-Bypass-certain-config-checks.patch |  64 +++
   .../systemd/systemd-systemctl/systemctl       | 366 ------------------
   4 files changed, 100 insertions(+), 378 deletions(-)
Quoted 3 lines

 create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0002-meson-Bypass-certain-config-checks.patch delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl

Unfortunately this showed circular dependency errors in testing:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/76/builds/933

Quoted 7 lines
Quoted 3 lines

Cheers,

Richard

I believe the failure comes from util-linux. Any idea how to "inherit" conditionally only for target builds? (without creating a separate native recipe).

Quoted 7 lines

Set a variable conditionally and use that with "inherit".

FOO = ""
FOO:class-target = "bar"

inherit ${FOO}

Just chiming in here, but I believe this should rather be inherit_defer ?

Cheers,
Quentin