+   if (Cache.HeaderP->PackageCount >= (1ULL<<sizeof(Cache.PkgP->ID)*8)-1)
+      return _error->Error(_("Wow, you exceeded the number of package "
+                            "names this APT is capable of."));
+   if (Cache.HeaderP->VersionCount >= (1ULL<<(sizeof(Cache.VerP->ID)*8))-1)
+      return _error->Error(_("Wow, you exceeded the number of versions "
+                            "this APT is capable of."));
+   if (Cache.HeaderP->DescriptionCount >= (1ULL<<(sizeof(Cache.DescP->ID)*8))-1)
+      return _error->Error(_("Wow, you exceeded the number of descriptions "
+                            "this APT is capable of."));
+   if (Cache.HeaderP->DependsCount >= (1ULL<<(sizeof(Cache.DepP->ID)*8))-1ULL)
+      return _error->Error(_("Wow, you exceeded the number of dependencies "
+                            "this APT is capable of."));
+
+   FoundFileDeps |= List.HasFileDeps();
+   return true;
+}
+// CacheGenerator::MergeListGroup                                      /*{{{*/
+bool pkgCacheGenerator::MergeListGroup(ListParser &List, std::string const &GrpName)
+{
+   pkgCache::GrpIterator Grp = Cache.FindGrp(GrpName);
+   if (Grp.end() == true)
+      return _error->Error("Information merge for non-existent group %s requested", GrpName.c_str());
+   Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
+
+   pkgCache::PkgIterator Pkg;
+   Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
+   for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+      if (MergeListPackage(List, Pkg) == false)
+        return false;
+
+   return true;
+}
+                                                                       /*}}}*/
+// CacheGenerator::MergeListPackage                                    /*{{{*/
+bool pkgCacheGenerator::MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg)
+{
+   // we first process the package, then the descriptions
+   // (for deb this package processing is in fact a no-op)
+   pkgCache::VerIterator Ver(Cache);
+   Dynamic<pkgCache::VerIterator> DynVer(Ver);
+   if (List.UsePackage(Pkg, Ver) == false)
+      return _error->Error(_("Error occurred while processing %s (UsePackage1)"),
+                          Pkg.Name());
+
+   // Find the right version to write the description
+   MD5SumValue CurMd5 = List.Description_md5();
+
+   for (Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
+   {
+      pkgCache::DescIterator Desc = Ver.DescriptionList();
+      Dynamic<pkgCache::DescIterator> DynDesc(Desc);
+      map_ptrloc *LastDesc = &Ver->DescriptionList;
+
+
+      // don't add a new description if we have one for the given
+      // md5 && language
+      bool duplicate = false;
+      for ( ; Desc.end() == false; ++Desc)
+        if (MD5SumValue(Desc.md5()) == CurMd5 &&
+            Desc.LanguageCode() == List.DescriptionLanguage())
+              duplicate=true;
+      if (duplicate == true)
+        continue;
+
+      for (Desc = Ver.DescriptionList();
+          Desc.end() == false;
+           LastDesc = &Desc->NextDesc, ++Desc)
+      {
+        if (MD5SumValue(Desc.md5()) != CurMd5)
+           continue;
+
+        // Add new description
+        void const * const oldMap = Map.Data();
+        map_ptrloc const descindex = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc);
+        if (oldMap != Map.Data())
+           LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+        *LastDesc = descindex;
+        Desc->ParentPkg = Pkg.Index();
+
+        if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
+           return _error->Error(_("Error occurred while processing %s (NewFileDesc1)"), Pkg.Name());
+        break;
+       }
+   }
+
+   return true;
+}
+                                                                       /*}}}*/
+// CacheGenerator::MergeListVersion                                    /*{{{*/
+bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
+                                        std::string const &Version, pkgCache::VerIterator* &OutVer)
+{
+   pkgCache::VerIterator Ver = Pkg.VersionList();
+   Dynamic<pkgCache::VerIterator> DynVer(Ver);
+   map_ptrloc *LastVer = &Pkg->VersionList;
+   void const * oldMap = Map.Data();
+
+   unsigned long const Hash = List.VersionHash();
+   if (Ver.end() == false)
+   {
+      /* We know the list is sorted so we use that fact in the search.
+         Insertion of new versions is done with correct sorting */