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

Magento 2.4.0 Version contraint problem #15

Closed
jruhlender opened this issue Oct 8, 2020 · 7 comments
Closed

Magento 2.4.0 Version contraint problem #15

jruhlender opened this issue Oct 8, 2020 · 7 comments

Comments

@jruhlender
Copy link

Module version 4.1.0 (branch: magento-2.4.1) has magento-ce dependency set to ">=2.4.1 <2.4.2". Because the module will most likely be required in projects with "^4.0" composer tries to install 4.1.0 and fails with magento 2.4.0.

Could be resolved in 2 ways:

  • include magento 2.4.0 to the versoin contraint even in branch "magento-2.4.1"
  • bump the "magento-2.4.1" branch to a new major version
@jissereitsma
Copy link
Collaborator

jissereitsma commented Oct 14, 2020

I feel really dumb by asking this. But shouldn't composer simply download the various versions of this package, see that version 4.0 is compatible with Magento 2.4.0, version 4.1 is compatible with Magento 2.4.1, and then pick 4.0 if you are running Magento 2.4.1? Assuming of course that the composer requirements for 4.0 would be >=2.4.0 <2.4.1 and the requirements for 4.1 would be >=2.4.1 <2.4.2. I feel that I'm missing some point of composer why this is failing repeatedly.

@jruhlender
Copy link
Author

jruhlender commented Oct 14, 2020

Composer is not that smart. If you install the package, the version in the composer.json is "^4.0". That means according to https://semver.org/ : take any version between 4.0.0 and below 5.0.0. Your 4.1.0 is in that range. The version for m2.4.1 should be 5.0.0 (major version bump) so that composer update on a m2.4.0 stays on 4.0.3 and every user has to update by hand to 5.0.0 if the magento version is updated to 2.4.1.
2nd option: if both your versions 4.0.3 and 4.1.0 could be used for m2.4.0 and m2.4.1 you just need to update the version constraint to include both magento versions at the same time in a version 4.2.0 or 4.1.1, depending if you take the change as update or bugfix.

@jissereitsma
Copy link
Collaborator

Thanks for explaining. What a lot of people seem to forget is that composer replacements are optional for composer. If you are replacing A with B but you don't even have A installed, the composer replacements will just sit there and do nothing. Because of this, I think the current release pattern of using a major 4.X is fine for the entire Magento 2.4 branch. It's just that 4.1 (which will be linked to both 2.4.0 and 2.4.1) might include additional packages that are not available in 2.4.0 - but that's fine.

Semantic versioning would say that I would need to wait with releasing an actual 4.1 release if actually new features are added. But the version of this meta-package is not meant for that: It is meant to co-relate version 4.1 to Magento version 2.4.1.

In short, I'm going to pick up on this a little bit differently: The change made earlier to the magento-2.4.0 branch is going to be rolled back to only support Magento 2.4.0 (which is identical to the current 4.0 release already made). Next, the new branch magento-2.4.1 will be modified to support both Magento 2.4.0 and 2.4.1 and next a release 4.1 will be made with that change.

This should make sure that we are ready for the release of Magento 2.4.1 later today.

@jruhlender
Copy link
Author

Sounds good and even makes sense according to semver because the actual code works for both magento versions.
Glad I could help :-)

@jissereitsma
Copy link
Collaborator

I'll keep this issue open for now, until we have actually upgraded to 2.4.1 and confirmed all is fine ;)

@hans2103
Copy link

hans2103 commented Jul 7, 2021

@jissereitsma any updates on this one?

@jissereitsma
Copy link
Collaborator

The current branch has this fixed already: https://github.com/yireo/magento2-replace-bundled/blob/magento-2.4.1/composer.json#L5 I'm closing this issue because of that. If you are asking for the updates, because of a specific issue you are running into, could you post that issue?

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

3 participants