1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 09:02:59 +00:00

Merge pull request #8859 from Seldaek/deduplicate-problems

Deduplicate require/conflict rules which are the same but for different versions of the same package
This commit is contained in:
Nils Adermann 2020-05-05 16:19:07 +02:00 committed by GitHub
commit ff0717ad66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 118 additions and 25 deletions

View file

@ -47,7 +47,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires b/b *@dev -> satisfiable by b/b[dev-master].
- a/a dev-master requires d/d 1.0.0 -> satisfiable by d/d[1.0.0].
- You can only install one version of a package, so only one of these can be installed: d/d[2.0.0, 1.0.0].
- You can only install one version of a package, so only one of these can be installed: d/d[1.0.0, 2.0.0].
- Conclusion: install d/d 2.0.0, learned rules:
- Root composer.json requires b/b *@dev -> satisfiable by b/b[dev-master].
- b/b dev-master requires d/d 2.0.0 -> satisfiable by d/d[2.0.0].

View file

@ -0,0 +1,48 @@
--TEST--
Test the error output of solver problems is deduplicated.
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "package/a", "version": "2.0.0", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.0.1", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.0.2", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.0.3", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.1.0", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.2.0", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.3.1", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.3.2", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.3.3", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.3.4", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.3.5", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.4.0", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.5.0", "require": { "missing/dep": "^1.0" } },
{ "name": "package/a", "version": "2.6.0", "require": { "missing/dep": "^1.0" } },
{ "name": "missing/dep", "version": "2.0.0" }
]
}
],
"require": {
"package/a": "*"
}
}
--RUN--
update
--EXPECT-EXIT-CODE--
2
--EXPECT-OUTPUT--
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- package/a[2.0.0, ..., 2.6.0] require missing/dep ^1.0 -> found missing/dep[2.0.0] but it does not match the constraint.
- Root composer.json requires package/a * -> satisfiable by package/a[2.0.0, ..., 2.6.0].
--EXPECT--

View file

@ -39,14 +39,14 @@ Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install regular/pkg 1.0.3, learned rules:
- Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].
- Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Conclusion: don't install regular/pkg 1.0.2, learned rules:
- Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].
- Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Conclusion: don't install regular/pkg 1.0.1, learned rules:
- Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].
- Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Only one of these can be installed: regular/pkg[1.0.3, 1.0.2, 1.0.1, 1.0.0], replacer/pkg[2.0.3, 2.0.2, 2.0.1, 2.0.0]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Only one of these can be installed: regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3], replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3]. replacer/pkg replaces regular/pkg and thus cannot coexist with it.
- Root composer.json requires regular/pkg 1.* -> satisfiable by regular/pkg[1.0.0, 1.0.1, 1.0.2, 1.0.3].
- Root composer.json requires replacer/pkg 2.* -> satisfiable by replacer/pkg[2.0.0, 2.0.1, 2.0.2, 2.0.3].