1
0
Fork 0

Merge branch '2.4'

pull/11115/head
Jordi Boggiano 2022-10-12 16:55:56 +02:00
commit 06359da3a3
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 88 additions and 25 deletions

48
composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
"version": "1.3.3", "version": "1.3.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/ca-bundle.git", "url": "https://github.com/composer/ca-bundle.git",
"reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c" "reference": "69098eca243998b53eed7a48d82dedd28b447cd5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/30897edbfb15e784fe55587b4f73ceefd3c4d98c", "url": "https://api.github.com/repos/composer/ca-bundle/zipball/69098eca243998b53eed7a48d82dedd28b447cd5",
"reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c", "reference": "69098eca243998b53eed7a48d82dedd28b447cd5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -64,7 +64,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/composer", "irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues", "issues": "https://github.com/composer/ca-bundle/issues",
"source": "https://github.com/composer/ca-bundle/tree/1.3.3" "source": "https://github.com/composer/ca-bundle/tree/1.3.4"
}, },
"funding": [ "funding": [
{ {
@ -80,7 +80,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-07-20T07:14:26+00:00" "time": "2022-10-12T12:08:29+00:00"
}, },
{ {
"name": "composer/class-map-generator", "name": "composer/class-map-generator",
@ -941,16 +941,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.4.13", "version": "v5.4.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be" "reference": "984ea2c0f45f42dfed01d2f3987b187467c4b16d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", "url": "https://api.github.com/repos/symfony/console/zipball/984ea2c0f45f42dfed01d2f3987b187467c4b16d",
"reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", "reference": "984ea2c0f45f42dfed01d2f3987b187467c4b16d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1020,7 +1020,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v5.4.13" "source": "https://github.com/symfony/console/tree/v5.4.14"
}, },
"funding": [ "funding": [
{ {
@ -1036,7 +1036,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-08-26T13:50:20+00:00" "time": "2022-10-07T08:01:20+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -1871,16 +1871,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.4.13", "version": "v5.4.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "2900c668a32138a34118740de3e4d5a701801f53" "reference": "089e7237497fae7a9c404d0c3aeb8db3254733e4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/2900c668a32138a34118740de3e4d5a701801f53", "url": "https://api.github.com/repos/symfony/string/zipball/089e7237497fae7a9c404d0c3aeb8db3254733e4",
"reference": "2900c668a32138a34118740de3e4d5a701801f53", "reference": "089e7237497fae7a9c404d0c3aeb8db3254733e4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1937,7 +1937,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.4.13" "source": "https://github.com/symfony/string/tree/v5.4.14"
}, },
"funding": [ "funding": [
{ {
@ -1953,7 +1953,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-01T01:52:16+00:00" "time": "2022-10-05T15:16:54+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -2239,16 +2239,16 @@
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
"version": "v6.1.3", "version": "v6.1.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git", "url": "https://github.com/symfony/phpunit-bridge.git",
"reference": "75c2fa71d049c1f48e39d208c0cefba97e66335a" "reference": "07cf788ac9ae83b59d46599bb5098c3add88c68b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/75c2fa71d049c1f48e39d208c0cefba97e66335a", "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/07cf788ac9ae83b59d46599bb5098c3add88c68b",
"reference": "75c2fa71d049c1f48e39d208c0cefba97e66335a", "reference": "07cf788ac9ae83b59d46599bb5098c3add88c68b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2302,7 +2302,7 @@
"description": "Provides utilities for PHPUnit, especially user deprecation notices management", "description": "Provides utilities for PHPUnit, especially user deprecation notices management",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v6.1.3" "source": "https://github.com/symfony/phpunit-bridge/tree/v6.1.6"
}, },
"funding": [ "funding": [
{ {
@ -2318,7 +2318,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-07-28T13:40:41+00:00" "time": "2022-10-07T08:04:03+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -94,6 +94,9 @@ abstract class BaseDependencyCommand extends BaseCommand
2, 2,
$input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*' $input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*'
); );
if (!$input->hasArgument(self::ARGUMENT_CONSTRAINT)) {
$textConstraint = '*';
}
// Find packages that are or provide the requested package first // Find packages that are or provide the requested package first
$packages = $installedRepo->findPackagesWithReplacersAndProviders($needle); $packages = $installedRepo->findPackagesWithReplacersAndProviders($needle);
@ -107,6 +110,8 @@ abstract class BaseDependencyCommand extends BaseCommand
$defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager())); $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager()));
if ($match = $defaultRepos->findPackage($needle, $textConstraint)) { if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
$installedRepo->addRepository(new InstalledArrayRepository([clone $match])); $installedRepo->addRepository(new InstalledArrayRepository([clone $match]));
} else {
$this->getIO()->writeError('<error>Package "'.$needle.'" could not be found with constraint "'.$textConstraint.'", results below will most likely be incomplete.</error>');
} }
} }

View File

@ -193,7 +193,7 @@ class RootPackageLoader extends ArrayLoader
private function extractAliases(array $requires, array $aliases): array private function extractAliases(array $requires, array $aliases): array
{ {
foreach ($requires as $reqName => $reqVersion) { foreach ($requires as $reqName => $reqVersion) {
if (Preg::isMatch('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) { if (Preg::isMatch('{(?:^|\| *|, *)([^,\s#|]+)(?:#[^ ]+)? +as +([^,\s|]+)(?:$| *\|| *,)}', $reqVersion, $match)) {
$aliases[] = [ $aliases[] = [
'package' => strtolower($reqName), 'package' => strtolower($reqName),
'version' => $this->versionParser->normalize($match[1], $reqVersion), 'version' => $this->versionParser->normalize($match[1], $reqVersion),

View File

@ -0,0 +1,58 @@
--TEST--
Aliases can be extracted out of complex AND or OR constraints
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{
"name": "a/a", "version": "dev-feature-foo",
"source": { "reference": "feat.a", "type": "git", "url": "" }
},
{
"name": "a/b", "version": "dev-feature-foo",
"source": { "reference": "feat.b", "type": "git", "url": "" }
},
{
"name": "a/c", "version": "dev-feature-foo",
"source": { "reference": "feat.c", "type": "git", "url": "" }
},
{
"name": "a/d", "version": "dev-feature-foo",
"source": { "reference": "feat.d", "type": "git", "url": "" }
},
{
"name": "enforcer/pkg", "version": "1.0.0",
"source": { "reference": "feat.c", "type": "git", "url": "" },
"require": {
"a/a": "^1",
"a/b": "^1",
"a/c": "^1",
"a/d": "^1"
}
}
]
}
],
"require": {
"a/a": "1.*||dev-feature-foo as 1.0.2||^2",
"a/b": "dev-feature-foo, dev-feature-foo as 1.0.2",
"a/c": "dev-feature-foo as 1.0.2||^2",
"a/d": "dev-feature-foo as 1.0.2, dev-feature-foo",
"enforcer/pkg": "*"
},
"minimum-stability": "dev"
}
--RUN--
install
--EXPECT--
Installing a/d (dev-feature-foo feat.d)
Marking a/d (1.0.2) as installed, alias of a/d (dev-feature-foo feat.d)
Installing a/c (dev-feature-foo feat.c)
Marking a/c (1.0.2) as installed, alias of a/c (dev-feature-foo feat.c)
Installing a/b (dev-feature-foo feat.b)
Marking a/b (1.0.2) as installed, alias of a/b (dev-feature-foo feat.b)
Installing a/a (dev-feature-foo feat.a)
Marking a/a (1.0.2) as installed, alias of a/a (dev-feature-foo feat.a)
Installing enforcer/pkg (1.0.0)