From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D7C371381F3 for ; Sat, 6 Jul 2013 21:45:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9BA69E09C5; Sat, 6 Jul 2013 21:45:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2608DE09C5 for ; Sat, 6 Jul 2013 21:45:26 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CA8AA33E7C3 for ; Sat, 6 Jul 2013 21:45:24 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 45321E468F for ; Sat, 6 Jul 2013 21:45:23 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1373147104.92d9c95c83ddc6ac7b59395db92c0c8d81d7687a.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/AbstractDepPriority.py pym/_emerge/DepPriority.py pym/_emerge/DepPrioritySatisfiedRange.py pym/_emerge/UnmergeDepPriority.py pym/_emerge/depgraph.py pym/portage/tests/resolver/test_merge_order.py X-VCS-Directories: pym/portage/tests/resolver/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 92d9c95c83ddc6ac7b59395db92c0c8d81d7687a X-VCS-Branch: master Date: Sat, 6 Jul 2013 21:45:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7d2d4d1b-03c1-4803-a776-728c57f8862b X-Archives-Hash: 5e664b8c46d4f4eba17a96717811ced2 commit: 92d9c95c83ddc6ac7b59395db92c0c8d81d7687a Author: Zac Medico gentoo org> AuthorDate: Sat Jul 6 21:45:04 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Jul 6 21:45:04 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=92d9c95c depgraph: tweak slot-operator merge order This handles circular DEPEND/RDEPEND with one := operator, so that when both deps are already satisfied by installed packages, the := dep is given higher priority in merge order. --- pym/_emerge/AbstractDepPriority.py | 5 ++-- pym/_emerge/DepPriority.py | 29 +++++++++++++-------- pym/_emerge/DepPrioritySatisfiedRange.py | 23 ++++++++++++----- pym/_emerge/UnmergeDepPriority.py | 25 ++++++++++-------- pym/_emerge/depgraph.py | 7 ++++++ pym/portage/tests/resolver/test_merge_order.py | 35 +++++++++++++++++++++++++- 6 files changed, 93 insertions(+), 31 deletions(-) diff --git a/pym/_emerge/AbstractDepPriority.py b/pym/_emerge/AbstractDepPriority.py index 94f26ef..1fcd043 100644 --- a/pym/_emerge/AbstractDepPriority.py +++ b/pym/_emerge/AbstractDepPriority.py @@ -1,11 +1,12 @@ -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import copy from portage.util.SlotObject import SlotObject class AbstractDepPriority(SlotObject): - __slots__ = ("buildtime", "runtime", "runtime_post") + __slots__ = ("buildtime", "buildtime_slot_op", + "runtime", "runtime_post", "runtime_slot_op") def __lt__(self, other): return self.__int__() < other diff --git a/pym/_emerge/DepPriority.py b/pym/_emerge/DepPriority.py index 3c2256a..34fdb48 100644 --- a/pym/_emerge/DepPriority.py +++ b/pym/_emerge/DepPriority.py @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AbstractDepPriority import AbstractDepPriority @@ -16,31 +16,38 @@ class DepPriority(AbstractDepPriority): Attributes Hardness - buildtime 0 - runtime -1 - runtime_post -2 - optional -3 - (none of the above) -4 + buildtime_slot_op 0 + buildtime -1 + runtime -2 + runtime_post -3 + optional -4 + (none of the above) -5 """ if self.optional: - return -3 - if self.buildtime: + return -4 + if self.buildtime_slot_op: return 0 - if self.runtime: + if self.buildtime: return -1 - if self.runtime_post: + if self.runtime: return -2 - return -4 + if self.runtime_post: + return -3 + return -5 def __str__(self): if self.ignored: return "ignored" if self.optional: return "optional" + if self.buildtime_slot_op: + return "buildtime_slot_op" if self.buildtime: return "buildtime" + if self.runtime_slot_op: + return "runtime_slot_op" if self.runtime: return "runtime" if self.runtime_post: diff --git a/pym/_emerge/DepPrioritySatisfiedRange.py b/pym/_emerge/DepPrioritySatisfiedRange.py index edb29df..e5fdba9 100644 --- a/pym/_emerge/DepPrioritySatisfiedRange.py +++ b/pym/_emerge/DepPrioritySatisfiedRange.py @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.DepPriority import DepPriority @@ -7,17 +7,18 @@ class DepPrioritySatisfiedRange(object): DepPriority Index Category not satisfied and buildtime HARD - not satisfied and runtime 6 MEDIUM - not satisfied and runtime_post 5 MEDIUM_SOFT + not satisfied and runtime 7 MEDIUM + not satisfied and runtime_post 6 MEDIUM_SOFT + satisfied and buildtime_slot_op 5 SOFT satisfied and buildtime 4 SOFT satisfied and runtime 3 SOFT satisfied and runtime_post 2 SOFT optional 1 SOFT (none of the above) 0 NONE """ - MEDIUM = 6 - MEDIUM_SOFT = 5 - SOFT = 4 + MEDIUM = 7 + MEDIUM_SOFT = 6 + SOFT = 5 NONE = 0 @classmethod @@ -50,6 +51,15 @@ class DepPrioritySatisfiedRange(object): def _ignore_satisfied_buildtime(cls, priority): if priority.__class__ is not DepPriority: return False + if priority.buildtime_slot_op: + return False + return bool(priority.optional or \ + priority.satisfied) + + @classmethod + def _ignore_satisfied_buildtime_slot_op(cls, priority): + if priority.__class__ is not DepPriority: + return False return bool(priority.optional or \ priority.satisfied) @@ -80,6 +90,7 @@ DepPrioritySatisfiedRange.ignore_priority = ( DepPrioritySatisfiedRange._ignore_satisfied_runtime_post, DepPrioritySatisfiedRange._ignore_satisfied_runtime, DepPrioritySatisfiedRange._ignore_satisfied_buildtime, + DepPrioritySatisfiedRange._ignore_satisfied_buildtime_slot_op, DepPrioritySatisfiedRange._ignore_runtime_post, DepPrioritySatisfiedRange._ignore_runtime ) diff --git a/pym/_emerge/UnmergeDepPriority.py b/pym/_emerge/UnmergeDepPriority.py index 4316600..0457ea9 100644 --- a/pym/_emerge/UnmergeDepPriority.py +++ b/pym/_emerge/UnmergeDepPriority.py @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from _emerge.AbstractDepPriority import AbstractDepPriority @@ -7,15 +7,16 @@ class UnmergeDepPriority(AbstractDepPriority): """ Combination of properties Priority Category - runtime 0 HARD - runtime_post -1 HARD - buildtime -2 SOFT - (none of the above) -2 SOFT + runtime_slot_op 0 HARD + runtime -1 HARD + runtime_post -2 HARD + buildtime -3 SOFT + (none of the above) -3 SOFT """ MAX = 0 - SOFT = -2 - MIN = -2 + SOFT = -3 + MIN = -3 def __init__(self, **kwargs): AbstractDepPriority.__init__(self, **kwargs) @@ -23,13 +24,15 @@ class UnmergeDepPriority(AbstractDepPriority): self.optional = True def __int__(self): - if self.runtime: + if self.runtime_slot_op: return 0 - if self.runtime_post: + if self.runtime: return -1 - if self.buildtime: + if self.runtime_post: return -2 - return -2 + if self.buildtime: + return -3 + return -3 def __str__(self): if self.ignored: diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index b2d79a8..939adde 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2254,6 +2254,13 @@ class depgraph(object): mypriority = dep_priority.copy() if not atom.blocker: + + if atom.slot_operator == "=": + if mypriority.buildtime: + mypriority.buildtime_slot_op = True + if mypriority.runtime: + mypriority.runtime_slot_op = True + inst_pkgs = [inst_pkg for inst_pkg in reversed(vardb.match_pkgs(atom)) if not reinstall_atoms.findAtomForPackage(inst_pkg, diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage/tests/resolver/test_merge_order.py index 5b5709a..5d000d1 100644 --- a/pym/portage/tests/resolver/test_merge_order.py +++ b/pym/portage/tests/resolver/test_merge_order.py @@ -1,4 +1,4 @@ -# Copyright 2011 Gentoo Foundation +# Copyright 2011-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import portage @@ -191,6 +191,12 @@ class MergeOrderTestCase(TestCase): "DEPEND" : "kde-base/libkdegames", "RDEPEND" : "kde-base/libkdegames", }, + "media-libs/mesa-9.1.3" : { + "EAPI" : "5", + "IUSE" : "+xorg", + "DEPEND" : "xorg? ( x11-base/xorg-server:= )", + "RDEPEND" : "xorg? ( x11-base/xorg-server:= )", + }, "media-video/libav-0.7_pre20110327" : { "EAPI" : "2", "IUSE" : "X +encode", @@ -205,6 +211,12 @@ class MergeOrderTestCase(TestCase): "IUSE" : "X +encode", "RDEPEND" : "|| ( >=media-video/ffmpeg-0.6.90_rc0-r2[X=,encode=] >=media-video/libav-0.6.90_rc[X=,encode=] )", }, + "x11-base/xorg-server-1.14.1" : { + "EAPI" : "5", + "SLOT": "0/1.14.1", + "DEPEND" : "media-libs/mesa", + "RDEPEND" : "media-libs/mesa", + }, } installed = { @@ -256,6 +268,13 @@ class MergeOrderTestCase(TestCase): "RDEPEND": "", }, "app-arch/xz-utils-5.0.1" : {}, + "media-libs/mesa-9.1.3" : { + "EAPI" : "5", + "IUSE" : "+xorg", + "USE": "xorg", + "DEPEND" : "x11-base/xorg-server:0/1.14.1=", + "RDEPEND" : "x11-base/xorg-server:0/1.14.1=", + }, "media-video/ffmpeg-0.7_rc1" : { "EAPI" : "2", "IUSE" : "X +encode", @@ -267,6 +286,12 @@ class MergeOrderTestCase(TestCase): "USE" : "encode", "RDEPEND" : "|| ( >=media-video/ffmpeg-0.6.90_rc0-r2[X=,encode=] >=media-video/libav-0.6.90_rc[X=,encode=] )", }, + "x11-base/xorg-server-1.14.1" : { + "EAPI" : "5", + "SLOT": "0/1.14.1", + "DEPEND" : "media-libs/mesa", + "RDEPEND" : "media-libs/mesa", + }, } test_cases = ( @@ -434,6 +459,14 @@ class MergeOrderTestCase(TestCase): ('kde-base/libkdegames-3.5.7', 'kde-base/kmines-3.5.7'), ), mergelist = [('kde-base/kdelibs-3.5.7', 'dev-util/pkgconfig-0.25-r2', 'kde-misc/kdnssd-avahi-0.1.2', 'app-arch/xz-utils-5.0.2', 'kde-base/libkdegames-3.5.7', 'kde-base/kdnssd-3.5.7', 'kde-base/kmines-3.5.7')]), + # Test satisfied circular DEPEND/RDEPEND with one := operator. + # Both deps are already satisfied by installed packages, but + # the := dep is given higher priority in merge order. + ResolverPlaygroundTestCase( + ["media-libs/mesa", "x11-base/xorg-server"], + success=True, + all_permutations = True, + mergelist = ['x11-base/xorg-server-1.14.1', 'media-libs/mesa-9.1.3']), ) playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)