Beispiel #1
0
 /**
  * @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();
 }
Beispiel #2
0
 /**
  * @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->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();
 }