Bladeren bron

* fixed a problem when it comes to the cache rebuilding

Michael Vogt 21 jaren geleden
bovenliggende
commit
f416d22e97
2 gewijzigde bestanden met toevoegingen van 14 en 13 verwijderingen
  1. 13 12
      apt-pkg/deb/debindexfile.cc
  2. 1 1
      apt-pkg/deb/debindexfile.h

+ 13 - 12
apt-pkg/deb/debindexfile.cc

@@ -458,20 +458,21 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
 /* */
 /* */
 pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const
 pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const
 {
 {
+   string FileName = TranslationFile();
+
    pkgCache::PkgFileIterator File = Cache.FileBegin();
    pkgCache::PkgFileIterator File = Cache.FileBegin();
-   if (this->UseTranslation()) 
-     for (; File.end() == false; File++)
-       {
-	 if (IndexFile(LanguageCode().c_str()) != File.FileName())
-	   continue;
+   for (; File.end() == false; File++)
+   {
+      if (FileName != File.FileName())
+	 continue;
       
       
-	 struct stat St;
-	 if (stat(File.FileName(),&St) != 0)
-	   return pkgCache::PkgFileIterator(Cache);
-	 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
-	   return pkgCache::PkgFileIterator(Cache);
-	 return File;
-       }   
+      struct stat St;
+      if (stat(File.FileName(),&St) != 0)
+	 return pkgCache::PkgFileIterator(Cache);
+      if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
+	 return pkgCache::PkgFileIterator(Cache);
+      return File;
+   }   
    return File;
    return File;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 1 - 1
apt-pkg/deb/debindexfile.h

@@ -96,7 +96,7 @@ class debTranslationsIndex : public pkgIndexFile
    
    
    // Interface for the Cache Generator
    // Interface for the Cache Generator
    virtual bool Exists() const;
    virtual bool Exists() const;
-   virtual bool HasPackages() const {return true;};
+   virtual bool HasPackages() const { return UseTranslation();};
    virtual unsigned long Size() const;
    virtual unsigned long Size() const;
    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;