aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/wrap
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-10-30 22:02:54 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2024-02-09 21:04:31 +0530
commit09c0803077b9887792b50520aa90bc30dc451f8c (patch)
treefa4c4d7811c7e10ce2d10a2509de7d65a4509ccb /mesonbuild/wrap
parent348c2e93d23b3f087e72cb04c3f6e2f2572c4fa9 (diff)
downloadmeson-09c0803077b9887792b50520aa90bc30dc451f8c.zip
meson-09c0803077b9887792b50520aa90bc30dc451f8c.tar.gz
meson-09c0803077b9887792b50520aa90bc30dc451f8c.tar.bz2
wraps: Ignore whitespace when applying diff_file
Fixes https://github.com/mesonbuild/meson/issues/12092
Diffstat (limited to 'mesonbuild/wrap')
-rw-r--r--mesonbuild/wrap/wrap.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index d302e9d..53caa02 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -811,13 +811,15 @@ class Resolver:
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())]
+ # Ignore whitespace when applying patches to workaround
+ # line-ending differences
+ cmd = [PATCH, '-l', '-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
# Git repository: by default, Git will try to apply the patch to
# the repository root.
- cmd = [GIT, '--work-tree', '.', 'apply', '-p1', relpath]
+ cmd = [GIT, '--work-tree', '.', 'apply', '--ignore-whitespace', '-p1', relpath]
else:
raise WrapException('Missing "patch" or "git" commands to apply diff files')