1
0
Fork 0

Handle alias packages properly, refs #2189

pull/2604/head
Jordi Boggiano 2014-05-07 19:10:55 +02:00
parent 32cd883daa
commit faeb706de6
2 changed files with 16 additions and 6 deletions

View File

@ -233,6 +233,14 @@ class AliasPackage extends BasePackage implements CompletePackageInterface
{ {
return $this->aliasOf->getDistSha1Checksum(); return $this->aliasOf->getDistSha1Checksum();
} }
public function setTransportOptions(array $options)
{
return $this->aliasOf->setTransportOptions($options);
}
public function getTransportOptions()
{
return $this->aliasOf->getTransportOptions();
}
public function getScripts() public function getScripts()
{ {
return $this->aliasOf->getScripts(); return $this->aliasOf->getScripts();

View File

@ -210,16 +210,15 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
$package = $package->getAliasOf(); $package = $package->getAliasOf();
} }
$package->setRepository($this); $package->setRepository($this);
$this->configurePackageOptions($package);
return $package; return $package;
} }
protected function configurePackageOptions(PackageInterface $package) protected function configurePackageTransportOptions(PackageInterface $package)
{ {
if ($package instanceof Package if (strpos($package->getDistUrl(), $this->baseUrl) === 0) {
&& strpos($package->getDistUrl(), $this->baseUrl) === 0) {
$package->setTransportOptions($this->options); $package->setTransportOptions($this->options);
return;
} }
} }
@ -399,7 +398,7 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
public function addPackage(PackageInterface $package) public function addPackage(PackageInterface $package)
{ {
parent::addPackage($package); parent::addPackage($package);
$this->configurePackageOptions($package); $this->configurePackageTransportOptions($package);
} }
protected function loadRootServerFile() protected function loadRootServerFile()
@ -548,7 +547,10 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository
$data['notification-url'] = $this->notifyUrl; $data['notification-url'] = $this->notifyUrl;
} }
return $this->loader->load($data, 'Composer\Package\CompletePackage'); $package = $this->loader->load($data, 'Composer\Package\CompletePackage');
$this->configurePackageTransportOptions($package);
return $package;
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e); throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
} }