diff options
| author | Ross Burton <ross.burton@arm.com> | 2025-08-05 12:26:14 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-07 12:11:16 +0100 |
| commit | 5de44144cfe551845f66b460733f3328890614da (patch) | |
| tree | 6138e7419c2f453146eac05ba8fd608dbc82e694 | |
| parent | f266b932995975b94250fd4944800fcfb4741434 (diff) | |
| download | poky-5de44144cfe551845f66b460733f3328890614da.tar.gz | |
dbus: add message-bus PACKAGECONFIG
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.
(From OE-Core rev: dc674bf44fc757a4ffe7577a4d106ae729048013)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-core/dbus/dbus_1.16.2.bb | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/meta/recipes-core/dbus/dbus_1.16.2.bb b/meta/recipes-core/dbus/dbus_1.16.2.bb index 4fc590eb39..abe4196d9a 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 \ | |||
| 27 | " | 27 | " |
| 28 | 28 | ||
| 29 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \ | 29 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \ |
| 30 | traditional-activation user-session \ | 30 | message-bus traditional-activation user-session \ |
| 31 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ | 31 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ |
| 32 | " | 32 | " |
| 33 | PACKAGECONFIG:class-native = "" | 33 | PACKAGECONFIG:class-native = "" |
| 34 | PACKAGECONFIG:class-nativesdk = "" | 34 | PACKAGECONFIG:class-nativesdk = "" |
| 35 | 35 | ||
| 36 | PACKAGECONFIG[message-bus] = "-Dmessage_bus=true,-Dmessage_bus=false,expat" | ||
| 36 | PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd_system_unitdir=${systemd_system_unitdir},-Dsystemd=disabled,systemd" | 37 | PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd_system_unitdir=${systemd_system_unitdir},-Dsystemd=disabled,systemd" |
| 37 | PACKAGECONFIG[x11] = "-Dx11_autolaunch=enabled,-Dx11_autolaunch=disabled, virtual/libx11 libsm" | 38 | PACKAGECONFIG[x11] = "-Dx11_autolaunch=enabled,-Dx11_autolaunch=disabled, virtual/libx11 libsm" |
| 38 | PACKAGECONFIG[traditional-activation] = "-Dtraditional_activation=true,-Dtraditional_activation=false" | 39 | PACKAGECONFIG[traditional-activation] = "-Dtraditional_activation=true,-Dtraditional_activation=false" |
| @@ -42,7 +43,7 @@ PACKAGECONFIG[audit] = "-Dlibaudit=enabled,-Dlibaudit=disabled,audit" | |||
| 42 | PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux" | 43 | PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux" |
| 43 | PACKAGECONFIG[tests] = "-Dmodular_tests=enabled -Dinstalled_tests=true,-Dmodular_tests=disabled -Dinstalled_tests=false,glib-2.0" | 44 | PACKAGECONFIG[tests] = "-Dmodular_tests=enabled -Dinstalled_tests=true,-Dmodular_tests=disabled -Dinstalled_tests=false,glib-2.0" |
| 44 | 45 | ||
| 45 | DEPENDS = "expat virtual/libintl" | 46 | DEPENDS = "virtual/libintl" |
| 46 | RDEPENDS:${PN} += "${PN}-common ${PN}-tools" | 47 | RDEPENDS:${PN} += "${PN}-common ${PN}-tools" |
| 47 | RDEPENDS:${PN}:class-native = "" | 48 | RDEPENDS:${PN}:class-native = "" |
| 48 | 49 | ||
| @@ -115,26 +116,31 @@ systemctl = '${bindir}/systemctl' | |||
| 115 | EOF | 116 | EOF |
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | do_install:append:class-target() { | 119 | do_install:append() { |
| 119 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | 120 | if ${@bb.utils.contains('PACKAGECONFIG', 'message-bus', 'true', 'false', d)}; then |
| 120 | install -d ${D}${sysconfdir}/init.d | 121 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 121 | sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh | 122 | install -d ${D}${sysconfdir}/init.d |
| 122 | install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1 | 123 | sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh |
| 123 | 124 | install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1 | |
| 124 | install -d ${D}${sysconfdir}/default/volatiles | 125 | |
| 125 | echo "d messagebus messagebus 0755 /run/dbus none" \ | 126 | install -d ${D}${sysconfdir}/default/volatiles |
| 126 | > ${D}${sysconfdir}/default/volatiles/99_dbus | 127 | echo "d messagebus messagebus 0755 /run/dbus none" \ |
| 127 | 128 | > ${D}${sysconfdir}/default/volatiles/99_dbus | |
| 128 | if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then | 129 | |
| 129 | # symlink dbus-1.service to /dev/null to "mask" the service, This ensures | 130 | if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then |
| 130 | # that if systemd and sysv init systems are both enabled, systemd doesn't | 131 | # symlink dbus-1.service to /dev/null to "mask" the service, This ensures |
| 131 | # start two system buses (one from init.d/dbus-1, one from dbus.service). | 132 | # that if systemd and sysv init systems are both enabled, systemd doesn't |
| 132 | ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service | 133 | # start two system buses (one from init.d/dbus-1, one from dbus.service). |
| 134 | ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service | ||
| 135 | fi | ||
| 133 | fi | 136 | fi |
| 134 | fi | ||
| 135 | 137 | ||
| 136 | mkdir -p ${D}${localstatedir}/lib/dbus | 138 | mkdir -p ${D}${localstatedir}/lib/dbus |
| 137 | chown messagebus:messagebus ${D}${localstatedir}/lib/dbus | 139 | chown messagebus:messagebus ${D}${localstatedir}/lib/dbus |
| 140 | else | ||
| 141 | # This gets installed even if the bus is disabled | ||
| 142 | rm -rf ${D}${localstatedir} | ||
| 143 | fi | ||
| 138 | 144 | ||
| 139 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ] | 145 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ] |
| 140 | then | 146 | then |
| @@ -146,20 +152,6 @@ do_install:append:class-target() { | |||
| 146 | rm -rf ${D}${runtimedir} | 152 | rm -rf ${D}${runtimedir} |
| 147 | } | 153 | } |
| 148 | 154 | ||
| 149 | do_install:append:class-native() { | ||
| 150 | # dbus-launch has no X support so lets not install it in case the host | ||
| 151 | # has a more featured and useful version | ||
| 152 | rm -f ${D}${bindir}/dbus-launch | ||
| 153 | } | ||
| 154 | |||
| 155 | do_install:append:class-nativesdk() { | ||
| 156 | # dbus-launch has no X support so lets not install it in case the host | ||
| 157 | # has a more featured and useful version | ||
| 158 | rm -f ${D}${bindir}/dbus-launch | ||
| 159 | |||
| 160 | # Remove /run to avoid QA error | ||
| 161 | rm -rf ${D}${runtimedir} | ||
| 162 | } | ||
| 163 | BBCLASSEXTEND = "native nativesdk" | 155 | BBCLASSEXTEND = "native nativesdk" |
| 164 | 156 | ||
| 165 | CVE_PRODUCT += "d-bus_project:d-bus freedesktop:dbus freedesktop:libdbus" | 157 | CVE_PRODUCT += "d-bus_project:d-bus freedesktop:dbus freedesktop:libdbus" |
