From: Fabian Groffen Date: Fri, 17 Nov 2006 18:26:25 +0000 (-0000) Subject: Merged from trunk 5060:5075 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=257322f6d8f3e4f580d49a121c943d0518e25bc3;p=portage.git Merged from trunk 5060:5075 Pull in the new-style virtuals and install them so that the vdb has complete standalone dep info, in case a portage tree isn't available. For bug #141118, make dep_zapdeps assign zero cost to new-style virtuals. Revert the depclean message, since new-style virtuals will now be kept. Update the _expand_new_virtuals docstring with a not about zero cost for new-style virtuals. Fix _expand_new_virtuals so that it doesn't allow any virtual deps to go unaccounted for. Integrate old-style virtuals handling into _expand_new_virtuals() and prefer new-style over old-style whenever they are available. For bug #155484, apply PORTAGE_NICENESS as soon as possible (especially before global updates). Make fixpackages use PORTAGE_NICENESS. svn path=/main/branches/prefix/; revision=5077 --- diff --git a/bin/emerge b/bin/emerge index 09456bbf6..11f75800a 100755 --- a/bin/emerge +++ b/bin/emerge @@ -2744,7 +2744,7 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files, # valid db entries to candidate_catpkgs if global_unmerge: if not unmerge_files or "world" in unmerge_files: - candidate_catpkgs.extend(vartree.dbapi.cpv_all()) + candidate_catpkgs.extend(vartree.dbapi.cp_all()) elif "system" in unmerge_files: candidate_catpkgs.extend(getlist(settings, "system")) else: @@ -3894,9 +3894,7 @@ def action_depclean(settings, trees, ldpath_mtimes, print warn_prefix + "be kept. They can be manually added to this set with" print warn_prefix + good("`emerge --noreplace `") + ". Packages that are listed in" print warn_prefix + "package.provided (see portage(5)) will be removed by" - print warn_prefix + "depclean, even if they are part of the world set. New-style" - print warn_prefix + "virtuals (virtual/* packages installed by older versions of" - print warn_prefix + "portage) will also be removed." + print warn_prefix + "depclean, even if they are part of the world set." print warn_prefix print warn_prefix + "As a safety measure, depclean will not remove any packages" print warn_prefix + "unless *all* required dependencies have been resolved. As a" @@ -4428,6 +4426,15 @@ def emerge_main(): os.umask(022) settings, trees, mtimedb = load_emerge_config() portdb = trees[settings["ROOT"]]["porttree"].dbapi + + try: + os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) + except (OSError, ValueError), e: + portage.writemsg("!!! Failed to change nice value to '%s'\n" % \ + settings["PORTAGE_NICENESS"]) + portage.writemsg("!!! %s\n" % str(e)) + del e + if portage.global_updates(settings, trees, mtimedb["updates"]): mtimedb.commit() # Reload the whole config from scratch. @@ -4469,14 +4476,6 @@ def emerge_main(): portage.deprecated_profile_check() - try: - os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) - except (OSError, ValueError), e: - portage.writemsg("!!! Failed to change nice value to '%s'\n" % \ - settings["PORTAGE_NICENESS"]) - portage.writemsg("!!! %s\n" % str(e)) - del e - #Freeze the portdbapi for enhanced performance: for myroot in trees: trees[myroot]["porttree"].dbapi.freeze() diff --git a/bin/fixpackages b/bin/fixpackages index 006ef0b85..14f911f98 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -11,6 +11,20 @@ except ImportError: sys.path.insert(0, "@PORTAGE_BASE@/pym") import portage +mysettings = portage.settings +mytrees = portage.db +mtimedb = portage.mtimedb + +try: + os.nice(int(mysettings.get("PORTAGE_NICENESS", "0"))) +except (OSError, ValueError), e: + portage.writemsg("!!! Failed to change nice value to '%s'\n" % \ + mysettings["PORTAGE_NICENESS"]) + portage.writemsg("!!! %s\n" % str(e)) + del e + +portage.global_updates(mysettings, mytrees, mtimedb["updates"]) + print print "Done." print diff --git a/pym/portage.py b/pym/portage.py index c7367cc6d..e3392800a 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1626,9 +1626,6 @@ class config: virts = flatten(portage_dep.use_reduce(portage_dep.paren_reduce(provides), uselist=myuse.split())) cp = dep_getkey(mycpv) - if cp.startswith("virtual/"): - # Bridge new-style virtual into old-style. - virts.append(cp) for virt in virts: virt = dep_getkey(virt) if not self.treeVirtuals.has_key(virt): @@ -1893,10 +1890,6 @@ class config: virtuals = stack_dictlist([ptVirtuals, self.treeVirtuals, self.dirVirtuals]) - # Bridge new-style virtuals into old-style. - for k, v in virtuals.iteritems(): - if k not in v: - v.append(k) return virtuals def __delitem__(self,mykey): @@ -3516,8 +3509,8 @@ def dep_virtual(mysplit, mysettings): def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", trees=None, **kwargs): """Recursively expand new-style virtuals so as to collapse one or more - levels of indirection. The new-style virtuals should never be installed - themselves. They are only used to expand virtual dependencies. Virtual + levels of indirection. In dep_zapdeps, new-style virtuals will be assigned + zero cost regardless of whether or not they are currently installed. Virtual blockers are supported but only when the virtual expands to a single atom because it wouldn't necessarily make sense to block all the components of a compound virtual. When more than one new-style virtual is matched, @@ -3530,6 +3523,7 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", def compare_pkgs(a, b): return pkgcmp(b[1], a[1]) portdb = trees[myroot]["porttree"].dbapi + myvirtuals = mysettings.getvirtuals() for x in mysplit: if x == "||": newsplit.append(x) @@ -3538,9 +3532,11 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", newsplit.append(_expand_new_virtuals(x, edebug, mydbapi, mysettings, myroot=myroot, trees=trees, **kwargs)) continue - elif not dep_getkey(x).startswith("virtual/"): + mykey = dep_getkey(x) + if not mykey.startswith("virtual/"): newsplit.append(x) continue + mychoices = myvirtuals.get(mykey, []) isblocker = x.startswith("!") match_atom = x if isblocker: @@ -3550,9 +3546,17 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", # only use new-style matches if cpv.startswith("virtual/"): pkgs.append((cpv, pkgsplit(cpv))) - if not pkgs: + if not (pkgs or mychoices): + # This one couldn't be expanded as a new-style virtual. Old-style + # virtuals have already been expanded by dep_virtual, so this one + # is unavailable and dep_zapdeps will identify it as such. The + # atom is not eliminated here since it may still represent a + # dependency that needs to be satisfied. newsplit.append(x) continue + if not pkgs and len(mychoices) == 1: + newsplit.append(x.replace(mykey, mychoices[0])) + continue pkgs.sort(compare_pkgs) # Prefer higher versions. if isblocker: a = [] @@ -3576,7 +3580,11 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", # compound virtual, so only a single atom block is allowed. a.append("!" + virtual_atoms[0]) else: + mycheck[1].append("="+y[0]) # pull in the new-style virtual a.append(mycheck[1]) + # Plain old-style virtuals. New-style virtuals are preferred. + for y in mychoices: + a.append(x.replace(mykey, y)) if isblocker and not a: # Probably a compound virtual. Pass the atom through unprocessed. newsplit.append(x) @@ -3677,7 +3685,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, preference selection is handled later via slot and version comparison.""" all_installed = True for atom in set([dep_getkey(atom) for atom in atoms]): - if not vardb.match(atom): + # New-style virtuals have zero cost to install. + if not vardb.match(atom) and not atom.startswith("virtual/"): all_installed = False break @@ -3692,7 +3701,11 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None, # over other atoms. if all_installed and all_available: for atom in atoms: - inst_pkgs = vardb.match(dep_getkey(atom)) + mykey = dep_getkey(atom) + if mykey.startswith("virtual/"): + # New-style virtuals have zero cost to install. + continue + inst_pkgs = vardb.match(mykey) avail_pkg = best(mydbapi.match(atom)) avail_slot = mydbapi.aux_get(avail_pkg, ["SLOT"])[0] avail_split = catpkgsplit(avail_pkg)[1:] @@ -3797,14 +3810,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, # Do the || conversions mysplit=portage_dep.dep_opconvert(mysplit) - #convert virtual dependencies to normal packages. - mysplit=dep_virtual(mysplit, mysettings) - #if mysplit is None, then we have a parse error (paren mismatch or misplaced ||) - #up until here, we haven't needed to look at the database tree - - if mysplit is None: - return [0,"Parse Error (parentheses mismatch?)"] - elif mysplit==[]: + if mysplit == []: #dependencies were reduced to nothing return [1,[]] @@ -4869,9 +4875,6 @@ class vartree(packagetree): if not mys: mys = string.split(myprovide, "/") myprovides += [mys[0] + "/" + mys[1]] - if mycpv.startswith("virtual/"): - # Bridge new-style virtual into old-style. - myprovides.append(dep_getkey(mycpv)) return myprovides except SystemExit, e: raise