Skip to content

Commit

Permalink
Fix error reporting issues when partial updates cannot update due to …
Browse files Browse the repository at this point in the history
…a symlinked path repo package, fixes #10451
  • Loading branch information
Seldaek committed Feb 4, 2022
1 parent 6c36920 commit ee36c5e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/Composer/DependencyResolver/Problem.php
Expand Up @@ -554,8 +554,18 @@ private static function computeCheckForLowerPrioRepo(Pool $pool, $isVerbose, $pa
if ($nextRepo instanceof LockArrayRepository) {
$singular = count($higherRepoPackages) === 1;

return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ',
'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.', );
$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).').';
// 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.');
Expand Down
Expand Up @@ -49,6 +49,6 @@ Your requirements could not be resolved to an installable set of packages.

Problem 1
- 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--
Expand Up @@ -48,6 +48,6 @@ Your requirements could not be resolved to an installable set of packages.

Problem 1
- 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--

0 comments on commit ee36c5e

Please sign in to comment.