1
0
Fork 0

Fix error reporting issues when partial updates cannot update due to a symlinked path repo package, fixes #10451

pull/10517/head
Jordi Boggiano 2022-02-04 15:36:53 +01:00
parent 6c36920453
commit ee36c5e54a
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 14 additions and 4 deletions

View File

@ -554,8 +554,18 @@ class Problem
if ($nextRepo instanceof LockArrayRepository) { if ($nextRepo instanceof LockArrayRepository) {
$singular = count($higherRepoPackages) === 1; $singular = count($higherRepoPackages) === 1;
return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', $suggestion = 'Make sure you either fix the '.$reason.' or avoid updating this package to keep the one present in the lock file ('.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).').';
'found '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' in the lock file and '.self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. Make sure you either fix the '.$reason.' or avoid updating this package to keep the one from the lock file.', ); // symlinked path repos cannot be locked so do not suggest keeping it locked
if ($nextRepoPackages[0]->getDistType() === 'path') {
$transportOptions = $nextRepoPackages[0]->getTransportOptions();
if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
$suggestion = 'Make sure you fix the '.$reason.' as packages installed from symlinked path repos are updated even in partial updates and the one from the lock file can thus not be used.';
}
}
return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ',
'found ' . self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. '.$suggestion,
);
} }
return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages from the higher priority repository do not match your '.$reason.' and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'); return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages from the higher priority repository do not match your '.$reason.' and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.');

View File

@ -49,6 +49,6 @@ Your requirements could not be resolved to an installable set of packages.
Problem 1 Problem 1
- Root composer.json requires main/dep * -> satisfiable by main/dep[1.0.0]. - Root composer.json requires main/dep * -> satisfiable by main/dep[1.0.0].
- main/dep 1.0.0 requires locked/dep ^2.1 -> found locked/dep[2.1.0] in the lock file and locked/dep[2.x-dev] from package repo (defining 3 packages) but it does not match your minimum-stability and is therefore not installable. Make sure you either fix the minimum-stability or avoid updating this package to keep the one from the lock file. - main/dep 1.0.0 requires locked/dep ^2.1 -> found locked/dep[2.x-dev] but it does not match your minimum-stability and is therefore not installable. Make sure you either fix the minimum-stability or avoid updating this package to keep the one present in the lock file (locked/dep[2.1.0]).
--EXPECT-- --EXPECT--

View File

@ -48,6 +48,6 @@ Your requirements could not be resolved to an installable set of packages.
Problem 1 Problem 1
- Root composer.json requires main/dep * -> satisfiable by main/dep[1.0.0]. - Root composer.json requires main/dep * -> satisfiable by main/dep[1.0.0].
- main/dep 1.0.0 requires locked/dep ^2.1 -> found locked/dep[2.1.0] in the lock file and locked/dep[2.0.5] from package repo (defining 2 packages) but it does not match your constraint and is therefore not installable. Make sure you either fix the constraint or avoid updating this package to keep the one from the lock file. - main/dep 1.0.0 requires locked/dep ^2.1 -> found locked/dep[2.0.5] but it does not match your constraint and is therefore not installable. Make sure you either fix the constraint or avoid updating this package to keep the one present in the lock file (locked/dep[2.1.0]).
--EXPECT-- --EXPECT--