]> code.ossystems Code Review - openembedded-core.git/commitdiff
weston: Use systemd notify,
authorPavel Zhukov <pavel.zhukov@huawei.com>
Wed, 6 Oct 2021 11:19:13 +0000 (13:19 +0200)
committerSteve Sakoman <steve@sakoman.com>
Tue, 19 Oct 2021 14:04:49 +0000 (04:04 -1000)
Using systemd notify fixes the problem with dependency chain in case
if other services depend on running weston.
This change required more robust handling of weston modules arguments
due to custom argument parser impmentation in weston (only last
--modules argument is accepted) and fixes the bug in modules handling
in the weston-start script (only last argument is actually parsed by
weston). Master branch implements systemd-notify thus backport but
doesn't utilize modules anymore so this change is mostly dunfell
specific.

Upstream-status: Backport

Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-graphics/wayland/weston-init/weston-start
meta/recipes-graphics/wayland/weston-init/weston@.service
meta/recipes-graphics/wayland/weston/systemd-notify.weston-start [new file with mode: 0644]
meta/recipes-graphics/wayland/weston/xwayland.weston-start
meta/recipes-graphics/wayland/weston_8.0.0.bb

index ccc70934259c1c6a83805f4fd2ce165c50e326c9..97471df80d2828ee48c6c42a2c11a7fbdedce45f 100755 (executable)
@@ -23,6 +23,15 @@ add_openvt_argument() {
        openvt_args="$openvt_args $1"
 }
 
+## Add module to --modules argument
+add_weston_module() {
+       if [ -z "${weston_modules}" ]; then
+               weston_modules="--modules "
+       fi;
+       weston_modules="${weston_modules}${1},"
+}
+
+
 if [ -n "$WAYLAND_DISPLAY" ]; then
        echo "ERROR: A Wayland compositor is already running, nested Weston instance is not supported yet."
        exit 1
@@ -65,6 +74,9 @@ if [ -d "$modules_dir" ]; then
                # process module
                . $m
        done
+       if [ -n "${weston_modules}" ]; then
+               add_weston_argument "${weston_modules} "
+       fi;
 fi
 
 if test -z "$XDG_RUNTIME_DIR"; then
index 39e193014ab2e99d014bab20fd648de5fc7694f3..70c706d75ceaaf6416e8715b091b6c41abd01cca 100644 (file)
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
 [Unit]
 Description=Weston Wayland Compositor
 RequiresMountsFor=/run
@@ -5,6 +9,8 @@ Conflicts=plymouth-quit.service
 After=systemd-user-sessions.service plymouth-quit-wait.service
 
 [Service]
+Type=notify
+NotifyAccess=all
 User=%i
 PAMName=login
 EnvironmentFile=-/etc/default/weston
diff --git a/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start b/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
new file mode 100644 (file)
index 0000000..fdb48cb
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+
+if [[ -x "/usr/lib/weston/systemd-notify.so" ]]; then
+       add_weston_module "systemd-notify.so"
+fi
index b483c97cf1ba871e88f063e2d66f7ccb930f2aee..22984f50a43db02c1a86f88a7b45351acbbc4f40 100644 (file)
@@ -2,6 +2,5 @@
 
 if type Xwayland  >/dev/null 2>/dev/null; then
        mkdir -p /tmp/.X11-unix
-
-       add_weston_argument "--modules=xwayland.so"
+       add_weston_module "xwayland.so"
 fi
index 0b383f25f36c1fc02c9c54ab8d3320caf9cb5cba..2b120d740481e98b2c2aa26a41b174168fa0e7e2 100644 (file)
@@ -5,9 +5,11 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
                     file://libweston/compositor.c;endline=27;md5=6c53bbbd99273f4f7c4affa855c33c0a"
 
+
 SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
            file://weston.png \
            file://weston.desktop \
+           file://systemd-notify.weston-start \
            file://xwayland.weston-start \
            file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \
 "
@@ -101,6 +103,10 @@ do_install_append() {
                install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland
        fi
 
+       if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then
+               install -Dm 644 ${WORKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify
+       fi
+
        if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then
                chmod u+s ${D}${bindir}/weston-launch
        fi