From ceac0ca75bc33dbf7eeaf617264de7ef7d42d1de Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 2 Apr 2012 21:32:05 +0200 Subject: [PATCH] Fix updating of already installed dev packages, fixes #496 --- src/Composer/Installer.php | 8 ++------ src/Composer/Installer/InstallationManager.php | 2 +- src/Composer/Package/BasePackage.php | 12 ++++++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 34e01fee6..a0c07b949 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -219,10 +219,6 @@ class Installer // force dev packages to be updated to latest reference on update if ($this->update) { foreach ($localRepo->getPackages() as $package) { - if ($package instanceof AliasPackage) { - $package = $package->getAliasOf(); - } - // skip non-dev packages if (!$package->isDev()) { continue; @@ -230,8 +226,8 @@ class Installer // skip packages that will be updated/uninstalled foreach ($operations as $operation) { - if (('update' === $operation->getJobType() && $package === $operation->getInitialPackage()) - || ('uninstall' === $operation->getJobType() && $package === $operation->getPackage()) + if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package)) + || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package)) ) { continue 2; } diff --git a/src/Composer/Installer/InstallationManager.php b/src/Composer/Installer/InstallationManager.php index d7708c2a7..c99dad571 100644 --- a/src/Composer/Installer/InstallationManager.php +++ b/src/Composer/Installer/InstallationManager.php @@ -141,7 +141,7 @@ class InstallationManager if ($initial instanceof AliasPackage) { $initial = $initial->getAliasOf(); } - $target = $operation->getTargetPackage(); + $target = $operation->getTargetPackage(); if ($target instanceof AliasPackage) { $target = $target->getAliasOf(); $target->setInstalledAsAlias(true); diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index b094779d5..90fb67868 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -165,6 +165,18 @@ abstract class BasePackage implements PackageInterface return $this->getName().'-'.$this->getVersion(); } + public function equals(PackageInterface $package) + { + $self = $this; + if ($this instanceof AliasPackage) { + $self = $this->getAliasOf(); + } + if ($package instanceof AliasPackage) { + $package = $package->getAliasOf(); + } + return $package === $self; + } + /** * Converts the package into a readable and unique string *