Gentoo Archives: gentoo-commits

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