summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2011-05-16 15:57:52 +0200
committerMichael Vogt <mvo@debian.org>2011-05-16 15:57:52 +0200
commitd44b706c2d5964daaaf55e6eb97845827958f6e3 (patch)
treeb77f6e72c34c2444ec28e2d47430211d802efb4b /apt-pkg/pkgcache.cc
parent9c192d2811c12dcaf607024eb7f0677b011194e6 (diff)
parentd77b985a309c379d4978525172a72b728fecd15e (diff)
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc32
1 files changed, 20 insertions, 12 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index b63900adb..38e4e904e 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -211,11 +211,14 @@ pkgCache::PkgIterator pkgCache::SingleArchFindPkg(const string &Name)
// ---------------------------------------------------------------------
/* Returns 0 on error, pointer to the package otherwise */
pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
- if (MultiArchCache() == false)
- return SingleArchFindPkg(Name);
size_t const found = Name.find(':');
if (found == string::npos)
- return FindPkg(Name, "native");
+ {
+ if (MultiArchCache() == false)
+ return SingleArchFindPkg(Name);
+ else
+ return FindPkg(Name, "native");
+ }
string const Arch = Name.substr(found+1);
/* Beware: This is specialcased to handle pkg:any in dependencies as
these are linked to virtual pkg:any named packages with all archs.
@@ -518,15 +521,24 @@ std::string pkgCache::PkgIterator::FullName(bool const &Pretty) const
conflicts (including dpkg's Breaks fields). */
bool pkgCache::DepIterator::IsCritical() const
{
- if (S->Type == pkgCache::Dep::Conflicts ||
- S->Type == pkgCache::Dep::DpkgBreaks ||
- S->Type == pkgCache::Dep::Obsoletes ||
+ if (IsNegative() == true ||
S->Type == pkgCache::Dep::Depends ||
S->Type == pkgCache::Dep::PreDepends)
return true;
return false;
}
/*}}}*/
+// DepIterator::IsNegative - Returns true if the dep is a negative one /*{{{*/
+// ---------------------------------------------------------------------
+/* Some dependencies are positive like Depends and Recommends, others
+ are negative like Conflicts which can and should be handled differently */
+bool pkgCache::DepIterator::IsNegative() const
+{
+ return S->Type == Dep::DpkgBreaks ||
+ S->Type == Dep::Conflicts ||
+ S->Type == Dep::Obsoletes;
+}
+ /*}}}*/
// DepIterator::SmartTargetPkg - Resolve dep target pointers w/provides /*{{{*/
// ---------------------------------------------------------------------
/* This intellegently looks at dep target packages and tries to figure
@@ -604,9 +616,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
if (Owner->VS->CheckDep(I.VerStr(),S->CompareOp,TargetVer()) == false)
continue;
- if ((S->Type == pkgCache::Dep::Conflicts ||
- S->Type == pkgCache::Dep::DpkgBreaks ||
- S->Type == pkgCache::Dep::Obsoletes) &&
+ if (IsNegative() == true &&
ParentPkg() == I.ParentPkg())
continue;
@@ -621,9 +631,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
if (Owner->VS->CheckDep(I.ProvideVersion(),S->CompareOp,TargetVer()) == false)
continue;
- if ((S->Type == pkgCache::Dep::Conflicts ||
- S->Type == pkgCache::Dep::DpkgBreaks ||
- S->Type == pkgCache::Dep::Obsoletes) &&
+ if (IsNegative() == true &&
ParentPkg() == I.OwnerPkg())
continue;