Fixed some of the partial update tests
parent
225a6a0a82
commit
7be24dccd9
|
@ -124,11 +124,11 @@ class PoolBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($request->getFixedPackages() as $package) {
|
foreach ($request->getFixedPackages() as $package) {
|
||||||
$this->loadedPackages[$package->getName()] = new EmptyConstraint();
|
$this->loadedPackages[$package->getName()] = new Constraint('==', $package->getVersion());
|
||||||
|
|
||||||
// replace means conflict, so if a fixed package replaces a name, no need to load that one, packages would conflict anyways
|
// replace means conflict, so if a fixed package replaces a name, no need to load that one, packages would conflict anyways
|
||||||
foreach ($package->getReplaces() as $link) {
|
foreach ($package->getReplaces() as $link) {
|
||||||
$this->loadedPackages[$link->getTarget()] = new EmptyConstraint();
|
$this->loadedPackages[$link->getTarget()] = $link->getConstraint();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO in how far can we do the above for conflicts? It's more tricky cause conflicts can be limited to
|
// TODO in how far can we do the above for conflicts? It's more tricky cause conflicts can be limited to
|
||||||
|
@ -146,6 +146,11 @@ class PoolBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($request->getRequires() as $packageName => $constraint) {
|
foreach ($request->getRequires() as $packageName => $constraint) {
|
||||||
|
// fixed packages have already been added, so if a root require needs one of them, no need to do anything
|
||||||
|
if (isset($this->loadedPackages[$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->markPackageNameForLoading($packageName, $constraint);
|
$this->markPackageNameForLoading($packageName, $constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +229,13 @@ class PoolBuilder
|
||||||
|
|
||||||
private function markPackageNameForLoading($name, ConstraintInterface $constraint)
|
private function markPackageNameForLoading($name, ConstraintInterface $constraint)
|
||||||
{
|
{
|
||||||
|
// Maybe it was already marked before but not loaded yet. In that case
|
||||||
|
// we have to extend the constraint (we don't check if they match because
|
||||||
|
// MultiConstraint::create() will optimize anyway
|
||||||
|
if (isset($this->packagesToLoad[$name]) && !$constraint->isSubsetOf($this->packagesToLoad[$name])) {
|
||||||
|
$constraint = MultiConstraint::create(array($this->packagesToLoad[$name], $constraint), false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($this->loadedPackages[$name])) {
|
if (!isset($this->loadedPackages[$name])) {
|
||||||
$this->packagesToLoad[$name] = $constraint;
|
$this->packagesToLoad[$name] = $constraint;
|
||||||
return;
|
return;
|
||||||
|
@ -235,13 +247,6 @@ class PoolBuilder
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe it was already marked before but not loaded yet. In that case
|
|
||||||
// we have to extend the constraint (we don't check if they match because
|
|
||||||
// MultiConstraint::create() will optimize anyway
|
|
||||||
if (isset($this->packagesToLoad[$name])) {
|
|
||||||
$constraint = MultiConstraint::create(array($this->packagesToLoad[$name], $constraint), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have already loaded that package but not in the constraint that's
|
// We have already loaded that package but not in the constraint that's
|
||||||
// required. We extend the constraint and mark that package as not being loaded
|
// required. We extend the constraint and mark that package as not being loaded
|
||||||
// yet so we get the required package versions
|
// yet so we get the required package versions
|
||||||
|
@ -322,19 +327,21 @@ class PoolBuilder
|
||||||
$require = $link->getTarget();
|
$require = $link->getTarget();
|
||||||
$linkConstraint = $link->getConstraint();
|
$linkConstraint = $link->getConstraint();
|
||||||
|
|
||||||
// if this is a partial update with transitive dependencies we need to unfix the package we now know is a
|
if ($propagateUpdate) {
|
||||||
// dependency of another package which we are trying to update, and then attempt to load it again
|
// if this is a partial update with transitive dependencies we need to unfix the package we now know is a
|
||||||
if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies() && isset($this->skippedLoad[$require])) {
|
// dependency of another package which we are trying to update, and then attempt to load it again
|
||||||
if ($request->getUpdateAllowTransitiveRootDependencies() || !$this->isRootRequire($request, $this->skippedLoad[$require])) {
|
if ($request->getUpdateAllowTransitiveDependencies() && isset($this->skippedLoad[$require])) {
|
||||||
$this->unfixPackage($request, $require);
|
if ($request->getUpdateAllowTransitiveRootDependencies() || !$this->isRootRequire($request, $this->skippedLoad[$require])) {
|
||||||
|
$this->unfixPackage($request, $require);
|
||||||
|
$this->markPackageNameForLoading($require, $linkConstraint);
|
||||||
|
} elseif (!$request->getUpdateAllowTransitiveRootDependencies() && $this->isRootRequire($request, $require) && !isset($this->updateAllowWarned[$require])) {
|
||||||
|
$this->updateAllowWarned[$require] = true;
|
||||||
|
$this->io->writeError('<warning>Dependency "'.$require.'" is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies to include root dependencies.</warning>');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$this->markPackageNameForLoading($require, $linkConstraint);
|
$this->markPackageNameForLoading($require, $linkConstraint);
|
||||||
} elseif (!$request->getUpdateAllowTransitiveRootDependencies() && $this->isRootRequire($request, $require) && !isset($this->updateAllowWarned[$require])) {
|
|
||||||
$this->updateAllowWarned[$require] = true;
|
|
||||||
$this->io->writeError('<warning>Dependency "'.$require.'" is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies to include root dependencies.</warning>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->markPackageNameForLoading($require, $linkConstraint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're doing a partial update with deps we also need to unfix packages which are being replaced in case they
|
// if we're doing a partial update with deps we also need to unfix packages which are being replaced in case they
|
||||||
|
|
Loading…
Reference in New Issue