1
0
Fork 0

Merge pull request #3740 from bestform/ignore-root-requirements-in-installer

Ignore root requirements in installer when installing from locked state
pull/3662/merge
Jordi Boggiano 2015-02-14 17:12:21 +00:00
commit 781d8cb925
2 changed files with 44 additions and 0 deletions

View File

@ -355,6 +355,9 @@ class Installer
$installFromLock = false; $installFromLock = false;
if (!$this->update && $this->locker->isLocked()) { if (!$this->update && $this->locker->isLocked()) {
$installFromLock = true; $installFromLock = true;
// we are removing all requirements from the root package so only the lock file is relevant for installation rules
$this->package->setRequires(array());
$this->package->setDevRequires(array());
try { try {
$lockedRepository = $this->locker->getLockedRepository($withDevReqs); $lockedRepository = $this->locker->getLockedRepository($withDevReqs);
} catch (\RuntimeException $e) { } catch (\RuntimeException $e) {

View File

@ -0,0 +1,41 @@
--TEST--
The locked version will not get overwritten by an install
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "foo/bar", "version": "1.0.0" },
{ "name": "foo/baz", "version": "1.0.0" },
{ "name": "foo/baz", "version": "2.0.0" }
]
}
],
"require": {
"foo/bar": "2.0.0",
"foo/baz": "2.0.0"
}
}
--LOCK--
{
"packages": [
{ "name": "foo/bar", "version": "1.0.0" },
{ "name": "foo/baz", "version": "2.0.0" }
],
"packages-dev": null,
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false
}
--INSTALLED--
[
{ "name": "foo/bar", "version": "1.0.0" },
{ "name": "foo/baz", "version": "1.0.0" }
]
--RUN--
install
--EXPECT--
Updating foo/baz (1.0.0) to foo/baz (2.0.0)