-
Notifications
You must be signed in to change notification settings - Fork 941
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
Replace cweagans/composer-patches with vaimo/composer-patches #393
Comments
FWIW, I'm pretty sure cweagans/composer-patches#189 resolves the issue you're having, and that's in 1.x. |
Thanks for the quick answer, will have a look at it and report back. |
Did some more homework. For managing a Drupal 8 project's codebase, we're having these requirements:
Here are my findings.
Summing it up, there are only two reasons for replacing cweagans/composer-patches with vaimo/composer-patches (after the
|
Grabbing patches from dependencies'
This is a bug. I ran across this last night, and it's definitely not the right behavior.
If you need a release, I'm happy to review the queue tonight and roll a new one.
I just committed a change to master last night that adds a more verbose patch format, which would allow you to optionally provide a patch depth and sha1 hash to validate the patch against. There are other things this could be used for as well, but those are the two immediate needs.
This is also coming. Commands to manage patches, user-extensible patch resolvers, etc. I haven't had much traction on getting people to work on composer-patches 2.0 with me, so it really just comes down to the amount of time I can spend on it. If y'all are interested in collaborating, I'd be happy to spec out what I'm looking at for 2.0. |
That sounds very good. Thank you @cweagans for the effort you put in the plugin. I think we should keep the current plugin |
Just to be clear: I'm not advocating for one plugin or another (of course, I hope mine is useful enough to keep). I'm just providing what information I can to make the decision-making process easier. |
@cweagans Thanks for the hard work. I'll keep cweagans/composer-patches as the default. |
The cweagans/composer-patches project has a list of issues which are basically around one thing: patches that add new files are NOT handled properly (cweagans/composer-patches#43, cweagans/composer-patches#101 and cweagans/composer-patches#178 to name a few).
I'm using this core patch as an example.
While using cweagans/composer-patches, I'm having some artifacts like
$gitroot/web/core/b/core/modules/taxonomy/taxonomy.install
and$gitroot/web/core/core/modules/taxonomy/taxonomy.install
, which are obviously wrong (correct one would be$gitroot/web/core/modules/taxonomy/taxonomy.install
, tho I must admit that this file gets also created). Searching for the root reason for this reveals that cweagans/composer-patches tries to invent the-p
level for thepatch
command by doing some try&error, with a hardcoded order of-p1
,-p0
,-p2
and-p4
(in this hardcoded, non-configurable order). With this approach, the patches that are creating new files will just apply cleanly in just about either case. Seemingly cweagans/composer-patches managed to pick-p2
, but doesn't clear up the mess it created. The author/maintainer @cweagans says the upcoming 2.x release will/does have a configuration option for each patch that would allow specifying the-p
level, but we're just not there yet.There are some known workarounds to remedy the situation: eg. acquia/blt#2809 simply runs an
rm -rf core/core core/b
duringpost-autoload-dump
.I did some research on alternatives to cweagans/composer-patches. First I came across netresearch/composer-patches-plugin which seems really-really flexible (eg. it would even allow patching a required package from another required package), but it turns out that even when I'm providing the correct
-p2
as theargs
for my patch and it says it's applied, actually it is not. That's a clear showstopper for me.Then I came across vaimo/composer-patches. It also allows providing the correct
-p
level manually and does apply the patch when it says so. Its only drawback I'm currently aware of is the inability of patching a package from another (like asking for a core patch within a particular contrib/custom module'scomposer.json
file; see vaimo/composer-patches#13 for more details). I'm also tempted to create a PR for it that would copy the lacking"enable-patching": true
functionality from cweagans/composer-patches.As I side note, I think it's also worth mentioning that vaimo/composer-patches seems to be forked from cweagans/composer-patches back in 2016, and seemingly both have some features since then which the other one lacks.
I'm not creating a PR just yet as I'm interested in your opinion first.
The text was updated successfully, but these errors were encountered: