From: Zac Medico Date: Wed, 19 Jan 2011 01:22:20 +0000 (-0800) Subject: depgraph: don't reinstall for changed repo X-Git-Tag: v2.2.0_alpha18~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=53e82dc0de30bb1339c2be5321bfb34e98d2f3f5;p=portage.git depgraph: don't reinstall for changed repo --- diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 737547626..c73381a82 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2991,7 +2991,16 @@ class depgraph(object): pkg_eb = self._pkg( pkg.cpv, "ebuild", root_config, myrepo=pkg.repo) except portage.exception.PackageNotFound: - continue + pkg_eb_visible = False + for pkg_eb in self._iter_match_pkgs(pkg.root_config, + "ebuild", Atom("=%s" % (pkg.cpv,))): + if self._pkg_visibility_check(pkg_eb, \ + allow_unstable_keywords=allow_unstable_keywords, + allow_license_changes=allow_license_changes): + pkg_eb_visible = True + break + if not pkg_eb_visible: + continue else: if not self._pkg_visibility_check(pkg_eb, \ allow_unstable_keywords=allow_unstable_keywords, @@ -5499,7 +5508,15 @@ class _dep_check_composite_db(dbapi): pkg.cpv, "ebuild", pkg.root_config, myrepo=pkg.repo) except portage.exception.PackageNotFound: - return False + pkg_eb_visible = False + for pkg_eb in self._depgraph._iter_match_pkgs( + pkg.root_config, "ebuild", + Atom("=%s" % (pkg.cpv,))): + if self._depgraph._pkg_visibility_check(pkg_eb): + pkg_eb_visible = True + break + if not pkg_eb_visible: + return False else: if not self._depgraph._pkg_visibility_check(pkg_eb): return False diff --git a/pym/portage/tests/resolver/test_multirepo.py b/pym/portage/tests/resolver/test_multirepo.py index 542bdd594..a4b905e69 100644 --- a/pym/portage/tests/resolver/test_multirepo.py +++ b/pym/portage/tests/resolver/test_multirepo.py @@ -1,4 +1,4 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -129,14 +129,13 @@ class MultirepoTestCase(TestCase): mergelist = ["dev-libs/F-1::repo1"]), # Dependency on installed dev-libs/C-2 ebuild for which ebuild is - # not available from the same repo should not unnecessarily pull - # in a different slot. It should just pull in the same slot from - # a different repo (bug #351828). + # not available from the same repo should not unnecessarily + # reinstall the same version from a different repo. ResolverPlaygroundTestCase( ["dev-libs/H"], options = {"--update": True, "--deep": True}, success = True, - mergelist = ["dev-libs/I-2"]), + mergelist = []), # Check interaction between repo priority and unsatisfied # REQUIRED_USE, for bug #350254. @@ -180,6 +179,10 @@ class MultirepoTestCase(TestCase): "dev-libs/E-1::repo1": { }, "dev-libs/H-1": { }, "dev-libs/H-1::repo1": { }, + "dev-libs/I-1::repo2": { "SLOT" : "1"}, + "dev-libs/I-2::repo2": { "SLOT" : "2"}, + "dev-libs/J-1": { "KEYWORDS": "x86", "EAPI" : "3", + "RDEPEND" : "|| ( dev-libs/I:2 dev-libs/I:1 )" }, #package.properties "dev-libs/F-1": { "PROPERTIES": "bar"}, @@ -193,6 +196,11 @@ class MultirepoTestCase(TestCase): "dev-libs/Z-1::repo3": { }, } + installed = { + "dev-libs/J-1": { "RDEPEND" : "|| ( dev-libs/I:2 dev-libs/I:1 )"}, + "dev-libs/I-2::repo1": {"SLOT" : "2"}, + } + user_config = { "package.use": ( @@ -210,6 +218,7 @@ class MultirepoTestCase(TestCase): ( "dev-libs/E::repo1", "dev-libs/H", + "dev-libs/I::repo1", #needed for package.unmask test "dev-libs/G", #wildcard test @@ -263,6 +272,16 @@ class MultirepoTestCase(TestCase): check_repo_names = True, mergelist = ["dev-libs/E-1"]), + # Dependency on installed dev-libs/C-2 ebuild for which ebuild is + # masked from the same repo should not unnecessarily pull + # in a different slot. It should just pull in the same slot from + # a different repo (bug #351828). + ResolverPlaygroundTestCase( + ["dev-libs/J"], + options = {"--update": True, "--deep": True}, + success = True, + mergelist = ["dev-libs/I-2"]), + #package.properties test ResolverPlaygroundTestCase( ["dev-libs/F"], @@ -286,7 +305,8 @@ class MultirepoTestCase(TestCase): success = False), ) - playground = ResolverPlayground(ebuilds=ebuilds, user_config=user_config) + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, user_config=user_config) try: for test_case in test_cases: playground.run_TestCase(test_case)