summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-08-01 16:03:15 +0900
committerJulian Andres Klode <julian.klode@canonical.com>2024-11-02 10:23:15 +0100
commitb4f43e48994bec07a9b5aa38d21e3fd350912d16 (patch)
tree4fcc00bdf3066ba0827508b5cbe94ecd2f385875
parentc1f69a64fd5070723ef425cc1255cde2a28966ad (diff)
solver3: Remove obsolete checks
These checks are no longer needed since Enqueue() ensures the correctness for us.
-rw-r--r--apt-pkg/solver3.cc49
1 files changed, 5 insertions, 44 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index a21af12f9..c04deadb3 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -339,9 +339,9 @@ bool APT::Solver::Install(pkgCache::PkgIterator Pkg, Var reason, Group group)
if ((*this)[Pkg].decision == Decision::MUST)
return true;
- // Check conflicting selections
- if ((*this)[Pkg].decision == Decision::MUSTNOT)
- return _error->Error("Conflict: %s -> %s but %s", WhyStr(reason).c_str(), Pkg.FullName().c_str(), WhyStr(Var(Pkg)).c_str());
+ // Note decision
+ if (not Enqueue(Var(Pkg), true, reason))
+ return false;
bool anyInstallable = false;
for (auto ver = Pkg.VersionList(); not ver.end(); ver++)
@@ -357,10 +357,6 @@ bool APT::Solver::Install(pkgCache::PkgIterator Pkg, Var reason, Group group)
return false;
}
- // Note decision
- if (not Enqueue(Var(Pkg), true, reason))
- return false;
-
// Insert the work item.
Work workItem{Var(Pkg), depth(), group};
for (auto ver = Pkg.VersionList(); not ver.end(); ver++)
@@ -388,24 +384,6 @@ bool APT::Solver::Install(pkgCache::VerIterator Ver, Var reason, Group group)
if (unlikely(debug >= 1))
assert(IsAllowedVersion(Ver));
- // Check conflicting selections
- if ((*this)[Ver].decision == Decision::MUSTNOT)
- return _error->Error("Conflict: %s -> %s but %s",
- WhyStr(reason).c_str(),
- (Ver.ParentPkg().FullName() + "=" + Ver.VerStr()).c_str(),
- WhyStr(Var(Ver)).c_str());
- if ((*this)[Ver.ParentPkg()].decision == Decision::MUSTNOT)
- return _error->Error("Conflict: %s -> %s but %s",
- WhyStr(reason).c_str(),
- (Ver.ParentPkg().FullName() + "=" + Ver.VerStr()).c_str(),
- WhyStr(Var(Ver.ParentPkg())).c_str());
- for (auto otherVer = Ver.ParentPkg().VersionList(); not otherVer.end(); otherVer++)
- if (otherVer->ID != Ver->ID && (*this)[otherVer].decision == Decision::MUST)
- return _error->Error("Conflict: %s -> %s but %s",
- WhyStr(reason).c_str(),
- (Ver.ParentPkg().FullName() + "=" + Ver.VerStr()).c_str(),
- WhyStr(Var(otherVer)).c_str());
-
// Note decision
if (not Enqueue(Var(Ver), true, reason))
return false;
@@ -437,13 +415,6 @@ bool APT::Solver::Reject(pkgCache::PkgIterator Pkg, Var reason, Group group)
if ((*this)[Pkg].decision == Decision::MUSTNOT)
return true;
- // Check conflicting selections
- for (auto ver = Pkg.VersionList(); not ver.end(); ver++)
- if ((*this)[ver].decision == Decision::MUST)
- return _error->Error("Conflict: %s -> not %s but %s", WhyStr(reason).c_str(), Pkg.FullName().c_str(), WhyStr(Var(ver)).c_str());
- if ((*this)[Pkg].decision == Decision::MUST)
- return _error->Error("Conflict: %s -> not %s but %s", WhyStr(reason).c_str(), Pkg.FullName().c_str(), WhyStr(Var(Pkg)).c_str());
-
// Reject the package and its versions.
if (not Enqueue(Var(Pkg), false, reason))
return false;
@@ -464,13 +435,6 @@ bool APT::Solver::Reject(pkgCache::VerIterator Ver, Var reason, Group group)
if ((*this)[Ver].decision == Decision::MUSTNOT)
return true;
- // Check conflicting choices.
- if ((*this)[Ver].decision == Decision::MUST)
- return _error->Error("Conflict: %s -> not %s but %s",
- WhyStr(reason).c_str(),
- (Ver.ParentPkg().FullName() + "=" + Ver.VerStr()).c_str(),
- WhyStr(Var(Ver)).c_str());
-
// Mark the package as rejected and propagate up as needed.
if (not Enqueue(Var(Ver), false, reason))
return false;
@@ -494,11 +458,8 @@ bool APT::Solver::Reject(pkgCache::VerIterator Ver, Var reason, Group group)
WhyStr(reason).c_str(),
(Ver.ParentPkg().FullName() + "=" + Ver.VerStr()).c_str());
}
- else if ((*this)[Ver.ParentPkg()].decision != Decision::MUSTNOT) // Last installable invalidated
- {
- if (not Enqueue(Var(Ver.ParentPkg()), false, Var(Ver)))
- return false;
- }
+ else if (not Enqueue(Var(Ver.ParentPkg()), false, Var(Ver))) // Last version invalidated
+ return false;
}
if (not RejectReverseDependencies(Ver))