Fix handling of root aliases in partial updates, fixes #9110
parent
05e9fe936f
commit
6186c7f36f
|
@ -390,8 +390,12 @@ class Installer
|
||||||
// if we're updating mirrors we want to keep exactly the same versions installed which are in the lock file, but we want current remote metadata
|
// if we're updating mirrors we want to keep exactly the same versions installed which are in the lock file, but we want current remote metadata
|
||||||
if ($this->updateMirrors && $lockedRepository) {
|
if ($this->updateMirrors && $lockedRepository) {
|
||||||
foreach ($lockedRepository->getPackages() as $lockedPackage) {
|
foreach ($lockedRepository->getPackages() as $lockedPackage) {
|
||||||
|
// exclude alias packages here as for root aliases, both alias and aliased are
|
||||||
|
// present in the lock repo and we only want to require the aliased version
|
||||||
|
if (!$lockedPackage instanceof AliasPackage) {
|
||||||
$request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
|
$request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
|
$links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
--TEST--
|
||||||
|
Partial update from lock file with root aliases should work
|
||||||
|
--COMPOSER--
|
||||||
|
{
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "package",
|
||||||
|
"package": [
|
||||||
|
{ "name": "a/dep", "version": "1.0.0", "require": { "c/aliased": "2.0.0" } },
|
||||||
|
{ "name": "b/dep", "version": "1.0.0", "require": { "c/aliased": "1.0.0" } },
|
||||||
|
{ "name": "c/aliased", "version": "1.0.0" },
|
||||||
|
{ "name": "c/aliased", "version": "2.0.0" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"a/dep": "*",
|
||||||
|
"b/dep": "*",
|
||||||
|
"c/aliased": "1.0.0 as 2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--LOCK--
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{ "name": "a/dep", "version": "1.0.0", "require": { "c/aliased": "2.0.0" } },
|
||||||
|
{ "name": "b/dep", "version": "1.0.0", "require": { "c/aliased": "1.0.0" } },
|
||||||
|
{ "name": "c/aliased", "version": "1.0.0" }
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [
|
||||||
|
{
|
||||||
|
"package": "c/aliased",
|
||||||
|
"version": "1.0.0.0",
|
||||||
|
"alias": "2.0.0",
|
||||||
|
"alias_normalized": "2.0.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": []
|
||||||
|
}
|
||||||
|
--INSTALLED--
|
||||||
|
[
|
||||||
|
{ "name": "a/dep", "version": "1.0.0", "require": { "c/aliased": "2.0.0" } },
|
||||||
|
{ "name": "b/dep", "version": "1.0.0", "require": { "c/aliased": "1.0.0" } },
|
||||||
|
{ "name": "c/aliased", "version": "1.0.0" }
|
||||||
|
]
|
||||||
|
--RUN--
|
||||||
|
update --lock
|
||||||
|
--EXPECT-LOCK--
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{ "name": "a/dep", "version": "1.0.0", "require": { "c/aliased": "2.0.0" }, "type": "library" },
|
||||||
|
{ "name": "b/dep", "version": "1.0.0", "require": { "c/aliased": "1.0.0" }, "type": "library" },
|
||||||
|
{ "name": "c/aliased", "version": "1.0.0", "type": "library" }
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [
|
||||||
|
{
|
||||||
|
"package": "c/aliased",
|
||||||
|
"version": "1.0.0.0",
|
||||||
|
"alias": "2.0.0",
|
||||||
|
"alias_normalized": "2.0.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": []
|
||||||
|
}
|
||||||
|
--EXPECT--
|
||||||
|
Marking c/aliased (2.0.0) as installed, alias of c/aliased (1.0.0)
|
Loading…
Reference in New Issue