aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-07-12 13:58:30 -0700
committerZac Medico <zmedico@gentoo.org>2012-07-12 13:58:30 -0700
commit4f1558ec085d4d1716faf8558741aad2e542463f (patch)
tree1206a6d19cbd8ff693f41ba79e748fb6dd1c478f
parentmanifest: remove unused mhashes variable (diff)
downloadportage-2.2.0_alpha117.tar.gz
portage-2.2.0_alpha117.tar.bz2
portage-2.2.0_alpha117.zip
vardbapi: use float mtime for aux cachev2.2.0_alpha117
-rw-r--r--pym/portage/dbapi/vartree.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index fbf2e747c..dddc094d2 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -647,7 +647,8 @@ class vardbapi(dbapi):
if e.errno != errno.ENOENT:
raise
raise KeyError(mycpv)
- mydir_mtime = mydir_stat[stat.ST_MTIME]
+ # Use float mtime when available.
+ mydir_mtime = mydir_stat.st_mtime
pkg_data = self._aux_cache["packages"].get(mycpv)
pull_me = cache_these.union(wants)
mydata = {"_mtime_" : mydir_mtime}
@@ -660,13 +661,18 @@ class vardbapi(dbapi):
pkg_data = None
else:
cache_mtime, metadata = pkg_data
- if not isinstance(cache_mtime, (long, int)) or \
+ if not isinstance(cache_mtime, (float, long, int)) or \
not isinstance(metadata, dict):
pkg_data = None
if pkg_data:
cache_mtime, metadata = pkg_data
- cache_valid = cache_mtime == mydir_mtime
+ if isinstance(cache_mtime, float):
+ cache_valid = cache_mtime == mydir_stat.st_mtime
+ else:
+ # Cache may contain integer mtime.
+ cache_valid = cache_mtime == mydir_stat[stat.ST_MTIME]
+
if cache_valid:
# Migrate old metadata to unicode.
for k, v in metadata.items():