From f3d9c8701a34486ba9b752983d445ef975bf09d1 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 20 May 2011 20:50:09 +0200 Subject: [PATCH] Generate transaction from solver's final decision queue. --- src/Composer/DependencyResolver/Solver.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index e084281c1..791076caa 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -574,8 +574,24 @@ class Solver //findrecommendedsuggested(solv); //solver_prepare_solutions(solv); - //transaction_calculate(&solv->trans, &solv->decisionq, &solv->noobsoletes); + $transaction = array(); + + foreach ($this->decisionQueue as $literal) { + $package = $literal->getPackage(); + + // wanted & installed || !wanted & !installed + if ($literal->isWanted() == ($this->installed == $package->getRepository())) { + continue; + } + + $transaction[] = array( + 'job' => ($literal->isWanted()) ? 'install' : 'remove', + 'package' => $package, + ); + } + + return $transaction; } public function printRules()