From 029ec2b89b7d55c68d89b6dff3dbe5539825e71a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 2 Jan 2011 23:13:56 -0800 Subject: [PATCH] depgraph: prefer highest priority repo more often Prefer the highest priority repo, even when the ebuild from the higher priority repo requires USE adjustments due to USE deps or REQUIRED_USE. This will fix bug #350254. --- pym/_emerge/Package.py | 7 +++++++ pym/_emerge/depgraph.py | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 0b3375edc..c80bad3ac 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -351,6 +351,13 @@ class Package(Task): def repo(self): return self.metadata['repository'] + @property + def repo_priority(self): + repo_info = self.root_config.settings.repositories.prepos.get(self.repo) + if repo_info is None: + return None + return repo_info.priority + @property def use(self): if self._use is None: diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index badbb506d..f62af31b8 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -2877,12 +2877,22 @@ class depgraph(object): # list only contains unbuilt ebuilds since USE can't # be changed for built packages. higher_version_rejected = False + repo_priority = pkg.repo_priority for rejected in packages_with_invalid_use_config: if rejected.cp != pkg.cp: continue if rejected > pkg: higher_version_rejected = True break + if portage.dep.cpvequal(rejected.cpv, pkg.cpv): + # If version is identical then compare + # repo priority (see bug #350254). + rej_repo_priority = rejected.repo_priority + if rej_repo_priority is not None and \ + (repo_priority is None or + rej_repo_priority > repo_priority): + higher_version_rejected = True + break if higher_version_rejected: continue -- 2.26.2