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

do not update on install #257

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

schmunk42
Copy link

@schmunk42 schmunk42 commented Jan 11, 2023

This would be my take for:

Alternative for:

Actually the callback onPostInstallOrUpdate should also be renamed into something more descriptive, but anyways.

As stated in #252 (comment) there's no need to run an update or any special processing when using install.

I've tested this in several use-cases: first install, regular install with and without .lock file. And it looks good to me so far.
Especially the edge-case install without .lock file is handled correctly -> it is treated as update.

@robbiehobby
Copy link

I found this issue occurs when the main composer.json is merging another composer.json with the same package requirement. What happens is the merged package takes priority and supersedes the main composer.lock version. Causing an update on composer install for the identical packages. For example:

Main composer.json:

{
  "require": {
    "example/package": "1.4"
  },
  "extra": {
    "merge-plugin": {
      "include": ["path/to/merged/composer.json"],
    }
  }
}

Merged composer.json:

{
  "require": {
    "example/package": "^1.5"
  }
}

The workaround is to set extra.merge-plugin.ignore-duplicates to true in the main composer.json. This ensures the main composer.lock version is always used. I have not tested how well this works with version based dependency resolution. It's probably up to project maintainers to be sure their main composer.json constraints are compatible.

https://github.com/wikimedia/composer-merge-plugin#ignore-duplicates

@schmunk42
Copy link
Author

The workaround is to set extra.merge-plugin.ignore-duplicates to true in the main composer.json.

We have that in almost all projects, but I haven't found it to be a cause for this specific issue.

@robbiehobby
Copy link

I wouldn't be surprised if there are multiple ways to create the issue. However, the workaround did indeed fix the issue in the described use case. You might want to review the lock files of your main and merged composer.json files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants