For dev extraction skip pool building, we already have a working package set
Also reduce getProviders back to just providers, and add some todospull/8684/head
parent
06f460c557
commit
281d8930ff
|
@ -248,7 +248,7 @@ class Problem
|
|||
return array("- Root composer.json requires $packageName, it ", 'could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.');
|
||||
}
|
||||
|
||||
if ($providers = $repositorySet->getProvidersAndReplacers($packageName)) {
|
||||
if ($providers = $repositorySet->getProviders($packageName)) {
|
||||
$maxProviders = 20;
|
||||
$providersStr = implode(array_map(function ($p) {
|
||||
$description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
|
||||
|
|
|
@ -565,7 +565,7 @@ class Installer
|
|||
$request->requireName($link->getTarget(), $link->getConstraint());
|
||||
}
|
||||
|
||||
$pool = $repositorySet->createPool($request, $this->eventDispatcher);
|
||||
$pool = $repositorySet->createPool($request, $this->eventDispatcher, true);
|
||||
|
||||
$solver = new Solver($policy, $pool, $this->io, $repositorySet);
|
||||
try {
|
||||
|
|
|
@ -422,11 +422,13 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
public function getProviders($packageName)
|
||||
{
|
||||
if (!$this->providersApiUrl) {
|
||||
// TODO should this return the info based on getPackages in other cases?
|
||||
return array();
|
||||
}
|
||||
|
||||
$result = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
|
||||
|
||||
// TODO filter packageName out here?
|
||||
return $result['providers'];
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ class RepositorySet
|
|||
return $candidates;
|
||||
}
|
||||
|
||||
public function getProvidersAndReplacers($packageName)
|
||||
public function getProviders($packageName)
|
||||
{
|
||||
$providers = array();
|
||||
foreach ($this->repositories as $repository) {
|
||||
|
@ -173,7 +173,7 @@ class RepositorySet
|
|||
}
|
||||
} else {
|
||||
foreach ($repository->getPackages() as $candidate) {
|
||||
foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
|
||||
foreach ($candidate->getProvides() as $link) {
|
||||
if ($packageName === $link->getTarget()) {
|
||||
$providers[] = array(
|
||||
'name' => $candidate->getName(),
|
||||
|
@ -200,10 +200,8 @@ class RepositorySet
|
|||
*
|
||||
* @return Pool
|
||||
*/
|
||||
public function createPool(Request $request, EventDispatcher $eventDispatcher = null)
|
||||
public function createPool(Request $request, EventDispatcher $eventDispatcher = null, $allPackages = false)
|
||||
{
|
||||
$poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $eventDispatcher);
|
||||
|
||||
foreach ($this->repositories as $repo) {
|
||||
if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
|
||||
throw new \LogicException('The pool can not accept packages from an installed repository');
|
||||
|
@ -212,6 +210,16 @@ class RepositorySet
|
|||
|
||||
$this->locked = true;
|
||||
|
||||
if ($allPackages) {
|
||||
$packages = array();
|
||||
foreach ($this->repositories as $repository) {
|
||||
$packages = array_merge($packages, $repository->getPackages());
|
||||
}
|
||||
return new Pool($packages);
|
||||
}
|
||||
|
||||
$poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $eventDispatcher);
|
||||
|
||||
return $poolBuilder->buildPool($this->repositories, $request);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue