diff mbox series

[1/5] systemd: move systemd-systemctl-native PACKAGE_WRITE_DEPS to systemd.bb

Message ID 20260710125425.220975-1-ross.burton@arm.com
State Under Review
Headers show
Series [1/5] systemd: move systemd-systemctl-native PACKAGE_WRITE_DEPS to systemd.bb | expand

Commit Message

Ross Burton July 10, 2026, 12:54 p.m. UTC
PACKAGE_WRITE_DEPS[1] is used to define package dependencies that are
needed at rootfs time, for example when a postinst can use a native
tool.

We allow distros to build recipes that support both systemd and sysv at
the same time, and the post-install script generated by systemd.bbclass
will use systemctl (via systemd-systemctl-native) at rootfs time to
install the units and thus generate the required symlinks.

Presently the dependency on systemctl-native is added to recipes via
systemd.bbclass but this results in all recipes that inherit that class
having the dependencies. This is actually suboptimal: at rootfs time
the key requirement is to install the units if and only if systemd is
being used.

We can move the PACKAGE_WRITE_DEPS dependency on systemd-systemctl-native
from each recipe (via the class) to systemd itself so units are installed
if systemd is present, and not otherwise.

This means recipes don't depend on systemd-systemctl-native (which has
non-trivial build dependencies itself), and the units are not installed
in non-systemd deployments.

[1] https://docs.yoctoproject.org/ref-manual/variables.html#term-PACKAGE_WRITE_DEPS

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/systemd.bbclass        | 1 -
 meta/recipes-core/systemd/systemd_259.5.bb | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass
index 26eaaf1922..5d8e6086b2 100644
--- a/meta/classes-recipe/systemd.bbclass
+++ b/meta/classes-recipe/systemd.bbclass
@@ -22,7 +22,6 @@  python __anonymous() {
     # redundant init files.
     if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
         d.appendVar("DEPENDS", " systemd-systemctl-native")
-        d.appendVar("PACKAGE_WRITE_DEPS", " systemd-systemctl-native")
         d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
 }
 
diff --git a/meta/recipes-core/systemd/systemd_259.5.bb b/meta/recipes-core/systemd/systemd_259.5.bb
index f3ec0edae7..594a716812 100644
--- a/meta/recipes-core/systemd/systemd_259.5.bb
+++ b/meta/recipes-core/systemd/systemd_259.5.bb
@@ -22,6 +22,8 @@  REQUIRED_DISTRO_FEATURES += "systemd"
 # this and hence we can no longer support it
 CONFLICT_DISTRO_FEATURES += "sysvinit"
 
+PACKAGE_WRITE_DEPS += "systemd-systemctl-native"
+
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \