Problem/Motivation

The current composer.json for the DevDependencies metapackage and the production dependency on composer/semver are not compatible with Composer 2.

Proposed resolution

  • Loosen the constraints to allow installation with Composer 2.
  • Keep locked dependencies the same.

Remaining tasks

Discuss. Do it.

User interface changes

N/A

API changes

Drupal 9.1 is installable with the Composer 2 alpha.

Data model changes

N/A

Release notes snippet

Drupal 9.0.0 was intended to be compatible with Composer 2; however, certain composer.json constraints in core were not compatible with Composer 2. Drupal 9.1 adjusts the production constraints for composer/semver and the dev dependency constraint for composer/composer to allow Composer 2 testing.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm created an issue. See original summary.

xjm’s picture

Status: Active » Needs review
FileSize
1.07 KB

Something like this.

Status: Needs review » Needs work

The last submitted patch, 2: composer-3159967-2.patch, failed testing. View results

xjm’s picture

Status: Needs work » Needs review
FileSize
2.14 KB
1.07 KB

Forgot to update the lockfile, for the first fail.

And maybe the scaffold needs to be changed too for the second?

Status: Needs review » Needs work

The last submitted patch, 4: composer-3159967-4.patch, failed testing. View results

xjm’s picture

Status: Needs work » Needs review
FileSize
3.29 KB
1.27 KB

One more spot.

xjm’s picture

+++ b/composer/Metapackage/DevDependencies/composer.json
@@ -10,7 +10,7 @@
-        "composer/composer": "^1.9.1",
+        "composer/composer": "^1.9.1 || ^2",

So the metapackage is not supposed to actually have two versions in it -- this is supposed to pin a single version. The rest of the patch could use review still.

andypost’s picture

This patch also unblocks compability with PHP 8.0

andypost’s picture

Upgrade of composer/semver could use separate issue as composer upgrade may affect plugins api

Gábor Hojtsy’s picture

Issue summary: View changes

#3135247: Composer's "prefer-stable" setting cannot be relied on to produce a stable release landed, so this should be possible now. Note that Composer 2 stable is this months (within two weeks), so it would be useful to be compatible.

greg.1.anderson’s picture

I think that this issue is a duplicate of #3128631: Update dependencies composer/composer ^2 and composer/semver to ^3. Please see comments there for issues.

So the metapackage is not supposed to actually have two versions in it

The dev-dependencies metapackage is designed to allow versions to "float"; it will contain the same version constraints as the require-dev section of the top-level composer.json file. If we desire to only allow Composer 2 dev dependencies, then we could remove the ^1.9.1 || from /composer.json.

Upgrade of composer/semver could use separate issue

This won't work unless we float both versions. Composer 1 requires composer/semver 1.x, and Composer 2 requires composer/semver 3.x. I would recommend doing both at the same, time, and only pick one version to support. Other decisions are possible, again, see #3128631.

catch’s picture

Status: Needs review » Closed (duplicate)