* [PATCH v2 1/3] dbus: glib is only used in the test suite
@ 2025-08-04 19:54 Ross Burton
2025-08-04 19:54 ` [PATCH v2 2/3] dbus: use the systemd class to handle the unit files Ross Burton
2025-08-04 19:54 ` [PATCH v2 3/3] dbus: add message-bus PACKAGECONFIG Ross Burton
0 siblings, 2 replies; 4+ messages in thread
From: Ross Burton @ 2025-08-04 19:54 UTC (permalink / raw)
To: openembedded-core
The glib/gio libraries are only used in a few of the tests:
$ grep use_glib
meson.build:use_glib = glib.found() and gio.found()
test/meson.build:if use_glib
test/meson.build:if message_bus and tools and platform_unix and use_glib
test/meson.build:if use_glib
test/meson.build:if message_bus and tools and platform_unix and use_glib
So there's no need to depend on glib if we're not building the tests.
Explicitly enable/disable the modular tests option to ensure that when
the tests are not being installed we don't still need glib to build them.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/recipes-core/dbus/dbus_1.16.2.bb | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-core/dbus/dbus_1.16.2.bb b/meta/recipes-core/dbus/dbus_1.16.2.bb
index 909a209fc7b..1876ea8a944 100644
--- a/meta/recipes-core/dbus/dbus_1.16.2.bb
+++ b/meta/recipes-core/dbus/dbus_1.16.2.bb
@@ -20,7 +20,6 @@ SRC_URI[sha256sum] = "0ba2a1a4b16afe7bceb2c07e9ce99a8c2c3508e5dec290dbb643384bd6
EXTRA_OEMESON = "-Dxml_docs=disabled \
-Ddoxygen_docs=disabled \
-Dsystem_socket=/run/dbus/system_bus_socket \
- -Dmodular_tests=enabled \
-Dchecks=true \
-Druntime_dir=${runtimedir} \
-Dtest_socket_dir=/tmp \
@@ -41,9 +40,9 @@ PACKAGECONFIG[user-session] = "-Duser_session=true -Dsystemd_user_unitdir=${syst
PACKAGECONFIG[verbose-mode] = "-Dverbose_mode=true,-Dverbose_mode=false,,"
PACKAGECONFIG[audit] = "-Dlibaudit=enabled,-Dlibaudit=disabled,audit"
PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux"
-PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false"
+PACKAGECONFIG[tests] = "-Dmodular_tests=enabled -Dinstalled_tests=true,-Dmodular_tests=disabled -Dinstalled_tests=false,glib-2.0"
-DEPENDS = "expat virtual/libintl glib-2.0"
+DEPENDS = "expat virtual/libintl"
RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
RDEPENDS:${PN}:class-native = ""
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] dbus: use the systemd class to handle the unit files
2025-08-04 19:54 [PATCH v2 1/3] dbus: glib is only used in the test suite Ross Burton
@ 2025-08-04 19:54 ` Ross Burton
2025-08-05 8:58 ` [OE-core] " Mathieu Dubois-Briand
2025-08-04 19:54 ` [PATCH v2 3/3] dbus: add message-bus PACKAGECONFIG Ross Burton
1 sibling, 1 reply; 4+ messages in thread
From: Ross Burton @ 2025-08-04 19:54 UTC (permalink / raw)
To: openembedded-core
Originally, the dbus recipe couldn't use the systemd class because there
was a circular dependency between systemd and dbus.
However, since systemd v209 in 2014[1] systemd hasn't needed libdbus, as
it has it's own implementation of the client library. DBus does not use
the systemd libraries, so there is no circular dependency.
The dbus build was already was installing the service and socket files,
so we are installing them again. Remove the installation of the units.
Manually mask dbus-1.service by simply creating a symlink, instead of
depending on systemctl and using an postinstall script.
Signed-off-by: Ross Burton <ross.burton@arm.com>
[1] dbus: 718db96199 ("core: convert PID 1 to libsystemd-bus")
---
meta/recipes-core/dbus/dbus_1.16.2.bb | 30 ++++++---------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/meta/recipes-core/dbus/dbus_1.16.2.bb b/meta/recipes-core/dbus/dbus_1.16.2.bb
index 1876ea8a944..9f2c500e1fc 100644
--- a/meta/recipes-core/dbus/dbus_1.16.2.bb
+++ b/meta/recipes-core/dbus/dbus_1.16.2.bb
@@ -46,16 +46,11 @@ DEPENDS = "expat virtual/libintl"
RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
RDEPENDS:${PN}:class-native = ""
-inherit useradd update-rc.d
+inherit systemd useradd update-rc.d
INITSCRIPT_NAME = "dbus-1"
INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
-python __anonymous() {
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
-}
-
PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools"
USERADD_PACKAGES = "dbus-common"
@@ -103,16 +98,7 @@ FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadi
RDEPENDS:${PN}-ptest += "bash make dbus"
-PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
pkg_postinst:dbus() {
- # If both systemd and sysvinit are enabled, mask the dbus-1 init script
- if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
- if [ -n "$D" ]; then
- OPTS="--root=$D"
- fi
- systemctl $OPTS mask dbus-1.service
- fi
-
if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
/etc/init.d/populate-volatile.sh update
fi
@@ -134,22 +120,18 @@ do_install:append:class-target() {
install -d ${D}${sysconfdir}/init.d
sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh
install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
+
install -d ${D}${sysconfdir}/default/volatiles
echo "d messagebus messagebus 0755 /run/dbus none" \
> ${D}${sysconfdir}/default/volatiles/99_dbus
fi
- if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
- for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
- install -d ${D}${systemd_system_unitdir}/$i; done
- install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/
- ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket
- ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket
- ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service
- fi
+ # symlink dbus-1.service to /dev/null to "mask" the service, This ensures
+ # that if systemd and sysv init systems are both enabled, systemd doesn't
+ # start two system buses (one from init.d/dbus-1, one from dbus.service).
+ ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service
mkdir -p ${D}${localstatedir}/lib/dbus
-
chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ]
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] dbus: add message-bus PACKAGECONFIG
2025-08-04 19:54 [PATCH v2 1/3] dbus: glib is only used in the test suite Ross Burton
2025-08-04 19:54 ` [PATCH v2 2/3] dbus: use the systemd class to handle the unit files Ross Burton
@ 2025-08-04 19:54 ` Ross Burton
1 sibling, 0 replies; 4+ messages in thread
From: Ross Burton @ 2025-08-04 19:54 UTC (permalink / raw)
To: openembedded-core
There's no need to build an actual message bus in native or nativesdk
environments, as if DBus is needed in those environments then it will be
used to connect to the existing session or system bus.
Add a PACKAGECONFIG for the message bus, and wrap the packaging logic
with a PACKAGECONFIG check.
Expat is only needed by the bus, so this reduces the mandatory build
dependencies in the native case.
This means we can merge the overridden do_install appends, as native and
nativesdk don't have the message bus enabled so they don't install
dbus-launch.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/recipes-core/dbus/dbus_1.16.2.bb | 55 +++++++++++----------------
1 file changed, 23 insertions(+), 32 deletions(-)
diff --git a/meta/recipes-core/dbus/dbus_1.16.2.bb b/meta/recipes-core/dbus/dbus_1.16.2.bb
index 9f2c500e1fc..1346dcc3b53 100644
--- a/meta/recipes-core/dbus/dbus_1.16.2.bb
+++ b/meta/recipes-core/dbus/dbus_1.16.2.bb
@@ -27,12 +27,13 @@ EXTRA_OEMESON = "-Dxml_docs=disabled \
"
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \
- traditional-activation user-session \
+ message-bus traditional-activation user-session \
${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
"
PACKAGECONFIG:class-native = ""
PACKAGECONFIG:class-nativesdk = ""
+PACKAGECONFIG[message-bus] = "-Dmessage_bus=true,-Dmessage_bus=false,expat"
PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd_system_unitdir=${systemd_system_unitdir},-Dsystemd=disabled,systemd"
PACKAGECONFIG[x11] = "-Dx11_autolaunch=enabled,-Dx11_autolaunch=disabled, virtual/libx11 libsm"
PACKAGECONFIG[traditional-activation] = "-Dtraditional_activation=true,-Dtraditional_activation=false"
@@ -42,7 +43,7 @@ PACKAGECONFIG[audit] = "-Dlibaudit=enabled,-Dlibaudit=disabled,audit"
PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux"
PACKAGECONFIG[tests] = "-Dmodular_tests=enabled -Dinstalled_tests=true,-Dmodular_tests=disabled -Dinstalled_tests=false,glib-2.0"
-DEPENDS = "expat virtual/libintl"
+DEPENDS = "virtual/libintl"
RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
RDEPENDS:${PN}:class-native = ""
@@ -115,25 +116,29 @@ systemctl = '${bindir}/systemctl'
EOF
}
-do_install:append:class-target() {
- if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
- install -d ${D}${sysconfdir}/init.d
- sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh
- install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
+do_install:append() {
+ if ${@bb.utils.contains('PACKAGECONFIG', 'message-bus', 'true', 'false', d)}; then
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+ install -d ${D}${sysconfdir}/init.d
+ sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh
+ install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
- install -d ${D}${sysconfdir}/default/volatiles
- echo "d messagebus messagebus 0755 /run/dbus none" \
- > ${D}${sysconfdir}/default/volatiles/99_dbus
+ install -d ${D}${sysconfdir}/default/volatiles
+ echo "d messagebus messagebus 0755 /run/dbus none" \
+ > ${D}${sysconfdir}/default/volatiles/99_dbus
+ fi
+
+ # symlink dbus-1.service to /dev/null to "mask" the service, This ensures
+ # that if systemd and sysv init systems are both enabled, systemd doesn't
+ # start two system buses (one from init.d/dbus-1, one from dbus.service).
+ ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service
+
+ chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
+ else
+ # This gets installed even if the bus is disabled
+ rm -rf ${D}${localstatedir}
fi
- # symlink dbus-1.service to /dev/null to "mask" the service, This ensures
- # that if systemd and sysv init systems are both enabled, systemd doesn't
- # start two system buses (one from init.d/dbus-1, one from dbus.service).
- ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service
-
- mkdir -p ${D}${localstatedir}/lib/dbus
- chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
-
if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ]
then
chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
@@ -144,20 +149,6 @@ do_install:append:class-target() {
rm -rf ${D}${runtimedir}
}
-do_install:append:class-native() {
- # dbus-launch has no X support so lets not install it in case the host
- # has a more featured and useful version
- rm -f ${D}${bindir}/dbus-launch
-}
-
-do_install:append:class-nativesdk() {
- # dbus-launch has no X support so lets not install it in case the host
- # has a more featured and useful version
- rm -f ${D}${bindir}/dbus-launch
-
- # Remove /run to avoid QA error
- rm -rf ${D}${runtimedir}
-}
BBCLASSEXTEND = "native nativesdk"
CVE_PRODUCT += "d-bus_project:d-bus freedesktop:dbus freedesktop:libdbus"
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [OE-core] [PATCH v2 2/3] dbus: use the systemd class to handle the unit files
2025-08-04 19:54 ` [PATCH v2 2/3] dbus: use the systemd class to handle the unit files Ross Burton
@ 2025-08-05 8:58 ` Mathieu Dubois-Briand
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Dubois-Briand @ 2025-08-05 8:58 UTC (permalink / raw)
To: ross.burton, openembedded-core
On Mon Aug 4, 2025 at 9:54 PM CEST, Ross Burton via lists.openembedded.org wrote:
> Originally, the dbus recipe couldn't use the systemd class because there
> was a circular dependency between systemd and dbus.
>
> However, since systemd v209 in 2014[1] systemd hasn't needed libdbus, as
> it has it's own implementation of the client library. DBus does not use
> the systemd libraries, so there is no circular dependency.
>
> The dbus build was already was installing the service and socket files,
> so we are installing them again. Remove the installation of the units.
>
> Manually mask dbus-1.service by simply creating a symlink, instead of
> depending on systemctl and using an postinstall script.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
>
> [1] dbus: 718db96199 ("core: convert PID 1 to libsystemd-bus")
> ---
Hi Ross,
I suspect this patch is the source of this error:
ERROR: dbus-1.16.2-r0 do_install: Execution of '/srv/pokybuild/yocto-worker/musl-qemux86-64/build/build/tmp/work/core2-64-poky-linux-musl/dbus/1.16.2/temp/run.do_install.976229' failed with exit code 1
...
| ln: failed to create symbolic link '/srv/pokybuild/yocto-worker/musl-qemux86-64/build/build/tmp/work/core2-64-poky-linux-musl/dbus/1.16.2/image/lib/systemd/system/dbus-1.service': No such file or directory
https://autobuilder.yoctoproject.org/valkyrie/#/builders/3/builds/2216
https://autobuilder.yoctoproject.org/valkyrie/#/builders/2/builds/2177
https://autobuilder.yoctoproject.org/valkyrie/#/builders/11/builds/2139
Can you have a look, please?
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-05 8:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04 19:54 [PATCH v2 1/3] dbus: glib is only used in the test suite Ross Burton
2025-08-04 19:54 ` [PATCH v2 2/3] dbus: use the systemd class to handle the unit files Ross Burton
2025-08-05 8:58 ` [OE-core] " Mathieu Dubois-Briand
2025-08-04 19:54 ` [PATCH v2 3/3] dbus: add message-bus PACKAGECONFIG Ross Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox