diff mbox series

seatd: fix packaging error with systemd DISTRO_FEATURES

Message ID 20250606161630.4027025-1-skandigraun@gmail.com
State Accepted, archived
Commit c7f157ad1207567ef3614ee4f6e755bccf60a3f4
Headers show
Series seatd: fix packaging error with systemd DISTRO_FEATURES | expand

Commit Message

Gyorgy Sarvari June 6, 2025, 4:16 p.m. UTC
The systemd unit file for this recipe is only installed in case
the target system's init system is not sysvinit (the recipe assumes
that in this case it is systemd). It is achieved by inspecting the
VIRTUAL-RUNTIME_init_manager variable.

However the systemd class was inherited unconditionally. This caused
a failure in do_package task, in case systemd is present in the
DISTRO_FEATURES but the system's init manager is sysvinit: in this case
the systemd unit file is not installed, however systemd.bbclass is
still trying to register is as a startup service. At this point
it failed:

ERROR: seatd-0.9.1-r0 do_package: Didn't find service unit 'seatd.service', specified in SYSTEMD_SERVICE:seatd.

To avoid this, inherit systemd bbclass only in case the init system is
specified as systemd.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 meta/recipes-core/seatd/seatd_0.9.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin June 10, 2025, 8:03 a.m. UTC | #1
On Fri, 6 Jun 2025 at 18:16, Gyorgy Sarvari via lists.openembedded.org
<skandigraun=gmail.com@lists.openembedded.org> wrote:
>
> The systemd unit file for this recipe is only installed in case
> the target system's init system is not sysvinit (the recipe assumes
> that in this case it is systemd). It is achieved by inspecting the
> VIRTUAL-RUNTIME_init_manager variable.
>
> However the systemd class was inherited unconditionally. This caused
> a failure in do_package task, in case systemd is present in the
> DISTRO_FEATURES but the system's init manager is sysvinit: in this case
> the systemd unit file is not installed, however systemd.bbclass is
> still trying to register is as a startup service. At this point
> it failed:
>
> ERROR: seatd-0.9.1-r0 do_package: Didn't find service unit 'seatd.service', specified in SYSTEMD_SERVICE:seatd.
>
> To avoid this, inherit systemd bbclass only in case the init system is
> specified as systemd.

> +inherit meson pkgconfig update-rc.d useradd ${@bb.utils.filter('VIRTUAL-RUNTIME_init_manager', 'systemd',  d)}

Conditional inherits are best avoided. There are plenty of recipes
that inherit systemd unconditionally, and they do not require similar
fixes. Perhaps we should install the service file unconditionally?

Alex
Gyorgy Sarvari June 10, 2025, 8:33 a.m. UTC | #2
On 6/10/25 10:03, Alexander Kanavin wrote:
> On Fri, 6 Jun 2025 at 18:16, Gyorgy Sarvari via lists.openembedded.org
> <skandigraun=gmail.com@lists.openembedded.org> wrote:
>> The systemd unit file for this recipe is only installed in case
>> the target system's init system is not sysvinit (the recipe assumes
>> that in this case it is systemd). It is achieved by inspecting the
>> VIRTUAL-RUNTIME_init_manager variable.
>>
>> However the systemd class was inherited unconditionally. This caused
>> a failure in do_package task, in case systemd is present in the
>> DISTRO_FEATURES but the system's init manager is sysvinit: in this case
>> the systemd unit file is not installed, however systemd.bbclass is
>> still trying to register is as a startup service. At this point
>> it failed:
>>
>> ERROR: seatd-0.9.1-r0 do_package: Didn't find service unit 'seatd.service', specified in SYSTEMD_SERVICE:seatd.
>>
>> To avoid this, inherit systemd bbclass only in case the init system is
>> specified as systemd.
>> +inherit meson pkgconfig update-rc.d useradd ${@bb.utils.filter('VIRTUAL-RUNTIME_init_manager', 'systemd',  d)}
> Conditional inherits are best avoided. There are plenty of recipes
> that inherit systemd unconditionally, and they do not require similar
> fixes. Perhaps we should install the service file unconditionally?
>
> Alex

Thanks for the feedback - I don't have particularly strong feelings for
this patch. Will send v2 soon.
diff mbox series

Patch

diff --git a/meta/recipes-core/seatd/seatd_0.9.1.bb b/meta/recipes-core/seatd/seatd_0.9.1.bb
index 87e1c3b67d..ef9364dc3c 100644
--- a/meta/recipes-core/seatd/seatd_0.9.1.bb
+++ b/meta/recipes-core/seatd/seatd_0.9.1.bb
@@ -11,7 +11,7 @@  SRC_URI = "git://git.sr.ht/~kennylevinsen/seatd;protocol=https;branch=master \
 SRCREV = "566ffeb032af42865dc1210e48cec08368059bb9"
 S = "${WORKDIR}/git"
 
-inherit meson pkgconfig systemd update-rc.d useradd
+inherit meson pkgconfig update-rc.d useradd ${@bb.utils.filter('VIRTUAL-RUNTIME_init_manager', 'systemd',  d)}
 
 # https://www.openwall.com/lists/musl/2020/01/20/3
 CFLAGS:append:libc-musl:powerpc64le = " -Wno-error=overflow"