continue;
pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
if (Pkg.end() == true) {
- if (archfound == std::string::npos) {
- std::vector<std::string> archs = APT::Configuration::getArchitectures();
- for (std::vector<std::string>::const_iterator a = archs.begin();
- a != archs.end() && Pkg.end() != true; ++a)
- Pkg = Grp.FindPkg(*a);
- }
+ if (archfound == std::string::npos)
+ Pkg = Grp.FindPreferredPkg(true);
if (Pkg.end() == true)
continue;
}
continue;
pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
if (Pkg.end() == true) {
- if (archfound == std::string::npos) {
- std::vector<std::string> archs = APT::Configuration::getArchitectures();
- for (std::vector<std::string>::const_iterator a = archs.begin();
- a != archs.end() && Pkg.end() != true; ++a)
- Pkg = Grp.FindPkg(*a);
- }
+ if (archfound == std::string::npos)
+ Pkg = Grp.FindPreferredPkg(true);
if (Pkg.end() == true)
continue;
}
if (unlikely(Cache.GetPkgCache() == 0))
return false;
+ std::string const pkgstring = pkg;
size_t const archfound = pkg.find_last_of(':');
std::string arch;
if (archfound != std::string::npos) {
}
}
- pkgCache::PkgIterator Pkg = canNotFindPkgName(Cache, pkg);
+ pkgCache::PkgIterator Pkg = canNotFindPkgName(Cache, pkgstring);
if (Pkg.end() == true)
return false;
pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
pkgCache::VerIterator Cand;
- if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false) {
- if (unlikely(Cache.GetPolicy() == 0))
- return pkgCache::VerIterator(Cache);
- Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
- } else {
+ if (Cache.IsDepCacheBuilt() == true) {
Cand = Cache[Pkg].CandidateVerIter(Cache);
+ } else if (unlikely(Cache.GetPolicy() == nullptr)) {
+ return pkgCache::VerIterator(Cache);
+ } else {
+ Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
}
if (Cand.end() == true)
return helper.canNotGetVersion(CacheSetHelper::CANDIDATE, Cache, Pkg);
}
PackageContainerInterface::~PackageContainerInterface() {}
-PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) { }
+PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) {}
+PackageUniverse::PackageUniverse(pkgCacheFile * const Owner) : _cont(Owner->GetPkgCache()), d(NULL) {}
PackageUniverse::~PackageUniverse() {}
VersionContainerInterface::VersionContainerInterface() : d(NULL) {}