summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 15:19:47 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 15:19:47 +0200
commit3671f6810b6306a07f0002b0a808435dad367ab0 (patch)
tree67aa1a70ebf550af64e899348eaddabc07378886 /apt-pkg/pkgcachegen.cc
parentb20c16833e20da8e367221b32764889cafe5b4c1 (diff)
parent2ec858bc68bc2d79ec020fe24be2d76b7c5b6792 (diff)
merged from lp:~mvo/apt/mvo
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 70dcd9de9..24e95f2f2 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -916,8 +916,11 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
/* This just verifies that each file in the list of index files exists,
has matching attributes with the cache and the cache does not have
any extra files. */
-static bool CheckValidity(const string &CacheFile, FileIterator Start,
- FileIterator End,MMap **OutMap = 0)
+static bool CheckValidity(const string &CacheFile,
+ pkgSourceList &List,
+ FileIterator Start,
+ FileIterator End,
+ MMap **OutMap = 0)
{
bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
// No file, certainly invalid
@@ -928,6 +931,13 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start,
return false;
}
+ if (List.GetLastModifiedTime() < GetModificationTime(CacheFile))
+ {
+ if (Debug == true)
+ std::clog << "sources.list is newer than the cache" << std::endl;
+ return false;
+ }
+
// Map it
FileFd CacheF(CacheFile,FileFd::ReadOnly);
SPtr<MMap> Map = new MMap(CacheF,0);
@@ -1153,7 +1163,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
Progress->OverallProgress(0,1,1,_("Reading package lists"));
// Cache is OK, Fin.
- if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true)
+ if (CheckValidity(CacheFile, List, Files.begin(),Files.end(),OutMap) == true)
{
if (Progress != NULL)
Progress->OverallProgress(1,1,1,_("Reading package lists"));
@@ -1206,7 +1216,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
// Lets try the source cache.
unsigned long CurrentSize = 0;
unsigned long TotalSize = 0;
- if (CheckValidity(SrcCacheFile,Files.begin(),
+ if (CheckValidity(SrcCacheFile, List, Files.begin(),
Files.begin()+EndOfSource) == true)
{
if (Debug == true)