From ff574e76beb97c101924c2d4746b5a2dbb862f19 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 28 Nov 2009 02:12:36 +0100 Subject: add APT::FTPArchive::AlwaysStat to disable the too aggressive caching if versions are build multiply times (not recommend) Patch by Christoph Goehre, thanks! (Closes: #463260) --- ftparchive/cachedb.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'ftparchive/cachedb.cc') 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++; -- cgit v1.2.3