From 3d1e0e79ccc79af687beaf807123496fa74053d3 Mon Sep 17 00:00:00 2001 From: Kath Young Date: Tue, 22 Jan 2019 11:18:35 +1030 Subject: [PATCH 1/8] Allow for no-api for Github to be a composer configuration as well as repo specific --- src/Composer/Config.php | 5 +++-- src/Composer/Repository/Vcs/GitHubDriver.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Composer/Config.php b/src/Composer/Config.php index 7b4220724..c34d8f38f 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -61,6 +61,7 @@ class Config 'archive-format' => 'tar', 'archive-dir' => '.', 'htaccess-protect' => true, + 'no-api' => false, // valid keys without defaults (auth config stuff): // bitbucket-oauth // github-oauth @@ -317,10 +318,10 @@ class Config case 'disable-tls': return $this->config[$key] !== 'false' && (bool) $this->config[$key]; - case 'secure-http': return $this->config[$key] !== 'false' && (bool) $this->config[$key]; - + case 'no-api': + return $this->config[$key] !== 'false' && (bool) $this->config[$key]; default: if (!isset($this->config[$key])) { return null; diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index d0b721af9..14e51699f 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -56,7 +56,7 @@ class GitHubDriver extends VcsDriver } $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository); - if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) { + if ( $this->config->get('no-api') === true || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){ $this->setupGitDriver($this->url); return; From 8b1f8a46293669ac9b5b0737bd4715108b3245c6 Mon Sep 17 00:00:00 2001 From: Kath Young Date: Tue, 22 Jan 2019 11:22:55 +1030 Subject: [PATCH 2/8] Add no-api in the config as an acceptable config --- src/Composer/Command/ConfigCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index b002fd3a7..3ed62e0c5 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -302,6 +302,7 @@ EOT $uniqueConfigValues = array( 'process-timeout' => array('is_numeric', 'intval'), 'use-include-path' => array($booleanValidator, $booleanNormalizer), + 'no-api' => array($booleanValidator, $booleanNormalizer), 'preferred-install' => array( function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); From fbb9d20c33597b2aeb1d985e2d44ff8cb00e9c62 Mon Sep 17 00:00:00 2001 From: Kath Young Date: Tue, 29 Jan 2019 07:23:24 +1030 Subject: [PATCH 3/8] Adjusted config name to be more descriptive, added documentation --- doc/06-config.md | 8 ++++++++ res/composer-schema.json | 4 ++++ src/Composer/Command/ConfigCommand.php | 2 +- src/Composer/Config.php | 4 ++-- src/Composer/Repository/Vcs/GitHubDriver.php | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/06-config.md b/doc/06-config.md index 87ffb02a0..6fc743f13 100644 --- a/doc/06-config.md +++ b/doc/06-config.md @@ -234,6 +234,14 @@ github API will have a date instead of the machine hostname. Defaults to `["gitlab.com"]`. A list of domains of GitLab servers. This is used if you use the `gitlab` repository type. +## use-github-api + +Defaults to `true`. Similar to the `no-api` key on a specific repository, setting `use-github-api` to `false` will define the global behavior for all GitHub repositories to clone the +repository as it would with any other git repository instead of using the +GitHub API. But unlike using the `git` driver directly, Composer will still +attempt to use github's zip files. + + ## notify-on-install Defaults to `true`. Composer allows repositories to define a notification URL, diff --git a/res/composer-schema.json b/res/composer-schema.json index ce80c209b..cb3594f7b 100644 --- a/res/composer-schema.json +++ b/res/composer-schema.json @@ -271,6 +271,10 @@ "type": "string" } }, + "use-github-api": { + "type": "boolean", + "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository." + }, "archive-format": { "type": "string", "description": "The default archiving format when not provided on cli, defaults to \"tar\"." diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index 3ed62e0c5..d6fe2844f 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -302,7 +302,7 @@ EOT $uniqueConfigValues = array( 'process-timeout' => array('is_numeric', 'intval'), 'use-include-path' => array($booleanValidator, $booleanNormalizer), - 'no-api' => array($booleanValidator, $booleanNormalizer), + 'use-github-api' => array($booleanValidator, $booleanNormalizer), 'preferred-install' => array( function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); diff --git a/src/Composer/Config.php b/src/Composer/Config.php index c34d8f38f..941505252 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -61,7 +61,7 @@ class Config 'archive-format' => 'tar', 'archive-dir' => '.', 'htaccess-protect' => true, - 'no-api' => false, + 'use-github-api' => true, // valid keys without defaults (auth config stuff): // bitbucket-oauth // github-oauth @@ -320,7 +320,7 @@ class Config return $this->config[$key] !== 'false' && (bool) $this->config[$key]; case 'secure-http': return $this->config[$key] !== 'false' && (bool) $this->config[$key]; - case 'no-api': + case 'use-github-api': return $this->config[$key] !== 'false' && (bool) $this->config[$key]; default: if (!isset($this->config[$key])) { diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 14e51699f..42b30222e 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -56,7 +56,7 @@ class GitHubDriver extends VcsDriver } $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository); - if ( $this->config->get('no-api') === true || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){ + if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){ $this->setupGitDriver($this->url); return; From dec2b5cd5008a5e69a2f47ea32310ac39ac71052 Mon Sep 17 00:00:00 2001 From: Andrew Gillis Date: Mon, 28 Jan 2019 13:36:28 -0500 Subject: [PATCH 4/8] add gitlab token auth for git clone --- src/Composer/Util/Git.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Composer/Util/Git.php b/src/Composer/Util/Git.php index 37410eecd..74e5c286f 100644 --- a/src/Composer/Util/Git.php +++ b/src/Composer/Util/Git.php @@ -153,6 +153,28 @@ class Git return; } } + } elseif (preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)) { + if (!$this->io->hasAuthentication($match[2])) { + $gitLabUtil = new GitLab($this->io, $this->config, $this->process); + $message = 'Cloning failed, enter your GitLab credentials to access private repos'; + + if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) { + $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message); + } + } + + if ($this->io->hasAuthentication($match[2])) { + $auth = $this->io->getAuthentication($match[2]); + if($auth['password'] === 'private-token' || $auth['password'] === 'oauth2') { + $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3]; // swap username and password + } else { + $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3]; + } + $command = call_user_func($commandCallable, $authUrl); + if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) { + return; + } + } } elseif ($this->isAuthenticationFailure($url, $match)) { // private non-github repo that failed to authenticate if (strpos($match[2], '@')) { list($authParts, $match[2]) = explode('@', $match[2], 2); @@ -304,6 +326,11 @@ class Git return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')'; } + public static function getGitLabDomainsRegex(Config $config) + { + return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')'; + } + public static function sanitizeUrl($message) { return preg_replace_callback('{://(?P[^@]+?):(?P.+?)@}', function ($m) { From 2d7a8c67e88281af1f35fc5766486bbbeb288ca6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 29 Jan 2019 10:55:05 +0100 Subject: [PATCH 5/8] Doc formatting fixes --- doc/06-config.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/06-config.md b/doc/06-config.md index 6fc743f13..87d73f8a1 100644 --- a/doc/06-config.md +++ b/doc/06-config.md @@ -236,11 +236,11 @@ This is used if you use the `gitlab` repository type. ## use-github-api -Defaults to `true`. Similar to the `no-api` key on a specific repository, setting `use-github-api` to `false` will define the global behavior for all GitHub repositories to clone the -repository as it would with any other git repository instead of using the -GitHub API. But unlike using the `git` driver directly, Composer will still -attempt to use github's zip files. - +Defaults to `true`. Similar to the `no-api` key on a specific repository, +setting `use-github-api` to `false` will define the global behavior for all +GitHub repositories to clone the repository as it would with any other git +repository instead of using the GitHub API. But unlike using the `git` +driver directly, Composer will still attempt to use GitHub's zip files. ## notify-on-install From 98a15bc93cd4bbe1b11778f9a8a424b5d0f6b043 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 29 Jan 2019 11:14:22 +0100 Subject: [PATCH 6/8] Add output for metapackage installs/updates/.. fixes #7586 --- src/Composer/Downloader/FileDownloader.php | 4 ++-- src/Composer/Factory.php | 2 +- .../Installer/MetapackageInstaller.php | 19 +++++++++++++++++++ .../Test/Downloader/FileDownloaderTest.php | 4 ++-- .../Installer/MetapackageInstallerTest.php | 8 +++++++- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 6596d9c8b..e63df021a 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -215,8 +215,8 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface public function update(PackageInterface $initial, PackageInterface $target, $path) { $name = $target->getName(); - $from = $initial->getPrettyVersion(); - $to = $target->getPrettyVersion(); + $from = $initial->getFullPrettyVersion(); + $to = $target->getFullPrettyVersion(); $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading'; $this->io->writeError(" - " . $actionName . " " . $name . " (" . $from . " => " . $to . "): ", false); diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 6df73ceb3..7e9fd1bd1 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -546,7 +546,7 @@ class Factory $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null)); $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library')); $im->addInstaller(new Installer\PluginInstaller($io, $composer)); - $im->addInstaller(new Installer\MetapackageInstaller()); + $im->addInstaller(new Installer\MetapackageInstaller($io)); } /** diff --git a/src/Composer/Installer/MetapackageInstaller.php b/src/Composer/Installer/MetapackageInstaller.php index 3f99ec03c..e1f31c1bf 100644 --- a/src/Composer/Installer/MetapackageInstaller.php +++ b/src/Composer/Installer/MetapackageInstaller.php @@ -14,6 +14,8 @@ namespace Composer\Installer; use Composer\Repository\InstalledRepositoryInterface; use Composer\Package\PackageInterface; +use Composer\Package\Version\VersionParser; +use Composer\IO\IOInterface; /** * Metapackage installation manager. @@ -22,6 +24,13 @@ use Composer\Package\PackageInterface; */ class MetapackageInstaller implements InstallerInterface { + private $io; + + public function __construct(IOInterface $io) + { + $this->io = $io; + } + /** * {@inheritDoc} */ @@ -43,6 +52,8 @@ class MetapackageInstaller implements InstallerInterface */ public function install(InstalledRepositoryInterface $repo, PackageInterface $package) { + $this->io->writeError(" - Installing " . $package->getName() . " (" . $package->getFullPrettyVersion() . ")"); + $repo->addPackage(clone $package); } @@ -55,6 +66,12 @@ class MetapackageInstaller implements InstallerInterface throw new \InvalidArgumentException('Package is not installed: '.$initial); } + $name = $target->getName(); + $from = $initial->getFullPrettyVersion(); + $to = $target->getFullPrettyVersion(); + $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading'; + $this->io->writeError(" - " . $actionName . " " . $name . " (" . $from . " => " . $to . ")"); + $repo->removePackage($initial); $repo->addPackage(clone $target); } @@ -68,6 +85,8 @@ class MetapackageInstaller implements InstallerInterface throw new \InvalidArgumentException('Package is not installed: '.$package); } + $this->io->writeError(" - Removing " . $package->getName() . " (" . $package->getFullPrettyVersion() . ")"); + $repo->removePackage($package); } diff --git a/tests/Composer/Test/Downloader/FileDownloaderTest.php b/tests/Composer/Test/Downloader/FileDownloaderTest.php index 476b9a8f7..b09065f85 100644 --- a/tests/Composer/Test/Downloader/FileDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FileDownloaderTest.php @@ -210,7 +210,7 @@ class FileDownloaderTest extends TestCase { $oldPackage = $this->getMock('Composer\Package\PackageInterface'); $oldPackage->expects($this->once()) - ->method('getPrettyVersion') + ->method('getFullPrettyVersion') ->will($this->returnValue('1.2.0')); $oldPackage->expects($this->once()) ->method('getVersion') @@ -218,7 +218,7 @@ class FileDownloaderTest extends TestCase $newPackage = $this->getMock('Composer\Package\PackageInterface'); $newPackage->expects($this->once()) - ->method('getPrettyVersion') + ->method('getFullPrettyVersion') ->will($this->returnValue('1.0.0')); $newPackage->expects($this->once()) ->method('getVersion') diff --git a/tests/Composer/Test/Installer/MetapackageInstallerTest.php b/tests/Composer/Test/Installer/MetapackageInstallerTest.php index 1a6b7a264..171773579 100644 --- a/tests/Composer/Test/Installer/MetapackageInstallerTest.php +++ b/tests/Composer/Test/Installer/MetapackageInstallerTest.php @@ -27,7 +27,7 @@ class MetapackageInstallerTest extends TestCase $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); - $this->installer = new MetapackageInstaller(); + $this->installer = new MetapackageInstaller($this->io); } public function testInstall() @@ -45,7 +45,13 @@ class MetapackageInstallerTest extends TestCase public function testUpdate() { $initial = $this->createPackageMock(); + $initial->expects($this->once()) + ->method('getVersion') + ->will($this->returnValue('1.0.0')); $target = $this->createPackageMock(); + $target->expects($this->once()) + ->method('getVersion') + ->will($this->returnValue('1.0.1')); $this->repository ->expects($this->exactly(2)) From acea4a4d4de0f9cf8523cc0fb81c654d0190d483 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 29 Jan 2019 13:27:52 +0100 Subject: [PATCH 7/8] Warn on invalid package name or require/provide/.., fixes #7874 --- src/Composer/Factory.php | 2 +- .../Package/Loader/RootPackageLoader.php | 25 ++++++++++++++- .../Package/Loader/ValidatingArrayLoader.php | 32 +++++++++++++++++++ .../Repository/PlatformRepository.php | 2 +- .../installer/github-issues-4319.test | 8 ++--- .../installer/github-issues-4795-2.test | 22 ++++++------- .../installer/github-issues-4795.test | 20 ++++++------ .../Fixtures/installer/solver-problems.test | 30 ++++++++--------- .../update-with-all-dependencies.test | 22 ++++++------- 9 files changed, 109 insertions(+), 54 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 7e9fd1bd1..8a0ff1e2d 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -347,7 +347,7 @@ class Factory // load package $parser = new VersionParser; $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser); - $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser); + $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io); $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd); $composer->setPackage($package); diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index f917eb838..84e99a857 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -15,6 +15,7 @@ namespace Composer\Package\Loader; use Composer\Package\BasePackage; use Composer\Package\AliasPackage; use Composer\Config; +use Composer\IO\IOInterface; use Composer\Package\RootPackageInterface; use Composer\Repository\RepositoryFactory; use Composer\Package\Version\VersionGuesser; @@ -46,13 +47,19 @@ class RootPackageLoader extends ArrayLoader */ private $versionGuesser; - public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null) + /** + * @var IOInterface + */ + private $io; + + public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null) { parent::__construct($parser); $this->manager = $manager; $this->config = $config; $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser); + $this->io = $io; } /** @@ -65,6 +72,10 @@ class RootPackageLoader extends ArrayLoader { if (!isset($config['name'])) { $config['name'] = '__root__'; + } elseif ($this->io) { + if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) { + $this->io->writeError('Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.'); + } } $autoVersioned = false; if (!isset($config['version'])) { @@ -131,6 +142,18 @@ class RootPackageLoader extends ArrayLoader } } + if ($this->io) { + foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) { + if (isset($config[$linkType])) { + foreach ($config[$linkType] as $linkName => $constraint) { + if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) { + $this->io->writeError('Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.'); + } + } + } + } + } + if (isset($links[$config['name']])) { throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL . 'Did you accidentally name your root package after an external package?', $config['name'])); diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index f4753025b..405e567f0 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -336,6 +336,38 @@ class ValidatingArrayLoader implements LoaderInterface return $this->errors; } + public static function hasPackageNamingError($name, $isLink = false) + { + if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) { + return; + } + + if (!preg_match('{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*$}iD', $name)) { + return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*".'; + } + + $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9'); + $bits = explode('/', strtolower($name)); + if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) { + return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.'; + } + + if (preg_match('{\.json$}', $name)) { + return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.'; + } + + if (preg_match('{[A-Z]}', $name)) { + if ($isLink) { + return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.'; + } + + $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name); + $suggestName = strtolower($suggestName); + + return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.'; + } + } + private function validateRegex($property, $regex, $mandatory = false) { if (!$this->validateString($property, $mandatory)) { diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 6d6e04d2f..4d74d8ed2 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -24,7 +24,7 @@ use Composer\XdebugHandler\XdebugHandler; */ class PlatformRepository extends ArrayRepository { - const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i'; + const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:-?[a-z0-9]+)*)$}iD'; private $versionParser; diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4319.test b/tests/Composer/Test/Fixtures/installer/github-issues-4319.test index d97aefc8d..ee221dab0 100644 --- a/tests/Composer/Test/Fixtures/installer/github-issues-4319.test +++ b/tests/Composer/Test/Fixtures/installer/github-issues-4319.test @@ -13,12 +13,12 @@ Present a clear error message when config.platform.php version results in a conf { "type": "package", "package": [ - { "name": "a", "version": "1.0.0", "require": { "php": "5.5" } } + { "name": "a/a", "version": "1.0.0", "require": { "php": "5.5" } } ] } ], "require": { - "a": "~1.0" + "a/a": "~1.0" }, "config": { "platform": { @@ -36,8 +36,8 @@ Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - - Installation request for a ~1.0 -> satisfiable by a[1.0.0]. - - a 1.0.0 requires php 5.5 -> your PHP version (%s) overridden by "config.platform.php" version (5.3) does not satisfy that requirement. + - Installation request for a/a ~1.0 -> satisfiable by a/a[1.0.0]. + - a/a 1.0.0 requires php 5.5 -> your PHP version (%s) overridden by "config.platform.php" version (5.3) does not satisfy that requirement. --EXPECT-- diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test index d807c6df8..877ac3653 100644 --- a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test +++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test @@ -11,27 +11,27 @@ that are also a root package, when that root package is also explicitly whitelis { "type": "package", "package": [ - { "name": "a", "version": "1.0.0" }, - { "name": "a", "version": "1.1.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }, - { "name": "b", "version": "1.1.0", "require": { "a": "~1.1" } } + { "name": "a/a", "version": "1.0.0" }, + { "name": "a/a", "version": "1.1.0" }, + { "name": "b/b", "version": "1.0.0", "require": { "a/a": "~1.0" } }, + { "name": "b/b", "version": "1.1.0", "require": { "a/a": "~1.1" } } ] } ], "require": { - "a": "~1.0", - "b": "~1.0" + "a/a": "~1.0", + "b/b": "~1.0" } } --INSTALLED-- [ - { "name": "a", "version": "1.0.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } } + { "name": "a/a", "version": "1.0.0" }, + { "name": "b/b", "version": "1.0.0", "require": { "a/a": "~1.0" } } ] --RUN-- -update a b --with-dependencies +update a/a b/b --with-dependencies --EXPECT-OUTPUT-- Loading composer repositories with package information @@ -41,5 +41,5 @@ Writing lock file Generating autoload files --EXPECT-- -Updating a (1.0.0) to a (1.1.0) -Updating b (1.0.0) to b (1.1.0) +Updating a/a (1.0.0) to a/a (1.1.0) +Updating b/b (1.0.0) to b/b (1.1.0) diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795.test index 5a1158f26..1f4b1af27 100644 --- a/tests/Composer/Test/Fixtures/installer/github-issues-4795.test +++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795.test @@ -11,30 +11,30 @@ dependency of one the requirements that is whitelisted for update. { "type": "package", "package": [ - { "name": "a", "version": "1.0.0" }, - { "name": "a", "version": "1.1.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }, - { "name": "b", "version": "1.1.0", "require": { "a": "~1.1" } } + { "name": "a/a", "version": "1.0.0" }, + { "name": "a/a", "version": "1.1.0" }, + { "name": "b/b", "version": "1.0.0", "require": { "a/a": "~1.0" } }, + { "name": "b/b", "version": "1.1.0", "require": { "a/b": "~1.1" } } ] } ], "require": { - "a": "~1.0", - "b": "~1.0" + "a/a": "~1.0", + "b/b": "~1.0" } } --INSTALLED-- [ - { "name": "a", "version": "1.0.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } } + { "name": "a/a", "version": "1.0.0" }, + { "name": "b/b", "version": "1.0.0", "require": { "a/a": "~1.0" } } ] --RUN-- -update b --with-dependencies +update b/b --with-dependencies --EXPECT-OUTPUT-- -Dependency "a" is also a root requirement, but is not explicitly whitelisted. Ignoring. +Dependency "a/a" is also a root requirement, but is not explicitly whitelisted. Ignoring. Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update diff --git a/tests/Composer/Test/Fixtures/installer/solver-problems.test b/tests/Composer/Test/Fixtures/installer/solver-problems.test index e0359a151..cab45f9dc 100644 --- a/tests/Composer/Test/Fixtures/installer/solver-problems.test +++ b/tests/Composer/Test/Fixtures/installer/solver-problems.test @@ -8,30 +8,30 @@ Test the error output of solver problems. "package": [ { "name": "unstable/package", "version": "2.0.0-alpha" }, { "name": "unstable/package", "version": "1.0.0" }, - { "name": "requirer", "version": "1.0.0", "require": {"dependency": "1.0.0" } }, - { "name": "dependency", "version": "2.0.0" }, - { "name": "dependency", "version": "1.0.0" }, - { "name": "stable-requiree-excluded", "version": "1.0.1" }, - { "name": "stable-requiree-excluded", "version": "1.0.0" } + { "name": "requirer/pkg", "version": "1.0.0", "require": {"dependency/pkg": "1.0.0" } }, + { "name": "dependency/pkg", "version": "2.0.0" }, + { "name": "dependency/pkg", "version": "1.0.0" }, + { "name": "stable-requiree-excluded/pkg", "version": "1.0.1" }, + { "name": "stable-requiree-excluded/pkg", "version": "1.0.0" } ] } ], "require": { "unstable/package": "2.*", - "bogus": "1.*", - "requirer": "1.*", - "dependency": "2.*", - "stable-requiree-excluded": "1.0.1" + "bogus/pkg": "1.*", + "requirer/pkg": "1.*", + "dependency/pkg": "2.*", + "stable-requiree-excluded/pkg": "1.0.1" } } --INSTALLED-- [ - { "name": "stable-requiree-excluded", "version": "1.0.0" } + { "name": "stable-requiree-excluded/pkg", "version": "1.0.0" } ] --RUN-- -update unstable/package requirer dependency +update unstable/package requirer/pkg dependency/pkg --EXPECT-EXIT-CODE-- 2 @@ -44,12 +44,12 @@ Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package unstable/package 2.* exists as unstable/package[1.0.0] but these are rejected by your constraint. Problem 2 - - The requested package bogus could not be found in any version, there may be a typo in the package name. + - The requested package bogus/pkg could not be found in any version, there may be a typo in the package name. Problem 3 - - The requested package stable-requiree-excluded (installed at 1.0.0, required as 1.0.1) is satisfiable by stable-requiree-excluded[1.0.0] but these conflict with your requirements or minimum-stability. + - The requested package stable-requiree-excluded/pkg (installed at 1.0.0, required as 1.0.1) is satisfiable by stable-requiree-excluded/pkg[1.0.0] but these conflict with your requirements or minimum-stability. Problem 4 - - Installation request for requirer 1.* -> satisfiable by requirer[1.0.0]. - - requirer 1.0.0 requires dependency 1.0.0 -> satisfiable by dependency[1.0.0] but these conflict with your requirements or minimum-stability. + - Installation request for requirer/pkg 1.* -> satisfiable by requirer/pkg[1.0.0]. + - requirer/pkg 1.0.0 requires dependency/pkg 1.0.0 -> satisfiable by dependency/pkg[1.0.0] but these conflict with your requirements or minimum-stability. Potential causes: - A typo in the package name diff --git a/tests/Composer/Test/Fixtures/installer/update-with-all-dependencies.test b/tests/Composer/Test/Fixtures/installer/update-with-all-dependencies.test index f4fbfce9b..c0019e6ca 100644 --- a/tests/Composer/Test/Fixtures/installer/update-with-all-dependencies.test +++ b/tests/Composer/Test/Fixtures/installer/update-with-all-dependencies.test @@ -10,27 +10,27 @@ When `--with-all-dependencies` is used, Composer\Installer::whitelistUpdateDepen { "type": "package", "package": [ - { "name": "a", "version": "1.0.0" }, - { "name": "a", "version": "1.1.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } }, - { "name": "b", "version": "1.1.0", "require": { "a": "~1.1" } } + { "name": "a/a", "version": "1.0.0" }, + { "name": "a/a", "version": "1.1.0" }, + { "name": "b/b", "version": "1.0.0", "require": { "a/a": "~1.0" } }, + { "name": "b/b", "version": "1.1.0", "require": { "a/a": "~1.1" } } ] } ], "require": { - "a": "~1.0", - "b": "~1.0" + "a/a": "~1.0", + "b/b": "~1.0" } } --INSTALLED-- [ - { "name": "a", "version": "1.0.0" }, - { "name": "b", "version": "1.0.0", "require": { "a": "~1.0" } } + { "name": "a/a", "version": "1.0.0" }, + { "name": "b/b", "version": "1.0.0", "require": { "a/a": "~1.0" } } ] --RUN-- -update b --with-all-dependencies +update b/b --with-all-dependencies --EXPECT-OUTPUT-- Loading composer repositories with package information @@ -40,5 +40,5 @@ Writing lock file Generating autoload files --EXPECT-- -Updating a (1.0.0) to a (1.1.0) -Updating b (1.0.0) to b (1.1.0) \ No newline at end of file +Updating a/a (1.0.0) to a/a (1.1.0) +Updating b/b (1.0.0) to b/b (1.1.0) From 9566b97e6e87aa03cd4993e110445de6f21e42a9 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 29 Jan 2019 13:57:47 +0100 Subject: [PATCH 8/8] Update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf06a0fd4..4b022d2bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +### [1.8.1] 2019-01-29 + + * Deprecated support for non-standard package names (anything with uppercase, or no / in it). Make sure to follow the warnings if you see any to avoid problems in 2.0. + * Fixed some packages missing from the autoloader config when installing with --no-dev + * Fixed support for cloning GitLab repos using OAuth tokens instead of SSH keys + * Fixed metapackage installs/updates missing from output + * Fixed --with-dependencies / --with-all-dependencies not updating some packages in some edge cases + * Fixed compatibility with Symfony 4.2 deprecations + * Fixed temp dir not being cleaned up on download error while archiving packages + * Updated to latest ca-bundle + ### [1.8.0] 2018-12-03 * Changed `post-package-install` / `post-package-update` event to be fired *after* the lock file has been updated as opposed to before