summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-18 07:05:12 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-18 07:05:12 +0000
commitdf8ef8acce04b1d378ed590ff7556852a46944ae (patch)
treeb483ddd986ee1891fd9e8ee6a4d3f8e59c48a6c9
parent150ca64cbb4a96f468cb69ff46855da9031a0e5f (diff)
downloadportage-df8ef8acce04b1d378ed590ff7556852a46944ae.tar.gz
portage-df8ef8acce04b1d378ed590ff7556852a46944ae.tar.bz2
portage-df8ef8acce04b1d378ed590ff7556852a46944ae.zip
For emerge --metadata runs, update _eclasses_ metadata to insert local eclass
paths. svn path=/main/trunk/; revision=11990
-rw-r--r--pym/portage/cache/util.py39
-rw-r--r--pym/portage/eclass_cache.py20
2 files changed, 40 insertions, 19 deletions
diff --git a/pym/portage/cache/util.py b/pym/portage/cache/util.py
index dafaed094..dc3881b19 100644
--- a/pym/portage/cache/util.py
+++ b/pym/portage/cache/util.py
@@ -3,6 +3,8 @@
# License: GPL2
# $Id$
+__all__ = ["mirror_cache", "non_quiet_mirroring", "quiet_mirroring"]
+
from itertools import chain
from portage.cache import cache_errors
@@ -65,25 +67,34 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
if write_it:
try:
- inherited = entry.get("INHERITED", None)
+ inherited = entry.get("INHERITED", "")
+ eclasses = entry.get("_eclasses_")
except cache_errors.CacheError, ce:
noise.exception(x, ce)
del ce
continue
+
+ if eclasses is not None:
+ if not eclass_cache.is_eclass_data_valid(entry["_eclasses_"]):
+ noise.eclass_stale(x)
+ continue
+ inherited = eclasses
+ else:
+ inherited = inherited.split()
+
if inherited:
- if src_cache.complete_eclass_entries:
- if not "_eclasses_" in entry:
- noise.corruption(x,"missing _eclasses_ field")
- continue
- if not eclass_cache.is_eclass_data_valid(entry["_eclasses_"]):
- noise.eclass_stale(x)
- continue
- else:
- entry["_eclasses_"] = eclass_cache.get_eclass_data(entry["INHERITED"].split(), \
- from_master_only=True)
- if not entry["_eclasses_"]:
- noise.eclass_stale(x)
- continue
+ if src_cache.complete_eclass_entries and eclasses is None:
+ noise.corruption(x, "missing _eclasses_ field")
+ continue
+
+ # Even if _eclasses_ already exists, replace it with data from
+ # eclass_cache, in order to insert local eclass paths.
+ eclasses = eclass_cache.get_eclass_data(inherited,
+ from_master_only=True)
+ if eclasses is None:
+ noise.eclass_stale(x)
+ continue
+ entry["_eclasses_"] = eclasses
# by this time, if it reaches here, the eclass has been validated, and the entry has
# been updated/translated (if needs be, for metadata/cache mainly)
diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py
index de20d307c..93c956f8a 100644
--- a/pym/portage/eclass_cache.py
+++ b/pym/portage/eclass_cache.py
@@ -3,6 +3,8 @@
# License: GPL2
# $Id$
+__all__ = ["cache"]
+
from portage.util import normalize_path, writemsg
import errno, os, sys
from portage.data import portage_gid
@@ -63,14 +65,22 @@ class cache(object):
except OSError:
continue
ys=y[:-eclass_len]
- self.eclasses[ys] = (x, long(mtime))
- self._eclass_locations[ys] = x
if x == self._master_eclass_root:
master_eclasses[ys] = mtime
- else:
- master_mtime = master_eclasses.get(ys)
- if master_mtime and master_mtime != mtime:
+ self.eclasses[ys] = (x, mtime)
+ self._eclass_locations[ys] = x
+ continue
+
+ master_mtime = master_eclasses.get(ys)
+ if master_mtime is not None:
+ if master_mtime == mtime:
+ # It appears to be identical to the master,
+ # so prefer the master entry.
+ continue
+ else:
self._master_eclasses_overridden[ys] = x
+ self.eclasses[ys] = (x, mtime)
+ self._eclass_locations[ys] = x
def is_eclass_data_valid(self, ec_dict):
if not isinstance(ec_dict, dict):