]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcache.cc
refactor: move solver execution into his own EDSP method
[apt.git] / apt-pkg / pkgcache.cc
index dbcbd9c26a6990b2eb1e793c5b2e31846ba150a5..93d09a18ead569cd1ed271097bbb2fff76fa4a70 100644 (file)
@@ -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);
        if (Arch == "any")
                return FindPkg(Name, "any");
@@ -317,6 +320,11 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
        if (unlikely(IsGood() == false || S->FirstPackage == 0))
                return PkgIterator(*Owner, 0);
 
+       /* If we accept any package we simply return the "first"
+          package in this group (the last one added). */
+       if (Arch == "any")
+               return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
+
        static string const myArch = _config->Find("APT::Architecture");
        /* Most of the time the package for our native architecture is
           the one we add at first to the cache, but this would be the
@@ -328,11 +336,6 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
                        return PkgIterator(*Owner, Pkg);
        }
 
-       /* If we accept any package we simply return the "first"
-          package in this group (the last one added). */
-       if (Arch == "any")
-               return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage);
-
        /* Iterate over the list to find the matching arch
           unfortunately this list includes "package noise"
           (= different packages with same calculated hash),