]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcache.cc
merge with debian-experimental-ma
[apt.git] / apt-pkg / pkgcache.cc
index 9e1f8b633e22c0f17287a5415a51def2d27697a5..bb28a33ca5dab5f84a07b0690feb79237529c437 100644 (file)
@@ -111,7 +111,10 @@ bool pkgCache::Header::CheckSizes(Header &Against) const
 /* */
 pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
 {
-   MultiArchEnabled = APT::Configuration::getArchitectures().size() > 1;
+   // call getArchitectures() with cached=false to ensure that the 
+   // architectures cache is re-evaulated. this is needed in cases
+   // when the APT::Architecture field changes between two cache creations
+   MultiArchEnabled = APT::Configuration::getArchitectures(false).size() > 1;
    if (DoMap == true)
       ReMap();
 }
@@ -661,6 +664,30 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
    }
 }
                                                                        /*}}}*/
+// ostream operator to handle string representation of a dependecy     /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+std::ostream& operator<<(ostream& out, pkgCache::DepIterator D)
+{
+   if (D.end() == true)
+      return out << "invalid dependency";
+
+   pkgCache::PkgIterator P = D.ParentPkg();
+   pkgCache::PkgIterator T = D.TargetPkg();
+
+   out << (P.end() ? "invalid pkg" : P.FullName(false)) << " " << D.DepType()
+       << " on ";
+   if (T.end() == true)
+      out << "invalid pkg";
+   else
+      out << T;
+
+   if (D->Version != 0)
+      out << " (" << D.CompType() << " " << D.TargetVer() << ")";
+
+   return out;
+}
+                                                                       /*}}}*/
 // VerIterator::CompareVer - Fast version compare for same pkgs                /*{{{*/
 // ---------------------------------------------------------------------
 /* This just looks over the version list to see if B is listed before A. In