1
0
Fork 0

Improve error reporting some more, fixes #4310

pull/5210/head
Jordi Boggiano 2016-04-18 23:03:00 +01:00
parent b10074338c
commit feda2a283f
4 changed files with 22 additions and 8 deletions

View File

@ -130,11 +130,11 @@ class Problem
}
if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but those are rejected by your minimum-stability.';
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
}
if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but those are rejected by your constraint.';
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
}
return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';

View File

@ -241,7 +241,7 @@ class Rule
return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
} else {
if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability';
return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
}
return $text . ' -> no matching package found.';

View File

@ -448,6 +448,7 @@ class Installer
$candidates = array();
foreach ($links as $link) {
$candidates[$link->getTarget()] = true;
$rootRequires[$link->getTarget()] = $link;
}
foreach ($localRepo->getPackages() as $package) {
$candidates[$package->getName()] = true;
@ -459,6 +460,9 @@ class Installer
if ($curPackage->getName() === $candidate) {
if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
$constraint = new Constraint('=', $curPackage->getVersion());
$description = $this->locker->isLocked() ? '(locked at' : '(installed at';
$requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
$constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
$request->install($curPackage->getName(), $constraint);
}
break;

View File

@ -10,7 +10,9 @@ Test the error output of solver problems.
{ "name": "unstable/package", "version": "1.0.0" },
{ "name": "requirer", "version": "1.0.0", "require": {"dependency": "1.0.0" } },
{ "name": "dependency", "version": "2.0.0" },
{ "name": "dependency", "version": "1.0.0" }
{ "name": "dependency", "version": "1.0.0" },
{ "name": "stable-requiree-excluded", "version": "1.0.1" },
{ "name": "stable-requiree-excluded", "version": "1.0.0" }
]
}
],
@ -18,12 +20,18 @@ Test the error output of solver problems.
"unstable/package": "2.*",
"bogus": "1.*",
"requirer": "1.*",
"dependency": "2.*"
"dependency": "2.*",
"stable-requiree-excluded": "1.0.1"
}
}
--INSTALLED--
[
{ "name": "stable-requiree-excluded", "version": "1.0.0" }
]
--RUN--
install
update unstable/package requirer dependency
--EXPECT-EXIT-CODE--
2
@ -34,12 +42,14 @@ Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package unstable/package 2.* exists as unstable/package[1.0.0] but those are rejected by your constraint.
- The requested package unstable/package 2.* exists as unstable/package[1.0.0] but these are rejected by your constraint.
Problem 2
- The requested package bogus could not be found in any version, there may be a typo in the package name.
Problem 3
- The requested package stable-requiree-excluded (installed at 1.0.0, required as 1.0.1) is satisfiable by stable-requiree-excluded[1.0.0] but these conflict with your requirements or minimum-stability.
Problem 4
- Installation request for requirer 1.* -> satisfiable by requirer[1.0.0].
- requirer 1.0.0 requires dependency 1.0.0 -> satisfiable by dependency[1.0.0] but these conflict with your requirements or minimum-stability
- requirer 1.0.0 requires dependency 1.0.0 -> satisfiable by dependency[1.0.0] but these conflict with your requirements or minimum-stability.
Potential causes:
- A typo in the package name