diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2013-04-03 19:34:47 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2013-04-03 19:34:47 +0200 |
commit | 887c6940d2afc9e3110f226e4d95fc72640e3ad6 (patch) | |
tree | bd9fd7dbb978cfec3cb48e8e06d78e0a614d6dfe | |
parent | aa0fe657e46b87cc692895a36df12e8b74bb27bb (diff) | |
download | apt-887c6940d2afc9e3110f226e4d95fc72640e3ad6.tar.gz |
* apt-pkg/cacheiterators.h:
- provide DepIterator::IsSatisfied as a nicer shorthand for DepCheck
-rw-r--r-- | apt-pkg/cacheiterators.h | 2 | ||||
-rw-r--r-- | apt-pkg/depcache.cc | 25 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 16 | ||||
-rw-r--r-- | debian/changelog | 2 |
4 files changed, 26 insertions, 19 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index dcd353119..179a0e963 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -286,6 +286,8 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> { bool IsIgnorable(PrvIterator const &Prv) const; bool IsIgnorable(PkgIterator const &Pkg) const; bool IsMultiArchImplicit() const; + bool IsSatisfied(VerIterator const &Ver) const; + bool IsSatisfied(PrvIterator const &Prv) const; void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index a48cd8b0c..6a3e9bfc4 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -351,18 +351,15 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res) PkgIterator Pkg = Dep.TargetPkg(); // Check the base package if (Type == NowVersion && Pkg->CurrentVer != 0) - if (VS().CheckDep(Pkg.CurrentVer().VerStr(),Dep->CompareOp, - Dep.TargetVer()) == true) + if (Dep.IsSatisfied(Pkg.CurrentVer()) == true) return true; if (Type == InstallVersion && PkgState[Pkg->ID].InstallVer != 0) - if (VS().CheckDep(PkgState[Pkg->ID].InstVerIter(*this).VerStr(), - Dep->CompareOp,Dep.TargetVer()) == true) + if (Dep.IsSatisfied(PkgState[Pkg->ID].InstVerIter(*this)) == true) return true; if (Type == CandidateVersion && PkgState[Pkg->ID].CandidateVer != 0) - if (VS().CheckDep(PkgState[Pkg->ID].CandidateVerIter(*this).VerStr(), - Dep->CompareOp,Dep.TargetVer()) == true) + if (Dep.IsSatisfied(PkgState[Pkg->ID].CandidateVerIter(*this)) == true) return true; } @@ -398,7 +395,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res) } // Compare the versions. - if (VS().CheckDep(P.ProvideVersion(),Dep->CompareOp,Dep.TargetVer()) == true) + if (Dep.IsSatisfied(P) == true) { Res = P.OwnerPkg(); return true; @@ -1192,14 +1189,13 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, { APT::VersionList verlist; pkgCache::VerIterator Cand = PkgState[Start.TargetPkg()->ID].CandidateVerIter(*this); - if (Cand.end() == false && VS().CheckDep(Cand.VerStr(), Start->CompareOp, Start.TargetVer()) == true) + if (Cand.end() == false && Start.IsSatisfied(Cand) == true) verlist.insert(Cand); for (PrvIterator Prv = Start.TargetPkg().ProvidesList(); Prv.end() != true; ++Prv) { pkgCache::VerIterator V = Prv.OwnerVer(); pkgCache::VerIterator Cand = PkgState[Prv.OwnerPkg()->ID].CandidateVerIter(*this); - if (Cand.end() == true || V != Cand || - VS().CheckDep(Prv.ProvideVersion(), Start->CompareOp, Start.TargetVer()) == false) + if (Cand.end() == true || V != Cand || Start.IsSatisfied(Prv) == false) continue; verlist.insert(Cand); } @@ -1407,7 +1403,7 @@ bool pkgDepCache::SetCandidateRelease(pkgCache::VerIterator TargetVer, if (Cand.end() == true) continue; // check if the current candidate is enough for the versioned dependency - and installable? - if (VS().CheckDep(P.CandVersion(), Start->CompareOp, Start.TargetVer()) == true && + if (Start.IsSatisfied(Cand) == true && (VersionState(Cand.DependsList(), DepInstall, DepCandMin, DepCandPolicy) & DepCandMin) == DepCandMin) { itsFine = true; @@ -1441,7 +1437,7 @@ bool pkgDepCache::SetCandidateRelease(pkgCache::VerIterator TargetVer, V = Match.Find(D.TargetPkg()); // check if the version from this release could satisfy the dependency - if (V.end() == true || VS().CheckDep(V.VerStr(), D->CompareOp, D.TargetVer()) == false) + if (V.end() == true || D.IsSatisfied(V) == false) { if (stillOr == true) continue; @@ -1771,7 +1767,7 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, for(VerIterator V = d.TargetPkg().VersionList(); !V.end(); ++V) { - if(_system->VS->CheckDep(V.VerStr(), d->CompareOp, d.TargetVer())) + if(d.IsSatisfied(V)) { if(debug_autoremove) { @@ -1793,8 +1789,7 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, for(PrvIterator prv=d.TargetPkg().ProvidesList(); !prv.end(); ++prv) { - if(_system->VS->CheckDep(prv.ProvideVersion(), d->CompareOp, - d.TargetVer())) + if(d.IsSatisfied(prv)) { if(debug_autoremove) { diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 879f34099..d7725563b 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -634,8 +634,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const { if (IsIgnorable(I.ParentPkg()) == true) continue; - - if (Owner->VS->CheckDep(I.VerStr(),S->CompareOp,TargetVer()) == false) + if (IsSatisfied(I) == false) continue; Size++; @@ -648,8 +647,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const { if (IsIgnorable(I) == true) continue; - - if (Owner->VS->CheckDep(I.ProvideVersion(),S->CompareOp,TargetVer()) == false) + if (IsSatisfied(I) == false) continue; Size++; @@ -757,6 +755,16 @@ bool pkgCache::DepIterator::IsMultiArchImplicit() const return false; } /*}}}*/ +// DepIterator::IsSatisfied - check if a version satisfied the dependency /*{{{*/ +bool pkgCache::DepIterator::IsSatisfied(VerIterator const &Ver) const +{ + return Owner->VS->CheckDep(Ver.VerStr(),S->CompareOp,TargetVer()); +} +bool pkgCache::DepIterator::IsSatisfied(PrvIterator const &Prv) const +{ + return Owner->VS->CheckDep(Prv.ProvideVersion(),S->CompareOp,TargetVer()); +} + /*}}}*/ // ostream operator to handle string representation of a dependecy /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/debian/changelog b/debian/changelog index d4f0e4bb3..7070c5fc9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ apt (0.9.7.8~exp2+nmu1) UNRELEASED; urgency=low - sort group and package names in the hashtable on insert * apt-pkg/pkgcache.cc: - assume sorted hashtable entries for groups/packages + * apt-pkg/cacheiterators.h: + - provide DepIterator::IsSatisfied as a nicer shorthand for DepCheck * apt-pkg/deb/debversion.cc: - add a string-equal shortcut for equal version comparisions |