summaryrefslogtreecommitdiff
path: root/ftparchive/cachedb.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-11-28 02:12:36 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-11-28 02:12:36 +0100
commitff574e76beb97c101924c2d4746b5a2dbb862f19 (patch)
tree7390fa656a4dc42e2aaf4f3a6be911a7abadb66c /ftparchive/cachedb.cc
parent1df14bc5a7011c2da0ecd1e89911c64627119883 (diff)
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)
Diffstat (limited to 'ftparchive/cachedb.cc')
-rw-r--r--ftparchive/cachedb.cc14
1 files changed, 9 insertions, 5 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++;