Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9404 - in main/branches/prefix: bin man pym pym/_emerge pym/portage pym/portage/dbapi
Date: Sat, 01 Mar 2008 17:36:53
Message-Id: E1JVVdg-0002jk-9m@stork.gentoo.org
1 Author: grobian
2 Date: 2008-03-01 17:36:46 +0000 (Sat, 01 Mar 2008)
3 New Revision: 9404
4
5 Modified:
6 main/branches/prefix/bin/ebuild.sh
7 main/branches/prefix/bin/misc-functions.sh
8 main/branches/prefix/bin/repoman
9 main/branches/prefix/man/repoman.1
10 main/branches/prefix/pym/_emerge/__init__.py
11 main/branches/prefix/pym/portage/__init__.py
12 main/branches/prefix/pym/portage/dbapi/porttree.py
13 main/branches/prefix/pym/portage/manifest.py
14 main/branches/prefix/pym/portage/util.py
15 main/branches/prefix/pym/portage_compat_namespace.py
16 Log:
17 Merged from trunk 9386:9402
18
19 | 9387 | Bug #211554 - Replace references to config["USE"] with |
20 | zmedico | references to config["PORTAGE_USE"] (which is filtered for |
21 | | intersection with IUSE) so that dependency calculations at |
22 | | installation time are consistent with those at depclean |
23 | | time. |
24
25 | 9388 | Don't filter USE flags in emerge --info output. |
26 | zmedico | |
27
28 | 9389 | Bug #211294 - Make repoman ignore profiles labeled with |
29 | zmedico | anything other than "stable" or "dev" in profiles.desc so |
30 | | that we can extend it with new labels such as "exp". |
31
32 | 9391 | Revert r9387 (the fix for bug #211554) until I figure out |
33 | zmedico | why it's messing up USE calculations for world updates. |
34
35 | 9392 | Bug #211554 - Replace references to config["USE"] with |
36 | zmedico | references to config["PORTAGE_USE"] (which is filtered for |
37 | | intersection with IUSE) so that dependency calculations at |
38 | | installation time are consistent with those at depclean |
39 | | time. |
40
41 | 9393 | Fix some references to config["PORTAGE_USE"] to prevent |
42 | zmedico | potential KeyErrors. |
43
44 | 9394 | separate different messages with newlines in post-emerge |
45 | genone | output |
46
47 | 9395 | remove obsolete information from preserve-libs post-emerge |
48 | genone | message |
49
50 | 9397 | supress stupid line echo in deprecation notices |
51 | genone | |
52
53 | 9398 | remove code for manifest1 support |
54 | genone | |
55
56 | 9399 | In the suidctl code, move the addwrite call out of the loop. |
57 | zmedico | Thanks to ferringb. |
58
59 | 9400 | Make 'import portage' statements more tolerant to broken |
60 | zmedico | source statements in make.conf since exceptions thrown |
61 | | during 'import portage' statements can practically render |
62 | | the api unusable for api consumers. Thanks to lxnay for the |
63 | | suggestion. |
64
65 | 9402 | Bug #211949 - Make filter_readonly_variables() remove any |
66 | zmedico | variables with names containing a hyphen since bash does not |
67 | | allow them. |
68
69
70 Modified: main/branches/prefix/bin/ebuild.sh
71 ===================================================================
72 --- main/branches/prefix/bin/ebuild.sh 2008-03-01 08:31:39 UTC (rev 9403)
73 +++ main/branches/prefix/bin/ebuild.sh 2008-03-01 17:36:46 UTC (rev 9404)
74 @@ -1410,9 +1410,13 @@
75
76 # @FUNCTION: filter_readonly_variables
77 # @DESCRIPTION: [--filter-sandbox] [--allow-extra-vars]
78 -# Read an environment from stdin and echo to stdout while filtering readonly
79 -# variables.
80 +# Read an environment from stdin and echo to stdout while filtering variables
81 +# with names that are known to cause interference:
82 #
83 +# * some specific variables for which bash does not allow assignment
84 +# * any variables with names containing a hyphen (not allowed by bash)
85 +# * some specific variables that affect portage or sandbox behavior
86 +#
87 # --filter-sandbox causes all SANDBOX_* variables to be filtered, which
88 # is only desired in certain cases, such as during preprocessing or when
89 # saving environment.bz2 for a binary or installed package.
90 @@ -1440,7 +1444,7 @@
91 SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
92 SANDBOX_LOG SANDBOX_ON"
93 filtered_vars="${readonly_bash_vars} ${READONLY_PORTAGE_VARS}
94 - BASH_[_[:alnum:]]* PATH"
95 + BASH_[_[:alnum:]]* PATH [-_[:alnum:]]*-[-_[:alnum:]]*"
96 if hasq --filter-sandbox $* ; then
97 filtered_vars="${filtered_vars} SANDBOX_[_[:alnum:]]*"
98 else
99
100 Modified: main/branches/prefix/bin/misc-functions.sh
101 ===================================================================
102 --- main/branches/prefix/bin/misc-functions.sh 2008-03-01 08:31:39 UTC (rev 9403)
103 +++ main/branches/prefix/bin/misc-functions.sh 2008-03-01 17:36:46 UTC (rev 9404)
104 @@ -588,6 +588,10 @@
105 if hasq suidctl $FEATURES; then
106 #TODO: not sure if PORTAGE_CONFIGROOT includes EPREFIX
107 sfconf=${PORTAGE_CONFIGROOT}etc/portage/suidctl.conf
108 + # sandbox prevents us from writing directly
109 + # to files outside of the sandbox, but this
110 + # can easly be bypassed using the addwrite() function
111 + addwrite "${sfconf}"
112 vecho ">>> Performing suid scan in ${D}"
113 #note not space-safe
114 for i in $(find "${ED}" -type f \( -perm -4000 -o -perm -2000 \) ); do
115 @@ -602,10 +606,6 @@
116 ls_ret=$(ls -ldh "${i}")
117 chmod ugo-s "${i}"
118 grep "^#${i/${D}}$" "${sfconf}" > /dev/null || {
119 - # sandbox prevents us from writing directly
120 - # to files outside of the sandbox, but this
121 - # can easly be bypassed using the addwrite() function
122 - addwrite "${sfconf}"
123 vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
124 echo "## ${ls_ret%${D}*}${ls_ret#*${D}}" >> "${sfconf}"
125 echo "#${i/${D}}" >> "${sfconf}"
126
127 Modified: main/branches/prefix/bin/repoman
128 ===================================================================
129 --- main/branches/prefix/bin/repoman 2008-03-01 08:31:39 UTC (rev 9403)
130 +++ main/branches/prefix/bin/repoman 2008-03-01 17:36:46 UTC (rev 9404)
131 @@ -234,13 +234,6 @@
132 qahelp={
133 "CVS/Entries.IO_error":"Attempting to commit, and an IO error was encountered access the Entries file",
134 "desktop.invalid":"desktop-file-validate reports errors in a *.desktop file",
135 - "digest.partial":"Digest files do not contain all corresponding URI elements",
136 - "digest.assumed":"Existing digest must be assumed correct (Package level only)",
137 - "digestentry.unused":"Digest/Manifest entry has no matching SRC_URI entry",
138 - "digest.fail":"Digest does not match the specified local file",
139 - "digest.stray":"Digest files that do not have a corresponding ebuild",
140 - "digest.missing":"Digest files that are missing (ebuild exists, digest doesn't)",
141 - "digest.unmatch":"Digests which are incomplete (please check if your USE/ARCH includes all files)",
142 "ebuild.invalidname":"Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)",
143 "ebuild.namenomatch":"Ebuild files that do not have the same name as their parent directory",
144 "changelog.missing":"Missing ChangeLog files",
145 @@ -313,9 +306,6 @@
146 "ebuild.allmasked",
147 "ebuild.nesteddie",
148 "desktop.invalid",
149 -"digest.assumed",
150 -"digest.missing",
151 -"digestentry.unused",
152 "DEPEND.badmasked","RDEPEND.badmasked","PDEPEND.badmasked",
153 "DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev",
154 "DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
155 @@ -544,7 +534,6 @@
156 logging.fatal("Couldn't read KEYWORDS from arch.list")
157 sys.exit(1)
158
159 -manifest1_compat = False
160 if portdir_overlay != portdir:
161 kwlist.update(portage.grabfile(
162 os.path.join(portdir_overlay, "profiles", "arch.list")))
163 @@ -782,9 +771,6 @@
164 has_filesdir = True
165 if not os.path.isdir(os.path.join(checkdir, "files")):
166 has_filesdir = False
167 - if manifest1_compat:
168 - stats["filedir.missing"] += 1
169 - fails["filedir.missing"].append(checkdir)
170
171 if isVcs:
172 try:
173 @@ -904,72 +890,7 @@
174
175 if os.path.exists(checkdir+"/files"):
176 filesdirlist=os.listdir(checkdir+"/files")
177 - if manifest1_compat:
178 - for y in filesdirlist:
179 - if not y.startswith("digest-"):
180 - continue
181 - relative_path = os.path.join(x, "files", y)
182 - full_path = os.path.join(repodir, relative_path)
183 - if stat.S_IMODE(os.stat(full_path).st_mode) & 0111:
184 - stats["file.executable"] += 1
185 - fails["file.executable"].append(x+"/files/"+y)
186 -
187 - mykey = catdir + "/" + y[7:]
188 - if y[7:] not in ebuildlist:
189 - #stray digest
190 - if options.mode == "fix":
191 - if vcs == "cvs":
192 - vcsrm="cvs rm -f"
193 - if vcs == "svn":
194 - vcsrm="svn rm --force"
195 - if options.pretend:
196 - print "(cd "+repodir+"/"+x+"/files; "+vcsrm+" "+y+")"
197 - else:
198 - os.system("(cd "+repodir+"/"+x+"/files; "+vcsrm+" "+y+")")
199 - else:
200 - stats["digest.stray"]=stats["digest.stray"]+1
201 - fails["digest.stray"].append(x+"/files/"+y)
202 - else:
203 - # We have an ebuild
204 - try:
205 - myuris, myfiles = portdb.getfetchlist(mykey, all=True)
206 - except portage.exception.InvalidDependString, e:
207 - # Already handled above.
208 - continue
209
210 - uri_dict = {}
211 - for myu in myuris:
212 - myubn = os.path.basename(myu)
213 - if myubn not in uri_dict:
214 - uri_dict[myubn] = [myu]
215 - else:
216 - uri_dict[myubn] += [myu]
217 -
218 - for myf in uri_dict:
219 - myff = repoman_settings["DISTDIR"] + "/" + myf
220 - if not mydigests.has_key(myf):
221 - uri_settings = portage.config(clone=repoman_settings)
222 - if options.mode == "fix":
223 - if not portage.fetch(uri_dict[myf], uri_settings):
224 - stats["digest.unmatch"] += 1
225 - fails["digest.unmatch"].append(y+"::"+myf)
226 - else:
227 - eb_name = portdb.findname2(mykey)[0]
228 - portage.doebuild(eb_name, "digest", "/",
229 - uri_settings, tree="porttree",
230 - mydbapi=portdb)
231 - else:
232 - stats["digest.partial"] += 1
233 - fails["digest.partial"].append(y+"::"+myf)
234 - elif "assume-digests" not in repoman_settings.features:
235 - if os.path.exists(myff):
236 - if not portage.checksum.verify_all(myff, mydigests[myf])[0]:
237 - stats["digest.fail"] += 1
238 - fails["digest.fail"].append(y+"::"+myf)
239 - elif repolevel == 3:
240 - stats["digest.assumed"] += 1
241 - fails["digest.assumed"].append(y+"::"+myf)
242 -
243 # recurse through files directory
244 # use filesdirlist as a stack, appending directories as needed so people can't hide > 20k files in a subdirectory.
245 while filesdirlist:
246 @@ -1061,20 +982,6 @@
247 if y in dadded:
248 stats["ebuild.disjointed"]=stats["ebuild.disjointed"]+1
249 fails["ebuild.disjointed"].append(x+"/"+y+".ebuild")
250 - if manifest1_compat and \
251 - not os.path.exists(os.path.join(checkdir, "files", "digest-"+y)):
252 - if options.mode == "fix":
253 - if options.pretend:
254 - print "You will need to run:"
255 - print " "+portage.const.PORTAGE_BASE+"/bin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest"
256 - else:
257 - retval=os.system(portage.const.PORTAGE_BASE+"/bin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest")
258 - if retval:
259 - print "!!! Exiting on ebuild digest (shell) error code:",retval
260 - sys.exit(retval)
261 - else:
262 - stats["digest.missing"]=stats["digest.missing"]+1
263 - fails["digest.missing"].append(x+"/files/digest-"+y)
264 myesplit=portage.pkgsplit(y)
265 if myesplit is None or myesplit[0] != x.split("/")[-1]:
266 stats["ebuild.invalidname"]=stats["ebuild.invalidname"]+1
267 @@ -1361,6 +1268,9 @@
268
269 for prof in profiles[arch]:
270
271 + if prof[1] not in ("stable", "dev"):
272 + continue
273 +
274 profdir = portdir+"/profiles/"+prof[0]
275
276 if prof[0] in arch_caches:
277 @@ -1558,20 +1468,6 @@
278 if options.pretend:
279 print green("RepoMan sez:"), "\"So, you want to play it safe. Good call.\"\n"
280
281 - if fails["digest.missing"]:
282 - print green("Creating missing digests...")
283 - for x in fails["digest.missing"]:
284 - xs=x.split("/")
285 - del xs[-2]
286 - myeb="/".join(xs[:-1])+"/"+xs[-1][7:]
287 - if options.pretend:
288 - print "(ebuild "+portdir+"/"+myeb+".ebuild digest)"
289 - else:
290 - retval=os.system("ebuild "+portdir+"/"+myeb+".ebuild digest")
291 - if retval:
292 - print "!!! Exiting on ebuild digest (shell) error code:",retval
293 - sys.exit(retval)
294 -
295 if isVcs and vcs == "cvs":
296 try:
297 myvcstree=portage.cvstree.getentries("./",recursive=1)
298
299 Modified: main/branches/prefix/man/repoman.1
300 ===================================================================
301 --- main/branches/prefix/man/repoman.1 2008-03-01 08:31:39 UTC (rev 9403)
302 +++ main/branches/prefix/man/repoman.1 2008-03-01 17:36:46 UTC (rev 9404)
303 @@ -174,24 +174,6 @@
304 .B digest.assumed
305 Existing digest must be assumed correct (Package level only)
306 .TP
307 -.B digest.fail
308 -Digest does not match the specified local file
309 -.TP
310 -.B digest.missing
311 -Digest files that are missing (ebuild exists, digest doesn't)
312 -.TP
313 -.B digest.partial
314 -Digest files do not contain all corresponding URI elements
315 -.TP
316 -.B digest.stray
317 -Digest files that do not have a corresponding ebuild
318 -.TP
319 -.B digest.unmatch
320 -Digests which are incomplete (please check if your USE/ARCH includes all files)
321 -.TP
322 -.B digest.unused
323 -Digest/Manifest entry has no matching SRC_URI entry
324 -.TP
325 .B ebuild.allmasked
326 All ebuilds are masked for this package (Package level only)
327 .TP
328
329 Modified: main/branches/prefix/pym/_emerge/__init__.py
330 ===================================================================
331 --- main/branches/prefix/pym/_emerge/__init__.py 2008-03-01 08:31:39 UTC (rev 9403)
332 +++ main/branches/prefix/pym/_emerge/__init__.py 2008-03-01 17:36:46 UTC (rev 9404)
333 @@ -1130,7 +1130,7 @@
334 metadata = None
335 if metadata and not built:
336 pkgsettings.setcpv(cpv, mydb=metadata)
337 - metadata["USE"] = pkgsettings.get("USE", "")
338 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
339 if metadata is None:
340 mreasons = ["corruption"]
341 else:
342 @@ -2146,7 +2146,7 @@
343 metadata = dict(izip(self._mydbapi_keys,
344 portdb.aux_get(mykey, self._mydbapi_keys)))
345 pkgsettings.setcpv(mykey, mydb=metadata)
346 - metadata["USE"] = pkgsettings["USE"]
347 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
348 pkg = Package(type_name="ebuild", root=myroot,
349 cpv=mykey, metadata=metadata, onlydeps=onlydeps)
350 args.append(PackageArg(arg=x, package=pkg,
351 @@ -2454,7 +2454,7 @@
352 if not built:
353 if (is_virt or "?" in metadata["LICENSE"]):
354 pkgsettings.setcpv(cpv, mydb=metadata)
355 - metadata["USE"] = pkgsettings["USE"]
356 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
357 else:
358 metadata["USE"] = ""
359
360 @@ -2646,7 +2646,7 @@
361 if not built:
362 if "?" in metadata["LICENSE"]:
363 pkgsettings.setcpv(cpv, mydb=metadata)
364 - metadata["USE"] = pkgsettings.get("USE","")
365 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
366 else:
367 metadata["USE"] = ""
368 myarg = None
369 @@ -2703,7 +2703,7 @@
370 pkgsettings.setcpv(myeb, mydb=mydb)
371 else:
372 pkgsettings.setcpv(cpv, mydb=mydb)
373 - now_use = pkgsettings["USE"].split()
374 + now_use = pkgsettings["PORTAGE_USE"].split()
375 forced_flags = set()
376 forced_flags.update(pkgsettings.useforce)
377 forced_flags.update(pkgsettings.usemask)
378 @@ -2729,7 +2729,7 @@
379 old_use = vardb.aux_get(cpv, ["USE"])[0].split()
380 old_iuse = set(filter_iuse_defaults(
381 vardb.aux_get(cpv, ["IUSE"])[0].split()))
382 - cur_use = pkgsettings["USE"].split()
383 + cur_use = pkgsettings["PORTAGE_USE"].split()
384 cur_iuse = set(filter_iuse_defaults(
385 metadata["IUSE"].split()))
386 reinstall_for_flags = \
387 @@ -2760,7 +2760,7 @@
388 db.aux_get(cpv, self._mydbapi_keys)))
389 if not built:
390 pkgsettings.setcpv(cpv, mydb=metadata)
391 - metadata["USE"] = pkgsettings.get("USE","")
392 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
393 myeb = cpv
394 matched_packages.append(
395 Package(type_name=pkg_type, root=root,
396 @@ -3686,7 +3686,7 @@
397 repo_path_real = os.path.dirname(os.path.dirname(
398 os.path.dirname(ebuild_path)))
399 pkgsettings.setcpv(pkg_key, mydb=mydbapi)
400 - metadata["USE"] = pkgsettings["USE"]
401 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
402 elif pkg_type == "binary":
403 repo_path_real = repo_name
404 else:
405 @@ -4279,7 +4279,8 @@
406 if pkg_type == "ebuild":
407 pkgsettings = self.pkgsettings[myroot]
408 pkgsettings.setcpv(pkg_key, mydb=fakedb[myroot])
409 - fakedb[myroot].aux_update(pkg_key, {"USE":pkgsettings["USE"]})
410 + fakedb[myroot].aux_update(pkg_key,
411 + {"USE":pkgsettings["PORTAGE_USE"]})
412 self.spinner.update()
413
414 class RepoDisplay(object):
415 @@ -4574,7 +4575,7 @@
416 metadata.update(izip(metadata_keys,
417 mydbapi.aux_get(pkg_key, metadata_keys)))
418 pkgsettings.setcpv(pkg_key, mydb=mydbapi)
419 - metadata["USE"] = pkgsettings["USE"]
420 + metadata["USE"] = pkgsettings["PORTAGE_USE"]
421 else:
422 if pkg_type == "binary":
423 mydbapi = bindb
424 @@ -5233,9 +5234,9 @@
425 regen_infodirs.append(inforoot)
426
427 if not regen_infodirs:
428 - portage.writemsg_stdout(" "+green("*")+" GNU info directory index is up-to-date.\n")
429 + portage.writemsg_stdout("\n "+green("*")+" GNU info directory index is up-to-date.\n")
430 else:
431 - portage.writemsg_stdout(" "+green("*")+" Regenerating GNU info directory index...\n")
432 + portage.writemsg_stdout("\n "+green("*")+" Regenerating GNU info directory index...\n")
433
434 dir_extensions = ("", ".gz", ".bz2")
435 icount=0
436 @@ -5421,6 +5422,7 @@
437 display_news_notification(trees)
438
439 if vardbapi.plib_registry.hasEntries():
440 + print
441 print colorize("WARN", "!!!") + " existing preserved libs:"
442 plibdata = vardbapi.plib_registry.getPreservedLibs()
443 for cpv in plibdata:
444 @@ -5428,7 +5430,6 @@
445 for f in plibdata[cpv]:
446 print colorize("WARN", " * ") + " - %s" % f
447 print "Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries"
448 - print "and then remerge the packages listed above."
449
450 sys.exit(retval)
451
452 @@ -5475,7 +5476,7 @@
453 del files[-1]
454 if files:
455 procount += 1
456 - print colorize("WARN", " * IMPORTANT:"),
457 + print "\n"+colorize("WARN", " * IMPORTANT:"),
458 if stat.S_ISDIR(mymode):
459 print "%d config files in '%s' need updating." % \
460 (len(files), x)
461 @@ -6373,8 +6374,8 @@
462 if portdb.cpv_exists(pkg):
463 mydb = portdb
464 pkgsettings.setcpv(pkg, mydb=mydb)
465 - if valuesmap["IUSE"].intersection(pkgsettings["USE"].split()) != \
466 - valuesmap["USE"]:
467 + if valuesmap["IUSE"].intersection(
468 + pkgsettings["PORTAGE_USE"].split()) != valuesmap["USE"]:
469 diff_values["USE"] = valuesmap["USE"]
470 # If a difference was found, print the info for
471 # this package.
472
473 Modified: main/branches/prefix/pym/portage/__init__.py
474 ===================================================================
475 --- main/branches/prefix/pym/portage/__init__.py 2008-03-01 08:31:39 UTC (rev 9403)
476 +++ main/branches/prefix/pym/portage/__init__.py 2008-03-01 17:36:46 UTC (rev 9404)
477 @@ -1,10 +1,10 @@
478 # portage.py -- core Portage functionality
479 # Copyright 1998-2004 Gentoo Foundation
480 # Distributed under the terms of the GNU General Public License v2
481 -# $Id: $
482 +# $Id$
483
484
485 -VERSION="$Rev$"[6:-2] + "-svn"
486 +VERSION="$Rev: 9373 $"[6:-2] + "-svn"
487
488 # ===========================================================================
489 # START OF IMPORTS -- START OF IMPORTS -- START OF IMPORTS -- START OF IMPORT
490 @@ -980,7 +980,11 @@
491 @type local_config: Boolean
492 """
493
494 - debug = os.environ.get("PORTAGE_DEBUG") == "1"
495 + # When initializing the global portage.settings instance, avoid
496 + # raising exceptions whenever possible since exceptions thrown
497 + # from 'import portage' or 'import portage.exceptions' statements
498 + # can practically render the api unusable for api consumers.
499 + tolerant = "_initializing_globals" in globals()
500
501 self.already_in_regenerate = 0
502
503 @@ -1255,7 +1259,7 @@
504
505 self.mygcfg = getconfig(
506 os.path.join(config_root, MAKE_CONF_FILE.lstrip(os.path.sep)),
507 - allow_sourcing=True)
508 + tolerant=tolerant, allow_sourcing=True)
509 if self.mygcfg is None:
510 self.mygcfg = {}
511
512 @@ -1303,7 +1307,7 @@
513
514 # Blacklist vars that could interfere with portage internals.
515 for blacklisted in "CATEGORY", "PKGUSE", "PORTAGE_CONFIGROOT", \
516 - "ROOT", "EPREFIX", "EROOT":
517 + "PORTAGE_IUSE", "PORTAGE_USE", "ROOT", "EPREFIX", "EROOT":
518 for cfg in self.lookuplist:
519 cfg.pop(blacklisted, None)
520 del blacklisted, cfg
521 @@ -1855,6 +1859,7 @@
522 self.modifying()
523 if self.mycpv == mycpv:
524 return
525 + ebuild_phase = self.get("EBUILD_PHASE")
526 has_changed = False
527 self.mycpv = mycpv
528 cp = dep_getkey(mycpv)
529 @@ -1931,7 +1936,7 @@
530 if "test" in self.features:
531 test_use_changed = \
532 bool(re.search(r'(^|\s)[-+]?test(\s|$)', iuse)) != \
533 - ("test" in self.get("PORTAGE_USE","").split())
534 + ("test" in self["USE"].split())
535 if self.get("EBUILD_PHASE") or \
536 self._use_wildcards or \
537 test_use_changed:
538 @@ -1943,6 +1948,66 @@
539 if has_changed:
540 self.reset(keeping_pkg=1,use_cache=use_cache)
541
542 + # Filter out USE flags that aren't part of IUSE. This has to
543 + # be done for every setcpv() call since practically every
544 + # package has different IUSE. Some flags are considered to
545 + # be implicit members of IUSE:
546 + #
547 + # * Flags derived from ARCH
548 + # * Flags derived from USE_EXPAND_HIDDEN variables
549 + # * Masked flags, such as those from {,package}use.mask
550 + # * Forced flags, such as those from {,package}use.force
551 + # * build and bootstrap flags used by bootstrap.sh
552 +
553 + usesplit = self["USE"].split()
554 + iuse_implicit = set(x.lstrip("+-") for x in iuse.split())
555 +
556 + # Flags derived from ARCH.
557 + arch = self.configdict["defaults"].get("ARCH")
558 + if arch:
559 + iuse_implicit.add(arch)
560 + iuse_implicit.update(self.get("PORTAGE_ARCHLIST", "").split())
561 +
562 + # Flags derived from USE_EXPAND_HIDDEN variables
563 + # such as ELIBC, KERNEL, and USERLAND.
564 + use_expand_hidden = self.get("USE_EXPAND_HIDDEN", "").split()
565 + use_expand_hidden_raw = use_expand_hidden
566 + if use_expand_hidden:
567 + use_expand_hidden = re.compile("^(%s)_.*" % \
568 + ("|".join(x.lower() for x in use_expand_hidden)))
569 + for x in usesplit:
570 + if use_expand_hidden.match(x):
571 + iuse_implicit.add(x)
572 +
573 + # Flags that have been masked or forced.
574 + iuse_implicit.update(self.usemask)
575 + iuse_implicit.update(self.useforce)
576 +
577 + # build and bootstrap flags used by bootstrap.sh
578 + iuse_implicit.add("build")
579 + iuse_implicit.add("bootstrap")
580 +
581 + # prefix flag is used in Prefix
582 + iuse_implicit.add("prefix")
583 +
584 + if ebuild_phase:
585 + iuse_grep = iuse_implicit.copy()
586 + if use_expand_hidden_raw:
587 + for x in use_expand_hidden_raw:
588 + iuse_grep.add(x.lower() + "_.*")
589 + if iuse_grep:
590 + iuse_grep = "^(%s)$" % "|".join(sorted(iuse_grep))
591 + else:
592 + iuse_grep = ""
593 + self.configdict["pkg"]["PORTAGE_IUSE"] = iuse_grep
594 +
595 + # Filtered for the ebuild environment. Store this in a separate
596 + # attribute since we still want to be able to see global USE
597 + # settings for things like emerge --info.
598 + self.configdict["pkg"]["PORTAGE_USE"] = " ".join(sorted(
599 + x for x in usesplit if \
600 + x in iuse_implicit))
601 +
602 def getMaskAtom(self, cpv, metadata):
603 """
604 Take a package and return a matching package.mask atom, or None if no
605 @@ -2154,7 +2219,7 @@
606 return
607 if isinstance(mydbapi, portdbapi):
608 self.setcpv(mycpv, mydb=mydbapi)
609 - myuse = self["USE"]
610 + myuse = self["PORTAGE_USE"]
611 elif isinstance(mydbapi, dict):
612 myuse = mydbapi["USE"]
613 else:
614 @@ -2434,67 +2499,9 @@
615 if arch and arch not in usesplit:
616 usesplit.append(arch)
617
618 - # Filter out USE flags that aren't part of IUSE. Some
619 - # flags are considered to be implicit members of IUSE:
620 - #
621 - # * Flags derived from ARCH
622 - # * Flags derived from USE_EXPAND_HIDDEN variables
623 - # * Masked flags, such as those from {,package}use.mask
624 - # * Forced flags, such as those from {,package}use.force
625 - # * build and bootstrap flags used by bootstrap.sh
626 -
627 - # Do this even when there's no package since setcpv() can
628 - # optimize away regenerate() calls.
629 - iuse_implicit = set(iuse)
630 -
631 - # Flags derived from ARCH.
632 - if arch:
633 - iuse_implicit.add(arch)
634 - iuse_implicit.update(self.get("PORTAGE_ARCHLIST", "").split())
635 -
636 - # Flags derived from USE_EXPAND_HIDDEN variables
637 - # such as ELIBC, KERNEL, and USERLAND.
638 - use_expand_hidden = self.get("USE_EXPAND_HIDDEN", "").split()
639 - use_expand_hidden_raw = use_expand_hidden
640 - if use_expand_hidden:
641 - use_expand_hidden = re.compile("^(%s)_.*" % \
642 - ("|".join(x.lower() for x in use_expand_hidden)))
643 - for x in usesplit:
644 - if use_expand_hidden.match(x):
645 - iuse_implicit.add(x)
646 -
647 - # Flags that have been masked or forced.
648 - iuse_implicit.update(self.usemask)
649 - iuse_implicit.update(self.useforce)
650 -
651 - # build and bootstrap flags used by bootstrap.sh
652 - iuse_implicit.add("build")
653 - iuse_implicit.add("bootstrap")
654 -
655 - # prefix flag is used in Prefix
656 - iuse_implicit.add("prefix")
657 -
658 - iuse_grep = iuse_implicit.copy()
659 - if use_expand_hidden_raw:
660 - for x in use_expand_hidden_raw:
661 - iuse_grep.add(x.lower() + "_.*")
662 - if iuse_grep:
663 - iuse_grep = "^(%s)$" % "|".join(sorted(iuse_grep))
664 - else:
665 - iuse_grep = ""
666 - self["PORTAGE_IUSE"] = iuse_grep
667 -
668 usesplit = [x for x in usesplit if \
669 x not in self.usemask]
670
671 - # Filtered for the ebuild environment. Store this in a separate
672 - # attribute since we still want to be able to see global USE
673 - # settings for things like emerge --info.
674 - self["PORTAGE_USE"] = " ".join(sorted(
675 - x for x in usesplit if \
676 - x in iuse_implicit))
677 - self.backup_changes("PORTAGE_USE")
678 -
679 usesplit.sort()
680 self.configlist[-1]["USE"]= " ".join(usesplit)
681
682 @@ -2696,7 +2703,7 @@
683 mydict[k] = v
684
685 # Filtered by IUSE and implicit IUSE.
686 - mydict["USE"] = self["PORTAGE_USE"]
687 + mydict["USE"] = self.get("PORTAGE_USE", "")
688
689 # sandbox's bashrc sources /etc/profile which unsets ROOTPATH,
690 # so we have to back it up and restore it.
691 @@ -3646,7 +3653,7 @@
692 for filename in auto_assumed:
693 if filename in fetchlist:
694 writemsg_stdout(
695 - " digest-%s::%s\n" % (pv, filename))
696 + " %s::%s\n" % (pv, filename))
697 return 1
698 finally:
699 _doebuild_manifest_exempt_depend -= 1
700 @@ -5444,7 +5451,7 @@
701 if use=="yes":
702 if myuse is None:
703 #default behavior
704 - myusesplit = mysettings["USE"].split()
705 + myusesplit = mysettings["PORTAGE_USE"].split()
706 else:
707 myusesplit = myuse
708 # We've been given useflags to use.
709 @@ -5769,7 +5776,7 @@
710 return ["corruption"]
711 if "?" in metadata["LICENSE"]:
712 settings.setcpv(p, mydb=metadata)
713 - metadata["USE"] = settings.get("USE", "")
714 + metadata["USE"] = settings["PORTAGE_USE"]
715 else:
716 metadata["USE"] = ""
717 mycp=mysplit[0]+"/"+mysplit[1]
718 @@ -6369,7 +6376,10 @@
719 for k, envvar in (("config_root", "PORTAGE_CONFIGROOT"), ("target_root", "ROOT")):
720 kwargs[k] = os.environ.get(envvar, "/")
721
722 + global _initializing_globals
723 + _initializing_globals = True
724 db = create_trees(**kwargs)
725 + del _initializing_globals
726
727 settings = db["/"]["vartree"].settings
728 portdb = db["/"]["porttree"].dbapi
729
730
731 Property changes on: main/branches/prefix/pym/portage/__init__.py
732 ___________________________________________________________________
733 Name: svn:keywords
734 - Rev
735 + Id
736
737 Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
738 ===================================================================
739 --- main/branches/prefix/pym/portage/dbapi/porttree.py 2008-03-01 08:31:39 UTC (rev 9403)
740 +++ main/branches/prefix/pym/portage/dbapi/porttree.py 2008-03-01 17:36:46 UTC (rev 9404)
741 @@ -146,18 +146,6 @@
742 for x in self.auxdb.values():
743 x.sync()
744
745 - def finddigest(self,mycpv):
746 - try:
747 - mydig = self.findname2(mycpv)[0]
748 - if not mydig:
749 - return ""
750 - mydigs = mydig.split("/")[:-1]
751 - mydig = "/".join(mydigs)
752 - mysplit = mycpv.split("/")
753 - except OSError:
754 - return ""
755 - return mydig+"/files/digest-"+mysplit[-1]
756 -
757 def findLicensePath(self, license_name):
758 mytrees = self.porttrees[:]
759 mytrees.reverse()
760
761 Modified: main/branches/prefix/pym/portage/manifest.py
762 ===================================================================
763 --- main/branches/prefix/pym/portage/manifest.py 2008-03-01 08:31:39 UTC (rev 9403)
764 +++ main/branches/prefix/pym/portage/manifest.py 2008-03-01 17:36:46 UTC (rev 9404)
765 @@ -50,21 +50,6 @@
766 myentry = Manifest2Entry(type=mytype, name=myname, hashes=myhashes)
767 return myentry
768
769 -def parseManifest1(mysplit):
770 - myentry = None
771 - if len(mysplit) == 4 and mysplit[0] in ["size"] + portage.const.MANIFEST1_HASH_FUNCTIONS:
772 - myname = mysplit[2]
773 - mytype = None
774 - mytype = guessManifestFileType(myname)
775 - if mytype == "AUX":
776 - if myname.startswith("files" + os.path.sep):
777 - myname = myname[6:]
778 - mysize = int(mysplit[3])
779 - myhashes = {mysplit[0]: mysplit[1]}
780 - myhashes["size"] = mysize
781 - myentry = Manifest1Entry(type=mytype, name=myname, hashes=myhashes)
782 - return myentry
783 -
784 class ManifestEntry(object):
785 __slots__ = ("type", "name", "hashes")
786 def __init__(self, **kwargs):
787 @@ -75,17 +60,6 @@
788 return 0
789 return 1
790
791 -class Manifest1Entry(ManifestEntry):
792 - def __str__(self):
793 - for hashkey in self.hashes:
794 - if hashkey != "size":
795 - break
796 - hashvalue = self.hashes[hashkey]
797 - myname = self.name
798 - if self.type == "AUX" and not myname.startswith("files" + os.sep):
799 - myname = os.path.join("files", myname)
800 - return " ".join([hashkey, str(hashvalue), myname, str(self.hashes["size"])])
801 -
802 class Manifest2Entry(ManifestEntry):
803 def __str__(self):
804 myline = " ".join([self.type, self.name, str(self.hashes["size"])])
805 @@ -97,7 +71,7 @@
806 return myline
807
808 class Manifest(object):
809 - parsers = (parseManifest2, parseManifest1)
810 + parsers = (parseManifest2,)
811 def __init__(self, pkgdir, distdir, fetchlist_dict=None,
812 manifest1_compat=False, from_scratch=False):
813 """ create new Manifest instance for package in pkgdir
814 @@ -110,16 +84,15 @@
815 self.hashes = set()
816 self.hashes.update(portage.const.MANIFEST2_HASH_FUNCTIONS)
817 if manifest1_compat:
818 - self.hashes.update(portage.const.MANIFEST1_HASH_FUNCTIONS)
819 + raise NotImplementedError("manifest1 support has been removed")
820 self.hashes.difference_update(hashname for hashname in \
821 list(self.hashes) if hashname not in hashfunc_map)
822 self.hashes.add("size")
823 if manifest1_compat:
824 - self.hashes.add(portage.const.MANIFEST1_REQUIRED_HASH)
825 + raise NotImplementedError("manifest1 support has been removed")
826 self.hashes.add(portage.const.MANIFEST2_REQUIRED_HASH)
827 for t in portage.const.MANIFEST2_IDENTIFIERS:
828 self.fhashdict[t] = {}
829 - self.compat = manifest1_compat
830 if not from_scratch:
831 self._read()
832 if fetchlist_dict != None:
833 @@ -144,26 +117,9 @@
834 """ Similar to getDigests(), but restricted to files of the given type. """
835 return self.fhashdict[ftype]
836
837 - def _readDigests(self, myhashdict=None):
838 - """ Parse old style digest files for this Manifest instance """
839 - if myhashdict is None:
840 - myhashdict = {}
841 - try:
842 - for d in os.listdir(os.path.join(self.pkgdir, "files")):
843 - if d.startswith("digest-"):
844 - self._readManifest(os.path.join(self.pkgdir, "files", d), mytype="DIST",
845 - myhashdict=myhashdict)
846 - except (IOError, OSError), e:
847 - if e.errno == errno.ENOENT:
848 - pass
849 - else:
850 - raise
851 - return myhashdict
852 -
853 def _readManifest(self, file_path, myhashdict=None, **kwargs):
854 - """Parse a manifest or an old style digest. If myhashdict is given
855 - then data will be added too it. Otherwise, a new dict will be created
856 - and returned."""
857 + """Parse a manifest. If myhashdict is given then data will be added too it.
858 + Otherwise, a new dict will be created and returned."""
859 try:
860 fd = open(file_path, "r")
861 if myhashdict is None:
862 @@ -183,8 +139,6 @@
863 self._readManifest(self.getFullname(), myhashdict=self.fhashdict)
864 except FileNotFound:
865 pass
866 - if self.compat:
867 - self._readDigests(myhashdict=self.fhashdict)
868
869 def _parseManifestLines(self, mylines):
870 """Parse manifest lines and return a list of manifest entries."""
871 @@ -212,63 +166,6 @@
872 myhashdict[myentry_type][myentry.name].update(myentry.hashes)
873 return myhashdict
874
875 - def _writeDigests(self, force=False):
876 - """ Create old style digest files for this Manifest instance """
877 - cpvlist = [os.path.join(self._pkgdir_category(), x[:-7]) for x in os.listdir(self.pkgdir) if x.endswith(".ebuild")]
878 - rval = []
879 - try:
880 - os.makedirs(os.path.join(self.pkgdir, "files"))
881 - except OSError, oe:
882 - if oe.errno == errno.EEXIST:
883 - pass
884 - else:
885 - raise
886 - for cpv in cpvlist:
887 - dname = os.path.join(self.pkgdir, "files", "digest-%s" % self._catsplit(cpv)[1])
888 - distlist = self._getCpvDistfiles(cpv)
889 - missing_digests = set()
890 - for f in distlist:
891 - if f not in self.fhashdict["DIST"] or len(self.fhashdict["DIST"][f]) == 0:
892 - missing_digests.add(f)
893 - if missing_digests:
894 - # This allows us to force remove of stale digests for the
895 - # ebuild --force digest option.
896 - distlist = [f for f in distlist if f not in missing_digests]
897 - update_digest = True
898 - if not force:
899 - try:
900 - f = open(dname, "r")
901 - old_data = self._parseDigests(f)
902 - f.close()
903 - new_data = self._getDigestData(distlist)
904 - if not old_data and not new_data:
905 - # SRC_URI is empty
906 - update_digest = False
907 - elif len(old_data) == 1 and "DIST" in old_data:
908 - if "DIST" in new_data:
909 - for myfile in new_data["DIST"]:
910 - for hashname in \
911 - new_data["DIST"][myfile].keys():
912 - if hashname != "size" and hashname not in \
913 - portage.const.MANIFEST1_HASH_FUNCTIONS:
914 - del new_data["DIST"][myfile][hashname]
915 - if new_data["DIST"] == old_data["DIST"]:
916 - update_digest = False
917 - except (IOError, OSError), e:
918 - if errno.ENOENT == e.errno:
919 - pass
920 - else:
921 - raise
922 - if update_digest:
923 - mylines = self._createDigestLines1(distlist, self.fhashdict)
924 - if mylines:
925 - mylines = "\n".join(mylines) + "\n"
926 - else:
927 - mylines = ""
928 - write_atomic(dname, mylines)
929 - rval.append(dname)
930 - return rval
931 -
932 def _getDigestData(self, distlist):
933 """create a hash dict for a specific list of files"""
934 myhashdict = {}
935 @@ -280,32 +177,6 @@
936 myhashdict[mytype][myname].update(self.fhashdict[mytype][myname])
937 return myhashdict
938
939 - def _createDigestLines1(self, distlist, myhashdict):
940 - """ Create an old style digest file."""
941 - mylines = []
942 - myfiles = myhashdict["DIST"].keys()
943 - myfiles.sort()
944 - for f in myfiles:
945 - if f in distlist:
946 - myhashkeys = myhashdict["DIST"][f].keys()
947 - myhashkeys.sort()
948 - for h in myhashkeys:
949 - if h not in portage.const.MANIFEST1_HASH_FUNCTIONS:
950 - continue
951 - myline = " ".join([h, str(myhashdict["DIST"][f][h]), f, str(myhashdict["DIST"][f]["size"])])
952 - mylines.append(myline)
953 - return mylines
954 -
955 - def _addDigestsToManifest(self, digests, fd):
956 - """ Add entries for old style digest files to Manifest file """
957 - mylines = []
958 - for dname in digests:
959 - myhashes = perform_multiple_checksums(dname, portage.const.MANIFEST1_HASH_FUNCTIONS+["size"])
960 - for h in myhashes:
961 - mylines.append((" ".join([h, str(myhashes[h]), os.path.join("files", os.path.basename(dname)), str(myhashes["size"])])))
962 - fd.write("\n".join(mylines))
963 - fd.write("\n")
964 -
965 def _createManifestEntries(self):
966 mytypes = self.fhashdict.keys()
967 mytypes.sort()
968 @@ -321,37 +192,7 @@
969 if h not in ["size"] + portage.const.MANIFEST2_HASH_FUNCTIONS:
970 del myentry.hashes[h]
971 yield myentry
972 - if self.compat and t != "DIST":
973 - mysize = self.fhashdict[t][f]["size"]
974 - myhashes = self.fhashdict[t][f]
975 - for h in myhashkeys:
976 - if h not in portage.const.MANIFEST1_HASH_FUNCTIONS:
977 - continue
978 - yield Manifest1Entry(
979 - type=t, name=f, hashes={"size":mysize, h:myhashes[h]})
980
981 - if self.compat:
982 - cvp_list = self.fetchlist_dict.keys()
983 - cvp_list.sort()
984 - manifest1_hashes = set(hashname for hashname in \
985 - portage.const.MANIFEST1_HASH_FUNCTIONS \
986 - if hashname in hashfunc_map)
987 - manifest1_hashes.add(portage.const.MANIFEST1_REQUIRED_HASH)
988 - manifest1_hashes.add("size")
989 - for cpv in cvp_list:
990 - digest_path = os.path.join("files", "digest-%s" % self._catsplit(cpv)[1])
991 - dname = os.path.join(self.pkgdir, digest_path)
992 - try:
993 - myhashes = perform_multiple_checksums(dname, manifest1_hashes)
994 - myhashkeys = myhashes.keys()
995 - myhashkeys.sort()
996 - for h in myhashkeys:
997 - if h in portage.const.MANIFEST1_HASH_FUNCTIONS:
998 - yield Manifest1Entry(type="AUX", name=digest_path,
999 - hashes={"size":myhashes["size"], h:myhashes[h]})
1000 - except FileNotFound:
1001 - pass
1002 -
1003 def checkIntegrity(self):
1004 for t in self.fhashdict:
1005 for f in self.fhashdict[t]:
1006 @@ -362,8 +203,6 @@
1007 """ Write Manifest instance to disk, optionally signing it """
1008 self.checkIntegrity()
1009 try:
1010 - if self.compat:
1011 - self._writeDigests()
1012 myentries = list(self._createManifestEntries())
1013 update_manifest = True
1014 if not force:
1015 @@ -451,7 +290,7 @@
1016 distfilehashes = {}
1017 self.__init__(self.pkgdir, self.distdir,
1018 fetchlist_dict=self.fetchlist_dict, from_scratch=True,
1019 - manifest1_compat=self.compat)
1020 + manifest1_compat=False)
1021 cpvlist = []
1022 pn = os.path.basename(self.pkgdir.rstrip(os.path.sep))
1023 cat = self._pkgdir_category()
1024
1025 Modified: main/branches/prefix/pym/portage/util.py
1026 ===================================================================
1027 --- main/branches/prefix/pym/portage/util.py 2008-03-01 08:31:39 UTC (rev 9403)
1028 +++ main/branches/prefix/pym/portage/util.py 2008-03-01 17:36:46 UTC (rev 9404)
1029 @@ -22,6 +22,11 @@
1030 except ImportError:
1031 import pickle as cPickle
1032
1033 +try:
1034 + import cStringIO as StringIO
1035 +except ImportError:
1036 + import StringIO
1037 +
1038 noiselimit = 0
1039
1040 def initialize_logger(level=logging.WARN):
1041 @@ -306,6 +311,15 @@
1042 return 0
1043 return 1
1044
1045 +class _tolerant_shlex(shlex.shlex):
1046 + def sourcehook(self, newfile):
1047 + try:
1048 + return shlex.shlex.sourcehook(self, newfile)
1049 + except EnvironmentError, e:
1050 + writemsg("!!! Parse error in '%s': source command failed: %s\n" % \
1051 + (self.infile, str(e)), noiselevel=-1)
1052 + return (newfile, StringIO.StringIO())
1053 +
1054 def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
1055 mykeys={}
1056 try:
1057 @@ -317,10 +331,14 @@
1058 raise
1059 return None
1060 try:
1061 + if tolerant:
1062 + shlex_class = _tolerant_shlex
1063 + else:
1064 + shlex_class = shlex.shlex
1065 # The default shlex.sourcehook() implementation
1066 # only joins relative paths when the infile
1067 # attribute is properly set.
1068 - lex = shlex.shlex(f, infile=mycfg, posix=True)
1069 + lex = shlex_class(f, infile=mycfg, posix=True)
1070 lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}"
1071 lex.quotes="\"'"
1072 if allow_sourcing:
1073
1074 Modified: main/branches/prefix/pym/portage_compat_namespace.py
1075 ===================================================================
1076 --- main/branches/prefix/pym/portage_compat_namespace.py 2008-03-01 08:31:39 UTC (rev 9403)
1077 +++ main/branches/prefix/pym/portage_compat_namespace.py 2008-03-01 17:36:46 UTC (rev 9404)
1078 @@ -31,5 +31,10 @@
1079 except ImportError, AttributeError:
1080 raise ImportError("No module named %s" % __oldname)
1081
1082 -warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
1083 +def _formatwarning(message, category, filename, lineno):
1084 + return "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)
1085 +
1086 +warnings.formatwarning = _formatwarning
1087 +
1088 +warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname), DeprecationWarning)
1089 sys.modules[__oldname] = __realmodule
1090
1091 --
1092 gentoo-commits@l.g.o mailing list