From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 430521382C5 for ; Sat, 27 Jan 2018 20:53:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 59111E0B1E; Sat, 27 Jan 2018 20:53:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 24488E0B1E for ; Sat, 27 Jan 2018 20:53:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E38DC335C30 for ; Sat, 27 Jan 2018 20:53:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 77F751C8 for ; Sat, 27 Jan 2018 20:53:48 +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: <1517086373.5c888fcd2e87270523f55fb180ced5c3c8689f76.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/portage/tests/resolver/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dep/dep_check.py pym/portage/tests/resolver/test_or_upgrade_installed.py X-VCS-Directories: pym/portage/dep/ pym/portage/tests/resolver/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 5c888fcd2e87270523f55fb180ced5c3c8689f76 X-VCS-Branch: master Date: Sat, 27 Jan 2018 20:53:48 +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: e09b7abc-bf9b-4f74-b9a7-0c7e191f06ae X-Archives-Hash: 3e6856b001be2bab91e7665817c6217a commit: 5c888fcd2e87270523f55fb180ced5c3c8689f76 Author: Zac Medico gentoo org> AuthorDate: Tue Jan 23 06:08:10 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Jan 27 20:52:53 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5c888fcd dep_zapdeps: fix virtual/rust handling (bug 645416) Fix the code from bug 643974 to set the installed_downgrade flag only if the selected newer package is either installed or in the graph. This is currently needed for appropriate handling of virtual/rust-1.19.0, since there's an upgrade to dev-lang/rust-1.23.0 available which may not be desired since it would mean that dev-lang/rust-bin-1.19.0 has to be installed in order to satisfy virtual/rust-1.19.0: || ( =dev-lang/rust-1.19.0* =dev-lang/rust-bin-1.19.0* ) So, the rust-bin choice is desirable only if the rust-1.23.0 package is already installed or in the graph. Fixes: 86ba22da7a2f ("dep_zapdeps: install new package, allow upgrade (bug 643974)") Bug: https://bugs.gentoo.org/645416 pym/portage/dep/dep_check.py | 10 ++-- .../tests/resolver/test_or_upgrade_installed.py | 59 ++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index c56f545ec..7e5a3186e 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -463,11 +463,15 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): avail_pkg = avail_pkg_use avail_slot = Atom("%s:%s" % (atom.cp, avail_pkg.slot)) - if downgrade_probe is not None: + if downgrade_probe is not None and graph is not None: highest_in_slot = mydbapi_match_pkgs(avail_slot) + highest_in_slot = (highest_in_slot[-1] + if highest_in_slot else None) if (avail_pkg and highest_in_slot and - avail_pkg < highest_in_slot[-1] and - not downgrade_probe(avail_pkg)): + avail_pkg < highest_in_slot and + not downgrade_probe(avail_pkg) and + (highest_in_slot.installed or + highest_in_slot in graph)): installed_downgrade = True slot_map[avail_slot] = avail_pkg diff --git a/pym/portage/tests/resolver/test_or_upgrade_installed.py b/pym/portage/tests/resolver/test_or_upgrade_installed.py index 6e01d321d..7018e08de 100644 --- a/pym/portage/tests/resolver/test_or_upgrade_installed.py +++ b/pym/portage/tests/resolver/test_or_upgrade_installed.py @@ -99,3 +99,62 @@ class OrUpgradeInstalledTestCase(TestCase): finally: playground.debug = False playground.cleanup() + + def testVirtualRust(self): + ebuilds = { + 'dev-lang/rust-1.19.0': {}, + 'dev-lang/rust-1.23.0': {}, + 'dev-lang/rust-bin-1.19.0': {}, + 'virtual/rust-1.19.0': { + 'RDEPEND': '|| ( =dev-lang/rust-1.19.0* =dev-lang/rust-bin-1.19.0* )' + }, + } + + installed = { + 'dev-lang/rust-1.19.0': {}, + 'virtual/rust-1.19.0': { + 'RDEPEND': '|| ( =dev-lang/rust-1.19.0* =dev-lang/rust-bin-1.19.0* )' + }, + } + + world = ['virtual/rust'] + + test_cases = ( + # Test bug 645416, where rust-bin-1.19.0 was pulled in + # inappropriately due to the rust-1.23.0 update being + # available. + ResolverPlaygroundTestCase( + ['virtual/rust'], + options={'--update': True, '--deep': True}, + success=True, + mergelist=[] + ), + # Test upgrade to rust-1.23.0, which is only possible + # if rust-bin-1.19.0 is installed in order to satisfy + # virtual/rust-1.19.0. + ResolverPlaygroundTestCase( + ['=dev-lang/rust-1.23.0', 'virtual/rust'], + options={'--update': True, '--deep': True}, + all_permutations=True, + success=True, + ambiguous_merge_order=True, + mergelist=( + ( + 'dev-lang/rust-1.23.0', + 'dev-lang/rust-bin-1.19.0', + ), + ), + ), + ) + + playground = ResolverPlayground(debug=False, + ebuilds=ebuilds, installed=installed, world=world) + + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, + test_case.fail_msg) + finally: + playground.debug = False + playground.cleanup()