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.');
|
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;
|
$maxProviders = 20;
|
||||||
$providersStr = implode(array_map(function ($p) {
|
$providersStr = implode(array_map(function ($p) {
|
||||||
$description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
|
$description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
|
||||||
|
|
|
@ -565,7 +565,7 @@ class Installer
|
||||||
$request->requireName($link->getTarget(), $link->getConstraint());
|
$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);
|
$solver = new Solver($policy, $pool, $this->io, $repositorySet);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -422,11 +422,13 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
public function getProviders($packageName)
|
public function getProviders($packageName)
|
||||||
{
|
{
|
||||||
if (!$this->providersApiUrl) {
|
if (!$this->providersApiUrl) {
|
||||||
|
// TODO should this return the info based on getPackages in other cases?
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
|
$result = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
|
||||||
|
|
||||||
|
// TODO filter packageName out here?
|
||||||
return $result['providers'];
|
return $result['providers'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ class RepositorySet
|
||||||
return $candidates;
|
return $candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProvidersAndReplacers($packageName)
|
public function getProviders($packageName)
|
||||||
{
|
{
|
||||||
$providers = array();
|
$providers = array();
|
||||||
foreach ($this->repositories as $repository) {
|
foreach ($this->repositories as $repository) {
|
||||||
|
@ -173,7 +173,7 @@ class RepositorySet
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($repository->getPackages() as $candidate) {
|
foreach ($repository->getPackages() as $candidate) {
|
||||||
foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
|
foreach ($candidate->getProvides() as $link) {
|
||||||
if ($packageName === $link->getTarget()) {
|
if ($packageName === $link->getTarget()) {
|
||||||
$providers[] = array(
|
$providers[] = array(
|
||||||
'name' => $candidate->getName(),
|
'name' => $candidate->getName(),
|
||||||
|
@ -200,10 +200,8 @@ class RepositorySet
|
||||||
*
|
*
|
||||||
* @return Pool
|
* @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) {
|
foreach ($this->repositories as $repo) {
|
||||||
if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
|
if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
|
||||||
throw new \LogicException('The pool can not accept packages from an installed repository');
|
throw new \LogicException('The pool can not accept packages from an installed repository');
|
||||||
|
@ -212,6 +210,16 @@ class RepositorySet
|
||||||
|
|
||||||
$this->locked = true;
|
$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);
|
return $poolBuilder->buildPool($this->repositories, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue