-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
wrap: Add support for applying a list of patch files #4570
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,6 +247,34 @@ With such wrap file, `find_program('myprog')` will automatically | |
| fallback to use the subproject, assuming it uses | ||
| `meson.override_find_program('myprog')`. | ||
|
|
||
| ## Patch files | ||
|
|
||
| *Since: 0.59.0* | ||
|
|
||
| A list of local patch files can be provided in the `[patch-files]` section. They | ||
| will be applied after the project has been extracted or cloned, and after the | ||
| `patch_filename` has been applied. `git` or `patch` command-line tool must be | ||
| available. | ||
|
|
||
| The `[patch-files]` section is optional and might contain the following keys: | ||
| - `strip`: Number of leading components from file names to strip. Defaults to 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the strip level be able to be specified per patch?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, you're right and it's annoying because it makes the syntax more complicated :( Not sure it's worth the trouble, cerbero (from gst project) does not seems to be able to set strip for each patch, is it?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any suggestion on the format we should use in the wrap file to allow per patch strip value? One section per patch seems a bit cumbersome but the most future proof?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to standardize on -p1 as
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, if we don't support configurable strip settings we don't need an entire section for this, we could just do:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eli-schwartz strip should definitely defaults to 1. The use-case for having other value is for projects from another century that are not in git in the first place, like svn or pure tarball, in which case you could have patches with strip=0. But I think it actually makes no sense to mix strip levels, my original PR is actually fine I think.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would you have patches with strip=0? Just create them via Or
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a separate setting for
|
||
| if omitted. | ||
| - `patches`: A list of patch filenames relative to `subprojects/packagefiles` | ||
| directory. It must be in the python string list format (e.g. `['foo', 'bar']`). | ||
|
|
||
| ```ini | ||
| [wrap-file] | ||
| directory = libfoobar-1.0 | ||
|
|
||
| source_url = https://example.com/foobar-1.0.tar.gz | ||
| source_filename = foobar-1.0.tar.gz | ||
| source_hash = 5ebeea0dfb75d090ea0e7ff84799b2a7a1550db3fe61eb5f6f61c2e971e57663 | ||
|
|
||
| [patch-files] | ||
| strip = 1 | ||
| patches = ['0001.patch', '0002.patch'] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These patch files need to have checksums as well.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it's only local files, not something we download. |
||
| ``` | ||
|
|
||
| ## Using wrapped projects | ||
|
|
||
| Wraps provide a convenient way of obtaining a project into your | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ## Wrap files can contain a list of patch files to apply | ||
|
|
||
| A list of local patch files can be provided by the `.wrap` file and they will be | ||
| applied after the subproject has been extracted or cloned from git. This requires | ||
| the `patch` or `git` command-line tool. | ||
|
|
||
| ```ini | ||
| [wrap-file] | ||
| directory = libfoobar-1.0 | ||
|
|
||
| source_url = https://example.com/foobar-1.0.tar.gz | ||
| source_filename = foobar-1.0.tar.gz | ||
| source_hash = 5ebeea0dfb75d090ea0e7ff84799b2a7a1550db3fe61eb5f6f61c2e971e57663 | ||
|
|
||
| [patch-files] | ||
| strip = 1 | ||
| patches = ['0001.patch', '0002.patch'] | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| From b79f6cc4a096f6c2888f73b947b652491885896a Mon Sep 17 00:00:00 2001 | ||
| From: Xavier Claessens <[email protected]> | ||
| Date: Fri, 30 Nov 2018 14:13:47 -0500 | ||
| Subject: [PATCH] Change foo to executable | ||
|
|
||
| --- | ||
| foo.c | 4 ++++ | ||
| meson.build | 2 +- | ||
| 2 files changed, 5 insertions(+), 1 deletion(-) | ||
|
|
||
| diff --git a/foo.c b/foo.c | ||
| index 54f9119..468f033 100644 | ||
| --- a/foo.c | ||
| +++ b/foo.c | ||
| @@ -1,3 +1,7 @@ | ||
| int dummy_func(void) { | ||
| return 44; | ||
| } | ||
| + | ||
| +int main(void) { | ||
| + return dummy_func() == 44 ? 0 : 1; | ||
| +} | ||
| diff --git a/meson.build b/meson.build | ||
| index 318e81d..4a281d9 100644 | ||
| --- a/meson.build | ||
| +++ b/meson.build | ||
| @@ -1,2 +1,2 @@ | ||
| project('static lib patchdir', 'c') | ||
| -libfoo = static_library('foo', 'foo.c') | ||
| +foo_exe = executable('foo', 'foo.c') | ||
| -- | ||
| 2.17.1 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| From 7001dcc738e5ae7dfa8af20ed582b9a985804f72 Mon Sep 17 00:00:00 2001 | ||
| From: Xavier Claessens <[email protected]> | ||
| Date: Fri, 30 Nov 2018 10:15:33 -0500 | ||
| Subject: [PATCH 1/2] Change return value to 43 | ||
|
|
||
| --- | ||
| foo.c | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/foo.c b/foo.c | ||
| index 019f2ba..e4577b8 100644 | ||
| --- a/foo.c | ||
| +++ b/foo.c | ||
| @@ -1,3 +1,3 @@ | ||
| int dummy_func(void) { | ||
| - return 42; | ||
| + return 43; | ||
| } | ||
| -- | ||
| 2.17.1 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| From c2da2e490b09f2e251c7f4ef7c1240acee215fec Mon Sep 17 00:00:00 2001 | ||
| From: Xavier Claessens <[email protected]> | ||
| Date: Fri, 30 Nov 2018 10:15:47 -0500 | ||
| Subject: [PATCH 2/2] Change return value to 44 | ||
|
|
||
| --- | ||
| foo.c | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/foo.c b/foo.c | ||
| index e4577b8..54f9119 100644 | ||
| --- a/foo.c | ||
| +++ b/foo.c | ||
| @@ -1,3 +1,3 @@ | ||
| int dummy_func(void) { | ||
| - return 43; | ||
| + return 44; | ||
| } | ||
| -- | ||
| 2.17.1 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [wrap-file] | ||
| directory = foo-1.0-patchfile | ||
|
|
||
| source_url = http://something.invalid | ||
| source_filename = foo-1.0.tar.xz | ||
| source_hash = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1 | ||
| lead_directory_missing = true | ||
|
|
||
| patch_directory = foo-1.0 | ||
|
|
||
| [patch-files] | ||
| patches = ['patchfile/0001-Change-return-value-to-43.patch', | ||
| 'patchfile/0002-Change-return-value-to-44.patch', | ||
| 'patchfile/0001-Change-foo-to-executable.patch', | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"patch-files" sounds extremely similar to patch_filename, which was, unwisely, not named "overlay_archive_filename". A while ago I lessened the confusion in the docs e.g. https://mesonbuild.com/Wrap-dependency-system-manual.html#wrapfile-with-meson-build-patch
But we didn't/couldn't change the wrap file format's key name.
In order to prevent even more confusion, we cannot use "patch-file". What about "diff-file"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC (it was a long time ago) I opted for a new section specifically for avoiding confusion with
patch_filename. Personally I still find it cleaner in a separate section.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People will still just ask "do I add foo.patch to the section for patch files, or to the key for patch files?"