1
0
Fork 0

Purge old dev packages before installing/updating new ones to make sure people do not have issues updating

pull/1644/head
Jordi Boggiano 2013-03-03 01:55:10 +01:00
parent 542d10d8fd
commit 73adf29602
1 changed files with 17 additions and 0 deletions

View File

@ -15,6 +15,7 @@ namespace Composer;
use Composer\Autoload\AutoloadGenerator; use Composer\Autoload\AutoloadGenerator;
use Composer\DependencyResolver\DefaultPolicy; use Composer\DependencyResolver\DefaultPolicy;
use Composer\DependencyResolver\Operation\UpdateOperation; use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Solver; use Composer\DependencyResolver\Solver;
@ -24,6 +25,7 @@ use Composer\Installer\InstallationManager;
use Composer\Config; use Composer\Config;
use Composer\Installer\NoopInstaller; use Composer\Installer\NoopInstaller;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\LinkConstraint\VersionConstraint;
@ -32,6 +34,7 @@ use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface; use Composer\Package\RootPackageInterface;
use Composer\Repository\CompositeRepository; use Composer\Repository\CompositeRepository;
use Composer\Repository\InstalledArrayRepository; use Composer\Repository\InstalledArrayRepository;
use Composer\Repository\InstalledFilesystemRepository;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Repository\RepositoryManager; use Composer\Repository\RepositoryManager;
@ -148,6 +151,20 @@ class Installer
$this->mockLocalRepositories($this->repositoryManager); $this->mockLocalRepositories($this->repositoryManager);
} }
// TODO remove this BC feature at some point
// purge old require-dev packages to avoid conflicts with the new way of handling dev requirements
$devRepo = new InstalledFilesystemRepository(new JsonFile($this->config->get('vendor-dir').'/composer/installed_dev.json'));
if ($devRepo->getPackages()) {
$this->io->write('<warning>BC Notice: Removing old dev packages to migrate to the new require-dev handling.</warning>');
foreach ($devRepo->getPackages() as $package) {
if ($this->installationManager->isPackageInstalled($devRepo, $package)) {
$this->installationManager->uninstall($devRepo, new UninstallOperation($package));
}
}
}
unset($devRepo, $package);
// end BC
if ($this->preferSource) { if ($this->preferSource) {
$this->downloadManager->setPreferSource(true); $this->downloadManager->setPreferSource(true);
} }