/** * @param Request $request * @param bool $ignorePlatformReqs * @return array */ public function solve(Request $request, $ignorePlatformReqs = false) { $this->jobs = $request->getJobs(); $this->setupInstalledMap(); $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs); $this->checkForRootRequireProblems($ignorePlatformReqs); $this->decisions = new Decisions($this->pool); $this->watchGraph = new RuleWatchGraph(); foreach ($this->rules as $rule) { $this->watchGraph->insert(new RuleWatchNode($rule)); } /* make decisions based on job/update assertions */ $this->makeAssertionRuleDecisions(); $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG); $before = microtime(true); $this->runSat(true); $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE); // decide to remove everything that's installed and undecided foreach ($this->installedMap as $packageId => $void) { if ($this->decisions->undecided($packageId)) { $this->decisions->decide(-$packageId, 1, null); } } if ($this->problems) { throw new SolverProblemsException($this->problems, $this->installedMap); } $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions); return $transaction->getOperations(); }
public function solve(Request $request) { $this->jobs = $request->getJobs(); $this->setupInstalledMap(); $this->decisions = new Decisions($this->pool); $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap); $this->watchGraph = new RuleWatchGraph(); foreach ($this->rules as $rule) { $this->watchGraph->insert(new RuleWatchNode($rule)); } /* make decisions based on job/update assertions */ $this->makeAssertionRuleDecisions(); $this->runSat(true); // decide to remove everything that's installed and undecided foreach ($this->installedMap as $packageId => $void) { if ($this->decisions->undecided($packageId)) { $this->decisions->decide(-$packageId, 1, null); } } if ($this->problems) { throw new SolverProblemsException($this->problems, $this->installedMap); } $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions); return $transaction->getOperations(); }
public function solve(Request $request, $ignorePlatformReqs = false) { $this->jobs = $request->getJobs(); $this->setupInstalledMap(); $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs); $this->checkForRootRequireProblems($ignorePlatformReqs); $this->decisions = new Decisions($this->pool); $this->watchGraph = new RuleWatchGraph(); foreach ($this->rules as $rule) { $this->watchGraph->insert(new RuleWatchNode($rule)); } $this->makeAssertionRuleDecisions(); $this->runSat(true); foreach ($this->installedMap as $packageId => $void) { if ($this->decisions->undecided($packageId)) { $this->decisions->decide(-$packageId, 1, null); } } if ($this->problems) { throw new SolverProblemsException($this->problems, $this->installedMap); } $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions); return $transaction->getOperations(); }
public function solve(Request $request) { $this->jobs = $request->getJobs(); $this->setupInstalledMap(); if (version_compare(PHP_VERSION, '5.3.4', '>=')) { $this->decisionMap = new \SplFixedArray($this->pool->getMaxId() + 1); } else { $this->decisionMap = array_fill(0, $this->pool->getMaxId() + 1, 0); } $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap); $this->watchGraph = new RuleWatchGraph(); foreach ($this->rules as $rule) { $this->watchGraph->insert(new RuleWatchNode($rule)); } /* make decisions based on job/update assertions */ $this->makeAssertionRuleDecisions(); $this->runSat(true); if ($this->problems) { throw new SolverProblemsException($this->problems); } $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisionMap, $this->decisionQueue, $this->decisionQueueWhy); return $transaction->getOperations(); }