aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-06 22:25:15 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-06 22:25:15 +0000
commit2bd2620142d15344f32ef67896c4fa88e5386953 (patch)
treee65dffa019d22454a0bf776c9f4a0b19dce5bfa9 /pym/portage/eclass_cache.py
parentBug #262647 - Inside config.setcpv(), never add SRC_URI to the environment (diff)
downloadportage-2bd2620142d15344f32ef67896c4fa88e5386953.tar.gz
portage-2bd2620142d15344f32ef67896c4fa88e5386953.tar.bz2
portage-2bd2620142d15344f32ef67896c4fa88e5386953.zip
Add portdbapi support for a metadata/layout.conf file which
specifies information about the repository layout. Currently, only a single "masters" attribute is supported, which is used to specify names of repositories which satisfy dependencies on eclasses and/or ebuilds. Each repository name should correspond the value of a repo_name entry from one of the repositories that is configured via the PORTDIR or PORTDIR_OVERLAY variables. Since layout.conf is now used to control eclass inheritance, it is now safer to use overlays which contain forked eclasses have names identical to those from the main tree. Such eclasses will only apply to their containing repository and any other repositories which reference their containing repository via layout.conf. This solves bug #124041 by containing eclass overrides so that they don't necessarily apply to all ebuilds. Thanks to Alistair Bush <ali_bush@g.o> for his initial patch for layout.conf support in repoman (will be merged later). See the "QA Overlay Layout support" thread on the gentoo-dev mailing list for more information: http://archives.gentoo.org/gentoo-dev/msg_33c61550b4ed2b7b25dd5a4110e1ec81.xml svn path=/main/trunk/; revision=13291
Diffstat (limited to 'pym/portage/eclass_cache.py')
-rw-r--r--pym/portage/eclass_cache.py53
1 files changed, 42 insertions, 11 deletions
diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py
index 670e9fb24..15602fc02 100644
--- a/pym/portage/eclass_cache.py
+++ b/pym/portage/eclass_cache.py
@@ -5,6 +5,7 @@
__all__ = ["cache"]
+import warnings
from portage.util import normalize_path, writemsg
import errno, os, sys
from portage.data import portage_gid
@@ -15,18 +16,47 @@ class cache(object):
Maintains the cache information about eclasses used in ebuild.
"""
def __init__(self, porttree_root, overlays=[]):
- self.porttree_root = porttree_root
self.eclasses = {} # {"Name": ("location","_mtime_")}
self._eclass_locations = {}
# screw with the porttree ordering, w/out having bash inherit match it, and I'll hurt you.
# ~harring
- self.porttrees = [self.porttree_root]+overlays
- self.porttrees = tuple(map(normalize_path, self.porttrees))
- self._master_eclass_root = os.path.join(self.porttrees[0],"eclass")
- self._master_eclasses_overridden = {}
- self.update_eclasses()
+ if porttree_root:
+ self.porttree_root = porttree_root
+ self.porttrees = [self.porttree_root] + overlays
+ self.porttrees = tuple(map(normalize_path, self.porttrees))
+ self._master_eclass_root = os.path.join(self.porttrees[0], "eclass")
+ self.update_eclasses()
+ else:
+ self.porttree_root = None
+ self.porttrees = ()
+ self._master_eclass_root = None
+
+ def copy(self):
+ return self.__copy__()
+
+ def __copy__(self):
+ result = self.__class__(None)
+ result.eclasses = self.eclasses.copy()
+ result._eclass_locations = self._eclass_locations.copy()
+ result.porttree_root = self.porttree_root
+ result.porttrees = self.porttrees
+ result._master_eclass_root = self._master_eclass_root
+ return result
+
+ def append(self, other):
+ """
+ Append another instance to this instance. This will cause eclasses
+ from the other instance to override and eclases from this instance
+ that have the same name.
+ """
+ if not isinstance(other, self.__class__):
+ raise TypeError(
+ "expected type %s, got %s" % (self.__class__, type(other)))
+ self.porttrees = self.porttrees + other.porttrees
+ self.eclasses.update(other.eclasses)
+ self._eclass_locations.update(other._eclass_locations)
def close_caches(self):
import traceback
@@ -77,8 +107,7 @@ class cache(object):
# 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
@@ -100,8 +129,10 @@ class cache(object):
ec_dict = {}
for x in inherits:
ec_dict[x] = self.eclasses[x]
- if from_master_only and \
- self._eclass_locations[x] != self._master_eclass_root:
- return None
+
+ if from_master_only is not False:
+ warnings.warn("portage.eclass_cache.cache.get_eclass_data(): " + \
+ "ignoring deprecated 'from_master_only' parameter",
+ DeprecationWarning)
return ec_dict