From 254b8ebb92e82e0d7cf5aa1391bcfbbeb23d534e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 25 Apr 2011 13:51:53 +0200 Subject: * apt-pkg/pkgcache.cc: - really ignore :arch in FindPkg() in non-multiarch environment --- apt-pkg/pkgcache.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index b63900adb..862d05348 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. -- cgit v1.2.3 From df77d8a5fb5340b23fec5363f9a52704e940b048 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 May 2011 14:09:18 +0200 Subject: if critical or-group can't be satisfied, exit directly. --- apt-pkg/pkgcache.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 862d05348..6c12b4581 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -530,6 +530,17 @@ bool pkgCache::DepIterator::IsCritical() const 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 -- cgit v1.2.3 From 359e46db58b85497fd232fbe912b8a62e77079c5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 May 2011 16:05:30 +0200 Subject: convert a lot of places to use IsNegative instead of checking by hand for the three different dependencies --- apt-pkg/pkgcache.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 6c12b4581..38e4e904e 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -521,9 +521,7 @@ 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; @@ -618,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; @@ -635,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; -- cgit v1.2.3