diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2023-09-12 10:03:07 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-09-14 06:58:23 -0400 |
commit | 718c86a7d577e6474ff325957248724d9b786174 (patch) | |
tree | 0e06ec5047cc3439394990e231ad51213f47c419 /mesonbuild/wrap | |
parent | 22da2c3c2df035220ea01e368120549987fa43ea (diff) | |
download | meson-718c86a7d577e6474ff325957248724d9b786174.zip meson-718c86a7d577e6474ff325957248724d9b786174.tar.gz meson-718c86a7d577e6474ff325957248724d9b786174.tar.bz2 |
Wrap: Use git instead of patch by default
This solves problems with Strawberry Perl providing patch.exe on Windows
with an unconsistent line ending support.
Fixes: #12092
Diffstat (limited to 'mesonbuild/wrap')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 941da3d..c0f0f07 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -801,15 +801,17 @@ class Resolver: if not path.exists(): raise WrapException(f'Diff file "{path}" does not exist') relpath = os.path.relpath(str(path), self.dirname) - if PATCH: - # Always pass a POSIX path to patch, because on Windows it's MSYS - cmd = [PATCH, '-f', '-p1', '-i', str(Path(relpath).as_posix())] - elif GIT: - # If the `patch` command is not available, fall back to `git - # apply`. The `--work-tree` is necessary in case we're inside a + if GIT: + # Git is more likely to be available on Windows and more likely + # to apply correctly assuming patches are often generated by git. + # See https://github.com/mesonbuild/meson/issues/12092. + # The `--work-tree` is necessary in case we're inside a # Git repository: by default, Git will try to apply the patch to # the repository root. cmd = [GIT, '--work-tree', '.', 'apply', '-p1', relpath] + elif PATCH: + # Always pass a POSIX path to patch, because on Windows it's MSYS + cmd = [PATCH, '-f', '-p1', '-i', str(Path(relpath).as_posix())] else: raise WrapException('Missing "patch" or "git" commands to apply diff files') |