diff options
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/cachedb.cc | 14 | ||||
-rw-r--r-- | ftparchive/cachedb.h | 4 | ||||
-rw-r--r-- | ftparchive/writer.cc | 5 | ||||
-rw-r--r-- | ftparchive/writer.h | 1 |
4 files changed, 15 insertions, 9 deletions
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index dfda827b6..c352aa53c 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -102,9 +102,9 @@ bool CacheDB::OpenFile() // --------------------------------------------------------------------- /* This gets the size from the database if it's there. If we need * to look at the file, also get the mtime from the file. */ -bool CacheDB::GetFileStat() +bool CacheDB::GetFileStat(bool const &doStat) { - if ((CurStat.Flags & FlSize) == FlSize) + if ((CurStat.Flags & FlSize) == FlSize && doStat == false) { /* Already worked out the file size */ } @@ -162,7 +162,7 @@ bool CacheDB::GetCurStat() // --------------------------------------------------------------------- bool CacheDB::GetFileInfo(string FileName, bool DoControl, bool DoContents, bool GenContentsOnly, - bool DoMD5, bool DoSHA1, bool DoSHA256) + bool DoMD5, bool DoSHA1, bool DoSHA256, bool const &checkMtime) { this->FileName = FileName; @@ -171,14 +171,18 @@ bool CacheDB::GetFileInfo(string FileName, bool DoControl, bool DoContents, return false; } OldStat = CurStat; - - if (GetFileStat() == false) + + if (GetFileStat(checkMtime) == false) { delete Fd; Fd = NULL; return false; } + /* if mtime changed, update CurStat from disk */ + if (checkMtime == true && OldStat.mtime != CurStat.mtime) + CurStat.Flags = FlSize; + Stats.Bytes += CurStat.FileSize; Stats.Packages++; diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h index c10f41ecc..15add459c 100644 --- a/ftparchive/cachedb.h +++ b/ftparchive/cachedb.h @@ -63,7 +63,7 @@ class CacheDB return true; } bool OpenFile(); - bool GetFileStat(); + bool GetFileStat(bool const &doStat = false); bool GetCurStat(); bool LoadControl(); bool LoadContents(bool GenOnly); @@ -125,7 +125,7 @@ class CacheDB bool SetFile(string FileName,struct stat St,FileFd *Fd); bool GetFileInfo(string FileName, bool DoControl, bool DoContents, - bool GenContentsOnly, bool DoMD5, bool DoSHA1, bool DoSHA256); + bool GenContentsOnly, bool DoMD5, bool DoSHA1, bool DoSHA256, bool const &checkMtime = false); bool Finish(); bool Clean(); diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index b2ebdca8a..6756021f8 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -306,6 +306,7 @@ PackagesWriter::PackagesWriter(string DB,string Overrides,string ExtOverrides, DoMD5 = _config->FindB("APT::FTPArchive::MD5",true); DoSHA1 = _config->FindB("APT::FTPArchive::SHA1",true); DoSHA256 = _config->FindB("APT::FTPArchive::SHA256",true); + DoAlwaysStat = _config->FindB("APT::FTPArchive::AlwaysStat", false); DoContents = _config->FindB("APT::FTPArchive::Contents",true); NoOverride = _config->FindB("APT::FTPArchive::NoOverrideMsg",false); LongDescription = _config->FindB("APT::FTPArchive::LongDescription",true); @@ -360,7 +361,7 @@ bool FTWScanner::SetExts(string Vals) bool PackagesWriter::DoPackage(string FileName) { // Pull all the data we need form the DB - if (Db.GetFileInfo(FileName, true, DoContents, true, DoMD5, DoSHA1, DoSHA256) + if (Db.GetFileInfo(FileName, true, DoContents, true, DoMD5, DoSHA1, DoSHA256, DoAlwaysStat) == false) { return false; @@ -753,7 +754,7 @@ ContentsWriter::ContentsWriter(string DB) : determine what the package name is. */ bool ContentsWriter::DoPackage(string FileName,string Package) { - if (!Db.GetFileInfo(FileName, Package.empty(), true, false, false, false, false)) + if (!Db.GetFileInfo(FileName, Package.empty(), true, false, false, false, false, false)) { return false; } diff --git a/ftparchive/writer.h b/ftparchive/writer.h index e76438900..8864461d5 100644 --- a/ftparchive/writer.h +++ b/ftparchive/writer.h @@ -84,6 +84,7 @@ class PackagesWriter : public FTWScanner bool DoMD5; bool DoSHA1; bool DoSHA256; + bool DoAlwaysStat; bool NoOverride; bool DoContents; bool LongDescription; |