Quellcode durchsuchen

Fix updating of already installed dev packages, fixes #496

Jordi Boggiano vor 13 Jahren
Ursprung
Commit
ceac0ca75b

+ 2 - 6
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;
                     }

+ 1 - 1
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);

+ 12 - 0
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
      *