Prioritize repository over package versions in the default policy, fixes #3509
parent
00ca2a91a3
commit
d6620195e5
|
@ -12,6 +12,13 @@ resulting order in which the solver will try to install them.
|
|||
|
||||
The rules are to be applied in the order of these descriptions.
|
||||
|
||||
### Repository priorities
|
||||
|
||||
Packages Repo1.Av1, Repo2.Av1
|
||||
|
||||
* priority(Repo1) >= priority(Repo2) => (Repo1.Av1, Repo2.Av1)
|
||||
* priority(Repo1) < priority(Repo2) => (Repo2.Av1, Repo1.Av1)
|
||||
|
||||
### Package versions
|
||||
|
||||
Packages: Av1, Av2, Av3
|
||||
|
@ -22,13 +29,6 @@ Request: install A
|
|||
|
||||
* (Av3)
|
||||
|
||||
### Repository priorities
|
||||
|
||||
Packages Repo1.Av1, Repo2.Av1
|
||||
|
||||
* priority(Repo1) >= priority(Repo2) => (Repo1.Av1, Repo2.Av1)
|
||||
* priority(Repo1) < priority(Repo2) => (Repo2.Av1, Repo1.Av1)
|
||||
|
||||
### Virtual Packages (provides)
|
||||
|
||||
Packages Av1, Bv1
|
||||
|
|
|
@ -82,10 +82,10 @@ class DefaultPolicy implements PolicyInterface
|
|||
}
|
||||
|
||||
foreach ($packages as &$literals) {
|
||||
$literals = $this->pruneToBestVersion($pool, $literals);
|
||||
|
||||
$literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
|
||||
|
||||
$literals = $this->pruneToBestVersion($pool, $literals);
|
||||
|
||||
$literals = $this->pruneRemoteAliases($pool, $literals);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
--TEST--
|
||||
Install prefers higher priority repositories over higher priority package versions
|
||||
--COMPOSER--
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "package",
|
||||
"package": [
|
||||
{ "name": "a/a", "version": "1.0.0" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": [
|
||||
{ "name": "a/a", "version": "1.1.0" },
|
||||
{ "name": "b/b", "version": "1.1.0" },
|
||||
{ "name": "b/b", "version": "1.0.0" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"a/a": "*",
|
||||
"b/b": "*"
|
||||
}
|
||||
}
|
||||
--RUN--
|
||||
install
|
||||
--EXPECT--
|
||||
Installing a/a (1.0.0)
|
||||
Installing b/b (1.1.0)
|
Loading…
Reference in New Issue