From bd2fb30a8647293f80b085d0308e66bb9219e662 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 31 May 2010 20:00:16 +0200 Subject: * apt-pkg/pkgcache.cc: - get the best matching arch package from a group with FindPreferredPkg --- apt-pkg/pkgcache.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index a59a06d65..adaae9c89 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -340,6 +340,25 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) { break; } + return PkgIterator(*Owner, 0); +} + /*}}}*/ +// GrpIterator::FindPreferredPkg - Locate the "best" package /*{{{*/ +// --------------------------------------------------------------------- +/* Returns an End-Pointer on error, pointer to the package otherwise */ +pkgCache::PkgIterator pkgCache::GrpIterator::FindPreferredPkg() { + pkgCache::PkgIterator Pkg = FindPkg("native"); + if (Pkg.end() == false) + return Pkg; + + std::vector const archs = APT::Configuration::getArchitectures(); + for (std::vector::const_iterator a = archs.begin(); + a != archs.end(); ++a) { + Pkg = FindPkg(*a); + if (Pkg.end() == false) + return Pkg; + } + return PkgIterator(*Owner, 0); } /*}}}*/ -- cgit v1.2.3 From d4489d4983d5b9840bb2882a088dd1f363a280b9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 31 May 2010 22:36:41 +0200 Subject: * apt-pkg/cacheset.{cc,h}: - add simple wrapper around std::set for cache structures --- apt-pkg/pkgcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index adaae9c89..30bb41470 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -742,7 +742,7 @@ pkgCache::VerFileIterator pkgCache::VerIterator::NewestFile() const // --------------------------------------------------------------------- /* This describes the version from a release-centric manner. The output is a list of Label:Version/Archive */ -string pkgCache::VerIterator::RelStr() +string pkgCache::VerIterator::RelStr() const { bool First = true; string Res; -- cgit v1.2.3