Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap: Fix diff_files not finding the patch to apply #10602

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions mesonbuild/wrap/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,15 @@ def apply_diff_files(self) -> None:
path = Path(self.wrap.filesdir) / filename
if not path.exists():
raise WrapException(f'Diff file "{path}" does not exist')
relpath = os.path.relpath(str(path), self.dirname)
if PATCH:
cmd = [PATCH, '-f', '-p1', '-i', str(path)]
cmd = [PATCH, '-f', '-p1', '-i', relpath]
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', str(path)]
cmd = [GIT, '--work-tree', '.', 'apply', '-p1', relpath]
else:
raise WrapException('Missing "patch" or "git" commands to apply diff files')

Expand Down