summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-09-26 01:15:44 +0000
committerZac Medico <zmedico@gentoo.org>2008-09-26 01:15:44 +0000
commit0a7db1255e63de9e72d4972a45bf21acb983f181 (patch)
tree94ace7815b2f6029deca232e5e44b12a05412b1a
parentRename the EAPI 2 docs and to indicate that they are no longer a draft, and (diff)
downloadportage-0a7db1255e63de9e72d4972a45bf21acb983f181.tar.gz
portage-0a7db1255e63de9e72d4972a45bf21acb983f181.tar.bz2
portage-0a7db1255e63de9e72d4972a45bf21acb983f181.zip
Make flat_hash write keys in alphabetical order.
svn path=/main/trunk/; revision=11552
-rw-r--r--pym/portage/cache/flat_hash.py17
-rw-r--r--pym/portage/dbapi/porttree.py1
2 files changed, 11 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.
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 33c8b52f2..2cc79b849 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -172,6 +172,7 @@ class portdbapi(dbapi):
# XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys
# ~harring
filtered_auxdbkeys = filter(lambda x: not x.startswith("UNUSED_0"), auxdbkeys)
+ filtered_auxdbkeys.sort()
if secpass < 1:
from portage.cache import metadata_overlay, volatile
for x in self.porttrees: