Backport fix for XDG dirs and compositor timeout

Resolves: https://issues.redhat.com/browse/RHEL-60056
This commit is contained in:
Olivier Fourdan 2024-10-01 10:12:16 +02:00
parent 230ebc03b1
commit 43334d620c
3 changed files with 87 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From d3ff26a72b28907599cc04b5d4537c4af05e2c52 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
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 <ofourdan@redhat.com>
---
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

View File

@ -0,0 +1,32 @@
From 3d0a3841226e8d48b5d48c2f69c69ff9d26006f9 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
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 <ofourdan@redhat.com>
---
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

View File

@ -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 <ofourdan@redhat.com> - 0.0.4-4
- Backport fix for XDG dirs and compositor timeout (RHEL-60056)
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0.0.4-3
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018