From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QGiBI-00044I-Dn for garchives@archives.gentoo.org; Mon, 02 May 2011 01:44:12 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C3C371C030; Mon, 2 May 2011 01:44:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 738F81C030 for ; Mon, 2 May 2011 01:44:04 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C32D11B401F for ; Mon, 2 May 2011 01:44:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1763880505 for ; Mon, 2 May 2011 01:44:03 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: b33d96f3f60a494ff528a3bd0671a3d0fa6682e8 Date: Mon, 2 May 2011 01:44:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 321b0efc3d84db4a8a239350e2a1de63 commit: b33d96f3f60a494ff528a3bd0671a3d0fa6682e8 Author: Zac Medico gentoo org> AuthorDate: Mon May 2 01:42:32 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon May 2 01:42:32 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Db33d96f3 depgraph: account for new-style virtual/libc This will fix bug #364681. --- pym/_emerge/depgraph.py | 164 ++++++++++++++++++++++++++---------------= ----- 1 files changed, 93 insertions(+), 71 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 5c39497..2401541 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2465,6 +2465,39 @@ class depgraph(object): =20 return selected_atoms =20 + def _expand_virt_from_graph(self, root, atom): + if not isinstance(atom, Atom): + atom =3D Atom(atom) + graphdb =3D self._dynamic_config.mydbapi[root] + match =3D graphdb.match_pkgs(atom) + if not match: + yield atom + return + pkg =3D match[-1] + if not pkg.cpv.startswith("virtual/"): + yield atom + return + try: + rdepend =3D self._select_atoms_from_graph( + pkg.root, pkg.metadata.get("RDEPEND", ""), + myuse=3Dself._pkg_use_enabled(pkg), + parent=3Dpkg, strict=3DFalse) + except InvalidDependString as e: + writemsg_level("!!! Invalid RDEPEND in " + \ + "'%svar/db/pkg/%s/RDEPEND': %s\n" % \ + (pkg.root, pkg.cpv, e), + noiselevel=3D-1, level=3Dlogging.ERROR) + yield atom + return + + for atoms in rdepend.values(): + for atom in atoms: + if hasattr(atom, "_orig_atom"): + # Ignore virtual atoms since we're only + # interested in expanding the real atoms. + continue + yield atom + def _get_dep_chain(self, start_node, target_atom=3DNone, unsatisfied_dependency=3DFalse): """ @@ -4394,65 +4427,44 @@ class depgraph(object): def _implicit_libc_deps(self, mergelist, graph): """ Create implicit dependencies on libc, in order to ensure that libc - is installed as early as possible (see bug #303567). If the merge - list contains both a new-style virtual and an old-style PROVIDE - virtual, the new-style virtual is used. + is installed as early as possible (see bug #303567). """ - implicit_libc_roots =3D set([self._frozen_config._running_root.root]) - libc_set =3D InternalPackageSet([portage.const.LIBC_PACKAGE_ATOM]) - norm_libc_pkgs =3D {} - virt_libc_pkgs =3D {} - for pkg in mergelist: - if not isinstance(pkg, Package): - # a satisfied blocker - continue - if pkg.installed: - continue - if pkg.root in implicit_libc_roots and \ - pkg.operation =3D=3D 'merge': - if libc_set.findAtomForPackage(pkg): - if pkg.category =3D=3D 'virtual': - d =3D virt_libc_pkgs - else: - d =3D norm_libc_pkgs - if pkg.root in d: - raise AssertionError( - "found 2 libc matches: %s and %s" % \ - (d[pkg.root], pkg)) - d[pkg.root] =3D pkg - - # Prefer new-style virtuals over old-style PROVIDE virtuals. - libc_pkg_map =3D norm_libc_pkgs.copy() - libc_pkg_map.update(virt_libc_pkgs) - - # Only add a dep when the version changes. - for libc_pkg in list(libc_pkg_map.values()): - if libc_pkg.root_config.trees['vartree'].dbapi.cpv_exists( - libc_pkg.cpv): - del libc_pkg_map[pkg.root] - - if not libc_pkg_map: + libc_pkgs =3D {} + implicit_libc_roots =3D (self._frozen_config._running_root.root,) + for root in implicit_libc_roots: + graphdb =3D self._dynamic_config.mydbapi[root] + vardb =3D self._frozen_config.trees[root]["vartree"].dbapi + for atom in self._expand_virt_from_graph(root, + portage.const.LIBC_PACKAGE_ATOM): + if atom.blocker: + continue + match =3D graphdb.match_pkgs(atom) + if not match: + continue + pkg =3D match[-1] + if pkg.operation =3D=3D "merge" and \ + not vardb.cpv_exists(pkg.cpv): + libc_pkgs.setdefault(pkg.root, set()).add(pkg) + + if not libc_pkgs: return =20 - libc_pkgs =3D set(libc_pkg_map.values()) earlier_libc_pkgs =3D set() =20 for pkg in mergelist: if not isinstance(pkg, Package): # a satisfied blocker continue - if pkg.installed: - continue - if pkg.root in implicit_libc_roots and \ - pkg.operation =3D=3D 'merge': - if pkg in libc_pkgs: + root_libc_pkgs =3D libc_pkgs.get(pkg.root) + if root_libc_pkgs is not None and \ + pkg.operation =3D=3D "merge": + if pkg in root_libc_pkgs: earlier_libc_pkgs.add(pkg) else: - my_libc =3D libc_pkg_map.get(pkg.root) - if my_libc is not None and \ - my_libc in earlier_libc_pkgs: - graph.add(my_libc, pkg, - priority=3DDepPriority(buildtime=3DTrue)) + for libc_pkg in root_libc_pkgs: + if libc_pkg in earlier_libc_pkgs: + graph.add(libc_pkg, pkg, + priority=3DDepPriority(buildtime=3DTrue)) =20 def schedulerGraph(self): """ @@ -4669,29 +4681,39 @@ class depgraph(object): =20 # Merge libc asap, in order to account for implicit # dependencies. See bug #303567. - for root in (running_root,): - libc_pkg =3D self._dynamic_config.mydbapi[root].match_pkgs( - portage.const.LIBC_PACKAGE_ATOM) - if libc_pkg: - libc_pkg =3D libc_pkg[0] - if libc_pkg.operation =3D=3D 'merge': - # Only add a dep when the version changes. - if not libc_pkg.root_config.trees[ - 'vartree'].dbapi.cpv_exists(libc_pkg.cpv): - - # If there's also an os-headers upgrade, we need to - # pull that in first. See bug #328317. - os_headers_pkg =3D self._dynamic_config.mydbapi[root].match_pkgs( - portage.const.OS_HEADERS_PACKAGE_ATOM) - if os_headers_pkg: - os_headers_pkg =3D os_headers_pkg[0] - if os_headers_pkg.operation =3D=3D 'merge': - # Only add a dep when the version changes. - if not os_headers_pkg.root_config.trees[ - 'vartree'].dbapi.cpv_exists(os_headers_pkg.cpv): - asap_nodes.append(os_headers_pkg) - - asap_nodes.append(libc_pkg) + implicit_libc_roots =3D (running_root,) + for root in implicit_libc_roots: + libc_pkgs =3D set() + vardb =3D self._frozen_config.trees[root]["vartree"].dbapi + graphdb =3D self._dynamic_config.mydbapi[root] + for atom in self._expand_virt_from_graph(root, + portage.const.LIBC_PACKAGE_ATOM): + if atom.blocker: + continue + match =3D graphdb.match_pkgs(atom) + if not match: + continue + pkg =3D match[-1] + if pkg.operation =3D=3D "merge" and \ + not vardb.cpv_exists(pkg.cpv): + libc_pkgs.add(pkg) + + if libc_pkgs: + # If there's also an os-headers upgrade, we need to + # pull that in first. See bug #328317. + for atom in self._expand_virt_from_graph(root, + portage.const.OS_HEADERS_PACKAGE_ATOM): + if atom.blocker: + continue + match =3D graphdb.match_pkgs(atom) + if not match: + continue + pkg =3D match[-1] + if pkg.operation =3D=3D "merge" and \ + not vardb.cpv_exists(pkg.cpv): + asap_nodes.append(pkg) + + asap_nodes.extend(libc_pkgs) =20 def gather_deps(ignore_priority, mergeable_nodes, selected_nodes, node):