summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-28 23:54:43 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-28 23:54:43 +0000
commitfa66059bfe1cbb74d6a2a62dd69f58220ef9ccb0 (patch)
tree257744be068e77463dc339d041bc6d2e99ec1360 /pym
parente49fb13e72b0d7f658a0015ae7fbf3bb099d4609 (diff)
downloadportage-fa66059bfe1cbb74d6a2a62dd69f58220ef9ccb0.tar.gz
portage-fa66059bfe1cbb74d6a2a62dd69f58220ef9ccb0.tar.bz2
portage-fa66059bfe1cbb74d6a2a62dd69f58220ef9ccb0.zip
Handle re.error exceptions raised from re.compile() when ACCEPT_CHOSTS
is invalid. Thanks to solar for reporting. svn path=/main/trunk/; revision=10840
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 7ccf5bdeb..5c90a2ee1 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2395,10 +2395,21 @@ class config(object):
if not accept_chost:
self._accept_chost_re = re.compile(".*")
elif len(accept_chost) == 1:
- self._accept_chost_re = re.compile(r'^%s$' % accept_chost[0])
+ try:
+ self._accept_chost_re = re.compile(r'^%s$' % accept_chost[0])
+ except re.error, e:
+ writemsg("!!! Invalid ACCEPT_CHOSTS value: '%s': %s\n" % \
+ (accept_chost[0], e), noiselevel=-1)
+ self._accept_chost_re = re.compile("^$")
else:
- self._accept_chost_re = re.compile(
- r'^(%s)$' % "|".join(accept_chost))
+ try:
+ self._accept_chost_re = re.compile(
+ r'^(%s)$' % "|".join(accept_chost))
+ except re.error, e:
+ writemsg("!!! Invalid ACCEPT_CHOSTS value: '%s': %s\n" % \
+ (" ".join(accept_chost), e), noiselevel=-1)
+ self._accept_chost_re = re.compile("^$")
+
return self._accept_chost_re.match(
pkg.metadata.get("CHOST", "")) is not None