Merge pull request #118 from naderman/priority-replace-any-version
Replaced packages have higher priority even if wrong version is replacedpull/123/head
commit
d020f2701d
|
@ -148,12 +148,23 @@ class DefaultPolicy implements PolicyInterface
|
||||||
return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
|
return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if source replaces a package with the same name as target.
|
||||||
|
*
|
||||||
|
* Replace constraints are ignored. This method should only be used for
|
||||||
|
* prioritisation, not for actual constraint verification.
|
||||||
|
*
|
||||||
|
* @param PackageInterface $source
|
||||||
|
* @param PackageInterface $target
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
protected function replaces(PackageInterface $source, PackageInterface $target)
|
protected function replaces(PackageInterface $source, PackageInterface $target)
|
||||||
{
|
{
|
||||||
foreach ($source->getReplaces() as $link) {
|
foreach ($source->getReplaces() as $link) {
|
||||||
if ($link->getTarget() === $target->getName() &&
|
if ($link->getTarget() === $target->getName()
|
||||||
(null === $link->getConstraint() ||
|
// && (null === $link->getConstraint() ||
|
||||||
$link->getConstraint()->matches(new VersionConstraint('==', $target->getVersion())))) {
|
// $link->getConstraint()->matches(new VersionConstraint('==', $target->getVersion())))) {
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,9 +160,9 @@ class RuleSet implements \IteratorAggregate, \Countable
|
||||||
foreach ($this->rules as $type => $rules) {
|
foreach ($this->rules as $type => $rules) {
|
||||||
$string .= str_pad(self::$types[$type], 8, ' ') . ": ";
|
$string .= str_pad(self::$types[$type], 8, ' ') . ": ";
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
$string .= $rule;
|
$string .= $rule."\n";
|
||||||
}
|
}
|
||||||
$string .= "\n";
|
$string .= "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
|
|
|
@ -1746,6 +1746,7 @@ class Solver
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
|
if (1 === $level) {
|
||||||
$conflictRule = $this->propagate($level);
|
$conflictRule = $this->propagate($level);
|
||||||
if ($conflictRule !== null) {
|
if ($conflictRule !== null) {
|
||||||
if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
|
if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
|
||||||
|
@ -1754,6 +1755,7 @@ class Solver
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// handle job rules
|
// handle job rules
|
||||||
if ($level < $systemLevel) {
|
if ($level < $systemLevel) {
|
||||||
|
@ -1987,7 +1989,11 @@ class Solver
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($level < $systemLevel || $level == 1) {
|
// open suse sat-solver uses this, but why is $level == 1 trouble?
|
||||||
|
// SYSTEMSOLVABLE related? we don't have that, so should work
|
||||||
|
//if ($level < $systemLevel || $level == 1) {
|
||||||
|
|
||||||
|
if ($level < $systemLevel) {
|
||||||
break; // trouble
|
break; // trouble
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1995,9 +2001,6 @@ class Solver
|
||||||
$n = -1;
|
$n = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->printDecisionMap();
|
|
||||||
// $this->printDecisionQueue();
|
|
||||||
|
|
||||||
// minimization step
|
// minimization step
|
||||||
if (count($this->branches)) {
|
if (count($this->branches)) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue