summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debindexfile.cc
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2012-04-16 19:24:07 +0200
committerMichael Vogt <egon@debian-devbox>2012-04-16 19:24:07 +0200
commit443f5e8a3205162ec6933529c5ca0c95ad3f6941 (patch)
tree3e2da22dcecc8eeaabc1ac5ceac0407a8e3cc25f /apt-pkg/deb/debindexfile.cc
parent96273866174c54bdb25813633891f29668d43848 (diff)
parentf352743312edeebf666e1c8304cdc4baf457469f (diff)
merge from the expermental2 branch
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r--apt-pkg/deb/debindexfile.cc37
1 files changed, 16 insertions, 21 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index e3d4063dc..5dc2a2ac2 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -9,6 +9,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/debindexfile.h>
#include <apt-pkg/debsrcrecords.h>
#include <apt-pkg/deblistparser.h>
@@ -24,6 +26,8 @@
#include <sys/stat.h>
/*}}}*/
+using std::string;
+
// SourcesIndex::debSourcesIndex - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -157,7 +161,7 @@ unsigned long debSourcesIndex::Size() const
/* we need to ignore errors here; if the lists are absent, just return 0 */
_error->PushToStack();
- FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+ FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnly, FileFd::Extension);
if (!f.Failed())
size = f.Size();
@@ -286,7 +290,7 @@ unsigned long debPackagesIndex::Size() const
/* we need to ignore errors here; if the lists are absent, just return 0 */
_error->PushToStack();
- FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+ FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnly, FileFd::Extension);
if (!f.Failed())
size = f.Size();
@@ -303,7 +307,7 @@ unsigned long debPackagesIndex::Size() const
bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
{
string PackageFile = IndexFile("Packages");
- FileFd Pkg(PackageFile,FileFd::ReadOnlyGzip);
+ FileFd Pkg(PackageFile,FileFd::ReadOnly, FileFd::Extension);
debListParser Parser(&Pkg, Architecture);
if (_error->PendingError() == true)
@@ -317,11 +321,8 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
// Store the IMS information
pkgCache::PkgFileIterator File = Gen.GetCurFile();
pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(File);
- struct stat St;
- if (fstat(Pkg.Fd(),&St) != 0)
- return _error->Errno("fstat","Failed to stat");
- File->Size = St.st_size;
- File->mtime = St.st_mtime;
+ File->Size = Pkg.FileSize();
+ File->mtime = Pkg.ModificationTime();
if (Gen.MergeList(Parser) == false)
return _error->Error("Problem with MergeList %s",PackageFile.c_str());
@@ -487,7 +488,7 @@ unsigned long debTranslationsIndex::Size() const
/* we need to ignore errors here; if the lists are absent, just return 0 */
_error->PushToStack();
- FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+ FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnly, FileFd::Extension);
if (!f.Failed())
size = f.Size();
@@ -507,7 +508,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
string TranslationFile = IndexFile(Language);
if (FileExists(TranslationFile))
{
- FileFd Trans(TranslationFile,FileFd::ReadOnlyGzip);
+ FileFd Trans(TranslationFile,FileFd::ReadOnly, FileFd::Extension);
debListParser TransParser(&Trans);
if (_error->PendingError() == true)
return false;
@@ -519,11 +520,8 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
// Store the IMS information
pkgCache::PkgFileIterator TransFile = Gen.GetCurFile();
- struct stat TransSt;
- if (fstat(Trans.Fd(),&TransSt) != 0)
- return _error->Errno("fstat","Failed to stat");
- TransFile->Size = TransSt.st_size;
- TransFile->mtime = TransSt.st_mtime;
+ TransFile->Size = Trans.FileSize();
+ TransFile->mtime = Trans.ModificationTime();
if (Gen.MergeList(TransParser) == false)
return _error->Error("Problem with MergeList %s",TranslationFile.c_str());
@@ -588,7 +586,7 @@ unsigned long debStatusIndex::Size() const
/* */
bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
{
- FileFd Pkg(File,FileFd::ReadOnlyGzip);
+ FileFd Pkg(File,FileFd::ReadOnly, FileFd::Extension);
if (_error->PendingError() == true)
return false;
debListParser Parser(&Pkg);
@@ -602,11 +600,8 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
// Store the IMS information
pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
- struct stat St;
- if (fstat(Pkg.Fd(),&St) != 0)
- return _error->Errno("fstat","Failed to stat");
- CFile->Size = St.st_size;
- CFile->mtime = St.st_mtime;
+ CFile->Size = Pkg.FileSize();
+ CFile->mtime = Pkg.ModificationTime();
CFile->Archive = Gen.WriteUniqString("now");
if (Gen.MergeList(Parser) == false)