summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-08-09 10:05:23 +0000
committerZac Medico <zmedico@gentoo.org>2008-08-09 10:05:23 +0000
commit11e7477f67d5af0cd40d435520c31812af56f7c8 (patch)
tree2dbbfcf633c6066f19c08bfe6ff8158916e16958
parent91395bdde4aadd218a45b220a5aca60c0ed85cab (diff)
downloadportage-11e7477f67d5af0cd40d435520c31812af56f7c8.tar.gz
portage-11e7477f67d5af0cd40d435520c31812af56f7c8.tar.bz2
portage-11e7477f67d5af0cd40d435520c31812af56f7c8.zip
Escape use flags before compiling regular expressions from them. Thanks
to pchrist for reporting. svn path=/main/trunk/; revision=11364
-rw-r--r--pym/_emerge/__init__.py8
-rw-r--r--pym/portage/__init__.py8
2 files changed, 12 insertions, 4 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 4ce2af793..9389b8391 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1465,8 +1465,12 @@ class Package(Task):
except AttributeError:
all = object.__getattribute__(self, "all")
iuse_implicit = object.__getattribute__(self, "iuse_implicit")
- self.regex = re.compile("^(%s)$" % "|".join(
- chain((re.escape(x) for x in all), iuse_implicit)))
+ # Escape anything except ".*" which is supposed
+ # to pass through from _get_implicit_iuse()
+ regex = (re.escape(x) for x in chain(all, iuse_implicit))
+ regex = "^(%s)$" % "|".join(regex)
+ regex = regex.replace("\\.\\*", ".*")
+ self.regex = re.compile(regex)
return object.__getattribute__(self, name)
def _get_hash_key(self):
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 15766f9a0..72deec23c 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2072,8 +2072,12 @@ class config(object):
iuse_implicit = self._get_implicit_iuse()
iuse_implicit.update(x.lstrip("+-") for x in iuse.split())
- self.configdict["pkg"]["PORTAGE_IUSE"] = \
- "^(%s)$" % "|".join(sorted(iuse_implicit))
+ # Escape anything except ".*" which is supposed
+ # to pass through from _get_implicit_iuse()
+ regex = sorted(re.escape(x) for x in iuse_implicit)
+ regex = "^(%s)$" % "|".join(regex)
+ regex = regex.replace("\\.\\*", ".*")
+ self.configdict["pkg"]["PORTAGE_IUSE"] = regex
ebuild_force_test = self.get("EBUILD_FORCE_TEST") == "1"
if ebuild_force_test and ebuild_phase and \