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: Add support for applying a list of patch files #9717

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

pwmarcz
Copy link
Contributor

@pwmarcz pwmarcz commented Dec 10, 2021

As discussed in #4570, I'd like to submit an updated patch. Since I'm building on the work by @xclaesse, I added him in Co-authored-by.

I made the following changes compared to the original PR:

  • hardcode -p1 instead of configuring strip level: this should be good for most workflows (e.g. patches generated from Git), and if the user has an incompatible patch, they can always convert or re-generate it
  • instead of a separate section, use a single property, diff_files:
    • "diff" instead of "patch" since "Meson build patches" unfortunately already mean something else
    • I proposed diff_filename previously, for consistency with patch_filename; but it looks awkward when used for multiple patches (and diff_filenames could be an annoying source of typos)
  • parse a comma-separated list (instead of Python list literal): this is a common convention for INI files, and already used in wrap files (dependency_names, program_names)
  • prefer using patch to Git: patch is the purpose-specific tool, and one usually used in build scripts; Git requires extra workarounds (--work-tree)
  • don't use git am for wrap-git, but apply patches in the same way as everything else: this is simpler, less prone to failure (no special rarely-taken case in code), and less surprising for the user (who probably doesn't expect Meson to apply patches as commits in this one case; and might reasonably be expected to provide a "bare" patch without a commit message)
  • don't apply patches with --ignore-whitespace: I think it's better if we fail when the patch doesn't apply exactly, as it could indicate problems (e.g. patch for a different version of code); since the user controls the patch, they can re-generate it if necessary

Please let me know if I should change anything. The above choices seem good to me as a potential user of the feature, but I'm pretty new to the Meson project.

Co-authored-by: Xavier Claessens xavier.claessens@collabora.com

@pwmarcz pwmarcz requested a review from jpakkane as a code owner December 10, 2021 16:01
@lgtm-com
Copy link

lgtm-com bot commented Dec 10, 2021

This pull request introduces 1 alert when merging 78d7d3b into f45a21a - view on LGTM.com

new alerts:

  • 1 for Unreachable code

mesonbuild/wrap/wrap.py Outdated Show resolved Hide resolved
Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit nervous about adding support to modify upstream code, as bugs should generally be fixed upstream or by committing to forking, not by vendoring.

(For example, if this is added to meson it will be completely forbidden in the WrapDB.)

Leaving that aside for now and just looking at the implementation...

docs/markdown/Wrap-dependency-system-manual.md Outdated Show resolved Hide resolved
docs/markdown/Wrap-dependency-system-manual.md Outdated Show resolved Hide resolved
docs/markdown/Wrap-dependency-system-manual.md Outdated Show resolved Hide resolved
mesonbuild/wrap/wrap.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 10, 2021

Codecov Report

Merging #9717 (e7ecd59) into master (2bcc204) will increase coverage by 0.66%.
The diff coverage is n/a.

❗ Current head e7ecd59 differs from pull request most recent head fbc0d27. Consider uploading reports for the commit fbc0d27 to get more accurate results

@@            Coverage Diff             @@
##           master    #9717      +/-   ##
==========================================
+ Coverage   66.55%   67.22%   +0.66%     
==========================================
  Files         402      203     -199     
  Lines       85522    43911   -41611     
  Branches    18817     9768    -9049     
==========================================
- Hits        56919    29517   -27402     
+ Misses      24210    12139   -12071     
+ Partials     4393     2255    -2138     
Impacted Files Coverage Δ
mdevenv.py 27.10% <0.00%> (-3.49%) ⬇️
modules/java.py 67.85% <0.00%> (-3.30%) ⬇️
mcompile.py 51.81% <0.00%> (-1.95%) ⬇️
modules/python.py 66.81% <0.00%> (-1.91%) ⬇️
ast/printer.py 79.22% <0.00%> (-1.43%) ⬇️
wrap/wrap.py 60.26% <0.00%> (-1.06%) ⬇️
coredata.py 82.43% <0.00%> (-0.84%) ⬇️
modules/__init__.py 94.18% <0.00%> (-0.56%) ⬇️
interpreter/compiler.py 93.11% <0.00%> (-0.55%) ⬇️
compilers/mixins/visualstudio.py 26.47% <0.00%> (-0.43%) ⬇️
... and 322 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bcc204...fbc0d27. Read the comment docs.

@xclaesse
Copy link
Member

Missing release notes (add a file in docs/markdown/snippets/) but other than that it looks good to me. Thanks for finishing it.

@pwmarcz
Copy link
Contributor Author

pwmarcz commented Dec 13, 2021

Release notes added.

@pwmarcz
Copy link
Contributor Author

pwmarcz commented Feb 2, 2022

Hi, is there a chance of getting this merged?

mesonbuild/wrap/wrap.py Outdated Show resolved Hide resolved
@pwmarcz pwmarcz force-pushed the wrap-patch-2 branch 4 times, most recently from e004190 to d18a773 Compare February 3, 2022 11:05
@tristan957
Copy link
Contributor

Anything missing for this PR to go in 0.62 @eli-schwartz. Seems like you had marked "changes requested", but they seem to have resolved.

@xclaesse
Copy link
Member

xclaesse commented Mar 3, 2022

I think you also need to re-apply patches when doing "meson subprojects update --reset".

@pwmarcz
Copy link
Contributor Author

pwmarcz commented Mar 3, 2022

I think you also need to re-apply patches when doing "meson subprojects update --reset".

Done: I assume you mean the git_reset() method in msubprojects.py, since that's where we call apply_patch() already.

@mkow
Copy link

mkow commented Jun 2, 2022

What's the status of this PR? It seems that all discussions were resolved and this patch would really make our lives easier.

@tristan957
Copy link
Contributor

tristan957 commented Jun 2, 2022

This should probably be marked for 0.63. Shame it wasn't in time for 0.62

Copy link
Member

@xclaesse xclaesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was merged already, LGTM.

docs/markdown/Wrap-dependency-system-manual.md Outdated Show resolved Hide resolved
mesonbuild/wrap/wrap.py Outdated Show resolved Hide resolved
@xclaesse
Copy link
Member

xclaesse commented Jun 3, 2022

@pwmarcz Could you do the quick fix above so this can be merged please?

Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
@pwmarcz
Copy link
Contributor Author

pwmarcz commented Jun 3, 2022

Done.

@xclaesse
Copy link
Member

xclaesse commented Jun 3, 2022

LGTM when CI is green.

@mkow
Copy link

mkow commented Jun 6, 2022

LGTM when CI is green.

@xclaesse: CI looks green :)

@xclaesse xclaesse merged commit 9061c3a into mesonbuild:master Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants