[BUGFIX] Ignore "composer/installers" requirement 85/24785/3
authorThomas Maroschik <tmaroschik@dfau.de>
Tue, 15 Oct 2013 08:35:49 +0000 (10:35 +0200)
committerThomas Maroschik <tmaroschik@dfau.de>
Tue, 15 Oct 2013 13:07:16 +0000 (15:07 +0200)
Most extensions that already provide a composer.json file have a
requirement against composer/installers. Our Package Manager tries
to resolve that dependency and files. As the composer/installers
package is not required for an extension to work it is ignored until
the Extensionmanager can handle composer packages natively.

Resolves: #52767
Releases: 6.2
Change-Id: Ia6c57f6006958aadea759cd583f2dce7716be389
Reviewed-on: https://review.typo3.org/24785
Tested-by: Claus Due
Reviewed-by: Sebastian Fischer
Reviewed-by: Fabien Udriot
Tested-by: Fabien Udriot
Reviewed-by: Thomas Maroschik
Tested-by: Thomas Maroschik
typo3/sysext/core/Classes/Package/Package.php
typo3/sysext/core/Classes/Package/PackageFactory.php
typo3/sysext/core/Classes/Package/PackageManager.php

index 138916b..34c7ad6 100644 (file)
@@ -232,4 +232,20 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
                }
                return $this->classAliases;
        }
-}
\ No newline at end of file
+
+       /**
+        * Check whether the given package requirement (like "typo3/flow" or "php") is a composer package or not
+        *
+        * @param string $requirement the composer requirement string
+        * @return boolean TRUE if $requirement is a composer package (contains a slash), FALSE otherwise
+        */
+       protected function packageRequirementIsComposerPackage($requirement) {
+               //@TODO remove this workaround once extensionmanager can handle composer packages natively
+               if ($requirement === 'composer/installers') {
+                       return FALSE;
+               }
+               return parent::packageRequirementIsComposerPackage($requirement);
+       }
+
+
+}
index 4180ca2..2c5b69f 100644 (file)
@@ -94,7 +94,7 @@ class PackageFactory extends \TYPO3\Flow\Package\PackageFactory {
                        /**
                         * @todo check that manifest name and directory follows convention
                         */
-                       $packageKey = preg_replace('/[^A-Za-z0-9._]/', '', $packageKey);
+                       $packageKey = preg_replace('/[^A-Za-z0-9._-]/', '', $packageKey);
                        return $packageKey;
                } else {
                        return parent::getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath);
index 6db31a9..e7ef089 100644 (file)
@@ -428,7 +428,11 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                if (isset($this->packageAliasMap[$composerName])) {
                        return $this->packageAliasMap[$composerName];
                }
-               return parent::getPackageKeyFromComposerName($composerName);
+               try {
+                       return parent::getPackageKeyFromComposerName($composerName);
+               } catch (\TYPO3\Flow\Package\Exception\InvalidPackageStateException $exception) {
+                       return $composerName;
+               }
        }
 
        /**