summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-15 04:38:15 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-15 04:38:15 +0000
commit4e140ed13ad3edb75a8e6e00990498caaf0aa5b2 (patch)
treef00effbf83ad025a5f73f451dcfbd8436e61b817 /pym
parent1947be0908f43bb644df6439e94e8aa0afbf19ee (diff)
downloadportage-4e140ed13ad3edb75a8e6e00990498caaf0aa5b2.tar.gz
portage-4e140ed13ad3edb75a8e6e00990498caaf0aa5b2.tar.bz2
portage-4e140ed13ad3edb75a8e6e00990498caaf0aa5b2.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. svn path=/main/trunk/; revision=10654
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py10
-rw-r--r--pym/portage/__init__.py21
2 files changed, 25 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 97bd9604c..fef25c3f0 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1114,9 +1114,8 @@ def visible(pkgsettings, pkg):
"""
if not pkg.metadata["SLOT"]:
return False
- if pkg.built and not pkg.installed:
- pkg_chost = pkg.metadata.get("CHOST")
- if pkg_chost and pkg_chost != pkgsettings["CHOST"]:
+ if pkg.built and not pkg.installed and "CHOST" in pkg.metadata:
+ if not pkgsettings._accept_chost(pkg):
return False
if not portage.eapi_is_supported(pkg.metadata["EAPI"]):
return False
@@ -1140,9 +1139,8 @@ def get_masking_status(pkg, pkgsettings, root_config):
pkg, settings=pkgsettings,
portdb=root_config.trees["porttree"].dbapi)
- if pkg.built and not pkg.installed:
- pkg_chost = pkg.metadata.get("CHOST")
- if pkg_chost and pkg_chost != pkgsettings["CHOST"]:
+ if pkg.built and not pkg.installed and "CHOST" in pkg.metadata:
+ if not pkgsettings._accept_chost(pkg):
mreasons.append("CHOST: %s" % \
pkg.metadata["CHOST"])
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 0ca4f2441..5eccf3a7f 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -998,6 +998,7 @@ class config(object):
]
_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,
@@ -2381,6 +2382,26 @@ class config(object):
ret.append(element)
return ret
+ 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()