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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EC79815823F for ; Sun, 19 Nov 2023 17:56:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 14AF52BC014; Sun, 19 Nov 2023 17:56:03 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DED032BC014 for ; Sun, 19 Nov 2023 17:56:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BBF5B335CB9 for ; Sun, 19 Nov 2023 17:56:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 090F3132F for ; Sun, 19 Nov 2023 17:56:00 +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: <1700367322.9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/, lib/portage/tests/resolver/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/depgraph.py lib/portage/tests/resolver/meson.build lib/portage/tests/resolver/test_alternatives_gzip.py lib/portage/tests/resolver/test_merge_order.py lib/portage/tests/resolver/test_rebuild_ghostscript.py X-VCS-Directories: lib/_emerge/ lib/portage/tests/resolver/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e X-VCS-Branch: master Date: Sun, 19 Nov 2023 17:56:00 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9a33b39a-b03e-40ef-8ae9-353184e98c1b X-Archives-Hash: d71e0535dd545f428906b5cdfbddb732 commit: 9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e Author: Zac Medico gentoo org> AuthorDate: Sat Nov 18 17:07:59 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Nov 19 04:15:22 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9206d5a7 find_smallest_cycle: Increase ignore_priority to find smaller cycles Fix AlternativesGzipTestCase by increasing ignore_priority in order to find smaller cycles. This causes some changes in merge order for MergeOrderTestCase, but they appear to be acceptable since they prevent temporarily unsatisfied RDEPEND by relying on satisfied installed build-time dependencies. Add a test case for bug 690436, since the change to merge order in MergeOrderTestCase is related (see commit 680276cc4d4f). Bug: https://bugs.gentoo.org/690436 Bug: https://bugs.gentoo.org/917259 Signed-off-by: Zac Medico gentoo.org> lib/_emerge/depgraph.py | 7 +- lib/portage/tests/resolver/meson.build | 1 + .../tests/resolver/test_alternatives_gzip.py | 7 +- lib/portage/tests/resolver/test_merge_order.py | 24 ++-- .../tests/resolver/test_rebuild_ghostscript.py | 160 +++++++++++++++++++++ 5 files changed, 180 insertions(+), 19 deletions(-) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index e4305c18c9..0d3b37c698 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -9345,9 +9345,10 @@ class depgraph: smallest_cycle = selected_nodes ignore_priority = priority - # Exit this loop with the lowest possible priority, which - # minimizes the use of installed packages to break cycles. - if smallest_cycle is not None: + if smallest_cycle is not None and len(smallest_cycle) == 1: + # The cycle can't get any smaller than this, + # so there is no need to search further since + # we try to minimize ignore_priority. break return smallest_cycle, ignore_priority diff --git a/lib/portage/tests/resolver/meson.build b/lib/portage/tests/resolver/meson.build index 7d2bd367d4..770027ac47 100644 --- a/lib/portage/tests/resolver/meson.build +++ b/lib/portage/tests/resolver/meson.build @@ -49,6 +49,7 @@ py.install_sources( 'test_profile_default_eapi.py', 'test_profile_package_set.py', 'test_rebuild.py', + 'test_rebuild_ghostscript.py', 'test_regular_slot_change_without_revbump.py', 'test_required_use.py', 'test_runtime_cycle_merge_order.py', diff --git a/lib/portage/tests/resolver/test_alternatives_gzip.py b/lib/portage/tests/resolver/test_alternatives_gzip.py index 602ed1756f..7cd1da25f1 100644 --- a/lib/portage/tests/resolver/test_alternatives_gzip.py +++ b/lib/portage/tests/resolver/test_alternatives_gzip.py @@ -1,8 +1,6 @@ # Copyright 2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -import pytest - from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ( ResolverPlayground, @@ -10,7 +8,6 @@ from portage.tests.resolver.ResolverPlayground import ( ) -@pytest.mark.xfail() class AlternativesGzipTestCase(TestCase): def testAlternativesGzip(self): """ @@ -19,8 +16,8 @@ class AlternativesGzipTestCase(TestCase): find_smallest_cycle selects a large cycle and the topological sort produces poor results when leaf_nodes returns app-alternatives/gzip as part of a large group of nodes. - This problem might be solved by implementing a finer-grained - ignore_priority for leaf_nodes calls. + This problem was solved by increasing ignore_priority in order + to find a smaller cycle. """ ebuilds = { "app-alternatives/gzip-1": { diff --git a/lib/portage/tests/resolver/test_merge_order.py b/lib/portage/tests/resolver/test_merge_order.py index 940eb3bbbe..671543ca29 100644 --- a/lib/portage/tests/resolver/test_merge_order.py +++ b/lib/portage/tests/resolver/test_merge_order.py @@ -382,10 +382,12 @@ class MergeOrderTestCase(TestCase): ambiguous_merge_order=True, # The following merge order assertion reflects optimal order for # a circular relationship which is DEPEND in one direction and - # RDEPEND in the other. - merge_order_assertions=( - ("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"), - ), + # RDEPEND in the other. However, it is not respected because + # it would result in a temporarily broken RDEPEND, so we instead + # rely on satisfied installed build-time dependencies. + # merge_order_assertions=( + # ("app-misc/circ-buildtime-a-1", "app-misc/circ-buildtime-c-1"), + # ), mergelist=[ ( "app-misc/circ-buildtime-b-1", @@ -699,15 +701,15 @@ class MergeOrderTestCase(TestCase): "!app-misc/installed-blocker-a", "app-misc/circ-direct-a-1", "app-misc/circ-direct-b-1", - "x11-base/xorg-server-1.14.1", - "media-libs/mesa-9.1.3", - "app-misc/circ-buildtime-a-1", - "app-misc/circ-buildtime-b-1", - "app-misc/circ-buildtime-c-1", - "app-misc/some-app-c-1", "app-misc/circ-satisfied-a-1", - "app-misc/circ-satisfied-b-1", "app-misc/circ-satisfied-c-1", + "app-misc/circ-satisfied-b-1", + "app-misc/circ-buildtime-c-1", + "app-misc/circ-buildtime-b-1", + "app-misc/circ-buildtime-a-1", + "app-misc/some-app-c-1", + "x11-base/xorg-server-1.14.1", + "media-libs/mesa-9.1.3", ], ), ) diff --git a/lib/portage/tests/resolver/test_rebuild_ghostscript.py b/lib/portage/tests/resolver/test_rebuild_ghostscript.py new file mode 100644 index 0000000000..e1d736610e --- /dev/null +++ b/lib/portage/tests/resolver/test_rebuild_ghostscript.py @@ -0,0 +1,160 @@ +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +from portage.tests import TestCase +from portage.tests.resolver.ResolverPlayground import ( + ResolverPlayground, + ResolverPlaygroundTestCase, +) + + +class RebuildGhostscriptTestCase(TestCase): + def testRebuildGhostscript(self): + """ + Test bug 703676, where app-text/libspectre was rebuilt before + its app-text/ghostscript-gpl DEPEND. + """ + ebuilds = { + "app-text/ghostscript-gpl-10.01.1": { + "EAPI": "8", + "DEPEND": "gtk? ( x11-libs/gtk+:3 )", + "RDEPEND": "gtk? ( x11-libs/gtk+:3 )", + "IUSE": "gtk", + }, + "app-text/ghostscript-gpl-10.01.2": { + "EAPI": "8", + "SLOT": "0/10.01", + "DEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "RDEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "IUSE": "dbus gtk", + }, + "app-text/libspectre-0.2.11": { + "EAPI": "8", + "DEPEND": ">=app-text/ghostscript-gpl-9.53.0:=", + "RDEPEND": ">=app-text/ghostscript-gpl-9.53.0:=", + }, + "app-text/libspectre-0.2.12": { + "EAPI": "8", + "DEPEND": ">=app-text/ghostscript-gpl-9.53.0:=", + "RDEPEND": ">=app-text/ghostscript-gpl-9.53.0:=", + }, + "net-dns/avahi-0.8-r7": { + "EAPI": "8", + "DEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "RDEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "IUSE": "dbus gtk", + }, + "net-print/cups-2.4.6": { + "EAPI": "8", + "DEPEND": "zeroconf? ( >=net-dns/avahi-0.6.31-r2[dbus] )", + "RDEPEND": "zeroconf? ( >=net-dns/avahi-0.6.31-r2[dbus] )", + "IUSE": "zeroconf", + }, + "sys-apps/dbus-1.15.6": { + "EAPI": "8", + }, + "x11-libs/gtk+-3.24.38": { + "EAPI": "8", + "SLOT": "3", + "DEPEND": "cups? ( >=net-print/cups-2.0 )", + "RDEPEND": "cups? ( >=net-print/cups-2.0 )", + "IUSE": "cups", + }, + "x11-libs/goffice-0.10.55": { + "EAPI": "8", + "DEPEND": ">=app-text/libspectre-0.2.6:=", + "RDEPEND": ">=app-text/libspectre-0.2.6:=", + }, + } + + installed = { + "app-text/ghostscript-gpl-10.01.1": { + "EAPI": "8", + "DEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "RDEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "IUSE": "dbus gtk", + "USE": "dbus gtk", + }, + "app-text/libspectre-0.2.11": { + "EAPI": "8", + "DEPEND": ">=app-text/ghostscript-gpl-9.53.0:0/10.01=", + "RDEPEND": ">=app-text/ghostscript-gpl-9.53.0:0/10.01=", + }, + "net-dns/avahi-0.8-r7": { + "EAPI": "8", + "DEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "RDEPEND": "dbus? ( sys-apps/dbus ) gtk? ( x11-libs/gtk+:3 )", + "IUSE": "dbus gtk", + "USE": "dbus gtk", + }, + "net-print/cups-2.4.6": { + "EAPI": "8", + "DEPEND": "zeroconf? ( >=net-dns/avahi-0.6.31-r2[dbus] )", + "RDEPEND": "zeroconf? ( >=net-dns/avahi-0.6.31-r2[dbus] )", + "IUSE": "zeroconf", + "USE": "zeroconf", + }, + "sys-apps/dbus-1.15.6": { + "EAPI": "8", + }, + "x11-libs/gtk+-3.24.38": { + "EAPI": "8", + "SLOT": "3", + "DEPEND": "cups? ( >=net-print/cups-2.0 )", + "RDEPEND": "cups? ( >=net-print/cups-2.0 )", + "IUSE": "cups", + "USE": "cups", + }, + "x11-libs/goffice-0.10.55": { + "EAPI": "8", + "DEPEND": ">=app-text/libspectre-0.2.6:0=", + "RDEPEND": ">=app-text/libspectre-0.2.6:0=", + }, + } + + world = [ + "x11-libs/goffice", + ] + + user_config = { + "make.conf": ('USE="cups dbus gtk zeroconf"',), + } + + test_cases = ( + ResolverPlaygroundTestCase( + ["@world"], + options={"--deep": True, "--update": True}, + success=True, + mergelist=[ + "app-text/ghostscript-gpl-10.01.2", + "app-text/libspectre-0.2.12", + ], + ), + ResolverPlaygroundTestCase( + ["@world"], + options={"--emptytree": True}, + success=True, + mergelist=[ + "sys-apps/dbus-1.15.6", + "app-text/ghostscript-gpl-10.01.2", + "app-text/libspectre-0.2.12", + "x11-libs/goffice-0.10.55", + "net-dns/avahi-0.8-r7", + "net-print/cups-2.4.6", + "x11-libs/gtk+-3.24.38", + ], + ), + ) + + playground = ResolverPlayground( + ebuilds=ebuilds, + installed=installed, + world=world, + user_config=user_config, + ) + 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.cleanup()