diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-11-17 23:10:27 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-11-17 23:10:27 +0000 |
commit | df8ccc4fb8fc0f26c7b505fcc95e8aa85b80c4b3 (patch) | |
tree | 760a0bbb65da2352039ec232d6a4bdc19119c140 | |
parent | 4fa2a25232e89fd914762ceaa9b3f2386e7c6cd7 (diff) | |
download | portage-df8ccc4fb8fc0f26c7b505fcc95e8aa85b80c4b3.tar.gz portage-df8ccc4fb8fc0f26c7b505fcc95e8aa85b80c4b3.tar.bz2 portage-df8ccc4fb8fc0f26c7b505fcc95e8aa85b80c4b3.zip |
Bug #139134 - Make the flat_hash and metadata modules write the _mtime_
field inside the file instead of mangling the mtime of the cache entry
file. Also, fix FsBased._ensure_access() to properly skip the utime()
call when no mtime is passed in. Theses cache changes are compatible
with current stable portage (2.1.4.x), which uses the _mtime_ field
contained in the file when available. (trunk r11984)
svn path=/main/branches/2.1.6/; revision=11985
-rw-r--r-- | pym/portage/cache/flat_hash.py | 3 | ||||
-rw-r--r-- | pym/portage/cache/fs_template.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index 219a4a22d..b9781b0c7 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -18,6 +18,7 @@ class database(fs_template.FsBased): self.label.lstrip(os.path.sep).rstrip(os.path.sep)) write_keys = set(self._known_keys) write_keys.add("_eclasses_") + write_keys.add("_mtime_") self._write_keys = sorted(write_keys) if not self.readonly and not os.path.exists(self.location): self._ensure_dirs() @@ -83,7 +84,7 @@ class database(fs_template.FsBased): myf.write("%s=%s\n" % (k, v)) finally: myf.close() - self._ensure_access(fp, mtime=values["_mtime_"]) + self._ensure_access(fp) #update written. now we move it. diff --git a/pym/portage/cache/fs_template.py b/pym/portage/cache/fs_template.py index e619db0ac..f3dc0ce44 100644 --- a/pym/portage/cache/fs_template.py +++ b/pym/portage/cache/fs_template.py @@ -36,7 +36,7 @@ class FsBased(template.database): try: os.chown(path, -1, self._gid) os.chmod(path, self._perms) - if mtime: + if mtime != -1: mtime=long(mtime) os.utime(path, (mtime, mtime)) except (OSError, IOError): |