From b99f9bae6045d87621df4474b4d8b3da2087bbdd Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 27 Apr 2012 19:23:35 +0200 Subject: [PATCH 1/4] Let the user know a package is being removed --- src/Composer/Downloader/FileDownloader.php | 1 + src/Composer/Downloader/VcsDownloader.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 356934514..b11bf7ba6 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -101,6 +101,7 @@ class FileDownloader implements DownloaderInterface */ public function remove(PackageInterface $package, $path) { + $this->io->write(" - Removing package " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); if (!$this->filesystem->removeDirectory($path)) { throw new \RuntimeException('Could not completely delete '.$path.', aborting.'); } diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 2d19bba40..7d3c90c7f 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -77,6 +77,7 @@ abstract class VcsDownloader implements DownloaderInterface public function remove(PackageInterface $package, $path) { $this->enforceCleanDirectory($path); + $this->io->write(" - Removing package " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); if (!$this->filesystem->removeDirectory($path)) { throw new \RuntimeException('Could not completely delete '.$path.', aborting.'); } From 22a825fc07c6e011f0ee1fd90f1f930edd160c93 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 27 Apr 2012 21:23:07 +0200 Subject: [PATCH 2/4] Clean up vendor dir after a package was removed --- src/Composer/Installer/LibraryInstaller.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 0da923654..9be2e1d1d 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -127,6 +127,13 @@ class LibraryInstaller implements InstallerInterface $this->downloadManager->remove($package, $downloadPath); $this->removeBinaries($package); $repo->removePackage($package); + + if (strpos($package->getName(), '/')) { + $packageVendorDir = dirname($downloadPath); + if (is_dir($packageVendorDir) && !glob($packageVendorDir.'/*')) { + @rmdir($packageVendorDir); + } + } } /** From b3659d85f3d51c47bb342c30ba4cc4809197e018 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 27 Apr 2012 21:24:07 +0200 Subject: [PATCH 3/4] Force platform packages to remain installed --- src/Composer/Installer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 5819e3996..a6094d6e9 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -242,9 +242,11 @@ class Installer } } - // fix the version all installed packages that are not in the current local repo to prevent rogue updates + // fix the version of all installed packages (+ platform) that are not + // in the current local repo to prevent rogue updates (e.g. non-dev + // updating when in dev) foreach ($installedRepo->getPackages() as $package) { - if ($package->getRepository() === $localRepo || $package->getRepository() instanceof PlatformRepository) { + if ($package->getRepository() === $localRepo) { continue; } From d5e35fbe19be36cfdd0121398b5d9b85faf2854b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 27 Apr 2012 21:40:46 +0200 Subject: [PATCH 4/4] Clarify output --- src/Composer/Downloader/FileDownloader.php | 4 ++-- src/Composer/Downloader/VcsDownloader.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index b11bf7ba6..3e15acf80 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -64,7 +64,7 @@ class FileDownloader implements DownloaderInterface $fileName = $this->getFileName($package, $path); - $this->io->write(" - Package " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); + $this->io->write(" - Installing " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); $processUrl = $this->processUrl($url); @@ -101,7 +101,7 @@ class FileDownloader implements DownloaderInterface */ public function remove(PackageInterface $package, $path) { - $this->io->write(" - Removing package " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); + $this->io->write(" - Removing " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); if (!$this->filesystem->removeDirectory($path)) { throw new \RuntimeException('Could not completely delete '.$path.', aborting.'); } diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 7d3c90c7f..cacc74fc4 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -50,7 +50,7 @@ abstract class VcsDownloader implements DownloaderInterface throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information'); } - $this->io->write(" - Package " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); + $this->io->write(" - Installing " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); $this->filesystem->removeDirectory($path); $this->doDownload($package, $path); $this->io->write(''); @@ -65,7 +65,7 @@ abstract class VcsDownloader implements DownloaderInterface throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information'); } - $this->io->write(" - Package " . $target->getName() . " (" . $target->getPrettyVersion() . ")"); + $this->io->write(" - Installing " . $target->getName() . " (" . $target->getPrettyVersion() . ")"); $this->enforceCleanDirectory($path); $this->doUpdate($initial, $target, $path); $this->io->write(''); @@ -77,7 +77,7 @@ abstract class VcsDownloader implements DownloaderInterface public function remove(PackageInterface $package, $path) { $this->enforceCleanDirectory($path); - $this->io->write(" - Removing package " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); + $this->io->write(" - Removing " . $package->getName() . " (" . $package->getPrettyVersion() . ")"); if (!$this->filesystem->removeDirectory($path)) { throw new \RuntimeException('Could not completely delete '.$path.', aborting.'); }