From 0b77a59af66c7611307139aec49014fbe2db3d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Ot=C3=A1vio=20Cobucci=20Oblonczyk?= Date: Mon, 19 Aug 2013 04:40:54 -0300 Subject: [PATCH] Repository options must be replicated on package when dist file is under repository base dir --- .../Repository/ComposerRepository.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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) {