]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcachegen.cc
* apt-pkg/pkgcachegen.cc:
[apt.git] / apt-pkg / pkgcachegen.cc
index 38f2d6a2adb58ba373b6b23db913eee64cf55120..5b943cca10adfd3e2d53c46e6844b796fd424b4b 100644 (file)
@@ -36,7 +36,7 @@
 #include <stdio.h>
                                                                        /*}}}*/
 typedef vector<pkgIndexFile *>::iterator FileIterator;
-template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap(6);
+template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
 
 // CacheGenerator::pkgCacheGenerator - Constructor                     /*{{{*/
 // ---------------------------------------------------------------------
@@ -115,25 +115,25 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
 
    for (std::vector<pkgCache::GrpIterator*>::const_iterator i = Dynamic<pkgCache::GrpIterator>::toReMap.begin();
        i != Dynamic<pkgCache::GrpIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
    for (std::vector<pkgCache::PkgIterator*>::const_iterator i = Dynamic<pkgCache::PkgIterator>::toReMap.begin();
        i != Dynamic<pkgCache::PkgIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
    for (std::vector<pkgCache::VerIterator*>::const_iterator i = Dynamic<pkgCache::VerIterator>::toReMap.begin();
        i != Dynamic<pkgCache::VerIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
    for (std::vector<pkgCache::DepIterator*>::const_iterator i = Dynamic<pkgCache::DepIterator>::toReMap.begin();
        i != Dynamic<pkgCache::DepIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
    for (std::vector<pkgCache::DescIterator*>::const_iterator i = Dynamic<pkgCache::DescIterator>::toReMap.begin();
        i != Dynamic<pkgCache::DescIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
    for (std::vector<pkgCache::PrvIterator*>::const_iterator i = Dynamic<pkgCache::PrvIterator>::toReMap.begin();
        i != Dynamic<pkgCache::PrvIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
    for (std::vector<pkgCache::PkgFileIterator*>::const_iterator i = Dynamic<pkgCache::PkgFileIterator>::toReMap.begin();
        i != Dynamic<pkgCache::PkgFileIterator>::toReMap.end(); ++i)
-      (*i)->ReOwn(Cache, oldMap, newMap);
+      (*i)->ReMap(oldMap, newMap);
 }                                                                      /*}}}*/
 // CacheGenerator::WriteStringInMap                                    /*{{{*/
 map_ptrloc pkgCacheGenerator::WriteStringInMap(const char *String,
@@ -638,21 +638,19 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
         Dynamic<pkgCache::PkgIterator> DynP(P);
         for (; P.end() != true; P = G.NextPkg(P))
         {
-           if (strcmp(P.Arch(),"all") == 0)
-              continue;
            pkgCache::PkgIterator allPkg;
            Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg);
            pkgCache::VerIterator V = P.VersionList();
            Dynamic<pkgCache::VerIterator> DynV(V);
            for (; V.end() != true; V++)
            {
-              string const Arch = V.Arch(true);
+              char const * const Arch = P.Arch();
               map_ptrloc *OldDepLast = NULL;
               /* MultiArch handling introduces a lot of implicit Dependencies:
                - MultiArch: same → Co-Installable if they have the same version
                - Architecture: all → Need to be Co-Installable for internal reasons
                - All others conflict with all other group members */
-              bool const coInstall = (V->MultiArch == pkgCache::Version::All ||
+              bool const coInstall = ((V->MultiArch == pkgCache::Version::All && strcmp(Arch, "all") != 0) ||
                                        V->MultiArch == pkgCache::Version::Same);
               if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true)
                  allPkg = G.FindPkg("all");
@@ -686,9 +684,15 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
                     }
                  } else {
                        // Conflicts: ${self}:other
-                       NewDepends(D, V, "",
-                                  pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
-                                  OldDepLast);
+                       if (strcmp(Arch, "all") == 0) {
+                               NewDepends(D, V, V.VerStr(),
+                                          pkgCache::Dep::NotEquals, pkgCache::Dep::Conflicts,
+                                          OldDepLast);
+                       } else {
+                               NewDepends(D, V, "",
+                                          pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+                                          OldDepLast);
+                       }
                  }
               }
            }
@@ -1192,7 +1196,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
    if (Writeable == true && CacheFile.empty() == false)
    {
       unlink(CacheFile.c_str());
-      CacheF = new FileFd(CacheFile,FileFd::WriteEmpty);
+      CacheF = new FileFd(CacheFile,FileFd::WriteAtomic);
       fchmod(CacheF->Fd(),0644);
       Map = CreateDynamicMMap(CacheF, MMap::Public);
       if (_error->PendingError() == true)
@@ -1254,7 +1258,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
       // Write it back
       if (Writeable == true && SrcCacheFile.empty() == false)
       {
-        FileFd SCacheF(SrcCacheFile,FileFd::WriteEmpty);
+        FileFd SCacheF(SrcCacheFile,FileFd::WriteAtomic);
         if (_error->PendingError() == true)
            return false;