aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-12 15:07:25 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-12 15:07:25 +0000
commit02edd0fce4428c6b56c3740af4793705b9902209 (patch)
tree42f4af7341c82684bba8f6aa00ca04d04ffac01c
parent9ee5a6f599ef9ea49c95c898afd37856bd649e74 (diff)
downloadpaludis-02edd0fce4428c6b56c3740af4793705b9902209.tar.gz
paludis-02edd0fce4428c6b56c3740af4793705b9902209.tar.xz
Check cache file mtimes
-rw-r--r--paludis/portage_repository.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 0e91c9b..b14e74b 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -711,7 +711,32 @@ PortageRepository::do_version_metadata(
std::getline(cache, line); result->set(vmk_eapi, line);
result->set(vmk_virtual, "");
+ // check mtimes
+ time_t cache_time(cache_file.mtime());
ok = true;
+
+ if ((_imp->location / stringify(c) / stringify(p) / (stringify(p) + "-" + stringify(v)
+ + ".ebuild")).mtime() > cache_time)
+ ok = false;
+ else
+ {
+ FSEntry timestamp(_imp->location / "metadata" / "timestamp");
+ if (timestamp.exists())
+ cache_time = timestamp.mtime();
+
+ static Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+ std::list<std::string> inherits;
+ tokeniser.tokenise(stringify(result->get(vmk_inherited)),
+ std::back_inserter(inherits));
+ for (std::list<std::string>::const_iterator i(inherits.begin()),
+ i_end(inherits.end()) ; i != i_end ; ++i)
+ if ((_imp->eclassdir / (*i + ".eclass")).mtime() > cache_time)
+ ok = false;
+ }
+
+ if (! ok)
+ Log::get_instance()->message(ll_warning, "Stale cache file at '"
+ + stringify(cache_file) + "'");
}
else
Log::get_instance()->message(ll_warning, "Couldn't read the cache file at '"