merge from lp:~donkult/apt/sid
[ntk/apt.git] / apt-pkg / pkgcachegen.cc
index 54b07c4..739b538 100644 (file)
@@ -69,7 +69,9 @@ pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) :
       *Cache.HeaderP = pkgCache::Header();
       map_ptrloc const idxVerSysName = WriteStringInMap(_system->VS->Label);
       Cache.HeaderP->VerSysName = idxVerSysName;
-      map_ptrloc const idxArchitecture = WriteStringInMap(_config->Find("APT::Architecture"));
+      // this pointer is set in ReMap, but we need it now for WriteUniqString
+      Cache.StringItemP = (pkgCache::StringItem *)Map.Data();
+      map_ptrloc const idxArchitecture = WriteUniqString(_config->Find("APT::Architecture"));
       Cache.HeaderP->Architecture = idxArchitecture;
       if (unlikely(idxVerSysName == 0 || idxArchitecture == 0))
         return;
@@ -209,6 +211,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
            just for these :none packages to a proper MultiArchCache, so just ensure
            that we have always a native package structure first for SingleArch */
         pkgCache::PkgIterator NP;
+        Dynamic<pkgCache::PkgIterator> DynPkg(NP);
         if (NewPackage(NP, PackageName, _config->Find("APT::Architecture")) == false)
         // TRANSLATOR: The first placeholder is a package name,
         // the other two should be copied verbatim as they include debug info
@@ -459,6 +462,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
 
               map_ptrloc *OldDepLast = NULL;
               pkgCache::VerIterator ConVersion = D.ParentVer();
+              Dynamic<pkgCache::VerIterator> DynV(ConVersion);
               // duplicate the Conflicts/Breaks/Replaces for :none arch
               if (D->Version == 0)
                  NewDepends(Pkg, ConVersion, "", 0, D->Type, OldDepLast);
@@ -772,6 +776,7 @@ unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
    
    // Fill it in
    Ver = pkgCache::VerIterator(Cache,Cache.VerP + Version);
+   //Dynamic<pkgCache::VerIterator> DynV(Ver); // caller MergeListVersion already takes care of it
    Ver->NextVer = Next;
    Ver->ID = Cache.HeaderP->VersionCount++;
    map_ptrloc const idxVerStr = WriteStringInMap(VerStr);
@@ -922,7 +927,7 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator &Ver,
    // Locate the target package
    pkgCache::PkgIterator Pkg = Grp.FindPkg(Arch);
    // we don't create 'none' packages and their dependencies if we can avoid it …
-   if (Pkg.end() == true && Arch == "none")
+   if (Pkg.end() == true && Arch == "none" && strcmp(Ver.ParentPkg().Arch(), "none") != 0)
       return true;
    Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
    if (Pkg.end() == true) {