1 |
Author: zmedico |
2 |
Date: 2009-10-05 22:46:07 +0000 (Mon, 05 Oct 2009) |
3 |
New Revision: 14496 |
4 |
|
5 |
Modified: |
6 |
main/trunk/cnf/make.globals |
7 |
main/trunk/pym/portage/__init__.py |
8 |
Log: |
9 |
* Add default ACCEPT_LICENSE and ACCEPT_PROPERTIES values in make.globals. |
10 |
* Set default values if missing from make.globals. |
11 |
* Only warn once if a given license group is missing. |
12 |
* Prune off any parts of an ACCEPT_LICENSE and ACCEPT_PROPERTIES that are |
13 |
made irrelevant by the latest occuring * or -* wildcard. |
14 |
|
15 |
|
16 |
Modified: main/trunk/cnf/make.globals |
17 |
=================================================================== |
18 |
--- main/trunk/cnf/make.globals 2009-10-05 08:56:14 UTC (rev 14495) |
19 |
+++ main/trunk/cnf/make.globals 2009-10-05 22:46:07 UTC (rev 14496) |
20 |
@@ -24,6 +24,9 @@ |
21 |
# Default distfiles mirrors |
22 |
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" |
23 |
|
24 |
+ACCEPT_LICENSE="* -@EULA" |
25 |
+ACCEPT_PROPERTIES="*" |
26 |
+ |
27 |
# Repository Paths |
28 |
PORTDIR=/usr/portage |
29 |
DISTDIR=/usr/portage/distfiles |
30 |
|
31 |
Modified: main/trunk/pym/portage/__init__.py |
32 |
=================================================================== |
33 |
--- main/trunk/pym/portage/__init__.py 2009-10-05 08:56:14 UTC (rev 14495) |
34 |
+++ main/trunk/pym/portage/__init__.py 2009-10-05 22:46:07 UTC (rev 14496) |
35 |
@@ -1479,6 +1479,12 @@ |
36 |
|
37 |
_environ_filter = frozenset(_environ_filter) |
38 |
|
39 |
+ _undef_lic_groups = set() |
40 |
+ _default_globals = ( |
41 |
+ ('ACCEPT_LICENSE', '* -@EULA'), |
42 |
+ ('ACCEPT_PROPERTIES', '*'), |
43 |
+ ) |
44 |
+ |
45 |
def __init__(self, clone=None, mycpv=None, config_profile_path=None, |
46 |
config_incrementals=None, config_root=None, target_root=None, |
47 |
local_config=True, env=None): |
48 |
@@ -1872,6 +1878,9 @@ |
49 |
if self.mygcfg is None: |
50 |
self.mygcfg = {} |
51 |
|
52 |
+ for k, v in self._default_globals: |
53 |
+ self.mygcfg.setdefault(k, v) |
54 |
+ |
55 |
self.configlist.append(self.mygcfg) |
56 |
self.configdict["globals"]=self.configlist[-1] |
57 |
|
58 |
@@ -2270,8 +2279,11 @@ |
59 |
else: |
60 |
rValue.extend(self._expandLicenseToken(l, traversed_groups)) |
61 |
else: |
62 |
- writemsg(_("Undefined license group '%s'\n") % group_name, |
63 |
- noiselevel=-1) |
64 |
+ if self._license_groups and \ |
65 |
+ group_name not in self._undef_lic_groups: |
66 |
+ self._undef_lic_groups.add(group_name) |
67 |
+ writemsg(_("Undefined license group '%s'\n") % group_name, |
68 |
+ noiselevel=-1) |
69 |
rValue.append("@"+group_name) |
70 |
if negate: |
71 |
rValue = ["-" + token for token in rValue] |
72 |
@@ -3003,8 +3015,6 @@ |
73 |
@rtype: List |
74 |
@return: A list of licenses that have not been accepted. |
75 |
""" |
76 |
- if not self._accept_license: |
77 |
- return [] |
78 |
accept_license = self._accept_license |
79 |
cpdict = self._plicensedict.get(dep_getkey(cpv), None) |
80 |
if cpdict: |
81 |
@@ -3084,8 +3094,6 @@ |
82 |
@rtype: List |
83 |
@return: A list of properties that have not been accepted. |
84 |
""" |
85 |
- if not self._accept_properties: |
86 |
- return [] |
87 |
accept_properties = self._accept_properties |
88 |
cpdict = self._ppropertiesdict.get(dep_getkey(cpv), None) |
89 |
if cpdict: |
90 |
@@ -3236,6 +3244,25 @@ |
91 |
# env_d will be None if profile.env doesn't exist. |
92 |
self.configdict["env.d"].update(env_d) |
93 |
|
94 |
+ def _prune_incremental(self, split): |
95 |
+ """ |
96 |
+ Prune off any parts of an incremental variable that are |
97 |
+ made irrelevant by the latest occuring * or -*. This |
98 |
+ could be more aggressive but that might be confusing |
99 |
+ and the point is just to reduce noise a bit. |
100 |
+ """ |
101 |
+ for i, x in enumerate(reversed(split)): |
102 |
+ if x == '*': |
103 |
+ split = split[-i-1:] |
104 |
+ break |
105 |
+ elif x == '-*': |
106 |
+ if i == 0: |
107 |
+ split = [] |
108 |
+ else: |
109 |
+ split = split[-i:] |
110 |
+ break |
111 |
+ return split |
112 |
+ |
113 |
def regenerate(self,useonly=0,use_cache=1): |
114 |
""" |
115 |
Regenerate settings |
116 |
@@ -3287,28 +3314,28 @@ |
117 |
mysplit = [] |
118 |
for curdb in mydbs: |
119 |
mysplit.extend(curdb.get('ACCEPT_LICENSE', '').split()) |
120 |
+ mysplit = self._prune_incremental(mysplit) |
121 |
accept_license_str = ' '.join(mysplit) |
122 |
- if accept_license_str: |
123 |
- self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str |
124 |
+ self.configlist[-1]['ACCEPT_LICENSE'] = accept_license_str |
125 |
if accept_license_str != self._accept_license_str: |
126 |
self._accept_license_str = accept_license_str |
127 |
self._accept_license = tuple(self.expandLicenseTokens(mysplit)) |
128 |
else: |
129 |
# repoman will accept any license |
130 |
- self._accept_license = () |
131 |
+ self._accept_license = ('*',) |
132 |
|
133 |
# ACCEPT_PROPERTIES works like ACCEPT_LICENSE, without groups |
134 |
if self.local_config: |
135 |
mysplit = [] |
136 |
for curdb in mydbs: |
137 |
mysplit.extend(curdb.get('ACCEPT_PROPERTIES', '').split()) |
138 |
- if mysplit: |
139 |
- self.configlist[-1]['ACCEPT_PROPERTIES'] = ' '.join(mysplit) |
140 |
+ mysplit = self._prune_incremental(mysplit) |
141 |
+ self.configlist[-1]['ACCEPT_PROPERTIES'] = ' '.join(mysplit) |
142 |
if tuple(mysplit) != self._accept_properties: |
143 |
self._accept_properties = tuple(mysplit) |
144 |
else: |
145 |
# repoman will accept any property |
146 |
- self._accept_properties = () |
147 |
+ self._accept_properties = ('*',) |
148 |
|
149 |
for mykey in myincrementals: |