1 |
Author: grobian |
2 |
Date: 2008-09-27 16:03:31 +0000 (Sat, 27 Sep 2008) |
3 |
New Revision: 11570 |
4 |
|
5 |
Added: |
6 |
main/branches/prefix/pym/portage/tests/dep/test_src_uri.py |
7 |
Modified: |
8 |
main/branches/prefix/bin/ebuild.sh |
9 |
main/branches/prefix/bin/isolated-functions.sh |
10 |
main/branches/prefix/bin/repoman |
11 |
main/branches/prefix/doc/package/ebuild/eapi/2.docbook |
12 |
main/branches/prefix/man/ebuild.1 |
13 |
main/branches/prefix/man/emerge.1 |
14 |
main/branches/prefix/man/make.conf.5 |
15 |
main/branches/prefix/pym/_emerge/__init__.py |
16 |
main/branches/prefix/pym/_emerge/help.py |
17 |
main/branches/prefix/pym/portage/__init__.py |
18 |
main/branches/prefix/pym/portage/dbapi/porttree.py |
19 |
main/branches/prefix/pym/portage/dep.py |
20 |
main/branches/prefix/pym/portage/sets/__init__.py |
21 |
main/branches/prefix/pym/portage/sets/files.py |
22 |
Log: |
23 |
Merged from trunk -r11515:11531 |
24 |
|
25 |
| 11516 | Fix typo in from previous commit. | |
26 |
| zmedico | | |
27 |
|
28 |
| 11517 | Implement the new EAPI 2 blocker behavior, including !!atom | |
29 |
| zmedico | sytax which forbids temporary simultaneous installation of | |
30 |
| | conflicting packages. | |
31 |
|
32 |
| 11518 | Document the --debug option. Thanks to Jeremy Olexa | |
33 |
| zmedico | <darkside@g.o> suggesting. | |
34 |
|
35 |
| 11519 | Define __all__ and clean up unused imports found by | |
36 |
| zmedico | pyflakes. | |
37 |
|
38 |
| 11520 | Bug #238157 - Update http_proxy/ftp_proxy docs to show | |
39 |
| zmedico | protocol://, for compat with rubygems. | |
40 |
|
41 |
| 11521 | Document the --ignore-default-opts and --skip-manifest | |
42 |
| zmedico | options. | |
43 |
|
44 |
| 11522 | Implement SRC_URI arrows for EAPI 2. The | |
45 |
| zmedico | portdbapi.getfetchlist() method is now deprecated and there | |
46 |
| | is a new getFetchMap() method that returns a dict which maps | |
47 |
| | each file name to a set of alternative URIs. The | |
48 |
| | portage.fetch() function uses introspection to detect when | |
49 |
| | such a dict is passed in and handles it appropriately, while | |
50 |
| | maintaining backward compatibility if a list of uris is | |
51 |
| | passed in. | |
52 |
|
53 |
| 11523 | Add a "EAPI 2_pre3" section to show what's changed. | |
54 |
| zmedico | | |
55 |
|
56 |
| 11524 | Add test cases for SRC_URI validation. | |
57 |
| zmedico | | |
58 |
|
59 |
| 11525 | Fix some broken logic inside portdbapi.getFetchMap(). | |
60 |
| zmedico | | |
61 |
|
62 |
| 11526 | More SRC_URI validation. | |
63 |
| zmedico | | |
64 |
|
65 |
| 11527 | As requested by jmbsvicetto, add support to StaticFileSet | |
66 |
| zmedico | for sets within subdirectories. This makes it possible to | |
67 |
| | create a set name foo/bar by placing a file named bar inside | |
68 |
| | a directory named foo. By allowing sets to be organized in | |
69 |
| | subdirectories, it will allow us to avoid overcrowding as | |
70 |
| | the number of sets grows. | |
71 |
|
72 |
| 11528 | Fix erroneous variable references in the multiset | |
73 |
| zmedico | 'Redefinition of set' message. | |
74 |
|
75 |
| 11529 | Bug #238251 - Use 'read' instead of $IFS for splitting | |
76 |
| zmedico | newlines in e* functions, since using $IFS causes spurious | |
77 |
| | newlines to be inserted in the message when the e* function | |
78 |
| | is called with more than one argument. | |
79 |
|
80 |
| 11530 | Always call `cd "$WORKDIR"` to ensure that $CWD is sane | |
81 |
| zmedico | whenever possible. | |
82 |
|
83 |
| 11531 | Add a new --list-sets action, as requested by jmbsvicetto. | |
84 |
| zmedico | | |
85 |
|
86 |
|
87 |
Modified: main/branches/prefix/bin/ebuild.sh |
88 |
=================================================================== |
89 |
--- main/branches/prefix/bin/ebuild.sh 2008-09-27 16:00:06 UTC (rev 11569) |
90 |
+++ main/branches/prefix/bin/ebuild.sh 2008-09-27 16:03:31 UTC (rev 11570) |
91 |
@@ -272,6 +272,9 @@ |
92 |
export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*" |
93 |
} |
94 |
|
95 |
+# Ensure that $CWD is sane whenever possible. |
96 |
+cd "$WORKDIR" 2>/dev/null |
97 |
+ |
98 |
#if no perms are specified, dirs/files will have decent defaults |
99 |
#(not secretive, but not stupid) |
100 |
umask 022 |
101 |
|
102 |
Modified: main/branches/prefix/bin/isolated-functions.sh |
103 |
=================================================================== |
104 |
--- main/branches/prefix/bin/isolated-functions.sh 2008-09-27 16:00:06 UTC (rev 11569) |
105 |
+++ main/branches/prefix/bin/isolated-functions.sh 2008-09-27 16:03:31 UTC (rev 11570) |
106 |
@@ -165,7 +165,7 @@ |
107 |
|
108 |
# Internal logging function, don't use this in ebuilds |
109 |
elog_base() { |
110 |
- local line lines=0 messagetype |
111 |
+ local messagetype |
112 |
[ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1 |
113 |
case "${1}" in |
114 |
INFO|WARN|ERROR|LOG|QA) |
115 |
@@ -181,39 +181,19 @@ |
116 |
# not entirely safe to use it as a delimiter in the log file since |
117 |
# there can still be escaped newlines that will be expanded due to |
118 |
# the echo -e parameter. |
119 |
- save_IFS |
120 |
- IFS=$'\n' |
121 |
- for line in $* ; do |
122 |
- (( lines++ )) |
123 |
+ echo "$@" | while read line ; do |
124 |
echo -ne "${messagetype} ${line}\n\0" >> \ |
125 |
"${T}/logging/${EBUILD_PHASE:-other}" |
126 |
done |
127 |
- restore_IFS |
128 |
- |
129 |
- # This is needed in case a blank line is being shown. |
130 |
- [ $lines -eq 0 ] && \ |
131 |
- echo -ne "${messagetype} $*\n\0" >> \ |
132 |
- "${T}/logging/${EBUILD_PHASE:-other}" |
133 |
- |
134 |
return 0 |
135 |
} |
136 |
|
137 |
eqawarn() { |
138 |
elog_base QA "$*" |
139 |
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo |
140 |
- local line lines=0 |
141 |
- save_IFS |
142 |
- IFS=$'\n' |
143 |
- for line in $* ; do |
144 |
- (( lines++ )) |
145 |
+ echo "$@" | while read line ; do |
146 |
vecho -e " ${WARN}*${NORMAL} ${line}" >&2 |
147 |
done |
148 |
- restore_IFS |
149 |
- |
150 |
- # This is needed in case a blank line is being shown. |
151 |
- [ $lines -eq 0 ] && \ |
152 |
- vecho -e " ${WARN}*${NORMAL} $*" >&2 |
153 |
- |
154 |
LAST_E_CMD="eqawarn" |
155 |
return 0 |
156 |
} |
157 |
@@ -221,19 +201,9 @@ |
158 |
elog() { |
159 |
elog_base LOG "$*" |
160 |
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo |
161 |
- local line lines=0 |
162 |
- save_IFS |
163 |
- IFS=$'\n' |
164 |
- for line in $* ; do |
165 |
- (( lines++ )) |
166 |
+ echo "$@" | while read line ; do |
167 |
echo -e " ${GOOD}*${NORMAL} ${line}" |
168 |
done |
169 |
- restore_IFS |
170 |
- |
171 |
- # This is needed in case a blank line is being shown. |
172 |
- [ $lines -eq 0 ] && \ |
173 |
- echo -e " ${GOOD}*${NORMAL} $*" |
174 |
- |
175 |
LAST_E_CMD="elog" |
176 |
return 0 |
177 |
} |
178 |
@@ -261,19 +231,9 @@ |
179 |
einfo() { |
180 |
elog_base INFO "$*" |
181 |
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo |
182 |
- save_IFS |
183 |
- IFS=$'\n' |
184 |
- local line lines=0 |
185 |
- for line in $* ; do |
186 |
- (( lines++ )) |
187 |
+ echo "$@" | while read line ; do |
188 |
echo -e " ${GOOD}*${NORMAL} ${line}" |
189 |
done |
190 |
- restore_IFS |
191 |
- |
192 |
- # This is needed in case a blank line is being shown. |
193 |
- [ $lines -eq 0 ] && \ |
194 |
- echo -e " ${GOOD}*${NORMAL} $*" |
195 |
- |
196 |
LAST_E_CMD="einfo" |
197 |
return 0 |
198 |
} |
199 |
@@ -289,19 +249,9 @@ |
200 |
ewarn() { |
201 |
elog_base WARN "$*" |
202 |
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo |
203 |
- save_IFS |
204 |
- IFS=$'\n' |
205 |
- local line lines=0 |
206 |
- for line in $* ; do |
207 |
- (( lines++ )) |
208 |
+ echo "$@" | while read line ; do |
209 |
echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}${line}" >&2 |
210 |
done |
211 |
- restore_IFS |
212 |
- |
213 |
- # This is needed in case a blank line is being shown. |
214 |
- [ $lines -eq 0 ] && \ |
215 |
- echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*" >&2 |
216 |
- |
217 |
LAST_E_CMD="ewarn" |
218 |
return 0 |
219 |
} |
220 |
@@ -309,19 +259,9 @@ |
221 |
eerror() { |
222 |
elog_base ERROR "$*" |
223 |
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo |
224 |
- save_IFS |
225 |
- IFS=$'\n' |
226 |
- local line lines=0 |
227 |
- for line in $* ; do |
228 |
- (( lines++ )) |
229 |
+ echo "$@" | while read line ; do |
230 |
echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}${line}" >&2 |
231 |
done |
232 |
- restore_IFS |
233 |
- |
234 |
- # This is needed in case a blank line is being shown. |
235 |
- [ $lines -eq 0 ] && \ |
236 |
- echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*" >&2 |
237 |
- |
238 |
LAST_E_CMD="eerror" |
239 |
return 0 |
240 |
} |
241 |
@@ -561,7 +501,7 @@ |
242 |
for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \ |
243 |
src_compile src_test src_install pkg_preinst pkg_postinst \ |
244 |
pkg_prerm pkg_postrm ; do |
245 |
- unset -f _default_$x _eapi{0,1,2}_$x |
246 |
+ unset -f default_$x _eapi{0,1,2}_$x |
247 |
done |
248 |
unset x |
249 |
|
250 |
|
251 |
Modified: main/branches/prefix/bin/repoman |
252 |
=================================================================== |
253 |
--- main/branches/prefix/bin/repoman 2008-09-27 16:00:06 UTC (rev 11569) |
254 |
+++ main/branches/prefix/bin/repoman 2008-09-27 16:03:31 UTC (rev 11570) |
255 |
@@ -1255,8 +1255,6 @@ |
256 |
badsyntax.append("'%s' not a valid atom" % token) |
257 |
else: |
258 |
is_blocker = atom.blocker |
259 |
- if atom.blocker: |
260 |
- atom = portage.dep.Atom(atom[1:]) |
261 |
|
262 |
if mytype == "DEPEND" and \ |
263 |
not is_blocker and \ |
264 |
@@ -1283,6 +1281,13 @@ |
265 |
(relative_path + ": %s use dependency" + \ |
266 |
" not supported with EAPI='%s':" + \ |
267 |
" '%s'") % (mytype, eapi, atom)) |
268 |
+ if atom.blocker and atom.blocker.overlap.forbid \ |
269 |
+ and eapi in ("0", "1"): |
270 |
+ stats['EAPI.incompatible'] += 1 |
271 |
+ fails['EAPI.incompatible'].append( |
272 |
+ (relative_path + ": %s new blocker syntax" + \ |
273 |
+ " not supported with EAPI='%s':" + \ |
274 |
+ " '%s'") % (mytype, eapi, atom)) |
275 |
|
276 |
type_list.extend([mytype] * (len(badsyntax) - len(type_list))) |
277 |
|
278 |
|
279 |
Modified: main/branches/prefix/doc/package/ebuild/eapi/2.docbook |
280 |
=================================================================== |
281 |
--- main/branches/prefix/doc/package/ebuild/eapi/2.docbook 2008-09-27 16:00:06 UTC (rev 11569) |
282 |
+++ main/branches/prefix/doc/package/ebuild/eapi/2.docbook 2008-09-27 16:03:31 UTC (rev 11570) |
283 |
@@ -216,6 +216,67 @@ |
284 |
</section> |
285 |
</section> |
286 |
</section> |
287 |
+<section id='package-ebuild-eapi-2-pre3'> |
288 |
+ <title>EAPI 2_pre3</title> |
289 |
+ <section id='package-ebuild-eapi-2-pre3-metadata'> |
290 |
+ <title>Metadata</title> |
291 |
+ <section id='package-ebuild-eapi-2-pre3-metadata-dependencies'> |
292 |
+ <title>Dependencies</title> |
293 |
+ <section id='package-ebuild-eapi-2-pre3-metadata-dependencies-blocker-atoms'> |
294 |
+ <title>Blocker Atoms</title> |
295 |
+ <section id='package-ebuild-eapi-2-pre3-metadata-dependencies-blocker-atoms-new-meaning'> |
296 |
+ <title>New Meaning for Old Syntax</title> |
297 |
+ <para> |
298 |
+ Blocker atoms which use the previously existing !atom syntax now have |
299 |
+ a slightly different meaning. These blocker atoms indicate that |
300 |
+ conflicting packages may be temporarily installed simultaneously. When |
301 |
+ temporary simultaneous installation of conflicting packages occurs, the |
302 |
+ installation of a newer package may overwrite any colliding files that |
303 |
+ belong to an older package which is explicitly blocked. When such file |
304 |
+ collisions occur, the colliding files cease to belong to the older |
305 |
+ package, and they remain installed after the older package is |
306 |
+ eventually uninstalled. The older package is uninstalled only after |
307 |
+ any newer blocking packages have been merged on top of it. |
308 |
+ </para> |
309 |
+ </section> |
310 |
+ <section id='package-ebuild-eapi-2-pre3-metadata-dependencies-blocker-atoms-new-syntax'> |
311 |
+ <title>New !!atom Syntax</title> |
312 |
+ <para> |
313 |
+ A new !!atom syntax is now supported, for use in special cases for which |
314 |
+ temporary simultaneous installation of conflicting packages should not be |
315 |
+ allowed. If a given package happens to be blocked my a mixture of atoms |
316 |
+ consisting of both the !atom and !!atom syntaxes, the !!atom syntax takes |
317 |
+ precedence over the !atom syntax. |
318 |
+ </para> |
319 |
+ </section> |
320 |
+ </section> |
321 |
+ </section> |
322 |
+ <section id='package-ebuild-eapi-2-pre3-metadata-src-uri'> |
323 |
+ <title>SRC_URI</title> |
324 |
+ <section id='package-ebuild-eapi-2-pre3-metadata-src-uri-output-file-name-customization'> |
325 |
+ <title>Customization of Output File Names</title> |
326 |
+ <para> |
327 |
+ A new syntax is supported which allows customization of the output |
328 |
+ file name for a given URI. In order to customize the output file |
329 |
+ name, a given URI should be followed by a "->" operator which, |
330 |
+ in turn, should be followed by the desired output file name. As |
331 |
+ usual, all tokens, including the operator and output file name, |
332 |
+ should be separated by whitespace. |
333 |
+ </para> |
334 |
+ </section> |
335 |
+ </section> |
336 |
+ </section> |
337 |
+ <section id='package-ebuild-eapi-2-pre3-phases'> |
338 |
+ <title>Phases</title> |
339 |
+ <section id='package-ebuild-eapi-2-pre3-phases-src-prepare'> |
340 |
+ <title>New src_prepare Phase Function</title> |
341 |
+ <para> |
342 |
+ A new src_prepare function is called after the src_unpack |
343 |
+ function, with cwd initially set to $S. |
344 |
+ </para> |
345 |
+ </section> |
346 |
+ </section> |
347 |
+</section> |
348 |
<section id='package-ebuild-eapi-2-draft'> |
349 |
<title>EAPI 2 Draft</title> |
350 |
<section id='package-ebuild-eapi-2-draft-helpers'> |
351 |
|
352 |
Modified: main/branches/prefix/man/ebuild.1 |
353 |
=================================================================== |
354 |
--- main/branches/prefix/man/ebuild.1 2008-09-27 16:00:06 UTC (rev 11569) |
355 |
+++ main/branches/prefix/man/ebuild.1 2008-09-27 16:03:31 UTC (rev 11570) |
356 |
@@ -171,11 +171,21 @@ |
357 |
information is not incorporated into the RPM. |
358 |
.SH OPTIONS |
359 |
.TP |
360 |
-\fB--force\fR |
361 |
+.BR "\-\-debug" |
362 |
+Run bash with the \-x option, causing it to output verbose debugging |
363 |
+information to stdout. |
364 |
+.TP |
365 |
+.BR "\-\-force" |
366 |
When used together with the digest or manifest command, |
367 |
this option forces regeneration of |
368 |
digests for all distfiles associated with the current ebuild. Any distfiles |
369 |
that do not already exist in ${DISTDIR} will be automatically fetched. |
370 |
+.TP |
371 |
+.BR "\-\-ignore\-default\-opts" |
372 |
+Do not use the \fIEBUILD_DEFAULT_OPTS\fR environment variable. |
373 |
+.TP |
374 |
+.BR "\-\-skip\-manifest" |
375 |
+Skip all manifest checks. |
376 |
.SH "REPORTING BUGS" |
377 |
Please report bugs via http://bugs.gentoo.org/ |
378 |
.SH "AUTHORS" |
379 |
|
380 |
Modified: main/branches/prefix/man/emerge.1 |
381 |
=================================================================== |
382 |
--- main/branches/prefix/man/emerge.1 2008-09-27 16:00:06 UTC (rev 11569) |
383 |
+++ main/branches/prefix/man/emerge.1 2008-09-27 16:03:31 UTC (rev 11570) |
384 |
@@ -67,7 +67,8 @@ |
385 |
in \fB/usr/share/portage/config/sets.conf\fR. Note that a \fIset\fR |
386 |
is generally used in conjunction with \fB\-\-update\fR. When used as |
387 |
arguments to \fBemerge\fR sets have to be prefixed with \fB@\fR to be |
388 |
-recognized. |
389 |
+recognized. Use the \fB\-\-list\-sets\fR action to display a list of |
390 |
+available package sets. |
391 |
.TP |
392 |
.BR atom |
393 |
An \fIatom\fR describes bounds on a package that you wish to install. |
394 |
@@ -142,6 +143,9 @@ |
395 |
information when submitting a bug report.\fR Expanded output can be obtained |
396 |
with the \fI\-\-verbose\fR option. |
397 |
.TP |
398 |
+.BR \-\-list\-sets |
399 |
+Displays a list of available package sets. |
400 |
+.TP |
401 |
.BR \-\-metadata |
402 |
Transfers metadata cache from ${PORTDIR}/metadata/cache/ to |
403 |
/var/cache/edb/dep/ as is normally done on the |
404 |
|
405 |
Modified: main/branches/prefix/man/make.conf.5 |
406 |
=================================================================== |
407 |
--- main/branches/prefix/man/make.conf.5 2008-09-27 16:00:06 UTC (rev 11569) |
408 |
+++ main/branches/prefix/man/make.conf.5 2008-09-27 16:03:31 UTC (rev 11570) |
409 |
@@ -375,7 +375,7 @@ |
410 |
variable that have no protocol and simply start with a '/' path separator may |
411 |
be used to specify mounted filesystem mirrors. |
412 |
.TP |
413 |
-\fBhttp_proxy ftp_proxy\fR = \fI[host:port]\fR |
414 |
+\fBhttp_proxy ftp_proxy\fR = \fI[protocol://host:port]\fR |
415 |
These vars are used if the sources must be downloaded from the |
416 |
internet by \fBwget\fR(1). They are only required if you use a |
417 |
proxy server for internet access. |
418 |
|
419 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
420 |
=================================================================== |
421 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-09-27 16:00:06 UTC (rev 11569) |
422 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-09-27 16:03:31 UTC (rev 11570) |
423 |
@@ -212,12 +212,12 @@ |
424 |
print "Interrupted." |
425 |
sys.exit(1) |
426 |
|
427 |
-actions=[ |
428 |
+actions = frozenset([ |
429 |
"clean", "config", "depclean", |
430 |
-"info", "metadata", |
431 |
+"info", "list-sets", "metadata", |
432 |
"prune", "regen", "search", |
433 |
"sync", "unmerge", |
434 |
-] |
435 |
+]) |
436 |
options=[ |
437 |
"--ask", "--alphabetical", |
438 |
"--buildpkg", "--buildpkgonly", |
439 |
@@ -446,7 +446,7 @@ |
440 |
pass |
441 |
self.portdb = fake_portdb |
442 |
for attrib in ("aux_get", "cp_all", |
443 |
- "xmatch", "findname", "getfetchlist"): |
444 |
+ "xmatch", "findname", "getFetchMap"): |
445 |
setattr(fake_portdb, attrib, getattr(self, "_"+attrib)) |
446 |
|
447 |
self._dbs = [] |
448 |
@@ -493,14 +493,14 @@ |
449 |
return value |
450 |
return None |
451 |
|
452 |
- def _getfetchlist(self, *args, **kwargs): |
453 |
+ def _getFetchMap(self, *args, **kwargs): |
454 |
for db in self._dbs: |
455 |
- func = getattr(db, "getfetchlist", None) |
456 |
+ func = getattr(db, "getFetchMap", None) |
457 |
if func: |
458 |
value = func(*args, **kwargs) |
459 |
if value: |
460 |
return value |
461 |
- return [], [] |
462 |
+ return {} |
463 |
|
464 |
def _visible(self, db, cpv, metadata): |
465 |
installed = db is self.vartree.dbapi |
466 |
@@ -699,8 +699,7 @@ |
467 |
from portage import manifest |
468 |
mf = manifest.Manifest( |
469 |
pkgdir, self.settings["DISTDIR"]) |
470 |
- fetchlist = self.portdb.getfetchlist(mycpv, |
471 |
- mysettings=self.settings, all=True)[1] |
472 |
+ fetchlist = self.portdb.getFetchMap(mycpv) |
473 |
try: |
474 |
mysum[0] = mf.getDistfilesSize(fetchlist) |
475 |
except KeyError, e: |
476 |
@@ -1413,7 +1412,7 @@ |
477 |
class Blocker(Task): |
478 |
|
479 |
__hash__ = Task.__hash__ |
480 |
- __slots__ = ("root", "atom", "cp", "satisfied") |
481 |
+ __slots__ = ("root", "atom", "cp", "eapi", "satisfied") |
482 |
|
483 |
def __init__(self, **kwargs): |
484 |
Task.__init__(self, **kwargs) |
485 |
@@ -1423,7 +1422,7 @@ |
486 |
hash_key = getattr(self, "_hash_key", None) |
487 |
if hash_key is None: |
488 |
self._hash_key = \ |
489 |
- ("blocks", self.root, self.atom) |
490 |
+ ("blocks", self.root, self.atom, self.eapi) |
491 |
return self._hash_key |
492 |
|
493 |
class Package(Task): |
494 |
@@ -4411,7 +4410,9 @@ |
495 |
return 1 |
496 |
# The blocker applies to the root where |
497 |
# the parent is or will be installed. |
498 |
- blocker = Blocker(atom=dep.atom, root=dep.parent.root) |
499 |
+ blocker = Blocker(atom=dep.atom, |
500 |
+ eapi=dep.parent.metadata["EAPI"], |
501 |
+ root=dep.parent.root) |
502 |
self._blocker_parents.add(blocker, dep.parent) |
503 |
return 1 |
504 |
dep_pkg, existing_node = self._select_package(dep.root, dep.atom, |
505 |
@@ -4669,15 +4670,14 @@ |
506 |
for atom in selected_atoms: |
507 |
try: |
508 |
|
509 |
- blocker = atom.startswith("!") |
510 |
- if blocker: |
511 |
- atom = atom[1:] |
512 |
+ atom = portage.dep.Atom(atom) |
513 |
+ |
514 |
mypriority = dep_priority.copy() |
515 |
- if not blocker and vardb.match(atom): |
516 |
+ if not atom.blocker and vardb.match(atom): |
517 |
mypriority.satisfied = True |
518 |
|
519 |
if not self._add_dep(Dependency(atom=atom, |
520 |
- blocker=blocker, depth=depth, parent=pkg, |
521 |
+ blocker=atom.blocker, depth=depth, parent=pkg, |
522 |
priority=mypriority, root=dep_root), |
523 |
allow_unsatisfied=allow_unsatisfied): |
524 |
return 0 |
525 |
@@ -5833,7 +5833,7 @@ |
526 |
except KeyError: |
527 |
pass |
528 |
if blockers is not None: |
529 |
- blockers = set("!" + blocker.atom \ |
530 |
+ blockers = set(str(blocker.atom) \ |
531 |
for blocker in blockers) |
532 |
|
533 |
# If this node has any blockers, create a "nomerge" |
534 |
@@ -5911,7 +5911,8 @@ |
535 |
blocker_cache.BlockerData(counter, blocker_atoms) |
536 |
if blocker_atoms: |
537 |
for myatom in blocker_atoms: |
538 |
- blocker = Blocker(atom=myatom[1:], root=myroot) |
539 |
+ blocker = Blocker(atom=portage.dep.Atom(myatom), |
540 |
+ eapi=pkg.metadata["EAPI"], root=myroot) |
541 |
self._blocker_parents.add(blocker, pkg) |
542 |
for cpv in stale_cache: |
543 |
del blocker_cache[cpv] |
544 |
@@ -5930,7 +5931,7 @@ |
545 |
self.spinner.update() |
546 |
root_config = self.roots[blocker.root] |
547 |
virtuals = root_config.settings.getvirtuals() |
548 |
- mytype, myroot, mydep = blocker |
549 |
+ myroot = blocker.root |
550 |
initial_db = self.trees[myroot]["vartree"].dbapi |
551 |
final_db = self.mydbapi[myroot] |
552 |
|
553 |
@@ -6401,7 +6402,18 @@ |
554 |
if self.digraph.contains(inst_pkg): |
555 |
continue |
556 |
|
557 |
- if running_root == task.root: |
558 |
+ forbid_overlap = False |
559 |
+ heuristic_overlap = False |
560 |
+ for blocker in myblocker_uninstalls.parent_nodes(task): |
561 |
+ if blocker.eapi in ("0", "1"): |
562 |
+ heuristic_overlap = True |
563 |
+ elif blocker.atom.blocker.overlap.forbid: |
564 |
+ forbid_overlap = True |
565 |
+ break |
566 |
+ if forbid_overlap and running_root == task.root: |
567 |
+ continue |
568 |
+ |
569 |
+ if heuristic_overlap and running_root == task.root: |
570 |
# Never uninstall sys-apps/portage or it's essential |
571 |
# dependencies, except through replacement. |
572 |
try: |
573 |
@@ -6601,7 +6613,8 @@ |
574 |
# will be temporarily installed simultaneously. |
575 |
for blocker in solved_blockers: |
576 |
retlist.append(Blocker(atom=blocker.atom, |
577 |
- root=blocker.root, satisfied=True)) |
578 |
+ root=blocker.root, eapi=blocker.eapi, |
579 |
+ satisfied=True)) |
580 |
|
581 |
unsolvable_blockers = set(self._unsolvable_blockers.leaf_nodes()) |
582 |
for node in myblocker_uninstalls.root_nodes(): |
583 |
@@ -6970,7 +6983,7 @@ |
584 |
if x.satisfied: |
585 |
counters.blocks_satisfied += 1 |
586 |
resolved = portage.key_expand( |
587 |
- pkg_key, mydb=vardb, settings=pkgsettings) |
588 |
+ str(x.atom).lstrip("!"), mydb=vardb, settings=pkgsettings) |
589 |
if "--columns" in self.myopts and "--quiet" in self.myopts: |
590 |
addl += " " + colorize(blocker_style, resolved) |
591 |
else: |
592 |
@@ -6983,7 +6996,7 @@ |
593 |
if resolved!=x[2]: |
594 |
addl += colorize(blocker_style, |
595 |
" (\"%s\" is blocking %s)") % \ |
596 |
- (pkg_key, block_parents) |
597 |
+ (str(x.atom).lstrip("!"), block_parents) |
598 |
else: |
599 |
addl += colorize(blocker_style, |
600 |
" (is blocking %s)") % block_parents |
601 |
@@ -13595,10 +13608,15 @@ |
602 |
print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n") |
603 |
break |
604 |
|
605 |
+ root_config = trees[settings["ROOT"]]["root_config"] |
606 |
+ if myaction == "list-sets": |
607 |
+ sys.stdout.write("".join("%s\n" % s for s in sorted(root_config.sets))) |
608 |
+ sys.stdout.flush() |
609 |
+ return os.EX_OK |
610 |
+ |
611 |
# only expand sets for actions taking package arguments |
612 |
oldargs = myfiles[:] |
613 |
if myaction in ("clean", "config", "depclean", "info", "prune", "unmerge", None): |
614 |
- root_config = trees[settings["ROOT"]]["root_config"] |
615 |
setconfig = root_config.setconfig |
616 |
# display errors that occured while loading the SetConfig instance |
617 |
for e in setconfig.errors: |
618 |
@@ -13840,8 +13858,6 @@ |
619 |
"not support '--pretend'.\n") % myaction) |
620 |
return 1 |
621 |
|
622 |
- root_config = trees[settings["ROOT"]]["root_config"] |
623 |
- |
624 |
if "sync" == myaction: |
625 |
return action_sync(settings, trees, mtimedb, myopts, myaction) |
626 |
elif "metadata" == myaction: |
627 |
|
628 |
Modified: main/branches/prefix/pym/_emerge/help.py |
629 |
=================================================================== |
630 |
--- main/branches/prefix/pym/_emerge/help.py 2008-09-27 16:00:06 UTC (rev 11569) |
631 |
+++ main/branches/prefix/pym/_emerge/help.py 2008-09-27 16:03:31 UTC (rev 11570) |
632 |
@@ -20,7 +20,7 @@ |
633 |
print " [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + " ]" |
634 |
print " [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ] [ "+green("--oneshot")+" ]" |
635 |
print " [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]" |
636 |
- print bold("Actions:")+" [ "+green("--clean")+" | "+green("--depclean")+" | "+green("--prune")+" | "+green("--regen")+" | "+green("--search")+" | "+green("--unmerge")+" ]" |
637 |
+ print bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]" |
638 |
|
639 |
def help(myaction,myopts,havecolor=1): |
640 |
# TODO: Implement a wrap() that accounts for console color escape codes. |
641 |
@@ -112,6 +112,12 @@ |
642 |
print " make.{conf,globals,defaults} and the environment show up if" |
643 |
print " run with the '--verbose' flag." |
644 |
print |
645 |
+ print " " + green("--list-sets") |
646 |
+ paragraph = "Displays a list of available package sets." |
647 |
+ |
648 |
+ for line in wrap(paragraph, desc_width): |
649 |
+ print desc_indent + line |
650 |
+ print |
651 |
print " "+green("--metadata") |
652 |
print " Transfers metadata cache from ${PORTDIR}/metadata/cache/ to" |
653 |
print " /var/cache/edb/dep/ as is normally done on the tail end of an" |
654 |
|
655 |
Modified: main/branches/prefix/pym/portage/__init__.py |
656 |
=================================================================== |
657 |
--- main/branches/prefix/pym/portage/__init__.py 2008-09-27 16:00:06 UTC (rev 11569) |
658 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-09-27 16:03:31 UTC (rev 11570) |
659 |
@@ -3507,11 +3507,19 @@ |
660 |
else: |
661 |
locations = mymirrors |
662 |
|
663 |
+ file_uri_tuples = [] |
664 |
+ if isinstance(myuris, dict): |
665 |
+ for myfile, uri_set in myuris.iteritems(): |
666 |
+ for myuri in uri_set: |
667 |
+ file_uri_tuples.append((myfile, myuri)) |
668 |
+ else: |
669 |
+ for myuri in myuris: |
670 |
+ file_uri_tuples.append((os.path.basename(myuri), myuri)) |
671 |
+ |
672 |
filedict={} |
673 |
primaryuri_indexes={} |
674 |
primaryuri_dict = {} |
675 |
- for myuri in myuris: |
676 |
- myfile=os.path.basename(myuri) |
677 |
+ for myfile, myuri in file_uri_tuples: |
678 |
if myfile not in filedict: |
679 |
filedict[myfile]=[] |
680 |
for y in range(0,len(locations)): |
681 |
@@ -4170,11 +4178,8 @@ |
682 |
doebuild_environment(myebuild, "fetch", |
683 |
mysettings["ROOT"], fetch_settings, |
684 |
debug, 1, myportdb) |
685 |
- alluris, aalist = myportdb.getfetchlist( |
686 |
- cpv, mytree=mytree, all=True, |
687 |
- mysettings=fetch_settings) |
688 |
- myuris = [uri for uri in alluris \ |
689 |
- if os.path.basename(uri) == myfile] |
690 |
+ uri_map = myportdb.getFetchMap(cpv, mytree=mytree) |
691 |
+ myuris = {myfile:uri_map[myfile]} |
692 |
fetch_settings["A"] = myfile # for use by pkg_nofetch() |
693 |
if fetch(myuris, fetch_settings): |
694 |
success = True |
695 |
@@ -4211,8 +4216,7 @@ |
696 |
writemsg_stdout(" digest.assumed" + portage.output.colorize("WARN", |
697 |
str(len(auto_assumed)).rjust(18)) + "\n") |
698 |
for pkg_key in pkgs: |
699 |
- fetchlist = myportdb.getfetchlist(pkg_key, |
700 |
- mysettings=mysettings, all=True, mytree=mytree)[1] |
701 |
+ fetchlist = myportdb.getFetchMap(pkg_key, mytree=mytree) |
702 |
pv = pkg_key.split("/")[1] |
703 |
for filename in auto_assumed: |
704 |
if filename in fetchlist: |
705 |
@@ -5628,11 +5632,10 @@ |
706 |
# Make sure we get the correct tree in case there are overlays. |
707 |
mytree = os.path.realpath( |
708 |
os.path.dirname(os.path.dirname(mysettings["O"]))) |
709 |
+ useflags = mysettings["PORTAGE_USE"].split() |
710 |
try: |
711 |
- newuris, alist = mydbapi.getfetchlist( |
712 |
- mycpv, mytree=mytree, mysettings=mysettings) |
713 |
- alluris, aalist = mydbapi.getfetchlist( |
714 |
- mycpv, mytree=mytree, all=True, mysettings=mysettings) |
715 |
+ alist = mydbapi.getFetchMap(mycpv, useflags=useflags, mytree=mytree) |
716 |
+ aalist = mydbapi.getFetchMap(mycpv, mytree=mytree) |
717 |
except portage.exception.InvalidDependString, e: |
718 |
writemsg("!!! %s\n" % str(e), noiselevel=-1) |
719 |
writemsg("!!! Invalid SRC_URI for '%s'.\n" % mycpv, noiselevel=-1) |
720 |
@@ -5641,26 +5644,11 @@ |
721 |
mysettings["A"] = " ".join(alist) |
722 |
mysettings["AA"] = " ".join(aalist) |
723 |
if ("mirror" in features) or fetchall: |
724 |
- fetchme = alluris[:] |
725 |
- checkme = aalist[:] |
726 |
- elif mydo == "digest": |
727 |
- fetchme = alluris[:] |
728 |
- checkme = aalist[:] |
729 |
- # Skip files that we already have digests for. |
730 |
- mf = Manifest(mysettings["O"], mysettings["DISTDIR"]) |
731 |
- mydigests = mf.getTypeDigests("DIST") |
732 |
- required_hash_types = set() |
733 |
- required_hash_types.add("size") |
734 |
- required_hash_types.add(portage.const.MANIFEST2_REQUIRED_HASH) |
735 |
- for filename, hashes in mydigests.iteritems(): |
736 |
- if not required_hash_types.difference(hashes): |
737 |
- checkme = [i for i in checkme if i != filename] |
738 |
- fetchme = [i for i in fetchme \ |
739 |
- if os.path.basename(i) != filename] |
740 |
- del filename, hashes |
741 |
+ fetchme = aalist |
742 |
+ checkme = aalist |
743 |
else: |
744 |
- fetchme = newuris[:] |
745 |
- checkme = alist[:] |
746 |
+ fetchme = alist |
747 |
+ checkme = alist |
748 |
|
749 |
if mydo == "fetch": |
750 |
# Files are already checked inside fetch(), |
751 |
@@ -6919,8 +6907,7 @@ |
752 |
self.portdb = mydbapi |
753 |
def __getitem__(self, pkg_key): |
754 |
"""Returns the complete fetch list for a given package.""" |
755 |
- return self.portdb.getfetchlist(pkg_key, mysettings=self.settings, |
756 |
- all=True, mytree=self.mytree)[1] |
757 |
+ return self.portdb.getFetchMap(pkg_key, mytree=self.mytree).keys() |
758 |
def __contains__(self, cpv): |
759 |
return cpv in self.keys() |
760 |
def has_key(self, pkg_key): |
761 |
|
762 |
Modified: main/branches/prefix/pym/portage/dbapi/porttree.py |
763 |
=================================================================== |
764 |
--- main/branches/prefix/pym/portage/dbapi/porttree.py 2008-09-27 16:00:06 UTC (rev 11569) |
765 |
+++ main/branches/prefix/pym/portage/dbapi/porttree.py 2008-09-27 16:03:31 UTC (rev 11570) |
766 |
@@ -2,29 +2,84 @@ |
767 |
# Distributed under the terms of the GNU General Public License v2 |
768 |
# $Id$ |
769 |
|
770 |
+__all__ = ["portdbapi", "close_portdbapi_caches", "portagetree"] |
771 |
+ |
772 |
from portage.cache.cache_errors import CacheError |
773 |
from portage.cache.mappings import slot_dict_class |
774 |
from portage.const import REPO_NAME_LOC |
775 |
from portage.data import portage_gid, secpass |
776 |
from portage.dbapi import dbapi |
777 |
-from portage.dep import use_reduce, paren_reduce, dep_getslot, dep_getkey, \ |
778 |
- match_from_list, match_to_list, remove_slot |
779 |
-from portage.exception import OperationNotPermitted, PortageException, \ |
780 |
+from portage.dep import use_reduce, paren_reduce, dep_getkey, match_from_list |
781 |
+from portage.exception import PortageException, \ |
782 |
UntrustedSignature, SecurityViolation, InvalidSignature, MissingSignature, \ |
783 |
FileNotFound, InvalidDependString, InvalidPackageName |
784 |
from portage.manifest import Manifest |
785 |
-from portage.output import red |
786 |
-from portage.util import ensure_dirs, writemsg, apply_recursive_permissions |
787 |
-from portage.versions import pkgcmp, pkgsplit, catpkgsplit, best, ver_regexp |
788 |
+from portage.util import ensure_dirs, writemsg |
789 |
+from portage.versions import pkgsplit, catpkgsplit, best, ver_regexp |
790 |
|
791 |
import portage.gpg, portage.checksum |
792 |
|
793 |
-from portage import eclass_cache, auxdbkeys, auxdbkeylen, doebuild, flatten, \ |
794 |
+from portage import eclass_cache, auxdbkeys, doebuild, flatten, \ |
795 |
listdir, dep_expand, eapi_is_supported, key_expand, dep_check |
796 |
|
797 |
-import os, re, stat, sys |
798 |
+import os, stat |
799 |
from itertools import izip |
800 |
|
801 |
+def _src_uri_validate(cpv, eapi, src_uri): |
802 |
+ """ |
803 |
+ Take a SRC_URI structure as returned by paren_reduce or use_reduce |
804 |
+ and validate it. Raises InvalidDependString if a problem is detected, |
805 |
+ such as missing operand for a -> operator. |
806 |
+ """ |
807 |
+ uri = None |
808 |
+ operator = None |
809 |
+ for x in src_uri: |
810 |
+ if isinstance(x, list): |
811 |
+ if operator is not None: |
812 |
+ raise portage.exception.InvalidDependString( |
813 |
+ ("getFetchMap(): '%s' SRC_URI arrow missing " + \ |
814 |
+ "right operand") % (cpv,)) |
815 |
+ uri = None |
816 |
+ _src_uri_validate(cpv, eapi, x) |
817 |
+ continue |
818 |
+ if x[:-1] == "?": |
819 |
+ if operator is not None: |
820 |
+ raise portage.exception.InvalidDependString( |
821 |
+ ("getFetchMap(): '%s' SRC_URI arrow missing " + \ |
822 |
+ "right operand") % (cpv,)) |
823 |
+ uri = None |
824 |
+ continue |
825 |
+ if uri is None: |
826 |
+ if x == "->": |
827 |
+ raise portage.exception.InvalidDependString( |
828 |
+ ("getFetchMap(): '%s' SRC_URI arrow missing " + \ |
829 |
+ "left operand") % (cpv,)) |
830 |
+ uri = x |
831 |
+ continue |
832 |
+ if x == "->": |
833 |
+ if eapi in ("0", "1"): |
834 |
+ raise portage.exception.InvalidDependString( |
835 |
+ ("getFetchMap(): '%s' SRC_URI arrows are not " + \ |
836 |
+ "supported with EAPI='%s'") % (cpv, eapi)) |
837 |
+ operator = x |
838 |
+ continue |
839 |
+ if operator is not None: |
840 |
+ if "/" in x: |
841 |
+ raise portage.exception.InvalidDependString( |
842 |
+ ("getFetchMap(): '%s' SRC_URI '/' character in " + \ |
843 |
+ "file name: '%s'") % (cpv, x)) |
844 |
+ if x[-1] == "?": |
845 |
+ raise portage.exception.InvalidDependString( |
846 |
+ ("getFetchMap(): '%s' SRC_URI arrow missing " + \ |
847 |
+ "right operand") % (cpv,)) |
848 |
+ uri = None |
849 |
+ operator = None |
850 |
+ |
851 |
+ if operator is not None: |
852 |
+ raise portage.exception.InvalidDependString( |
853 |
+ "getFetchMap(): '%s' SRC_URI arrow missing right operand" % \ |
854 |
+ (cpv,)) |
855 |
+ |
856 |
class portdbapi(dbapi): |
857 |
"""this tree will scan a portage directory located at root (passed to init)""" |
858 |
portdbapi_instances = [] |
859 |
@@ -450,9 +505,24 @@ |
860 |
|
861 |
return returnme |
862 |
|
863 |
- def getfetchlist(self, mypkg, useflags=None, mysettings=None, all=0, mytree=None): |
864 |
- if mysettings is None: |
865 |
- mysettings = self.doebuild_settings |
866 |
+ def getFetchMap(self, mypkg, useflags=None, mytree=None): |
867 |
+ """ |
868 |
+ Get the SRC_URI metadata as a dict which maps each file name to a |
869 |
+ set of alternative URIs. |
870 |
+ |
871 |
+ @param mypkg: cpv for an ebuild |
872 |
+ @type mypkg: String |
873 |
+ @param useflags: a collection of enabled USE flags, for evaluation of |
874 |
+ conditionals |
875 |
+ @type useflags: set, or None to enable all conditionals |
876 |
+ @param mytree: The canonical path of the tree in which the ebuild |
877 |
+ is located, or None for automatic lookup |
878 |
+ @type mypkg: String |
879 |
+ @returns: A dict which maps each file name to a set of alternative |
880 |
+ URIs. |
881 |
+ @rtype: dict |
882 |
+ """ |
883 |
+ |
884 |
try: |
885 |
eapi, myuris = self.aux_get(mypkg, |
886 |
["EAPI", "SRC_URI"], mytree=mytree) |
887 |
@@ -460,34 +530,65 @@ |
888 |
# Convert this to an InvalidDependString exception since callers |
889 |
# already handle it. |
890 |
raise portage.exception.InvalidDependString( |
891 |
- "getfetchlist(): aux_get() error reading "+mypkg+"; aborting.") |
892 |
+ "getFetchMap(): aux_get() error reading "+mypkg+"; aborting.") |
893 |
|
894 |
if not eapi_is_supported(eapi): |
895 |
# Convert this to an InvalidDependString exception |
896 |
# since callers already handle it. |
897 |
raise portage.exception.InvalidDependString( |
898 |
- "getfetchlist(): '%s' has unsupported EAPI: '%s'" % \ |
899 |
+ "getFetchMap(): '%s' has unsupported EAPI: '%s'" % \ |
900 |
(mypkg, eapi.lstrip("-"))) |
901 |
|
902 |
- if not all and useflags is None: |
903 |
+ myuris = paren_reduce(myuris) |
904 |
+ _src_uri_validate(mypkg, eapi, myuris) |
905 |
+ myuris = use_reduce(myuris, uselist=useflags, |
906 |
+ matchall=(useflags is None)) |
907 |
+ myuris = flatten(myuris) |
908 |
+ |
909 |
+ uri_map = {} |
910 |
+ |
911 |
+ myuris.reverse() |
912 |
+ while myuris: |
913 |
+ uri = myuris.pop() |
914 |
+ if myuris and myuris[-1] == "->": |
915 |
+ operator = myuris.pop() |
916 |
+ distfile = myuris.pop() |
917 |
+ else: |
918 |
+ distfile = os.path.basename(uri) |
919 |
+ if not distfile: |
920 |
+ raise portage.exception.InvalidDependString( |
921 |
+ ("getFetchMap(): '%s' SRC_URI has no file " + \ |
922 |
+ "name: '%s'") % (mypkg, uri)) |
923 |
+ |
924 |
+ uri_set = uri_map.get(distfile) |
925 |
+ if uri_set is None: |
926 |
+ uri_set = set() |
927 |
+ uri_map[distfile] = uri_set |
928 |
+ uri_set.add(uri) |
929 |
+ uri = None |
930 |
+ operator = None |
931 |
+ |
932 |
+ return uri_map |
933 |
+ |
934 |
+ def getfetchlist(self, mypkg, useflags=None, mysettings=None, |
935 |
+ all=0, mytree=None): |
936 |
+ |
937 |
+ writemsg("!!! pordbapi.getfetchlist() is deprecated, " + \ |
938 |
+ "use getFetchMap() instead.\n", noiselevel=-1) |
939 |
+ |
940 |
+ if all: |
941 |
+ useflags = None |
942 |
+ elif useflags is None: |
943 |
+ if mysettings is None: |
944 |
+ mysettings = self.doebuild_settings |
945 |
mysettings.setcpv(mypkg, mydb=self) |
946 |
useflags = mysettings["PORTAGE_USE"].split() |
947 |
+ uri_map = self.getFetchMap(mypkg, useflags=useflags, mytree=mytree) |
948 |
+ uris = set() |
949 |
+ for uri_set in uri_map.itervalues(): |
950 |
+ uris.update(uri_set) |
951 |
+ return [list(uris), uri_map.keys()] |
952 |
|
953 |
- myurilist = paren_reduce(myuris) |
954 |
- myurilist = use_reduce(myurilist, uselist=useflags, matchall=all) |
955 |
- newuris = flatten(myurilist) |
956 |
- |
957 |
- myfiles = [] |
958 |
- for x in newuris: |
959 |
- mya = os.path.basename(x) |
960 |
- if not mya: |
961 |
- raise portage.exception.InvalidDependString( |
962 |
- "getfetchlist(): '%s' SRC_URI has no file name: '%s'" % \ |
963 |
- (mypkg, x)) |
964 |
- if not mya in myfiles: |
965 |
- myfiles.append(mya) |
966 |
- return [newuris, myfiles] |
967 |
- |
968 |
def getfetchsizes(self, mypkg, useflags=None, debug=0): |
969 |
# returns a filename:size dictionnary of remaining downloads |
970 |
myebuild = self.findname(mypkg) |
971 |
@@ -499,10 +600,7 @@ |
972 |
print "[empty/missing/bad digest]: "+mypkg |
973 |
return None |
974 |
filesdict={} |
975 |
- if useflags is None: |
976 |
- myuris, myfiles = self.getfetchlist(mypkg,all=1) |
977 |
- else: |
978 |
- myuris, myfiles = self.getfetchlist(mypkg,useflags=useflags) |
979 |
+ myfiles = self.getFetchMap(mypkg, useflags=useflags) |
980 |
#XXX: maybe this should be improved: take partial downloads |
981 |
# into account? check checksums? |
982 |
for myfile in myfiles: |
983 |
@@ -530,10 +628,12 @@ |
984 |
return filesdict |
985 |
|
986 |
def fetch_check(self, mypkg, useflags=None, mysettings=None, all=False): |
987 |
- if not useflags: |
988 |
+ if all: |
989 |
+ useflags = None |
990 |
+ elif useflags is None: |
991 |
if mysettings: |
992 |
useflags = mysettings["USE"].split() |
993 |
- myuri, myfiles = self.getfetchlist(mypkg, useflags=useflags, mysettings=mysettings, all=all) |
994 |
+ myfiles = self.getFetchMap(mypkg, useflags=useflags) |
995 |
myebuild = self.findname(mypkg) |
996 |
pkgdir = os.path.dirname(myebuild) |
997 |
mf = Manifest(pkgdir, self.mysettings["DISTDIR"]) |
998 |
|
999 |
Modified: main/branches/prefix/pym/portage/dep.py |
1000 |
=================================================================== |
1001 |
--- main/branches/prefix/pym/portage/dep.py 2008-09-27 16:00:06 UTC (rev 11569) |
1002 |
+++ main/branches/prefix/pym/portage/dep.py 2008-09-27 16:03:31 UTC (rev 11570) |
1003 |
@@ -489,14 +489,34 @@ |
1004 |
__slots__ = ("__weakref__", "blocker", "cp", "cpv", "operator", |
1005 |
"slot", "use") + _str_methods |
1006 |
|
1007 |
+ class _blocker(object): |
1008 |
+ __slots__ = ("overlap",) |
1009 |
+ |
1010 |
+ class _overlap(object): |
1011 |
+ __slots__ = ("forbid",) |
1012 |
+ |
1013 |
+ def __init__(self, forbid=False): |
1014 |
+ self.forbid = forbid |
1015 |
+ |
1016 |
+ def __init__(self, forbid_overlap=False): |
1017 |
+ self.overlap = self._overlap(forbid=forbid_overlap) |
1018 |
+ |
1019 |
def __init__(self, s): |
1020 |
if not isvalidatom(s, allow_blockers=True): |
1021 |
raise InvalidAtom(s) |
1022 |
for x in self._str_methods: |
1023 |
setattr(self, x, getattr(s, x)) |
1024 |
- self.blocker = "!" == s[:1] |
1025 |
- if self.blocker: |
1026 |
- s = s[1:] |
1027 |
+ |
1028 |
+ blocker = "!" == s[:1] |
1029 |
+ if blocker: |
1030 |
+ self.blocker = self._blocker(forbid_overlap=("!" == s[1:2])) |
1031 |
+ if self.blocker.overlap.forbid: |
1032 |
+ s = s[2:] |
1033 |
+ else: |
1034 |
+ s = s[1:] |
1035 |
+ else: |
1036 |
+ self.blocker = False |
1037 |
+ |
1038 |
self.cp = dep_getkey(s) |
1039 |
self.cpv = dep_getcpv(s) |
1040 |
self.slot = dep_getslot(s) |
1041 |
@@ -586,7 +606,10 @@ |
1042 |
if mydep and mydep[-1] == "*": |
1043 |
mydep = mydep[:-1] |
1044 |
if mydep and mydep[0] == "!": |
1045 |
- mydep = mydep[1:] |
1046 |
+ if mydep[1:2] == "!": |
1047 |
+ mydep = mydep[2:] |
1048 |
+ else: |
1049 |
+ mydep = mydep[1:] |
1050 |
if mydep[:2] in [">=", "<="]: |
1051 |
mydep = mydep[2:] |
1052 |
elif mydep[:1] in "=<>~": |
1053 |
@@ -720,8 +743,11 @@ |
1054 |
global _invalid_atom_chars_regexp |
1055 |
if _invalid_atom_chars_regexp.search(atom): |
1056 |
return 0 |
1057 |
- if allow_blockers and atom.startswith("!"): |
1058 |
- atom = atom[1:] |
1059 |
+ if allow_blockers and atom[:1] == "!": |
1060 |
+ if atom[1:2] == "!": |
1061 |
+ atom = atom[2:] |
1062 |
+ else: |
1063 |
+ atom = atom[1:] |
1064 |
|
1065 |
try: |
1066 |
use = dep_getusedeps(atom) |
1067 |
|
1068 |
Modified: main/branches/prefix/pym/portage/sets/__init__.py |
1069 |
=================================================================== |
1070 |
--- main/branches/prefix/pym/portage/sets/__init__.py 2008-09-27 16:00:06 UTC (rev 11569) |
1071 |
+++ main/branches/prefix/pym/portage/sets/__init__.py 2008-09-27 16:03:31 UTC (rev 11570) |
1072 |
@@ -65,7 +65,7 @@ |
1073 |
continue |
1074 |
for x in newsets: |
1075 |
if x in self.psets: |
1076 |
- self.errors.append("Redefinition of set '%s' (sections: '%s', '%s')" % (setname, self.psets[setname].creator, sname)) |
1077 |
+ self.errors.append("Redefinition of set '%s' (sections: '%s', '%s')" % (x, self.psets[x].creator, sname)) |
1078 |
newsets[x].creator = sname |
1079 |
if self.has_option(sname, "world-candidate") and not self.getboolean(sname, "world-candidate"): |
1080 |
newsets[x].world_candidate = False |
1081 |
|
1082 |
Modified: main/branches/prefix/pym/portage/sets/files.py |
1083 |
=================================================================== |
1084 |
--- main/branches/prefix/pym/portage/sets/files.py 2008-09-27 16:00:06 UTC (rev 11569) |
1085 |
+++ main/branches/prefix/pym/portage/sets/files.py 2008-09-27 16:03:31 UTC (rev 11570) |
1086 |
@@ -6,7 +6,7 @@ |
1087 |
import re |
1088 |
from itertools import chain |
1089 |
|
1090 |
-from portage.util import grabfile, write_atomic, ensure_dirs |
1091 |
+from portage.util import grabfile, write_atomic, ensure_dirs, normalize_path |
1092 |
from portage.const import PRIVATE_PATH, USER_CONFIG_PATH, EPREFIX_LSTRIP |
1093 |
from portage.locks import lockfile, unlockfile |
1094 |
from portage import portage_gid |
1095 |
@@ -122,12 +122,18 @@ |
1096 |
except KeyError: |
1097 |
raise SetConfigError("Could not find repository '%s'" % match.groupdict()["reponame"]) |
1098 |
if os.path.isdir(directory): |
1099 |
- for filename in os.listdir(directory): |
1100 |
- if filename.endswith(".metadata"): |
1101 |
- continue |
1102 |
- myname = name_pattern.replace("$name", filename) |
1103 |
- myname = myname.replace("${name}", filename) |
1104 |
- rValue[myname] = StaticFileSet(os.path.join(directory, filename), greedy=greedy, dbapi=trees["vartree"].dbapi) |
1105 |
+ directory = normalize_path(directory) |
1106 |
+ for parent, dirs, files in os.walk(directory): |
1107 |
+ for filename in files: |
1108 |
+ if filename.endswith(".metadata"): |
1109 |
+ continue |
1110 |
+ filename = os.path.join(parent, |
1111 |
+ filename)[1 + len(directory):] |
1112 |
+ myname = name_pattern.replace("$name", filename) |
1113 |
+ myname = myname.replace("${name}", filename) |
1114 |
+ rValue[myname] = StaticFileSet( |
1115 |
+ os.path.join(directory, filename), |
1116 |
+ greedy=greedy, dbapi=trees["vartree"].dbapi) |
1117 |
return rValue |
1118 |
multiBuilder = classmethod(multiBuilder) |
1119 |
|
1120 |
|
1121 |
Copied: main/branches/prefix/pym/portage/tests/dep/test_src_uri.py (from rev 11531, main/trunk/pym/portage/tests/dep/test_src_uri.py) |
1122 |
=================================================================== |
1123 |
--- main/branches/prefix/pym/portage/tests/dep/test_src_uri.py (rev 0) |
1124 |
+++ main/branches/prefix/pym/portage/tests/dep/test_src_uri.py 2008-09-27 16:03:31 UTC (rev 11570) |
1125 |
@@ -0,0 +1,34 @@ |
1126 |
+# Copyright 2008 Gentoo Foundation |
1127 |
+# Distributed under the terms of the GNU General Public License v2 |
1128 |
+# $Id$ |
1129 |
+ |
1130 |
+from portage.tests import TestCase |
1131 |
+from portage.dep import paren_reduce |
1132 |
+from portage.dbapi.porttree import _src_uri_validate |
1133 |
+from portage.exception import InvalidDependString |
1134 |
+ |
1135 |
+class SrcUri(TestCase): |
1136 |
+ |
1137 |
+ def testSrcUri(self): |
1138 |
+ |
1139 |
+ tests = [ |
1140 |
+ ( "0", "http://foo/bar -> blah.tbz2" , False ), |
1141 |
+ ( "1", "http://foo/bar -> blah.tbz2" , False ), |
1142 |
+ ( "2", "http://foo/bar -> blah.tbz2" , True ), |
1143 |
+ ( "2", "foo? ( http://foo/bar -> blah.tbz2 )" , True ), |
1144 |
+ ( "2", "http://foo/bar -> foo? ( ftp://foo/a )" , False ), |
1145 |
+ ( "2", "http://foo/bar -> bar.tbz2 foo? ( ftp://foo/a )" , True ), |
1146 |
+ ( "2", "http://foo/bar blah.tbz2 ->" , False ), |
1147 |
+ ( "2", "-> http://foo/bar blah.tbz2 )" , False ), |
1148 |
+ ( "2", "http://foo/bar ->" , False ), |
1149 |
+ ( "2", "foo? ( http://foo/bar -> ) blah.tbz2" , False ), |
1150 |
+ ( "2", "http://foo/bar -> foo/blah.tbz2" , False ), |
1151 |
+ ] |
1152 |
+ |
1153 |
+ for eapi, src_uri, valid in tests: |
1154 |
+ try: |
1155 |
+ _src_uri_validate("cat/pkg-1", eapi, paren_reduce(src_uri)) |
1156 |
+ except InvalidDependString: |
1157 |
+ self.assertEqual(valid, False) |
1158 |
+ else: |
1159 |
+ self.assertEqual(valid, True) |