diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 5eab777a4..2b6dd2385 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -13,6 +13,7 @@ namespace Composer\Repository; use Composer\Package\Loader\ArrayLoader; +use Composer\Package\Package; use Composer\Package\PackageInterface; use Composer\Package\AliasPackage; use Composer\Package\Version\VersionParser; @@ -204,10 +205,19 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository $package = $package->getAliasOf(); } $package->setRepository($this); + $this->configurePackageOptions($package); return $package; } + protected function configurePackageOptions(PackageInterface $package) + { + if ($package instanceof Package + && strpos($package->getDistUrl(), $this->baseUrl) === 0) { + $package->setOptions($this->options); + } + } + /** * {@inheritDoc} */ @@ -376,6 +386,17 @@ class ComposerRepository extends ArrayRepository implements StreamableRepository } } + /** + * Adds a new package to the repository + * + * @param PackageInterface $package + */ + public function addPackage(PackageInterface $package) + { + parent::addPackage($package); + $this->configurePackageOptions($package); + } + protected function loadRootServerFile() { if (null !== $this->rootData) {