summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-30 07:31:39 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-30 07:31:39 +0000
commit821f5aaaea60a562effc03f57806e38b8893c422 (patch)
tree986883079a02af29d7495bed2fe4f50a77ec5161
parentIn config.regenerate(), explicitly include self.backupenv when processing (diff)
downloadportage-multirepo-821f5aaaea60a562effc03f57806e38b8893c422.tar.gz
portage-multirepo-821f5aaaea60a562effc03f57806e38b8893c422.tar.bz2
portage-multirepo-821f5aaaea60a562effc03f57806e38b8893c422.zip
Generate a pruned version of ACCEPT_LICENSE, by intersection with
LICENSE. This is required since otherwise ACCEPT_LICENSE might be too big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG errors as in bug #262647. (trunk r13417) svn path=/main/branches/2.1.6/; revision=13557
-rw-r--r--pym/portage/__init__.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 3fe6f1ca..785498e7 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2063,6 +2063,31 @@ class config(object):
DeprecationWarning)
return 1
+ class _lazy_accept_license(object):
+ """
+ Generate a pruned version of ACCEPT_LICENSE, by intersection with
+ LICENSE. This is required since otherwise ACCEPT_LICENSE might be too
+ big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG
+ errors as in bug #262647.
+ """
+ __slots__ = ('settings',)
+
+ def __init__(self, settings):
+ self.settings = settings
+
+ def __call__(self):
+ settings = self.settings
+ try:
+ licenses = set(flatten(
+ dep.use_reduce(dep.paren_reduce(
+ settings['LICENSE']),
+ uselist=settings['PORTAGE_USE'].split())))
+ except exception.InvalidDependString:
+ licenses = set()
+ if '*' not in settings._accept_license:
+ licenses.intersection_update(settings._accept_license)
+ return ' '.join(sorted(licenses))
+
class _lazy_use_expand(object):
"""
Lazily evaluate USE_EXPAND variables since they are only needed when
@@ -2278,6 +2303,9 @@ class config(object):
if has_changed:
self.reset(keeping_pkg=1,use_cache=use_cache)
+ env_configdict.addLazySingleton('ACCEPT_LICENSE',
+ self._lazy_accept_license(self))
+
# If reset() has not been called, it's safe to return
# early if IUSE has not changed.
if not has_changed and previous_iuse == iuse: