Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] memory-control: fix build failure on non-systemd distros
@ 2026-07-13 15:01 Ishaan Desai
  2026-07-13 17:18 ` Mathieu Dubois-Briand
  0 siblings, 1 reply; 2+ messages in thread
From: Ishaan Desai @ 2026-07-13 15:01 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ishaan Desai, Mathieu Dubois-Briand

The recipe unconditionally declared RDEPENDS on 'systemd', which is an
init manager, not an installable package. On distros like poky that do
not enable the systemd DISTRO_FEATURE, the dependency resolver cannot
satisfy this, causing the recipe and anything that inherits
memory-control.bbclass to become unbuildable in a world build:

  ERROR: Nothing RPROVIDES 'systemd'
  NOTE: Runtime target 'memory-control' is unbuildable

Fix by adding 'inherit features_check' and REQUIRED_DISTRO_FEATURES =
"systemd" to the recipe so it is cleanly skipped on non-systemd distros,
removing 'systemd' from RDEPENDS:${PN} in the recipe (the tool shells out
to systemctl at runtime, but systemd is an init manager present on the
running system, not a package dependency to install), and guarding the
RDEPENDS injection in memory-control.bbclass with bb.utils.contains so
recipes that inherit the class do not pull in the memory-control package
on non-systemd distros. Also add the missing RECIPE_MAINTAINER entry to
maintainers.inc.

Reported-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
AI-Generated: Uses IBM Bob

Signed-off-by: Ishaan Desai <Ishaan.Desai@ibm.com>
---
 meta/classes-recipe/memory-control.bbclass                | 4 +++-
 meta/conf/distro/include/maintainers.inc                  | 1 +
 meta/recipes-support/memory-control/memory-control_1.0.bb | 6 ++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/meta/classes-recipe/memory-control.bbclass b/meta/classes-recipe/memory-control.bbclass
index 4b45720a1d..ebde5ed46b 100644
--- a/meta/classes-recipe/memory-control.bbclass
+++ b/meta/classes-recipe/memory-control.bbclass
@@ -25,7 +25,9 @@ MEMORY_LIMIT ?= ""
 MEMORY_LIMIT_SERVICE ?= "${PN}.service"
 MEMORY_OOM_POLICY ?= "reboot"
 
-RDEPENDS:${PN} += "memory-control"
+# Only inject the runtime dependency when the distro actually has systemd;
+# memory-control itself requires the systemd DISTRO_FEATURE.
+RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'memory-control', '', d)}"
 
 python memory_control_do_install() {
     import os
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 4c6307086c..8589a67fa4 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -520,6 +520,7 @@ RECIPE_MAINTAINER:pn-matchbox-wm = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-mc = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-mdadm = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-menu-cache = "Ross Burton <ross.burton@arm.com>"
+RECIPE_MAINTAINER:pn-memory-control = "Ishaan Desai <Ishaan.Desai@ibm.com>"
 RECIPE_MAINTAINER:pn-mesa = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-mesa-demos = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-mesa-gl = "Unassigned <unassigned@yoctoproject.org>"
diff --git a/meta/recipes-support/memory-control/memory-control_1.0.bb b/meta/recipes-support/memory-control/memory-control_1.0.bb
index 3740b783b6..56b156be4b 100644
--- a/meta/recipes-support/memory-control/memory-control_1.0.bb
+++ b/meta/recipes-support/memory-control/memory-control_1.0.bb
@@ -7,7 +7,9 @@ BUGTRACKER = "https://bugzilla.yoctoproject.org"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
-inherit systemd
+inherit systemd features_check
+
+REQUIRED_DISTRO_FEATURES = "systemd"
 
 SRC_URI = " \
     file://memory-control.sh \
@@ -18,7 +20,7 @@ SRC_URI = " \
 SYSTEMD_SERVICE:${PN} = ""
 SYSTEMD_AUTO_ENABLE = "disable"
 
-RDEPENDS:${PN} = "bash systemd"
+RDEPENDS:${PN} = "bash"
 
 do_install() {
     install -d ${D}${bindir}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-13 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 15:01 [PATCH] memory-control: fix build failure on non-systemd distros Ishaan Desai
2026-07-13 17:18 ` Mathieu Dubois-Briand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox