diff options
author | Michael Vogt <mvo@debian.org> | 2010-10-13 15:33:16 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2010-10-13 15:33:16 +0200 |
commit | 6bea738672fb503d2813ae2d998096015a81c4a2 (patch) | |
tree | a60d61b723bbc90b8b715a476c5f1ee5e8d6e0c2 /apt-pkg/deb/debindexfile.cc | |
parent | 94eb3bee531ae1f3042eb8378e383b34dd083851 (diff) | |
parent | e344c4a7a1569c77ef8f8921852fd9822ee64b90 (diff) |
* apt-pkg/deb/debindexfile.cc:
- Use FileFd::Size() instead of stat()ing the sources/binary/translations
indexes directly, so that we have transparent handling of gzipped
indexes.
* apt-pkg/contrib/fileutl.cc:
- Fix FileFd::Size() for gzipped files to give the size of the
uncompressed data. This fixes cache building progress going way
over 100%.
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index ba5b3f266..a89a2574f 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -149,10 +149,11 @@ bool debSourcesIndex::Exists() const /* */ unsigned long debSourcesIndex::Size() const { - struct stat S; - if (stat(IndexFile("Sources").c_str(),&S) != 0) + FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip); + + if (f.Failed()) return 0; - return S.st_size; + return f.Size(); } /*}}}*/ @@ -268,10 +269,11 @@ bool debPackagesIndex::Exists() const /* This is really only used for progress reporting. */ unsigned long debPackagesIndex::Size() const { - struct stat S; - if (stat(IndexFile("Packages").c_str(),&S) != 0) + FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip); + + if (f.Failed()) return 0; - return S.st_size; + return f.Size(); } /*}}}*/ // PackagesIndex::Merge - Load the index file into a cache /*{{{*/ @@ -458,10 +460,12 @@ bool debTranslationsIndex::Exists() const /* This is really only used for progress reporting. */ unsigned long debTranslationsIndex::Size() const { - struct stat S; - if (stat(IndexFile(Language).c_str(),&S) != 0) + FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip); + + if (f.Failed()) return 0; - return S.st_size; + + return f.Size(); } /*}}}*/ // TranslationsIndex::Merge - Load the index file into a cache /*{{{*/ |