]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcachegen.cc
merged r1811 from lp:~donkult/apt/experimenal
[apt.git] / apt-pkg / pkgcachegen.cc
index ce9b96980c3792b16a244843510b64c9408207a8..397c198293a934331ef98c73796e3a61075fe313 100644 (file)
@@ -139,10 +139,21 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
         {
            pkgCache::DescIterator Desc = Ver.DescriptionList();
            map_ptrloc *LastDesc = &Ver->DescriptionList;
-
-           for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++)
+           bool duplicate=false;
+
+           // don't add a new description if we have one for the given
+           // md5 && language
+           for ( ; Desc.end() == false; Desc++)
+              if (MD5SumValue(Desc.md5()) == CurMd5 && 
+                  Desc.LanguageCode() == List.DescriptionLanguage())
+                 duplicate=true;
+           if(duplicate)
+              continue;
+           
+           for (Desc = Ver.DescriptionList();
+                Desc.end() == false; 
+                LastDesc = &Desc->NextDesc, Desc++)
            {
-
               if (MD5SumValue(Desc.md5()) == CurMd5) 
                {
                  // Add new description
@@ -150,7 +161,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
                  Desc->ParentPkg = Pkg.Index();
                  
                  if (NewFileDesc(Desc,List) == false)
-                    return _error->Error(_("Error occured while processing %s (NewFileDesc1)"),PackageName.c_str());
+                    return _error->Error(_("Error occurred while processing %s (NewFileDesc1)"),PackageName.c_str());
                  break;
               }
            }
@@ -242,7 +253,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       Desc->ParentPkg = Pkg.Index();
 
       if (NewFileDesc(Desc,List) == false)
-        return _error->Error(_("Error occured while processing %s (NewFileDesc2)"),PackageName.c_str());
+        return _error->Error(_("Error occurred while processing %s (NewFileDesc2)"),PackageName.c_str());
    }
 
    FoundFileDeps |= List.HasFileDeps();
@@ -434,7 +445,8 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc,
 // ---------------------------------------------------------------------
 /* This puts a description structure in the linked list */
 map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
-                                           const string &Lang, const MD5SumValue &md5sum,
+                                           const string &Lang, 
+                                            const MD5SumValue &md5sum,
                                            map_ptrloc Next)
 {
    // Get a structure
@@ -781,7 +793,7 @@ static bool BuildCache(pkgCacheGenerator &Gen,
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
                        MMap **OutMap,bool AllowMem)
 {
-   unsigned long MapSize = _config->FindI("APT::Cache-Limit",16*1024*1024);
+   unsigned long MapSize = _config->FindI("APT::Cache-Limit",24*1024*1024);
    
    vector<pkgIndexFile *> Files;
    for (vector<metaIndex *>::const_iterator i = List.begin();
@@ -928,7 +940,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 /* */
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
 {
-   unsigned long MapSize = _config->FindI("APT::Cache-Limit",12*1024*1024);
+   unsigned long MapSize = _config->FindI("APT::Cache-Limit",20*1024*1024);
    vector<pkgIndexFile *> Files;
    unsigned long EndOfSource = Files.size();
    if (_system->AddStatusFiles(Files) == false)