1
0
Fork 0

Merge branch '1.10'

pull/8995/head
Jordi Boggiano 2020-06-16 17:16:42 +02:00
commit c8731598cc
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
22 changed files with 151 additions and 145 deletions

View File

@ -257,16 +257,16 @@ EOF;
EOF;
}
$blacklist = null;
$excluded = null;
if (!empty($autoloads['exclude-from-classmap'])) {
$blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
$excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
}
$classMap = array();
$ambiguousClasses = array();
$scannedFiles = array();
foreach ($autoloads['classmap'] as $dir) {
$classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, null, $classMap, $ambiguousClasses, $scannedFiles);
$classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, null, null, $classMap, $ambiguousClasses, $scannedFiles);
}
if ($scanPsrPackages) {
@ -289,7 +289,7 @@ EOF;
continue;
}
$classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
$classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
}
}
}
@ -368,9 +368,9 @@ EOF;
return count($classMap);
}
private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
{
foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
if (!isset($classMap[$class])) {
$classMap[$class] = $pathCode;
@ -382,9 +382,9 @@ EOF;
return $classMap;
}
private function generateClassMap($dir, $blacklist, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
{
return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
return ClassMapGenerator::createMap($dir, $excluded, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
}
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
@ -488,15 +488,15 @@ EOF;
}
if (isset($autoloads['classmap'])) {
$blacklist = null;
$excluded = null;
if (!empty($autoloads['exclude-from-classmap'])) {
$blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
$excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
}
$scannedFiles = array();
foreach ($autoloads['classmap'] as $dir) {
try {
$loader->addClassMap($this->generateClassMap($dir, $blacklist, null, null, false, $scannedFiles));
$loader->addClassMap($this->generateClassMap($dir, $excluded, null, null, false, $scannedFiles));
} catch (\RuntimeException $e) {
$this->io->writeError('<warning>'.$e->getMessage().'</warning>');
}

View File

@ -51,7 +51,7 @@ class ClassMapGenerator
* Iterate over all files in the given directory searching for classes
*
* @param \Iterator|string $path The path to search in or an iterator
* @param string $blacklist Regex that matches against the file path that exclude from the classmap.
* @param string $excluded Regex that matches against the file path that exclude from the classmap.
* @param IOInterface $io IO object
* @param string $namespace Optional namespace prefix to filter by
* @param string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules
@ -59,7 +59,7 @@ class ClassMapGenerator
* @throws \RuntimeException When the path is neither an existing file nor directory
* @return array A class map array
*/
public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
{
$basePath = $path;
if (is_string($path)) {
@ -102,12 +102,12 @@ class ClassMapGenerator
continue;
}
// check the realpath of the file against the blacklist as the path might be a symlink and the blacklist is realpath'd so symlink are resolved
if ($blacklist && preg_match($blacklist, strtr($realPath, '\\', '/'))) {
// check the realpath of the file against the excluded paths as the path might be a symlink and the excluded path is realpath'd so symlink are resolved
if ($excluded && preg_match($excluded, strtr($realPath, '\\', '/'))) {
continue;
}
// check non-realpath of file for directories symlink in project dir
if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
if ($excluded && preg_match($excluded, strtr($filePath, '\\', '/'))) {
continue;
}

View File

@ -431,7 +431,11 @@ EOT
}
$versionsUtil = new Versions($config, $this->httpDownloader);
$latest = $versionsUtil->getLatest();
try {
$latest = $versionsUtil->getLatest();
} catch (\Exception $e) {
return $e;
}
if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';

View File

@ -156,7 +156,7 @@ class Application extends BaseApplication
}
// prompt user for dir change if no composer.json is present in current dir
if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile())) {
$dir = dirname(getcwd());
$home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');

View File

@ -338,14 +338,12 @@ class GitHubDriver extends VcsDriver
$this->branches = array();
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
$branchBlacklist = array('gh-pages');
do {
$response = $this->getContents($resource);
$branchData = $response->decodeJson();
foreach ($branchData as $branch) {
$name = substr($branch['ref'], 11);
if (!in_array($name, $branchBlacklist)) {
if ($name !== 'gh-pages') {
$this->branches[$name] = $branch['object']['sha'];
}
}

View File

@ -63,7 +63,11 @@ class Versions
public function getLatest($channel = null)
{
$protocol = extension_loaded('openssl') ? 'https' : 'http';
if ($this->config->get('disable-tls') === true) {
$protocol = 'http';
} else {
$protocol = 'https';
}
$versions = $this->httpDownloader->get($protocol . '://getcomposer.org/versions')->decodeJson();
foreach ($versions[$channel ?: $this->getChannel()] as $version) {

View File

@ -2,8 +2,8 @@
See Github issue #4795 ( github.com/composer/composer/issues/4795 ).
Composer\Installer::whitelistUpdateDependencies should not output a warning for dependencies that need to be updated
that are also a root package, when that root package is also explicitly whitelisted.
Composer\Installer::allowListUpdateDependencies should not output a warning for dependencies that need to be updated
that are also a root package, when that root package is also explicitly allowed.
--COMPOSER--
{

View File

@ -2,8 +2,8 @@
See Github issue #4795 ( github.com/composer/composer/issues/4795 ).
Composer\Installer::whitelistUpdateDependencies intentionally ignores root requirements even if said package is also a
dependency of one the requirements that is whitelisted for update.
Composer\Installer::allowListUpdateDependencies intentionally ignores root requirements even if said package is also a
dependency of one the requirements that is allowed for update.
--COMPOSER--
{

View File

@ -6,8 +6,8 @@ Install from a lock file that deleted a package
{
"type": "package",
"package": [
{ "name": "whitelisted/pkg", "version": "1.1.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "fixed/dependency": "1.0.0", "old/dependency": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.1.0" },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "fixed/dependency": "1.0.0", "old/dependency": "1.0.0" } },
{ "name": "fixed/dependency", "version": "1.1.0" },
{ "name": "fixed/dependency", "version": "1.0.0" },
{ "name": "old/dependency", "version": "1.0.0" }
@ -15,14 +15,14 @@ Install from a lock file that deleted a package
}
],
"require": {
"whitelisted/pkg": "1.*",
"allowed/pkg": "1.*",
"fixed/dependency": "1.*"
}
}
--LOCK--
{
"packages": [
{ "name": "whitelisted/pkg", "version": "1.1.0" },
{ "name": "allowed/pkg", "version": "1.1.0" },
{ "name": "fixed/dependency", "version": "1.0.0" }
],
"packages-dev": [],
@ -33,7 +33,7 @@ Install from a lock file that deleted a package
}
--INSTALLED--
[
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "old/dependency": "1.0.0", "fixed/dependency": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "old/dependency": "1.0.0", "fixed/dependency": "1.0.0" } },
{ "name": "fixed/dependency", "version": "1.0.0" },
{ "name": "old/dependency", "version": "1.0.0" }
]
@ -41,4 +41,4 @@ Install from a lock file that deleted a package
install
--EXPECT--
Removing old/dependency (1.0.0)
Upgrading whitelisted/pkg (1.0.0 => 1.1.0)
Upgrading allowed/pkg (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Partial update forces updates dev reference from lock file for non whitelisted packages
Partial update forces updates dev reference from lock file for non allowed packages
--COMPOSER--
{
"repositories": [

View File

@ -1,13 +1,13 @@
--TEST--
Update with a package whitelist only updates those packages if they are not present in composer.json
Update with a package allow list only updates those packages if they are not present in composer.json
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "whitelisted/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0", "fixed/dependency": "1.*" } },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0", "fixed/dependency": "1.*" } },
{ "name": "allowed/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0", "fixed/dependency": "1.*" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0", "fixed/dependency": "1.*" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "fixed/dependency", "version": "1.1.0", "require": { "fixed/sub-dependency": "1.*" } },
@ -18,13 +18,13 @@ Update with a package whitelist only updates those packages if they are not pres
}
],
"require": {
"whitelisted/pkg": "1.*",
"allowed/pkg": "1.*",
"fixed/dependency": "1.*"
}
}
--INSTALLED--
[
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0", "fixed/dependency": "1.*" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0", "fixed/dependency": "1.*" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "fixed/dependency", "version": "1.0.0", "require": { "fixed/sub-dependency": "1.*" } },
{ "name": "fixed/sub-dependency", "version": "1.0.0" }
@ -32,7 +32,7 @@ Update with a package whitelist only updates those packages if they are not pres
--LOCK--
{
"packages": [
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0", "fixed/dependency": "1.*" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0", "fixed/dependency": "1.*" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "fixed/dependency", "version": "1.0.0", "require": { "fixed/sub-dependency": "1.*" } },
{ "name": "fixed/sub-dependency", "version": "1.0.0" }
@ -47,7 +47,7 @@ Update with a package whitelist only updates those packages if they are not pres
"platform-dev": []
}
--RUN--
update whitelisted/pkg dependency/pkg
update allowed/pkg dependency/pkg
--EXPECT--
Upgrading dependency/pkg (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg (1.0.0 => 1.1.0)
Upgrading allowed/pkg (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist pattern and all-dependencies flag updates packages and their dependencies, even if defined as root dependency, matching the pattern
Update with a package allow list pattern and all-dependencies flag updates packages and their dependencies, even if defined as root dependency, matching the pattern
--COMPOSER--
{
"repositories": [
@ -8,10 +8,10 @@ Update with a package whitelist pattern and all-dependencies flag updates packag
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.1.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg-component1", "version": "1.1.0" },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.1.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -23,8 +23,8 @@ Update with a package whitelist pattern and all-dependencies flag updates packag
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg-component1": "1.*",
"whitelisted/pkg-component2": "1.*",
"allowed/pkg-component1": "1.*",
"allowed/pkg-component2": "1.*",
"dependency/pkg": "1.*",
"unrelated/pkg": "1.*"
}
@ -32,8 +32,8 @@ Update with a package whitelist pattern and all-dependencies flag updates packag
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -42,8 +42,8 @@ Update with a package whitelist pattern and all-dependencies flag updates packag
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -58,8 +58,8 @@ Update with a package whitelist pattern and all-dependencies flag updates packag
"platform-dev": []
}
--RUN--
update whitelisted/pkg-* --with-all-dependencies
update allowed/pkg-* --with-all-dependencies
--EXPECT--
Upgrading whitelisted/pkg-component1 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component1 (1.0.0 => 1.1.0)
Upgrading dependency/pkg (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg-component2 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component2 (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates those packages and their dependencies matching the pattern but no dependencies defined as roo package
Update with a package allow list only updates those packages and their dependencies matching the pattern but no dependencies defined as roo package
--COMPOSER--
{
"repositories": [
@ -8,10 +8,10 @@ Update with a package whitelist only updates those packages and their dependenci
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.1.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.*", "root/pkg-dependency": "1.*" } },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.*", "root/pkg-dependency": "1.*" } },
{ "name": "allowed/pkg-component1", "version": "1.1.0" },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.*", "root/pkg-dependency": "1.*" } },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.*", "root/pkg-dependency": "1.*" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "root/pkg-dependency", "version": "1.1.0" },
@ -25,8 +25,8 @@ Update with a package whitelist only updates those packages and their dependenci
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg-component1": "1.*",
"whitelisted/pkg-component2": "1.*",
"allowed/pkg-component1": "1.*",
"allowed/pkg-component2": "1.*",
"root/pkg-dependency": "1.*",
"unrelated/pkg": "1.*"
}
@ -34,8 +34,8 @@ Update with a package whitelist only updates those packages and their dependenci
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "root/pkg-dependency", "version": "1.0.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -45,8 +45,8 @@ Update with a package whitelist only updates those packages and their dependenci
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "root/pkg-dependency", "version": "1.0.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -60,8 +60,8 @@ Update with a package whitelist only updates those packages and their dependenci
"prefer-lowest": false
}
--RUN--
update whitelisted/pkg-* --with-dependencies
update allowed/pkg-* --with-dependencies
--EXPECT--
Upgrading whitelisted/pkg-component1 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component1 (1.0.0 => 1.1.0)
Upgrading dependency/pkg (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg-component2 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component2 (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates those packages and their dependencies matching the pattern
Update with a package allow list only updates those packages and their dependencies matching the pattern
--COMPOSER--
{
"repositories": [
@ -8,16 +8,16 @@ Update with a package whitelist only updates those packages and their dependenci
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.1.0", "require": { "whitelisted/pkg-component2": "1.1.0" } },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0", "require": { "whitelisted/pkg-component2": "1.0.0" } },
{ "name": "whitelisted/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0", "whitelisted/pkg-component5": "1.0.0" } },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "whitelisted/pkg-component3", "version": "1.1.0", "require": { "whitelisted/pkg-component4": "1.1.0" } },
{ "name": "whitelisted/pkg-component3", "version": "1.0.0", "require": { "whitelisted/pkg-component4": "1.0.0" } },
{ "name": "whitelisted/pkg-component4", "version": "1.1.0" },
{ "name": "whitelisted/pkg-component4", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component5", "version": "1.1.0" },
{ "name": "whitelisted/pkg-component5", "version": "1.0.0" },
{ "name": "allowed/pkg-component1", "version": "1.1.0", "require": { "allowed/pkg-component2": "1.1.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0", "require": { "allowed/pkg-component2": "1.0.0" } },
{ "name": "allowed/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0", "allowed/pkg-component5": "1.0.0" } },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component3", "version": "1.1.0", "require": { "allowed/pkg-component4": "1.1.0" } },
{ "name": "allowed/pkg-component3", "version": "1.0.0", "require": { "allowed/pkg-component4": "1.0.0" } },
{ "name": "allowed/pkg-component4", "version": "1.1.0" },
{ "name": "allowed/pkg-component4", "version": "1.0.0" },
{ "name": "allowed/pkg-component5", "version": "1.1.0" },
{ "name": "allowed/pkg-component5", "version": "1.0.0" },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.1.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -29,20 +29,20 @@ Update with a package whitelist only updates those packages and their dependenci
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg-component1": "1.*",
"whitelisted/pkg-component2": "1.*",
"whitelisted/pkg-component3": "1.0.0",
"allowed/pkg-component1": "1.*",
"allowed/pkg-component2": "1.*",
"allowed/pkg-component3": "1.0.0",
"unrelated/pkg": "1.*"
}
}
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0", "require": { "whitelisted/pkg-component2": "1.0.0" } },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "whitelisted/pkg-component3", "version": "1.0.0", "require": { "whitelisted/pkg-component4": "1.0.0" } },
{ "name": "whitelisted/pkg-component4", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component5", "version": "1.0.0" },
{ "name": "allowed/pkg-component1", "version": "1.0.0", "require": { "allowed/pkg-component2": "1.0.0" } },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component3", "version": "1.0.0", "require": { "allowed/pkg-component4": "1.0.0" } },
{ "name": "allowed/pkg-component4", "version": "1.0.0" },
{ "name": "allowed/pkg-component5", "version": "1.0.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -51,11 +51,11 @@ Update with a package whitelist only updates those packages and their dependenci
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0", "require": { "whitelisted/pkg-component2": "1.0.0" } },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "whitelisted/pkg-component3", "version": "1.0.0", "require": { "whitelisted/pkg-component4": "1.0.0" } },
{ "name": "whitelisted/pkg-component4", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component5", "version": "1.0.0" },
{ "name": "allowed/pkg-component1", "version": "1.0.0", "require": { "allowed/pkg-component2": "1.0.0" } },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component3", "version": "1.0.0", "require": { "allowed/pkg-component4": "1.0.0" } },
{ "name": "allowed/pkg-component4", "version": "1.0.0" },
{ "name": "allowed/pkg-component5", "version": "1.0.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -70,8 +70,8 @@ Update with a package whitelist only updates those packages and their dependenci
"platform-dev": []
}
--RUN--
update whitelisted/pkg-* foobar --with-dependencies
update allowed/pkg-* foobar --with-dependencies
--EXPECT--
Upgrading dependency/pkg (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg-component2 (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg-component1 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component2 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component1 (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates those packages matching the pattern
Update with a package allow list only updates those packages matching the pattern
--COMPOSER--
{
"repositories": [
@ -8,10 +8,10 @@ Update with a package whitelist only updates those packages matching the pattern
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.1.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg-component1", "version": "1.1.0" },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.1.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.1.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -23,16 +23,16 @@ Update with a package whitelist only updates those packages matching the pattern
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg-component1": "1.*",
"whitelisted/pkg-component2": "1.*",
"allowed/pkg-component1": "1.*",
"allowed/pkg-component2": "1.*",
"unrelated/pkg": "1.*"
}
}
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -41,8 +41,8 @@ Update with a package whitelist only updates those packages matching the pattern
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component1", "version": "1.0.0" },
{ "name": "whitelisted/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg-component1", "version": "1.0.0" },
{ "name": "allowed/pkg-component2", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -55,7 +55,7 @@ Update with a package whitelist only updates those packages matching the pattern
"prefer-lowest": false
}
--RUN--
update whitelisted/pkg-*
update allowed/pkg-*
--EXPECT--
Upgrading whitelisted/pkg-component1 (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg-component2 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component1 (1.0.0 => 1.1.0)
Upgrading allowed/pkg-component2 (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates those corresponding to the pattern
Update with a package allow list only updates those corresponding to the pattern
--COMPOSER--
{
"repositories": [

View File

@ -1,13 +1,13 @@
--TEST--
Update with a package whitelist removes unused packages
Update with a package allow list removes unused packages
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "whitelisted/pkg", "version": "1.1.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "fixed/dependency": "1.0.0", "old/dependency": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.1.0" },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "fixed/dependency": "1.0.0", "old/dependency": "1.0.0" } },
{ "name": "fixed/dependency", "version": "1.1.0" },
{ "name": "fixed/dependency", "version": "1.0.0" },
{ "name": "old/dependency", "version": "1.0.0" }
@ -15,20 +15,20 @@ Update with a package whitelist removes unused packages
}
],
"require": {
"whitelisted/pkg": "1.*",
"allowed/pkg": "1.*",
"fixed/dependency": "1.*"
}
}
--INSTALLED--
[
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "old/dependency": "1.0.0", "fixed/dependency": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "old/dependency": "1.0.0", "fixed/dependency": "1.0.0" } },
{ "name": "fixed/dependency", "version": "1.0.0" },
{ "name": "old/dependency", "version": "1.0.0" }
]
--LOCK--
{
"packages": [
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "old/dependency": "1.0.0", "fixed/dependency": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "old/dependency": "1.0.0", "fixed/dependency": "1.0.0" } },
{ "name": "fixed/dependency", "version": "1.0.0" },
{ "name": "old/dependency", "version": "1.0.0" }
],
@ -42,7 +42,7 @@ Update with a package whitelist removes unused packages
"platform-dev": []
}
--RUN--
update --with-dependencies whitelisted/pkg
update --with-dependencies allowed/pkg
--EXPECT--
Removing old/dependency (1.0.0)
Upgrading whitelisted/pkg (1.0.0 => 1.1.0)
Upgrading allowed/pkg (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates those packages and their dependencies listed as command arguments
Update with a package allow list only updates those packages and their dependencies listed as command arguments
--COMPOSER--
{
"repositories": [
@ -8,8 +8,8 @@ Update with a package whitelist only updates those packages and their dependenci
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0" } },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.1.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -21,14 +21,14 @@ Update with a package whitelist only updates those packages and their dependenci
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg": "1.*",
"allowed/pkg": "1.*",
"unrelated/pkg": "1.*"
}
}
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -37,7 +37,7 @@ Update with a package whitelist only updates those packages and their dependenci
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -50,7 +50,7 @@ Update with a package whitelist only updates those packages and their dependenci
"prefer-lowest": false
}
--RUN--
update whitelisted/pkg --with-dependencies
update allowed/pkg --with-dependencies
--EXPECT--
Upgrading dependency/pkg (1.0.0 => 1.1.0)
Upgrading whitelisted/pkg (1.0.0 => 1.1.0)
Upgrading allowed/pkg (1.0.0 => 1.1.0)

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates whitelisted packages if no dependency conflicts
Update with a package allow list only updates allowed packages if no dependency conflicts
--COMPOSER--
{
"repositories": [
@ -8,8 +8,8 @@ Update with a package whitelist only updates whitelisted packages if no dependen
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0" } },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.1.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.1.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -21,14 +21,14 @@ Update with a package whitelist only updates whitelisted packages if no dependen
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg": "1.*",
"allowed/pkg": "1.*",
"unrelated/pkg": "1.*"
}
}
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -37,7 +37,7 @@ Update with a package whitelist only updates whitelisted packages if no dependen
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.0.0" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -50,5 +50,5 @@ Update with a package whitelist only updates whitelisted packages if no dependen
"prefer-lowest": false
}
--RUN--
update whitelisted/pkg
update allowed/pkg
--EXPECT--

View File

@ -1,5 +1,5 @@
--TEST--
Update with a package whitelist only updates those packages listed as command arguments
Update with a package allow list only updates those packages listed as command arguments
--COMPOSER--
{
"repositories": [
@ -8,8 +8,8 @@ Update with a package whitelist only updates those packages listed as command ar
"package": [
{ "name": "fixed/pkg", "version": "1.1.0" },
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg", "version": "1.1.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "dependency/pkg", "version": "1.1.0" },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.1.0", "require": { "unrelated/pkg-dependency": "1.*" } },
@ -21,14 +21,14 @@ Update with a package whitelist only updates those packages listed as command ar
],
"require": {
"fixed/pkg": "1.*",
"whitelisted/pkg": "1.*",
"allowed/pkg": "1.*",
"unrelated/pkg": "1.*"
}
}
--INSTALLED--
[
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency": "1.*" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency": "1.*" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -37,7 +37,7 @@ Update with a package whitelist only updates those packages listed as command ar
{
"packages": [
{ "name": "fixed/pkg", "version": "1.0.0" },
{ "name": "whitelisted/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "allowed/pkg", "version": "1.0.0", "require": { "dependency/pkg": "1.*" } },
{ "name": "dependency/pkg", "version": "1.0.0" },
{ "name": "unrelated/pkg", "version": "1.0.0", "require": { "unrelated/pkg-dependency": "1.*" } },
{ "name": "unrelated/pkg-dependency", "version": "1.0.0" }
@ -52,6 +52,6 @@ Update with a package whitelist only updates those packages listed as command ar
"platform-dev": []
}
--RUN--
update whitelisted/pkg
update allowed/pkg
--EXPECT--
Upgrading whitelisted/pkg (1.0.0 => 1.1.0)
Upgrading allowed/pkg (1.0.0 => 1.1.0)

View File

@ -3,10 +3,10 @@ Update updates URLs for updated packages if they have changed
a/a is dev and gets everything updated as it updates to a new ref
b/b is a tag and gets everything updated by updating the package URL directly
c/c is a tag and not whitelisted and remains unchanged
c/c is a tag and not allowlisted and remains unchanged
d/d is dev but with a #ref so it should get URL updated but not the reference
e/e is dev and newly installed with a #ref so it should get the correct URL but with the #111 ref
f/f is dev but not whitelisted and remains unchanged
f/f is dev but not allowlisted and remains unchanged
g/g is dev and installed in a different ref than the #ref, so it gets updated and gets the new URL but not the new ref
--COMPOSER--
{

View File

@ -2,7 +2,7 @@
See Github issue #6661 ( github.com/composer/composer/issues/6661 ).
When `--with-all-dependencies` is used, Composer\Installer::whitelistUpdateDependencies should update the dependencies of all whitelisted packages, even if the dependency is a root requirement.
When `--with-all-dependencies` is used, Composer\Installer::allowListUpdateDependencies should update the dependencies of all allowed packages, even if the dependency is a root requirement.
--COMPOSER--
{