summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2025-02-03 19:00:25 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2025-02-14 19:04:56 +0100
commit50f1335212909962b9bba8db74e8be005a55f4e1 (patch)
tree6571749d755a431d602b09257863c8645a590d87 /apt-pkg/pkgcache.cc
parent85eeadde2aefeb0bea1eff4dc2456eec8a405d05 (diff)
Add DepIterator::IsSatisfied(PkgIterator)
This allows checking if a dependency is satisfied by all versions of a package.
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index bccd7798f..1f1aadf59 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -776,6 +776,13 @@ bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const
}
/*}}}*/
// DepIterator::IsSatisfied - check if a version satisfied the dependency /*{{{*/
+bool pkgCache::DepIterator::IsSatisfied(PkgIterator const &Pkg) const
+{
+ for (auto ver = Pkg.VersionList(); not ver.end(); ++ver)
+ if (not IsSatisfied(ver))
+ return false;
+ return not Pkg.VersionList().end();
+}
bool pkgCache::DepIterator::IsSatisfied(VerIterator const &Ver) const
{
return Owner->VS->CheckDep(Ver.VerStr(),S2->CompareOp,TargetVer());