1
0
Fork 0

Merge branch '1.6'

pull/7289/merge
Jordi Boggiano 2018-05-03 17:38:09 +02:00
commit 464daeebe2
4 changed files with 8 additions and 12 deletions

View File

@ -678,9 +678,7 @@
{ "$ref": "#/definitions/inline-package" }, { "$ref": "#/definitions/inline-package" },
{ {
"type": "array", "type": "array",
"items": { "items": { "$ref": "#/definitions/inline-package" }
"type": { "$ref": "#/definitions/inline-package" }
}
} }
] ]
} }

View File

@ -17,6 +17,7 @@ use Composer\DependencyResolver\DefaultPolicy;
use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\PolicyInterface; use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\Pool;
@ -716,6 +717,10 @@ class Installer
foreach ($devPackages as $pkg) { foreach ($devPackages as $pkg) {
$packagesToSkip[$pkg->getName()] = true; $packagesToSkip[$pkg->getName()] = true;
if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) { if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
if ($installedDevPkg instanceof AliasPackage) {
$finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
$installedDevPkg = $installedDevPkg->getAliasOf();
}
$finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it'); $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
} }
} }

View File

@ -167,13 +167,6 @@ class ArrayRepository extends BaseRepository
{ {
$packageId = $package->getUniqueName(); $packageId = $package->getUniqueName();
if ($package instanceof AliasPackage) {
$aliasedPackage = $package->getAliasOf();
if ($this === $aliasedPackage->getRepository()) {
$this->removePackage($aliasedPackage);
}
}
foreach ($this->getPackages() as $key => $repoPackage) { foreach ($this->getPackages() as $key => $repoPackage) {
if ($packageId === $repoPackage->getUniqueName()) { if ($packageId === $repoPackage->getUniqueName()) {
array_splice($this->packages, $key, 1); array_splice($this->packages, $key, 1);

View File

@ -68,7 +68,7 @@ class ArrayRepositoryTest extends TestCase
$this->assertEquals('bar', $bar[0]->getName()); $this->assertEquals('bar', $bar[0]->getName());
} }
public function testAutomaticallyAddAndRemoveAliasedPackage() public function testAutomaticallyAddAliasedPackageButNotRemove()
{ {
$repo = new ArrayRepository(); $repo = new ArrayRepository();
@ -83,7 +83,7 @@ class ArrayRepositoryTest extends TestCase
$repo->removePackage($alias); $repo->removePackage($alias);
$this->assertCount(0, $repo); $this->assertCount(1, $repo);
} }
public function testSearch() public function testSearch()