diff options
author | Otavio Salvador <otavio@debian.org> | 2005-05-13 14:05:10 +0000 |
---|---|---|
committer | Otavio Salvador <otavio@debian.org> | 2005-05-13 14:05:10 +0000 |
commit | c51c6f08ab15d09e1585ab7e680b53f87d654d6b (patch) | |
tree | ac18d1c25ec8daf8f72b7dea590165d233890d38 /apt-pkg/deb/debindexfile.cc | |
parent | 8bd0670fc9f71add3441befc1894879cbbdeee1d (diff) |
Add FindInCache method to skip the rebuild of cache every time.
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 4113137eb..b8435a6bc 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -453,7 +453,28 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const return true; } /*}}}*/ - +// TranslationsIndex::FindInCache - Find this index /*{{{*/ +// --------------------------------------------------------------------- +/* */ +pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const +{ + pkgCache::PkgFileIterator File = Cache.FileBegin(); + if (this->UseTranslation()) + for (; File.end() == false; File++) + { + if (IndexFile(LanguageCode().c_str()) != 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; + } + return File; +} + /*}}}*/ // StatusIndex::debStatusIndex - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ |