foreach ($request->getFixedPackages() as $package) {
foreach ($request->getFixedPackages() as $package) {
if ($package->id == -1) {
if ($package->id == -1) {
throw new \RuntimeException("Fixed package ".$package->getName()." ".$package->getVersion().($package instanceof AliasPackage ? " (alias)" : "")." was not added to solver pool.");
// fixed package was not added to the pool as it did not pass the stability requirements, this is fine
if ($this->pool->isUnacceptableFixedPackage($package)) {
continue;
}
// otherwise, looks like a bug
throw new \LogicException("Fixed package ".$package->getName()." ".$package->getVersion().($package instanceof AliasPackage ? " (alias)" : "")." was not added to solver pool.");
@ -22,7 +22,7 @@ use Composer\Repository\PlatformRepository;
use Composer\Repository\LockArrayRepository;
use Composer\Repository\LockArrayRepository;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Test\DependencyResolver\PoolTest;
use Composer\Package\Version\StabilityFilter;
/**
/**
* @author Nils Adermann <naderman@naderman.de>
* @author Nils Adermann <naderman@naderman.de>
@ -89,23 +89,6 @@ class RepositorySet
}
}
}
}
public function isPackageAcceptable($name, $stability)
{
foreach ((array) $name as $n) {
// allow if package matches the global stability requirement and has no exception
if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
return true;
}
// allow if package matches the package-specific stability flag
if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
return true;
}
}
return false;
}
/**
/**
* Find packages providing or matching a name and optionally meeting a constraint in all repositories
* Find packages providing or matching a name and optionally meeting a constraint in all repositories
*
*
@ -113,10 +96,11 @@ class RepositorySet
*
*
* @param string $name
* @param string $name
* @param ConstraintInterface|null $constraint
* @param ConstraintInterface|null $constraint
* @param bool $exactMatch
* @param bool $exactMatch if set to false, packages which replace/provide the given name might be returned as well even if they do not match the name exactly
* @param bool $ignoreStability if set to true, packages are returned even though their stability does not match the required stability
* @return array
* @return array
*/
*/
public function findPackages($name, ConstraintInterface $constraint = null, $exactMatch = true)
public function findPackages($name, ConstraintInterface $constraint = null, $exactMatch = true, $ignoreStability = false)
{
{
$packages = array();
$packages = array();
foreach ($this->repositories as $repository) {
foreach ($this->repositories as $repository) {
@ -131,7 +115,7 @@ class RepositorySet
continue;
continue;
}
}
if ($this->isPackageAcceptable($candidate->getNames(), $candidate->getStability())) {
if (!$ignoreStability &&$this->isPackageAcceptable($candidate->getNames(), $candidate->getStability())) {
$result[] = $candidate;
$result[] = $candidate;
}
}
}
}
@ -139,6 +123,11 @@ class RepositorySet
return $candidates;
return $candidates;
}
}
public function isPackageAcceptable($names, $stability)