From 43334d620c4f03f0ff6404214eff0359ca90f279 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 1 Oct 2024 10:12:16 +0200 Subject: [PATCH] Backport fix for XDG dirs and compositor timeout Resolves: https://issues.redhat.com/browse/RHEL-60056 --- ...s-Set-sensible-defaults-for-XDG-dirs.patch | 47 +++++++++++++++++++ ...it-for-the-compositor-up-to-150-secs.patch | 32 +++++++++++++ xwayland-run.spec | 9 +++- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 0001-wlheadless-Set-sensible-defaults-for-XDG-dirs.patch create mode 100644 0002-wlheadless-Wait-for-the-compositor-up-to-150-secs.patch diff --git a/0001-wlheadless-Set-sensible-defaults-for-XDG-dirs.patch b/0001-wlheadless-Set-sensible-defaults-for-XDG-dirs.patch new file mode 100644 index 0000000..6504ff6 --- /dev/null +++ b/0001-wlheadless-Set-sensible-defaults-for-XDG-dirs.patch @@ -0,0 +1,47 @@ +From d3ff26a72b28907599cc04b5d4537c4af05e2c52 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Thu, 26 Sep 2024 08:46:19 +0200 +Subject: [PATCH 1/2] wlheadless: Set sensible defaults for XDG dirs + +The specification says: + + | $XDG_DATA_HOME defines the base directory relative to which user- + | specific data files should be stored. If $XDG_DATA_HOME is either + | not set or empty, a default equal to $HOME/.local/share should be + | used. + +And: + + | If $XDG_DATA_DIRS is either not set or empty, a value equal to + | /usr/local/share/:/usr/share/ should be used. + +Set the default values according to the specifications, so that the +configuration file can be found even if either or those environment +variables is not set. + +See-also: https://specifications.freedesktop.org/basedir-spec/latest/index.html#variables +Signed-off-by: Olivier Fourdan +--- + src/wlheadless/wlheadless_common.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/wlheadless/wlheadless_common.py b/src/wlheadless/wlheadless_common.py +index d056f3b..57ede5e 100644 +--- a/src/wlheadless/wlheadless_common.py ++++ b/src/wlheadless/wlheadless_common.py +@@ -76,8 +76,10 @@ class WlheadlessCommon: + def get_compositor(self): + """ Read the configuration for the default compositor """ + dirs = [] +- dirs.extend(os.getenv('XDG_DATA_HOME', '').split(':')) +- dirs.extend(os.getenv('XDG_DATA_DIRS', '').split(':')) ++ xdg_data_home=os.getenv('HOME', '') + '/.local/share' ++ xdg_data_dirs='/usr/local/share/:/usr/share/' ++ dirs.extend(os.getenv('XDG_DATA_HOME', xdg_data_home).split(':')) ++ dirs.extend(os.getenv('XDG_DATA_DIRS', xdg_data_dirs).split(':')) + config = configparser.ConfigParser() + config.read([os.path.join(d, 'wlheadless', 'wlheadless.conf') for d in dirs]) + return config.get('DEFAULT', 'Compositor', fallback = 'weston') +-- +2.46.2 + diff --git a/0002-wlheadless-Wait-for-the-compositor-up-to-150-secs.patch b/0002-wlheadless-Wait-for-the-compositor-up-to-150-secs.patch new file mode 100644 index 0000000..faf1b4e --- /dev/null +++ b/0002-wlheadless-Wait-for-the-compositor-up-to-150-secs.patch @@ -0,0 +1,32 @@ +From 3d0a3841226e8d48b5d48c2f69c69ff9d26006f9 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Thu, 26 Sep 2024 09:59:02 +0200 +Subject: [PATCH 2/2] wlheadless: Wait for the compositor up to 150 secs + +Some compositors who depend on DBus services may take up to 2 minutes +to start. + +Increase the timeout to 150 seconds before declaring forfeit and bail +out. + +Signed-off-by: Olivier Fourdan +--- + src/wlheadless/wlheadless_common.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/wlheadless/wlheadless_common.py b/src/wlheadless/wlheadless_common.py +index 57ede5e..d4a51d9 100644 +--- a/src/wlheadless/wlheadless_common.py ++++ b/src/wlheadless/wlheadless_common.py +@@ -110,7 +110,7 @@ class WlheadlessCommon: + + def wait_compositor(self): + """ Waits for the compositor to start """ +- for _ in range(0, 3): ++ for _ in range(0, 150): + try: + self.__try_connect() + return 0 +-- +2.46.2 + diff --git a/xwayland-run.spec b/xwayland-run.spec index 3813175..311226c 100644 --- a/xwayland-run.spec +++ b/xwayland-run.spec @@ -1,6 +1,6 @@ Name: xwayland-run Version: 0.0.4 -Release: 3%{?dist} +Release: 4t%{?dist} Summary: Set of utilities to run headless X/Wayland clients License: GPL-2.0-or-later @@ -9,6 +9,10 @@ Source0: %{url}/-/archive/%{version}/%{name}-%{version}.tar.bz2 # https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/merge_requests/19 Patch1: 0001-wlheadless-Ignore-os.waitpid-1-0-error.patch +# https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/merge_requests/21 +Patch2: 0001-wlheadless-Set-sensible-defaults-for-XDG-dirs.patch +# https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/merge_requests/22 +Patch3: 0002-wlheadless-Wait-for-the-compositor-up-to-150-secs.patch BuildArch: noarch @@ -57,6 +61,9 @@ Xwayland and various Wayland compositor headless. %changelog +* Thu Dec 12 2024 Olivier Fourdan - 0.0.4-4 +- Backport fix for XDG dirs and compositor timeout (RHEL-60056) + * Tue Oct 29 2024 Troy Dawson - 0.0.4-3 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018