]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cacheset.cc
tests: try to support spaces in TMPDIR
[apt.git] / apt-pkg / cacheset.cc
index 6a625184eb3e14b9435a20fa18fb48648ea5c50e..5e60ef54a371e518e738683d372dbdf58c56b0de 100644 (file)
@@ -153,12 +153,8 @@ bool CacheSetHelper::PackageFromRegEx(PackageContainerInterface * const pci, pkg
                        continue;
                pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
                if (Pkg.end() == true) {
                        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 (Pkg.end() == true)
                                continue;
                }
@@ -213,12 +209,8 @@ bool CacheSetHelper::PackageFromFnmatch(PackageContainerInterface * const pci,
                        continue;
                pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
                if (Pkg.end() == true) {
                        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 (Pkg.end() == true)
                                continue;
                }
@@ -273,6 +265,7 @@ bool CacheSetHelper::PackageFromPackageName(PackageContainerInterface * const pc
        if (unlikely(Cache.GetPkgCache() == 0))
                return false;
 
        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) {
        size_t const archfound = pkg.find_last_of(':');
        std::string arch;
        if (archfound != std::string::npos) {
@@ -309,7 +302,7 @@ bool CacheSetHelper::PackageFromPackageName(PackageContainerInterface * const pc
                }
        }
 
                }
        }
 
-       pkgCache::PkgIterator Pkg = canNotFindPkgName(Cache, pkg);
+       pkgCache::PkgIterator Pkg = canNotFindPkgName(Cache, pkgstring);
        if (Pkg.end() == true)
           return false;
 
        if (Pkg.end() == true)
           return false;