diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index bcc0582df..720982012 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -117,6 +117,14 @@ class Application extends BaseApplication } if ($commandName !== 'global') { + $io->writeError(sprintf( + 'Running %s (%s) with %s on %s', + Composer::VERSION, + Composer::RELEASE_DATE, + defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION, + php_uname('s') . ' / ' . php_uname('r') + ), true, IOInterface::DEBUG); + if (PHP_VERSION_ID < 50302) { $io->writeError('Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.'); } diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index 474c07b43..d42ca4774 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -130,11 +130,11 @@ class Problem } if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) { - return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but those are rejected by your minimum-stability.'; + return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.'; } if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) { - return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but those are rejected by your constraint.'; + return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.'; } return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.'; diff --git a/src/Composer/DependencyResolver/Rule.php b/src/Composer/DependencyResolver/Rule.php index 2f2d61b8f..dc10391be 100644 --- a/src/Composer/DependencyResolver/Rule.php +++ b/src/Composer/DependencyResolver/Rule.php @@ -241,7 +241,7 @@ class Rule return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.'; } else { if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) { - return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability'; + return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.'; } return $text . ' -> no matching package found.'; diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 8f9c51c51..e1f0011e0 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -448,6 +448,7 @@ class Installer $candidates = array(); foreach ($links as $link) { $candidates[$link->getTarget()] = true; + $rootRequires[$link->getTarget()] = $link; } foreach ($localRepo->getPackages() as $package) { $candidates[$package->getName()] = true; @@ -459,6 +460,9 @@ class Installer if ($curPackage->getName() === $candidate) { if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) { $constraint = new Constraint('=', $curPackage->getVersion()); + $description = $this->locker->isLocked() ? '(locked at' : '(installed at'; + $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : ''; + $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')'); $request->install($curPackage->getName(), $constraint); } break; diff --git a/tests/Composer/Test/ApplicationTest.php b/tests/Composer/Test/ApplicationTest.php index e7ab59c78..4e843bfa6 100644 --- a/tests/Composer/Test/ApplicationTest.php +++ b/tests/Composer/Test/ApplicationTest.php @@ -30,6 +30,9 @@ class ApplicationTest extends TestCase ->will($this->returnValue('list')); $index = 0; + $outputMock->expects($this->at($index++)) + ->method("writeError"); + if (extension_loaded('xdebug')) { $outputMock->expects($this->at($index++)) ->method("getVerbosity") diff --git a/tests/Composer/Test/Fixtures/installer/solver-problems.test b/tests/Composer/Test/Fixtures/installer/solver-problems.test index 87c4fa7ee..605bd3cae 100644 --- a/tests/Composer/Test/Fixtures/installer/solver-problems.test +++ b/tests/Composer/Test/Fixtures/installer/solver-problems.test @@ -10,7 +10,9 @@ Test the error output of solver problems. { "name": "unstable/package", "version": "1.0.0" }, { "name": "requirer", "version": "1.0.0", "require": {"dependency": "1.0.0" } }, { "name": "dependency", "version": "2.0.0" }, - { "name": "dependency", "version": "1.0.0" } + { "name": "dependency", "version": "1.0.0" }, + { "name": "stable-requiree-excluded", "version": "1.0.1" }, + { "name": "stable-requiree-excluded", "version": "1.0.0" } ] } ], @@ -18,12 +20,18 @@ Test the error output of solver problems. "unstable/package": "2.*", "bogus": "1.*", "requirer": "1.*", - "dependency": "2.*" + "dependency": "2.*", + "stable-requiree-excluded": "1.0.1" } } +--INSTALLED-- +[ + { "name": "stable-requiree-excluded", "version": "1.0.0" } +] + --RUN-- -install +update unstable/package requirer dependency --EXPECT-EXIT-CODE-- 2 @@ -34,12 +42,14 @@ Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - - The requested package unstable/package 2.* exists as unstable/package[1.0.0] but those are rejected by your constraint. + - The requested package unstable/package 2.* exists as unstable/package[1.0.0] but these are rejected by your constraint. Problem 2 - The requested package bogus could not be found in any version, there may be a typo in the package name. Problem 3 + - The requested package stable-requiree-excluded (installed at 1.0.0, required as 1.0.1) is satisfiable by stable-requiree-excluded[1.0.0] but these conflict with your requirements or minimum-stability. + Problem 4 - Installation request for requirer 1.* -> satisfiable by requirer[1.0.0]. - - requirer 1.0.0 requires dependency 1.0.0 -> satisfiable by dependency[1.0.0] but these conflict with your requirements or minimum-stability + - requirer 1.0.0 requires dependency 1.0.0 -> satisfiable by dependency[1.0.0] but these conflict with your requirements or minimum-stability. Potential causes: - A typo in the package name