def accepted_keyword(self):
"""returns the keyword used from the ebuild's KEYWORDS string"""
-
+
keywords = set(self.metadata.get('KEYWORDS').split())
accept_keywords = set(self.root_config.settings['ACCEPT_KEYWORDS'].split())
used_keyword = list(set.intersection(keywords, accept_keywords))
writemsg_level( "_emerge.output.resolver.Display(), too many keywords recieved for pkg: %s, %s"
% (pkg.cpv, used_keyword))
used_keyword = used_keyword[0]
- #print "pmaskdict", self.root_config.settings.pmaskdict
return used_keyword
def isHardMasked(self):
- """returns a bool if the cpv is in the list of
+ """returns a bool if the cpv is in the list of
expanded pmaskdict[cp] availble ebuilds"""
- try:
- # returns a list of mask atoms
- pmask = self.root_config.settings.pmaskdict[self.cp]
- except KeyError:
- pmask = []
- if pmask:
- # narrow pmask atoms down to the relevant repo
- n = [x for x in pmask if x.split('::')[-1] in [self.repo]]
- # hopefully it is down to only 1 mask atom
- #print "n =", n
- #count = 0
- hardmasked = set()
- for x in n:
- #expand the atom to matching available ebuilds
- hardmasked.update(self.root_config.trees['porttree'].dbapi.xmatch("match-all",x))
- #count += 1
- #print "for x in n: loop count =", count, hardmasked
- return self.cpv in hardmasked
- return False
+ pmask = self.root_config.settings._getRawMaskAtom(self.cpv, self.metadata)
+ print "pmask =", pmask
+ return pmask is not None
def _metadata_exception(self, k, e):
not self._iuse_implicit_match(flag):
return False
return True
-
+
def get_missing_iuse(self, flags):
"""
@returns: A list of flags missing from IUSE.
return None
return x
return None
+
+ def getRawMaskAtom(self, cpv, slot, repo):
+ """
+ Take a package and return a matching package.mask atom, or None if no
+ such atom exists. It HAS NOT! been cancelled by any package.unmask.
+ PROVIDE is not checked, so atoms will not be found for old-style
+ virtuals.
+
+ @param cpv: The package name
+ @type cpv: String
+ @param slot: The package's slot
+ @type slot: String
+ @rtype: String
+ @return: A matching atom string or None if one is not found.
+ """
+
+ cp = cpv_getkey(cpv)
+ mask_atoms = self._pmaskdict.get(cp)
+ if mask_atoms:
+ pkg = "".join((cpv, _slot_separator, slot))
+ if repo:
+ pkg = "".join((pkg, _repo_separator, repo))
+ pkg_list = [pkg]
+ for x in mask_atoms:
+ if not match_from_list(x, pkg_list):
+ continue
+ return x
+ return None
class config(object):
"""
This class encompasses the main portage configuration. Data is pulled from
- ROOT/PORTDIR/profiles/, from ROOT/etc/make.profile incrementally through all
+ ROOT/PORTDIR/profiles/, from ROOT/etc/make.profile incrementally through all
parent profiles as well as from ROOT/PORTAGE_CONFIGROOT/* for user specified
overrides.
-
+
Generally if you need data like USE flags, FEATURES, environment variables,
virtuals ...etc you look in here.
"""
"""
return self._mask_manager.getMaskAtom(cpv, metadata["SLOT"], metadata.get('repository'))
+ def _getRawMaskAtom(self, cpv, metadata):
+ """
+ Take a package and return a matching package.mask atom, or None if no
+ such atom exists or it has been cancelled by package.unmask. PROVIDE
+ is not checked, so atoms will not be found for old-style virtuals.
+
+ @param cpv: The package name
+ @type cpv: String
+ @param metadata: A dictionary of raw package metadata
+ @type metadata: dict
+ @rtype: String
+ @return: A matching atom string or None if one is not found.
+ """
+ return self._mask_manager.getRawMaskAtom(cpv, metadata["SLOT"], metadata.get('repository'))
+
+
def _getProfileMaskAtom(self, cpv, metadata):
"""
Take a package and return a matching profile atom, or None if no
@return: A list of KEYWORDS that have not been accepted.
"""
- # Hack: Need to check the env directly here as otherwise stacking
+ # Hack: Need to check the env directly here as otherwise stacking
# doesn't work properly as negative values are lost in the config
# object (bug #139600)
backuped_accept_keywords = self.configdict["backupenv"].get("ACCEPT_KEYWORDS", "")