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

Patch not applied if metapackage #280

Closed
ghost opened this issue Aug 28, 2019 · 2 comments
Closed

Patch not applied if metapackage #280

ghost opened this issue Aug 28, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 28, 2019

If a package is of type metapackage (cf https://getcomposer.org/doc/04-schema.md) and the unix patch method is used in vendor/cweagans/composer-patches/src/Patches.php, it fails with: 'Could not apply patch! Skipping. The error was: Cannot apply patch...'

This is because $install_path obtained in postInstall() is null, so in getAndApplyPatch() the -d arg to patch command is empty and causes the patch command to fail.

The attempt to write PATCHES.txt also fails as tries to write to root directory.

$install_path could be set to '.', which allows patch to complete - (though doesn't resolve how PATCHES.txt is used later).

I'm not sure why a number of the Drupal packages are set to metapackage in composer.lock, but they are sub-modules of a large overall module. Ideally I guess these should be of type: drupal-module

@ghost
Copy link
Author

ghost commented Aug 31, 2019

It turns out that using the main module as the key gets the patch applied to the sub-module.
Suggest a special error message if $install_path is empty rather than the generic 'Could not apply patch' when the patch command fails.

@cweagans
Copy link
Owner

cweagans commented Feb 7, 2023

Not sure if this is something that can be fixed. metapackage implies that there is no path that the package actually exists at, so it would be difficult for a patcher to apply a patch at that path. :)

I've made a note to explicitly avoid trying to patch metapackages in the plugin + add docs to explain why.

@cweagans cweagans closed this as completed Feb 7, 2023
@cweagans cweagans mentioned this issue Feb 7, 2023
31 tasks
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

No branches or pull requests

1 participant