Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13557 - main/branches/2.1.6/pym/portage
Date: Thu, 30 Apr 2009 07:31:48
Message-Id: E1LzQk8-0002Ze-O1@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-04-30 07:31:39 +0000 (Thu, 30 Apr 2009)
3 New Revision: 13557
4
5 Modified:
6 main/branches/2.1.6/pym/portage/__init__.py
7 Log:
8 Generate a pruned version of ACCEPT_LICENSE, by intersection with
9 LICENSE. This is required since otherwise ACCEPT_LICENSE might be too
10 big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG
11 errors as in bug #262647. (trunk r13417)
12
13 Modified: main/branches/2.1.6/pym/portage/__init__.py
14 ===================================================================
15 --- main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:31:19 UTC (rev 13556)
16 +++ main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:31:39 UTC (rev 13557)
17 @@ -2063,6 +2063,31 @@
18 DeprecationWarning)
19 return 1
20
21 + class _lazy_accept_license(object):
22 + """
23 + Generate a pruned version of ACCEPT_LICENSE, by intersection with
24 + LICENSE. This is required since otherwise ACCEPT_LICENSE might be too
25 + big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG
26 + errors as in bug #262647.
27 + """
28 + __slots__ = ('settings',)
29 +
30 + def __init__(self, settings):
31 + self.settings = settings
32 +
33 + def __call__(self):
34 + settings = self.settings
35 + try:
36 + licenses = set(flatten(
37 + dep.use_reduce(dep.paren_reduce(
38 + settings['LICENSE']),
39 + uselist=settings['PORTAGE_USE'].split())))
40 + except exception.InvalidDependString:
41 + licenses = set()
42 + if '*' not in settings._accept_license:
43 + licenses.intersection_update(settings._accept_license)
44 + return ' '.join(sorted(licenses))
45 +
46 class _lazy_use_expand(object):
47 """
48 Lazily evaluate USE_EXPAND variables since they are only needed when
49 @@ -2278,6 +2303,9 @@
50 if has_changed:
51 self.reset(keeping_pkg=1,use_cache=use_cache)
52
53 + env_configdict.addLazySingleton('ACCEPT_LICENSE',
54 + self._lazy_accept_license(self))
55 +
56 # If reset() has not been called, it's safe to return
57 # early if IUSE has not changed.
58 if not has_changed and previous_iuse == iuse: