File 0001-Fix-order-of-paths-passed-to-applications-running-wi.patch of Package meson
From dcbe7a78ea7f5eda70f5388bd1176a5a0eabe764 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Wed, 11 Jan 2023 10:17:54 +0100
Subject: [PATCH 1/2] Fix order of paths passed to applications running with
wine
The paths to the build directory must to be placed before the
system paths to avoid using possibly incorrect dll's.
To detect multiple path definitions, the paths are first
normalized.
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de
---
mesonbuild/mtest.py | 10 +++++-----
mesonbuild/scripts/meson_exe.py | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 27e0f796a..82a801ef0 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1422,11 +1422,11 @@ class SingleTestRunner:
for c in self.cmd:
winecmd.append(c)
if os.path.basename(c).startswith('wine'):
- env['WINEPATH'] = get_wine_shortpath(
- winecmd,
- ['Z:' + p for p in self.test.extra_paths] + env.get('WINEPATH', '').split(';'),
- self.test.workdir
- )
+ wine_paths = list(set(['Z:' + os.path.normpath(p) for p in self.test.extra_paths]
+ + env.get('WINEPATH', '').split(';')))
+ build_dir = os.getcwd()
+ wine_paths.sort(key=lambda x: not build_dir in x)
+ env['WINEPATH'] = get_wine_shortpath(winecmd, wine_paths, self.test.workdir)
break
# If MALLOC_PERTURB_ is not set, or if it is set to an empty value,
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py
index e928e9c1e..7d02208d6 100644
--- a/mesonbuild/scripts/meson_exe.py
+++ b/mesonbuild/scripts/meson_exe.py
@@ -38,11 +38,11 @@ def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[T.Dict[str, str]
child_env['PATH'])
if exe.exe_wrapper and any('wine' in i for i in exe.exe_wrapper.get_command()):
from .. import mesonlib
- child_env['WINEPATH'] = mesonlib.get_wine_shortpath(
- exe.exe_wrapper.get_command(),
- ['Z:' + p for p in exe.extra_paths] + child_env.get('WINEPATH', '').split(';'),
- exe.workdir
- )
+ wine_paths = list(set(['Z:' + os.path.normpath(p) for p in exe.extra_paths]
+ + child_env.get('WINEPATH', '').split(';')))
+ build_dir = os.getcwd()
+ wine_paths.sort(key=lambda x: not build_dir in x)
+ child_env['WINEPATH'] = mesonlib.get_wine_shortpath(exe.exe_wrapper.get_command(), wine_paths, exe.workdir)
stdin = None
if exe.feed:
--
2.47.1