1
0
Fork 0

Minor Installer cleanups

pull/8566/head
Jordi Boggiano 2020-01-30 21:03:35 +01:00
parent 2f4ea3a463
commit a1fe64152d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 7 additions and 12 deletions

View File

@ -345,7 +345,7 @@ class Installer
// creating repository set // creating repository set
$policy = $this->createPolicy(true); $policy = $this->createPolicy(true);
$repositorySet = $this->createRepositorySet($platformRepo, $aliases); $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
$repositories = $this->repositoryManager->getRepositories(); $repositories = $this->repositoryManager->getRepositories();
foreach ($repositories as $repository) { foreach ($repositories as $repository) {
$repositorySet->addRepository($repository); $repositorySet->addRepository($repository);
@ -353,7 +353,6 @@ class Installer
if ($lockedRepository) { if ($lockedRepository) {
$repositorySet->addRepository($lockedRepository); $repositorySet->addRepository($lockedRepository);
} }
// TODO can we drop any locked packages that we have matching remote versions for?
$request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository); $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
@ -377,7 +376,6 @@ class Installer
if ($this->updateWhitelist && $lockedRepository) { if ($this->updateWhitelist && $lockedRepository) {
foreach ($lockedRepository->getPackages() as $lockedPackage) { foreach ($lockedRepository->getPackages() as $lockedPackage) {
if (!$this->isUpdateable($lockedPackage)) { if (!$this->isUpdateable($lockedPackage)) {
// TODO add reason for fix?
$request->fixPackage($lockedPackage); $request->fixPackage($lockedPackage);
} }
} }
@ -516,7 +514,7 @@ class Installer
$resultRepo->addPackage($loader->load($dumper->dump($pkg))); $resultRepo->addPackage($loader->load($dumper->dump($pkg)));
} }
$repositorySet = $this->createRepositorySet($platformRepo, $aliases, null); $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
$repositorySet->addRepository($resultRepo); $repositorySet->addRepository($resultRepo);
$request = $this->createRequest($this->fixedRootPackage, $platformRepo, null); $request = $this->createRequest($this->fixedRootPackage, $platformRepo, null);
@ -552,14 +550,12 @@ class Installer
protected function doInstall(RepositoryInterface $localRepo, $alreadySolved = false) protected function doInstall(RepositoryInterface $localRepo, $alreadySolved = false)
{ {
$platformRepo = $this->createPlatformRepo(false); $platformRepo = $this->createPlatformRepo(false);
$aliases = $this->getRootAliases(false);
$lockedRepository = $this->locker->getLockedRepository($this->devMode); $lockedRepository = $this->locker->getLockedRepository($this->devMode);
// creating repository set // creating repository set
$policy = $this->createPolicy(false); $policy = $this->createPolicy(false);
// use aliases from lock file only, so empty root aliases here // use aliases from lock file only, so empty root aliases here
$repositorySet = $this->createRepositorySet($platformRepo, array(), $lockedRepository); $repositorySet = $this->createRepositorySet(false, $platformRepo, array(), $lockedRepository);
$repositorySet->addRepository($lockedRepository); $repositorySet->addRepository($lockedRepository);
$this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>'); $this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
@ -676,16 +672,15 @@ class Installer
} }
/** /**
* @param bool $forUpdate
* @param PlatformRepository $platformRepo
* @param array $rootAliases * @param array $rootAliases
* @param RepositoryInterface|null $lockedRepository * @param RepositoryInterface|null $lockedRepository
* @return RepositorySet * @return RepositorySet
*/ */
private function createRepositorySet(PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null) private function createRepositorySet($forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), $lockedRepository = null)
{ {
// TODO what's the point of rootConstraints at all, we generate the package pool taking them into account anyway? if ($forUpdate) {
// TODO maybe we can drop the lockedRepository here
// TODO if this gets called in doInstall, this->update is still true?!
if ($this->update) {
$minimumStability = $this->package->getMinimumStability(); $minimumStability = $this->package->getMinimumStability();
$stabilityFlags = $this->package->getStabilityFlags(); $stabilityFlags = $this->package->getStabilityFlags();