diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index f9a7541c3..5376367e2 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -62,8 +62,12 @@ class PoolBuilder foreach ($request->getJobs() as $job) { switch ($job['cmd']) { case 'install': - $loadNames[$job['packageName']] = $job['constraint']; - $this->nameConstraints[$job['packageName']] = $job['constraint'] ? new MultiConstraint(array($job['constraint']), false) : null; + // TODO currently lock above is always NULL if we adjust that, this needs to merge constraints + // TODO does it really make sense that we can have install requests for the same package that is actively locked with non-matching constraints? + // also see the solver-problems.test test case + $constraint = array_key_exists($job['packageName'], $loadNames) ? null : $job['constraint']; + $loadNames[$job['packageName']] = $constraint; + $this->nameConstraints[$job['packageName']] = $constraint ? new MultiConstraint(array($job['constraint']), false) : null; break; } } @@ -199,6 +203,7 @@ class PoolBuilder // TODO addConstraint function? $this->nameConstraints[$require] = new MultiConstraint(array_merge(array($linkConstraint), $this->nameConstraints[$require]->getConstraints()), false); } + // else it is null and should stay null } else { $this->nameConstraints[$require] = null; } diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index 2c1c7236a..bc3f2de04 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -211,10 +211,10 @@ class Problem case 'fix': $package = $job['package']; if ($job['lockable']) { - return 'Package '.$package->getPrettyName().' is locked to version '.$package->getPrettyVersion(); - } else { - return 'Package '.$package->getPrettyName().' is present at version '.$package->getPrettyVersion() . ' and cannot be modified by Composer'; + return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion().' and an update of this package was not requested.'; } + + return $package->getPrettyName().' is present at version '.$package->getPrettyVersion() . ' and cannot be modified by Composer'; case 'install': $packages = $this->pool->whatProvides($packageName, $constraint); if (!$packages) { diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index 0c7350cdd..d42617a7a 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -261,6 +261,10 @@ class RuleSetGenerator $unlockableMap = $request->getUnlockableMap(); foreach ($request->getFixedPackages() as $package) { + if ($package->id == -1) { + throw new \RuntimeException("Fixed package ".$package->getName()." was not added to solver pool."); + } + $this->addRulesForPackage($package, $ignorePlatformReqs); $rule = $this->createInstallOneOfRule(array($package), Rule::RULE_JOB_INSTALL, array( diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index 348b17c2b..2abcf5d8a 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -147,7 +147,6 @@ class Solver if (abs($literal) !== abs($assertRuleLiteral)) { continue; } - $problem->addRule($assertRule); $this->disableProblem($assertRule); } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 6c94df10e..dea1e03e5 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -523,8 +523,6 @@ class Installer return array(); } - ; - $resultRepo = new ArrayRepository(array()); $loader = new ArrayLoader(null, true); $dumper = new ArrayDumper(); diff --git a/tests/Composer/Test/Fixtures/installer/solver-problems.test b/tests/Composer/Test/Fixtures/installer/solver-problems.test index b6d2180db..57d3ced92 100644 --- a/tests/Composer/Test/Fixtures/installer/solver-problems.test +++ b/tests/Composer/Test/Fixtures/installer/solver-problems.test @@ -61,12 +61,12 @@ Your requirements could not be resolved to an installable set of packages. Problem 2 - The requested package bogus/pkg could not be found in any version, there may be a typo in the package name. Problem 3 - - The requested package stable-requiree-excluded/pkg 1.0.1 exists as stable-requiree-excluded/pkg[1.0.0] but these are rejected by your constraint. - Problem 4 - - The requested package stable-requiree-excluded/pkg (installed at 1.0.0, required as 1.0.1) is satisfiable by stable-requiree-excluded/pkg[1.0.0] but these conflict with your requirements or minimum-stability. - Problem 5 - Installation request for requirer/pkg 1.* -> satisfiable by requirer/pkg[1.0.0]. - requirer/pkg 1.0.0 requires dependency/pkg 1.0.0 -> no matching package found. + Problem 4 + - stable-requiree-excluded/pkg is locked to version 1.0.0 and an update of this package was not requested. + - Same name, can only install one of: stable-requiree-excluded/pkg[1.0.0, 1.0.1]. + - Installation request for stable-requiree-excluded/pkg 1.0.1 -> satisfiable by stable-requiree-excluded/pkg[1.0.1]. Potential causes: - A typo in the package name