]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcache.cc
criss-cross merge with my sid branch
[apt.git] / apt-pkg / pkgcache.cc
index 1e4c7edb3825ac4f2c8c72f63e07e3846eac6b0b..29c27b58eb1497c3a9a01ad4bb11fce5742bb458 100644 (file)
@@ -27,6 +27,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/macros.h>
 
 #include <apti18n.h>
     
@@ -35,7 +36,6 @@
 #include <unistd.h>
 
 #include <ctype.h>
-#include <system.h>
                                                                        /*}}}*/
 
 using std::string;
@@ -186,7 +186,10 @@ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
        size_t const found = Name.find(':');
        if (found == string::npos)
                return FindPkg(Name, "native");
-       return FindPkg(Name.substr(0, found), Name.substr(found+1, string::npos));
+       string const Arch = Name.substr(found+1);
+       if (Arch == "any")
+               return FindPkg(Name, "any");
+       return FindPkg(Name.substr(0, found), Arch);
 }
                                                                        /*}}}*/
 // Cache::FindPkg - Locate a package by name                           /*{{{*/
@@ -399,7 +402,7 @@ const char *
 pkgCache::PkgIterator::CandVersion() const 
 {
   //TargetVer is empty, so don't use it.
-  VerIterator version = pkgPolicy::pkgPolicy(Owner).GetCandidateVer(*this);
+  VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this);
   if (version.IsGood())
     return version.VerStr();
   return 0;
@@ -646,6 +649,23 @@ bool pkgCache::VerIterator::Automatic() const
    return false;
 }
                                                                        /*}}}*/
+// VerIterator::Pseudo - Check if this version is a pseudo one         /*{{{*/
+// ---------------------------------------------------------------------
+/* Sometimes you have the need to express dependencies with versions
+   which doesn't really exist or exist multiply times for "different"
+   packages. We need these versions for dependency resolution but they
+   are a problem everytime we need to download/install something. */
+bool pkgCache::VerIterator::Pseudo() const
+{
+   if (S->MultiArch == pkgCache::Version::All &&
+          strcmp(Arch(true),"all") != 0)
+   {
+          GrpIterator const Grp = ParentPkg().Group();
+          return (Grp->LastPackage != Grp->FirstPackage);
+   }
+   return false;
+}
+                                                                       /*}}}*/
 // VerIterator::NewestFile - Return the newest file version relation   /*{{{*/
 // ---------------------------------------------------------------------
 /* This looks at the version numbers associated with all of the sources
@@ -727,7 +747,7 @@ string pkgCache::VerIterator::RelStr()
            Res += File.Site();
       }      
    }
-   if (S->Arch != 0)
+   if (S->ParentPkg != 0)
       Res.append(" [").append(Arch()).append("]");
    return Res;
 }