1
0
Fork 0

Fix feedback

pull/10157/head
Jordi Boggiano 2021-11-25 15:18:24 +01:00
parent 4352f23962
commit a6fc1ab663
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 5 additions and 16 deletions

View File

@ -165,8 +165,6 @@ class PoolBuilder
foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) { foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) {
if (!$this->isUpdateAllowed($lockedPackage)) { if (!$this->isUpdateAllowed($lockedPackage)) {
$lockedName = $lockedPackage->getName();
// remember which packages we skipped loading remote content for in this partial update // remember which packages we skipped loading remote content for in this partial update
$this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage; $this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage;
foreach ($lockedPackage->getReplaces() as $link) { foreach ($lockedPackage->getReplaces() as $link) {
@ -624,7 +622,7 @@ class PoolBuilder
if (isset($this->pathRepoUnlocked[$name])) { if (isset($this->pathRepoUnlocked[$name])) {
foreach ($this->packages as $index => $package) { foreach ($this->packages as $index => $package) {
if ($package->getName() === $name) { if ($package->getName() === $name) {
$this->removeLoadedPackage($request, $repositories, $package, $index, false); $this->removeLoadedPackage($request, $repositories, $package, $index);
} }
} }
} }
@ -636,7 +634,7 @@ class PoolBuilder
if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) { if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) {
if (false !== $index = array_search($lockedPackage, $this->packages, true)) { if (false !== $index = array_search($lockedPackage, $this->packages, true)) {
$request->unlockPackage($lockedPackage); $request->unlockPackage($lockedPackage);
$this->removeLoadedPackage($request, $repositories, $lockedPackage, $index, true); $this->removeLoadedPackage($request, $repositories, $lockedPackage, $index);
// make sure that any requirements for this package by other locked or fixed packages are now // make sure that any requirements for this package by other locked or fixed packages are now
// also loaded, as they were previously ignored because the locked (now unlocked) package already // also loaded, as they were previously ignored because the locked (now unlocked) package already
@ -661,10 +659,9 @@ class PoolBuilder
/** /**
* @param RepositoryInterface[] $repositories * @param RepositoryInterface[] $repositories
* @param int $index * @param int $index
* @param bool $unlock
* @return void * @return void
*/ */
private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index, $unlock) private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index)
{ {
$repoIndex = array_search($package->getRepository(), $repositories, true); $repoIndex = array_search($package->getRepository(), $repositories, true);
@ -672,9 +669,6 @@ class PoolBuilder
unset($this->packages[$index]); unset($this->packages[$index]);
if (isset($this->aliasMap[spl_object_hash($package)])) { if (isset($this->aliasMap[spl_object_hash($package)])) {
foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) { foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) {
if ($unlock) {
$request->unlockPackage($aliasPackage);
}
unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]); unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]);
unset($this->packages[$aliasIndex]); unset($this->packages[$aliasIndex]);
} }

View File

@ -29,6 +29,7 @@ Partially updating one root requirement with transitive deps fully updates trans
"mirrored/path-pkg": "*" "mirrored/path-pkg": "*"
} }
} }
--LOCK-- --LOCK--
{ {
"packages": [ "packages": [
@ -66,13 +67,7 @@ Partially updating one root requirement with transitive deps fully updates trans
"platform": [], "platform": [],
"platform-dev": [] "platform-dev": []
} }
--INSTALLED--
[
{ "name": "a/old", "version": "0.9.0" },
{ "name": "b/unstable", "version": "1.1.0-alpha", "require": {"f/dependency": "1.*"} },
{ "name": "c/uptodate", "version": "2.0.0" },
{ "name": "f/dependency", "version": "1.0.0" }
]
--RUN-- --RUN--
update --with-all-dependencies root/update update --with-all-dependencies root/update