1
0
Fork 0

Fix picking of new dev packages for updates to latest source ref

pull/1015/head
Jordi Boggiano 2012-08-24 12:06:29 +02:00
parent f9f86f03ae
commit c97720c607
2 changed files with 26 additions and 7 deletions

View File

@ -247,7 +247,8 @@ class Installer
// creating repository pool // creating repository pool
$pool = new Pool($minimumStability, $stabilityFlags); $pool = new Pool($minimumStability, $stabilityFlags);
$pool->addRepository($installedRepo, $aliases); $pool->addRepository($installedRepo, $aliases);
foreach ($this->repositoryManager->getRepositories() as $repository) { $repositories = $this->repositoryManager->getRepositories();
foreach ($repositories as $repository) {
$pool->addRepository($repository, $aliases); $pool->addRepository($repository, $aliases);
} }
@ -360,6 +361,10 @@ class Installer
continue; continue;
} }
if ($package instanceof AliasPackage) {
continue;
}
// skip packages that will be updated/uninstalled // skip packages that will be updated/uninstalled
foreach ($operations as $operation) { foreach ($operations as $operation) {
if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package)) if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
@ -394,9 +399,13 @@ class Installer
$newPackage = null; $newPackage = null;
$matches = $pool->whatProvides($package->getName(), new VersionConstraint('=', $package->getVersion())); $matches = $pool->whatProvides($package->getName(), new VersionConstraint('=', $package->getVersion()));
foreach ($matches as $match) { foreach ($matches as $match) {
if (null === $newPackage || $newPackage->getReleaseDate() < $match->getReleaseDate()) { // skip local packages
$newPackage = $match; if (!in_array($match->getRepository(), $repositories, true)) {
continue;
} }
$newPackage = $match;
break;
} }
if ($newPackage && $newPackage->getSourceReference() !== $package->getSourceReference()) { if ($newPackage && $newPackage->getSourceReference() !== $package->getSourceReference()) {

View File

@ -1,5 +1,5 @@
--TEST-- --TEST--
Update aliased package to non-aliased version Update aliased package does not mess up the lock file
--COMPOSER-- --COMPOSER--
{ {
"repositories": [ "repositories": [
@ -12,12 +12,22 @@ Update aliased package to non-aliased version
"source": { "reference": "master", "type": "git", "url": "" } "source": { "reference": "master", "type": "git", "url": "" }
} }
] ]
},
{
"type": "package",
"package": [
{
"name": "a/a", "version": "dev-master",
"extra": { "branch-alias": { "dev-master": "1.0.x-dev" } },
"source": { "reference": "lowpriomaster", "type": "git", "url": "" }
}
]
} }
], ],
"require": { "require": {
"a/a": "1.*" "a/a": "1.*"
}, },
"minimum-stability": "stable" "minimum-stability": "dev"
} }
--LOCK-- --LOCK--
{ {
@ -27,7 +37,7 @@ Update aliased package to non-aliased version
], ],
"packages-dev": null, "packages-dev": null,
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "dev",
"stability-flags": [] "stability-flags": []
} }
--INSTALLED-- --INSTALLED--
@ -48,7 +58,7 @@ update
], ],
"packages-dev": null, "packages-dev": null,
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "dev",
"stability-flags": [] "stability-flags": []
} }
--EXPECT-- --EXPECT--