1 |
Author: grobian |
2 |
Date: 2009-05-02 09:23:14 +0000 (Sat, 02 May 2009) |
3 |
New Revision: 13593 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/ebuild.sh |
7 |
main/branches/prefix/pym/_emerge/__init__.py |
8 |
main/branches/prefix/pym/portage/__init__.py |
9 |
Log: |
10 |
Merged from trunk -r13563:13575 |
11 |
|
12 |
| 13565 | Fix _lazy_accept_license to discard || from the set of | |
13 |
| zmedico | licenses. | |
14 |
|
15 |
| 13567 | Bug #267104 - When appropriate, advise the user that they | |
16 |
| zmedico | may set FEATURES= -userfetch in order to use remaining | |
17 |
| | space. | |
18 |
|
19 |
| 13569 | Move PORTAGE_RESTRICT calculation to config.setcpv() (lazy | |
20 |
| zmedico | evaluation) and fix it to work correctly for pre-built | |
21 |
| | packages. | |
22 |
|
23 |
| 13570 | Enable use() qa checks via PORTAGE_IUSE for all ebuild | |
24 |
| zmedico | phases and for binary packages since it should work fine | |
25 |
| | now. | |
26 |
|
27 |
| 13573 | In config.setcpv() reuse split USE from built packages | |
28 |
| zmedico | instead of splitting them again. | |
29 |
|
30 |
| 13575 | Remove unnecessary doebuild_environment() call from | |
31 |
| zmedico | EbuildFetchonly.execute() since PORTAGE_RESTRICT is | |
32 |
| | calculated by config.setcpv() now. | |
33 |
|
34 |
|
35 |
Modified: main/branches/prefix/bin/ebuild.sh |
36 |
=================================================================== |
37 |
--- main/branches/prefix/bin/ebuild.sh 2009-05-02 09:20:39 UTC (rev 13592) |
38 |
+++ main/branches/prefix/bin/ebuild.sh 2009-05-02 09:23:14 UTC (rev 13593) |
39 |
@@ -144,12 +144,7 @@ |
40 |
fi |
41 |
|
42 |
# Make sure we have this USE flag in IUSE |
43 |
- if [[ -n ${PORTAGE_IUSE} ]] && \ |
44 |
- [[ -n ${EBUILD_PHASE} ]] && \ |
45 |
- ! hasq ${EBUILD_PHASE} config depend info prerm postrm postinst && \ |
46 |
- [[ ${EMERGE_FROM} != binary ]] ; then |
47 |
- # TODO: Implement PORTAGE_IUSE for binary packages. Currently, |
48 |
- # it is only valid for build time phases. |
49 |
+ if [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then |
50 |
[[ $u =~ $PORTAGE_IUSE ]] || \ |
51 |
eqawarn "QA Notice: USE Flag '${u}' not" \ |
52 |
"in IUSE for ${CATEGORY}/${PF}" |
53 |
|
54 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
55 |
=================================================================== |
56 |
--- main/branches/prefix/pym/_emerge/__init__.py 2009-05-02 09:20:39 UTC (rev 13592) |
57 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2009-05-02 09:23:14 UTC (rev 13593) |
58 |
@@ -1768,9 +1768,6 @@ |
59 |
ebuild_path = portdb.findname(pkg.cpv) |
60 |
settings.setcpv(pkg) |
61 |
debug = settings.get("PORTAGE_DEBUG") == "1" |
62 |
- use_cache = 1 # always true |
63 |
- portage.doebuild_environment(ebuild_path, "fetch", |
64 |
- settings["ROOT"], settings, debug, use_cache, portdb) |
65 |
restrict_fetch = 'fetch' in settings['PORTAGE_RESTRICT'].split() |
66 |
|
67 |
if restrict_fetch: |
68 |
|
69 |
Modified: main/branches/prefix/pym/portage/__init__.py |
70 |
=================================================================== |
71 |
--- main/branches/prefix/pym/portage/__init__.py 2009-05-02 09:20:39 UTC (rev 13592) |
72 |
+++ main/branches/prefix/pym/portage/__init__.py 2009-05-02 09:23:14 UTC (rev 13593) |
73 |
@@ -2088,35 +2088,59 @@ |
74 |
DeprecationWarning) |
75 |
return 1 |
76 |
|
77 |
- class _lazy_accept_license(object): |
78 |
- """ |
79 |
- Generate a pruned version of ACCEPT_LICENSE, by intersection with |
80 |
- LICENSE. This is required since otherwise ACCEPT_LICENSE might be too |
81 |
- big (bigger than ARG_MAX), causing execve() calls to fail with E2BIG |
82 |
- errors as in bug #262647. |
83 |
- """ |
84 |
- __slots__ = ('built_use', 'settings',) |
85 |
+ class _lazy_vars(object): |
86 |
|
87 |
+ __slots__ = ('built_use', 'settings', 'values') |
88 |
+ |
89 |
def __init__(self, built_use, settings): |
90 |
self.built_use = built_use |
91 |
self.settings = settings |
92 |
+ self.values = None |
93 |
|
94 |
- def __call__(self): |
95 |
+ def __getitem__(self, k): |
96 |
+ if self.values is None: |
97 |
+ self.values = self._init_values() |
98 |
+ return self.values[k] |
99 |
+ |
100 |
+ def _init_values(self): |
101 |
+ values = {} |
102 |
settings = self.settings |
103 |
use = self.built_use |
104 |
if use is None: |
105 |
- use = settings['PORTAGE_USE'] |
106 |
+ use = frozenset(settings['PORTAGE_USE'].split()) |
107 |
+ values['ACCEPT_LICENSE'] = self._accept_license(use, settings) |
108 |
+ values['PORTAGE_RESTRICT'] = self._restrict(use, settings) |
109 |
+ return values |
110 |
+ |
111 |
+ def _accept_license(self, use, settings): |
112 |
+ """ |
113 |
+ Generate a pruned version of ACCEPT_LICENSE, by intersection with |
114 |
+ LICENSE. This is required since otherwise ACCEPT_LICENSE might be |
115 |
+ too big (bigger than ARG_MAX), causing execve() calls to fail with |
116 |
+ E2BIG errors as in bug #262647. |
117 |
+ """ |
118 |
try: |
119 |
licenses = set(flatten( |
120 |
dep.use_reduce(dep.paren_reduce( |
121 |
settings['LICENSE']), |
122 |
- uselist=use.split()))) |
123 |
+ uselist=use))) |
124 |
except exception.InvalidDependString: |
125 |
licenses = set() |
126 |
+ licenses.discard('||') |
127 |
if '*' not in settings._accept_license: |
128 |
licenses.intersection_update(settings._accept_license) |
129 |
return ' '.join(sorted(licenses)) |
130 |
|
131 |
+ def _restrict(self, use, settings): |
132 |
+ try: |
133 |
+ restrict = set(flatten( |
134 |
+ dep.use_reduce(dep.paren_reduce( |
135 |
+ settings['RESTRICT']), |
136 |
+ uselist=use))) |
137 |
+ except exception.InvalidDependString: |
138 |
+ restrict = set() |
139 |
+ return ' '.join(sorted(restrict)) |
140 |
+ |
141 |
class _lazy_use_expand(object): |
142 |
""" |
143 |
Lazily evaluate USE_EXPAND variables since they are only needed when |
144 |
@@ -2222,7 +2246,7 @@ |
145 |
mydb = pkg.metadata |
146 |
args_hash = (mycpv, id(pkg)) |
147 |
if pkg.built: |
148 |
- built_use = pkg.metadata['USE'] |
149 |
+ built_use = pkg.use.enabled |
150 |
else: |
151 |
args_hash = (mycpv, id(mydb)) |
152 |
|
153 |
@@ -2339,8 +2363,11 @@ |
154 |
if k != 'USE': |
155 |
env_configdict.pop(k, None) |
156 |
|
157 |
+ lazy_vars = self._lazy_vars(built_use, self) |
158 |
env_configdict.addLazySingleton('ACCEPT_LICENSE', |
159 |
- self._lazy_accept_license(built_use, self)) |
160 |
+ lazy_vars.__getitem__, 'ACCEPT_LICENSE') |
161 |
+ env_configdict.addLazySingleton('PORTAGE_RESTRICT', |
162 |
+ lazy_vars.__getitem__, 'PORTAGE_RESTRICT') |
163 |
|
164 |
# If reset() has not been called, it's safe to return |
165 |
# early if IUSE has not changed. |
166 |
@@ -3991,6 +4018,7 @@ |
167 |
|
168 |
myfile_path = os.path.join(mysettings["DISTDIR"], myfile) |
169 |
has_space = True |
170 |
+ has_space_superuser = False |
171 |
file_lock = None |
172 |
if listonly: |
173 |
writemsg_stdout("\n", noiselevel=-1) |
174 |
@@ -4008,18 +4036,30 @@ |
175 |
mysize = 0 |
176 |
if (size - mysize + vfs_stat.f_bsize) >= \ |
177 |
(vfs_stat.f_bsize * vfs_stat.f_bavail): |
178 |
- if secpass < 2: |
179 |
+ |
180 |
+ if (size - mysize + vfs_stat.f_bsize) >= \ |
181 |
+ (vfs_stat.f_bsize * vfs_stat.f_bfree): |
182 |
+ has_space_superuser = True |
183 |
+ |
184 |
+ if not has_space_superuser: |
185 |
has_space = False |
186 |
+ elif secpass < 2: |
187 |
+ has_space = False |
188 |
elif userfetch: |
189 |
has_space = False |
190 |
- elif (size - mysize + vfs_stat.f_bsize) >= \ |
191 |
- (vfs_stat.f_bsize * vfs_stat.f_bfree): |
192 |
- has_space = False |
193 |
|
194 |
if not has_space: |
195 |
writemsg("!!! Insufficient space to store %s in %s\n" % \ |
196 |
(myfile, mysettings["DISTDIR"]), noiselevel=-1) |
197 |
|
198 |
+ if has_space_superuser: |
199 |
+ writemsg("!!! Insufficient privileges to use " + \ |
200 |
+ "remaining space.\n", noiselevel=-1) |
201 |
+ if userfetch: |
202 |
+ writemsg("!!! You may set FEATURES=\"-userfetch\"" + \ |
203 |
+ " in /etc/make.conf in order to fetch with\n" + \ |
204 |
+ "!!! superuser privileges.\n", noiselevel=-1) |
205 |
+ |
206 |
if distdir_writable and use_locks: |
207 |
|
208 |
if locks_in_subdir: |
209 |
@@ -5351,14 +5391,6 @@ |
210 |
if not eapi_is_supported(eapi): |
211 |
# can't do anything with this. |
212 |
raise portage.exception.UnsupportedAPIException(mycpv, eapi) |
213 |
- try: |
214 |
- mysettings["PORTAGE_RESTRICT"] = " ".join(flatten( |
215 |
- portage.dep.use_reduce(portage.dep.paren_reduce( |
216 |
- mysettings["RESTRICT"]), |
217 |
- uselist=mysettings["PORTAGE_USE"].split()))) |
218 |
- except portage.exception.InvalidDependString: |
219 |
- # RESTRICT is validated again inside doebuild, so let this go |
220 |
- mysettings["PORTAGE_RESTRICT"] = "" |
221 |
|
222 |
if mysplit[2] == "r0": |
223 |
mysettings["PVR"]=mysplit[1] |