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 1PocQg-0008Jr-Bm for garchives@archives.gentoo.org; Sun, 13 Feb 2011 13:55:59 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EE05EE07B2; Sun, 13 Feb 2011 13:55:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A852CE07B2 for ; Sun, 13 Feb 2011 13:55:51 +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 BFE081B400C for ; Sun, 13 Feb 2011 13:55:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2EC748006A for ; Sun, 13 Feb 2011 13:55:50 +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/portage/tests/resolver/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py pym/portage/tests/resolver/test_depth.py X-VCS-Directories: pym/portage/tests/resolver/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: f5eaf39529393b0b68f656b06600920791d9bec0 Date: Sun, 13 Feb 2011 13:55:50 +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: 9566447280dc926ae8fb125672ffe9a0 commit: f5eaf39529393b0b68f656b06600920791d9bec0 Author: Zac Medico gentoo org> AuthorDate: Sun Feb 13 13:55:18 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Feb 13 13:55:18 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Df5eaf395 depgraph: fix and test depth control for virtuals --- pym/_emerge/depgraph.py | 50 ++++++++++++++++++++++++= +----- pym/portage/tests/resolver/test_depth.py | 33 +++++++++++++++----- 2 files changed, 67 insertions(+), 16 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1dba229..30e7046 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1238,6 +1238,7 @@ class depgraph(object): =20 root_config =3D self._frozen_config.roots[dep_root] vardb =3D root_config.trees["vartree"].dbapi + traversed_virt_pkgs =3D set() =20 for atom, child in self._minimize_children( pkg, dep_priority, root_config, selected_atoms[pkg]): @@ -1278,7 +1279,6 @@ class depgraph(object): # available for optimization of merge order. ignored =3D False if not atom.blocker and \ - not is_virt and \ not recurse_satisfied and \ mypriority.satisfied and \ mypriority.satisfied.visible and \ @@ -1304,9 +1304,12 @@ class depgraph(object): dep.child =3D None self._dynamic_config._ignored_deps.append(dep) =20 - if not ignored and not self._add_dep(dep, - allow_unsatisfied=3Dallow_unsatisfied): - return 0 + if not ignored: + if not self._add_dep(dep, + allow_unsatisfied=3Dallow_unsatisfied): + return 0 + if is_virt: + traversed_virt_pkgs.add(dep.child) =20 selected_atoms.pop(pkg) =20 @@ -1318,6 +1321,8 @@ class depgraph(object): for virt_dep, atoms in selected_atoms.items(): =20 virt_pkg =3D virt_dep.child + if virt_pkg not in traversed_virt_pkgs: + continue =20 if debug: writemsg_level("Candidates: %s: %s\n" % \ @@ -1334,6 +1339,7 @@ class depgraph(object): # from dep_check, map it back to the original, in # order to avoid distortion in places like display # or conflict resolution code. + is_virt =3D hasattr(atom, '_orig_atom') atom =3D getattr(atom, '_orig_atom', atom) =20 # This is a GLEP 37 virtual, so its deps are all runtime. @@ -1352,11 +1358,39 @@ class depgraph(object): =20 # Dependencies of virtuals are considered to have the # same depth as the virtual itself. - if not self._add_dep(Dependency(atom=3Datom, + dep =3D Dependency(atom=3Datom, blocker=3Datom.blocker, child=3Dchild, depth=3Dvirt_dep.depth, - parent=3Dvirt_pkg, priority=3Dmypriority, root=3Ddep_root), - allow_unsatisfied=3Dallow_unsatisfied): - return 0 + parent=3Dvirt_pkg, priority=3Dmypriority, root=3Ddep_root) + + ignored =3D False + if not atom.blocker and \ + not recurse_satisfied and \ + mypriority.satisfied and \ + mypriority.satisfied.visible and \ + dep.child is not None and \ + not dep.child.installed: + myarg =3D None + if dep.root =3D=3D self._frozen_config.target_root: + try: + myarg =3D next( + self._iter_atoms_for_pkg(dep.child)) + except StopIteration: + pass + except InvalidDependString: + if not dep.child.installed: + raise + + if myarg is None: + ignored =3D True + dep.child =3D None + self._dynamic_config._ignored_deps.append(dep) + + if not ignored: + if not self._add_dep(dep, + allow_unsatisfied=3Dallow_unsatisfied): + return 0 + if is_virt: + traversed_virt_pkgs.add(dep.child) =20 if debug: writemsg_level("Exiting... %s\n" % (pkg,), diff --git a/pym/portage/tests/resolver/test_depth.py b/pym/portage/tests= /resolver/test_depth.py index cecdd37..65cfac6 100644 --- a/pym/portage/tests/resolver/test_depth.py +++ b/pym/portage/tests/resolver/test_depth.py @@ -123,19 +123,28 @@ class ResolverDepthTestCase(TestCase): ["virtual/jre"], options =3D {"--update" : True}, success =3D True, + mergelist =3D ['virtual/jre-1.6.0-r1', 'virtual/jre-1.5.0-r1']), + + # Recursively traversed virtual dependencies, and their + # direct dependencies, are considered to have the same + # depth as direct dependencies. + ResolverPlaygroundTestCase( + ["virtual/jre"], + options =3D {"--update" : True, "--deep" : 1}, + success =3D True, mergelist =3D ['dev-java/icedtea-6.1-r1', 'dev-java/gcj-jdk-4.5-r1',= 'virtual/jdk-1.6.0-r1', 'virtual/jdk-1.5.0-r1', 'virtual/jre-1.6.0-r1', = 'virtual/jre-1.5.0-r1']), =20 ResolverPlaygroundTestCase( ["virtual/jre:1.5"], options =3D {"--update" : True}, success =3D True, - mergelist =3D ['dev-java/gcj-jdk-4.5-r1', 'virtual/jdk-1.5.0-r1', 'v= irtual/jre-1.5.0-r1']), + mergelist =3D ['virtual/jre-1.5.0-r1']), =20 ResolverPlaygroundTestCase( ["virtual/jre:1.6"], options =3D {"--update" : True}, success =3D True, - mergelist =3D ['dev-java/icedtea-6.1-r1', 'virtual/jdk-1.6.0-r1', 'v= irtual/jre-1.6.0-r1']), + mergelist =3D ['virtual/jre-1.6.0-r1']), =20 # Test that we don't pull in any unnecessary updates # when --update is not specified, even though we @@ -146,12 +155,20 @@ class ResolverDepthTestCase(TestCase): success =3D True, mergelist =3D ["dev-java/ant-core-1.8"]), =20 - # FIXME: pulls in unwanted updates without --deep: ['dev-java/icedtea= -6.1-r1', 'virtual/jdk-1.6.0-r1', 'dev-java/ant-core-1.8'] - #ResolverPlaygroundTestCase( - # ["dev-java/ant-core"], - # options =3D {"--update" : True}, - # success =3D True, - # mergelist =3D ["dev-java/ant-core-1.8"]), + ResolverPlaygroundTestCase( + ["dev-java/ant-core"], + options =3D {"--update" : True}, + success =3D True, + mergelist =3D ["dev-java/ant-core-1.8"]), + + # Recursively traversed virtual dependencies, and their + # direct dependencies, are considered to have the same + # depth as direct dependencies. + ResolverPlaygroundTestCase( + ["dev-java/ant-core"], + options =3D {"--update" : True, "--deep" : 1}, + success =3D True, + mergelist =3D ['dev-java/icedtea-6.1-r1', 'virtual/jdk-1.6.0-r1', 'd= ev-java/ant-core-1.8']), =20 ResolverPlaygroundTestCase( ["dev-db/hsqldb"],