diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-07-25 08:24:03 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-07-25 08:24:03 +0200 |
commit | 3db58cf41785f1e0b7046bbe7f3ef5e545c9a658 (patch) | |
tree | 376c6857d0a1c94dbe143d1fe64d634b6b41c8d3 /apt-pkg/pkgcache.cc | |
parent | 8fde723961709118837153cdf94f150c680e10e9 (diff) |
* apt-pkg/pkgcache.cc:
- prefer non-virtual packages in FindPreferredPkg
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r-- | apt-pkg/pkgcache.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 8af8ef7de..9e1f8b633 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -349,19 +349,21 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const { // GrpIterator::FindPreferredPkg - Locate the "best" package /*{{{*/ // --------------------------------------------------------------------- /* Returns an End-Pointer on error, pointer to the package otherwise */ -pkgCache::PkgIterator pkgCache::GrpIterator::FindPreferredPkg() const { +pkgCache::PkgIterator pkgCache::GrpIterator::FindPreferredPkg(bool const &PreferNonVirtual) const { pkgCache::PkgIterator Pkg = FindPkg("native"); - if (Pkg.end() == false) + if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0)) return Pkg; std::vector<std::string> const archs = APT::Configuration::getArchitectures(); for (std::vector<std::string>::const_iterator a = archs.begin(); a != archs.end(); ++a) { Pkg = FindPkg(*a); - if (Pkg.end() == false) + if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0)) return Pkg; } + if (PreferNonVirtual == true) + return FindPreferredPkg(false); return PkgIterator(*Owner, 0); } /*}}}*/ |