summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-15 04:38:35 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-15 04:38:35 +0000
commit94aea60ead91a0c23867d300a7aea820b4bf664a (patch)
treeba8bcb5552c8480ea62231e8559c416ded084bd5 /pym
parenteee8439f8a16f22457ab648a628944b06d4ea7dc (diff)
downloadportage-94aea60ead91a0c23867d300a7aea820b4bf664a.tar.gz
portage-94aea60ead91a0c23867d300a7aea820b4bf664a.tar.bz2
portage-94aea60ead91a0c23867d300a7aea820b4bf664a.zip
Add support for and ACCEPT_CHOSTS variable that controls masking behavior
for binary packages wrt CHOST. The variable is a space separated list of chosts. It support regular expressions, so if the actual chost contains any special characters then the user must escape them when setting ACCEPT_CHOSTS. (trunk r10654) svn path=/main/branches/2.1.2/; revision=10655
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 3bef63963..8e1a620c6 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1159,6 +1159,7 @@ class config:
]
_environ_filter = frozenset(_environ_filter)
+ _accept_chost_re = None
def __init__(self, clone=None, mycpv=None, config_profile_path=None,
config_incrementals=None, config_root=None, target_root=None,
@@ -2385,6 +2386,26 @@ class config:
missing = mygroups
return missing
+ def _accept_chost(self, pkg):
+ """
+ @return True if pkg CHOST is accepted, False otherwise.
+ """
+ if self._accept_chost_re is None:
+ accept_chost = self.get("ACCEPT_CHOSTS", "").split()
+ if not accept_chost:
+ chost = self.get("CHOST")
+ if chost:
+ accept_chost.append(chost)
+ if not accept_chost:
+ self._accept_chost_re = re.compile(".*")
+ elif len(accept_chost) == 1:
+ self._accept_chost_re = re.compile(accept_chost[0])
+ else:
+ self._accept_chost_re = re.compile(
+ r'^(%s)$' % "|".join(accept_chost))
+ return self._accept_chost_re.match(
+ pkg.metadata.get("CHOST", "")) is not None
+
def setinst(self,mycpv,mydbapi):
"""This updates the preferences for old-style virtuals,
affecting the behavior of dep_expand() and dep_check()