diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-28 09:04:28 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-28 09:04:28 +0000 |
commit | c2b0e9d1ccd2e3f3bec857ac1cdfeb2b87cddcac (patch) | |
tree | 6cf8446bc0046a9da9a9b449dcbd743de8057eff /bin | |
parent | 361801e4b4ed59911763219da09608ca6bb02b6e (diff) | |
download | portage-c2b0e9d1ccd2e3f3bec857ac1cdfeb2b87cddcac.tar.gz portage-c2b0e9d1ccd2e3f3bec857ac1cdfeb2b87cddcac.tar.bz2 portage-c2b0e9d1ccd2e3f3bec857ac1cdfeb2b87cddcac.zip |
For bug #142473, add 2 additional color classes for system packages and packages matched by arguments. (trunk r7074:7076)
svn path=/main/branches/2.1.2/; revision=7077
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/emerge | 73 |
1 files changed, 61 insertions, 12 deletions
diff --git a/bin/emerge b/bin/emerge index 443f5d7e0..492ed6274 100755 --- a/bin/emerge +++ b/bin/emerge @@ -980,6 +980,8 @@ class depgraph: self.outdatedpackages=[] self._args_atoms = {} self._args_nodes = set() + self._sets = {} + self._sets_nodes = {} self.blocker_digraph = digraph() self.blocker_parents = {} self._unresolved_blocker_parents = {} @@ -1119,12 +1121,13 @@ class depgraph: if not arg and myroot == self.target_root: try: - arg = self._get_arg(mykey, metadata) + arg = self._find_atom_for_pkg(self._args_atoms, mykey, metadata) except portage_exception.InvalidDependString, e: - show_invalid_depstring_notice(tuple(mybigkey+["merge"]), - metadata["PROVIDE"], str(e)) + if mytype != "installed": + show_invalid_depstring_notice(tuple(mybigkey+["merge"]), + metadata["PROVIDE"], str(e)) + return 0 del e - return 0 merging=1 if mytype == "installed": @@ -1163,6 +1166,7 @@ class depgraph: if addme: if merging == 0 and vardbapi.cpv_exists(mykey) and \ mytype != "installed": + mytype = "installed" mybigkey[0] = "installed" mydbapi = vardbapi jbigkey = tuple(mybigkey) @@ -1228,6 +1232,17 @@ class depgraph: if arg: self._args_nodes.add(jbigkey) + try: + for set_name, pkg_set in self._sets.iteritems(): + atom = self._find_atom_for_pkg(pkg_set, mykey, metadata) + if atom: + self._sets_nodes[set_name].add(jbigkey) + except portage_exception.InvalidDependString, e: + if mytype != "installed": + show_invalid_depstring_notice(jbigkey, + metadata["PROVIDE"], str(e)) + return 0 + del e # Do this even when addme is False (--onlydeps) so that the # parent/child relationship is always known in case @@ -2204,13 +2219,24 @@ class depgraph: matches = portdb.gvisible(portdb.visible(mylist)) return [x for x in mylist \ if x in matches or not portdb.cpv_exists(x)] + def create_cp_dict(atom_list): + cp_dict = {} + for atom in atom_list: + cp_dict.setdefault(portage.dep_getkey(atom), []).append(atom) + return cp_dict world_problems = False if mode=="system": mylist = getlist(self.settings, "system") + self._sets["system"] = create_cp_dict(mylist) + self._sets_nodes["system"] = set() else: #world mode worldlist = getlist(self.settings, "world") + self._sets["world"] = create_cp_dict(worldlist) + self._sets_nodes["world"] = set() mylist = getlist(self.settings, "system") + self._sets["system"] = create_cp_dict(mylist) + self._sets_nodes["system"] = set() worlddict=genericdict(worldlist) for x in worlddict: @@ -2311,14 +2337,14 @@ class depgraph: return 1 - def _get_arg(self, cpv, metadata): + def _find_atom_for_pkg(self, pkg_set, cpv, metadata): """Return the best match for a given package from the arguments, or None if there are no matches. This matches virtual arguments against the PROVIDE metadata. This can raise an InvalidDependString exception if an error occurs while parsing PROVIDE.""" cpv_slot = "%s:%s" % (cpv, metadata["SLOT"]) cp = portage.dep_getkey(cpv) - atoms = self._args_atoms.get(cp) + atoms = pkg_set.get(cp) if atoms: best_match = portage.best_match_to_list(cpv_slot, atoms) if best_match: @@ -2328,7 +2354,7 @@ class depgraph: uselist=metadata["USE"].split())) for provide in provides: provided_cp = portage.dep_getkey(provide) - atoms = self._args_atoms.get(provided_cp) + atoms = pkg_set.get(provided_cp) if atoms: transformed_atoms = [atom.replace(provided_cp, cp) for atom in atoms] best_match = portage.best_match_to_list(cpv_slot, transformed_atoms) @@ -2781,17 +2807,40 @@ class depgraph: myoldbest=blue("["+myoldbest+"]") pkg_cp = xs[0] - pkg_world = pkg_cp in worldlist and myroot == self.target_root + pkg_arg = False + pkg_world = False + pkg_system = False + pkg_node = tuple(x) + if pkg_node in self._args_nodes: + pkg_arg = True + world_nodes = self._sets_nodes.get("world") + if world_nodes and pkg_node in world_nodes: + pkg_world = True + if world_nodes is None: + # Don't colorize system package when in "world" mode. + system_nodes = self._sets_nodes.get("system") + if system_nodes and pkg_node in system_nodes: + pkg_system = True def pkgprint(pkg): if pkg_merge: - if pkg_world: - return colorize("PKG_MERGE_WORLD", pkg) + if pkg_arg: + if pkg_world: + return colorize("PKG_MERGE_WORLD", pkg) + elif pkg_system: + return colorize("PKG_MERGE_SYSTEM", pkg) + else: + return colorize("PKG_MERGE_ARG", pkg) else: return colorize("PKG_MERGE", pkg) else: - if pkg_world: - return colorize("PKG_NOMERGE_WORLD", pkg) + if pkg_arg: + if pkg_world: + return colorize("PKG_NOMERGE_WORLD", pkg) + elif pkg_system: + return colorize("PKG_NOMERGE_SYSTEM", pkg) + else: + return colorize("PKG_NOMERGE_ARG", pkg) else: return colorize("PKG_NOMERGE", pkg) |