1
0
Fork 0

Small tweaks and make sure composer fails properly in a plane

pull/7904/head
Jordi Boggiano 2018-12-05 13:28:37 +01:00
parent a5d5270a7e
commit 4b7658a2a8
2 changed files with 9 additions and 3 deletions

View File

@ -250,13 +250,18 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
foreach ($packageNameMap as $name => $constraint) {
$matches = array();
// if a repo has no providers but only partial packages and the partial packages are missing
// then we don't want to call whatProvides as it would try to load from the providers and fail
if (!$hasProviders && !isset($this->partialPackagesByName[$name])) {
continue;
}
$candidates = $this->whatProvides($name, $isPackageAcceptableCallable);
foreach ($candidates as $candidate) {
if ($candidate->getName() === $name && (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion())))) {
if ($candidate->getName() !== $name) {
throw new \LogicException('whatProvides should never return a package with a different name than the requested one');
}
if (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
$matches[spl_object_hash($candidate)] = $candidate;
if ($candidate instanceof AliasPackage && !isset($matches[spl_object_hash($candidate->getAliasOf())])) {
$matches[spl_object_hash($candidate->getAliasOf())] = $candidate->getAliasOf();
@ -278,7 +283,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
return $packages;
}
if ($this->lazyProvidersUrl) {
if ($this->lazyProvidersUrl && count($packageNameMap)) {
$packages = array_merge($packages, $this->loadAsyncPackages($packageNameMap, $isPackageAcceptableCallable));
}

View File

@ -225,6 +225,7 @@ class CurlDownloader
if (!isset($this->jobs[$i])) {
continue;
}
$progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
$job = $this->jobs[$i];
unset($this->jobs[$i]);
@ -239,7 +240,7 @@ class CurlDownloader
try {
// TODO progress
//$this->onProgress($curlHandle, $job['callback'], $progress, $job['progress']);
if (CURLE_OK !== $errno) {
if (CURLE_OK !== $errno || $error) {
throw new TransportException($error);
}