diff options
Diffstat (limited to 'pym/portage/cache/flat_hash.py')
-rw-r--r-- | pym/portage/cache/flat_hash.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index 40ad51eb6..219a4a22d 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -16,7 +16,9 @@ class database(fs_template.FsBased): super(database,self).__init__(*args, **config) self.location = os.path.join(self.location, self.label.lstrip(os.path.sep).rstrip(os.path.sep)) - + write_keys = set(self._known_keys) + write_keys.add("_eclasses_") + self._write_keys = sorted(write_keys) if not self.readonly and not os.path.exists(self.location): self._ensure_dirs() @@ -73,13 +75,14 @@ class database(fs_template.FsBased): else: raise cache_errors.CacheCorruption(cpv, e) - for k, v in values.iteritems(): - if not v: - continue - if k != "_mtime_" and (k == "_eclasses_" or k in self._known_keys): + try: + for k in self._write_keys: + v = values.get(k) + if not v: + continue myf.write("%s=%s\n" % (k, v)) - - myf.close() + finally: + myf.close() self._ensure_access(fp, mtime=values["_mtime_"]) #update written. now we move it. |