From: Sebastian Luther Date: Wed, 22 Sep 2010 08:50:17 +0000 (+0200) Subject: reposyntax: Let portdbapi.getRepositories return repos sorted by priority X-Git-Tag: v2.2_rc90~110 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e5fb61a392ebd22b761e10f85e22243a52555b67;p=portage.git reposyntax: Let portdbapi.getRepositories return repos sorted by priority --- diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index d5fb0a18c..44dfa2503 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -265,6 +265,9 @@ class portdbapi(dbapi): self._repo_info[path] = _repo_info(repo_name, path, eclass_db) + #Keep a list of repo names, sorted by priority (highest priority first). + self._ordered_repo_name_list = tuple(self._repo_info[path].name for path in reversed(self.porttrees)) + self.auxdbmodule = self.settings.load_best_module("portdbapi.auxdbmodule") self.auxdb = {} self._pregen_auxdb = {} @@ -388,7 +391,7 @@ class portdbapi(dbapi): repository IDs TreeMap = {id: path} """ - return [k for k in self.treemap if k] + return self._ordered_repo_name_list def findname2(self, mycpv, mytree=None, myrepo = None): """ diff --git a/pym/portage/tests/resolver/test_multirepo.py b/pym/portage/tests/resolver/test_multirepo.py index 4ff7ce3de..14f415c99 100644 --- a/pym/portage/tests/resolver/test_multirepo.py +++ b/pym/portage/tests/resolver/test_multirepo.py @@ -75,19 +75,19 @@ class MultirepoTestCase(TestCase): check_repo_names = True, mergelist = ["dev-libs/C-1::repo1"]), - #Package in repository 1 and 2, but 1 must be used + #Package in repository 1 and 2, but 2 must be used ResolverPlaygroundTestCase( ["dev-libs/D"], success = True, check_repo_names = True, - mergelist = ["dev-libs/D-1::repo1"]), + mergelist = ["dev-libs/D-1::repo2"]), #Atoms with slots ResolverPlaygroundTestCase( ["dev-libs/E"], success = True, check_repo_names = True, - mergelist = ["dev-libs/E-1::repo1"]), + mergelist = ["dev-libs/E-1::repo2"]), ResolverPlaygroundTestCase( ["dev-libs/E:1::repo2"], success = True, @@ -102,17 +102,17 @@ class MultirepoTestCase(TestCase): ["dev-libs/F:1"], success = True, check_repo_names = True, - mergelist = ["dev-libs/F-1::repo1"]), + mergelist = ["dev-libs/F-1::repo2"]), ResolverPlaygroundTestCase( ["=dev-libs/F-1:1"], success = True, check_repo_names = True, - mergelist = ["dev-libs/F-1::repo1"]), + mergelist = ["dev-libs/F-1::repo2"]), ResolverPlaygroundTestCase( - ["=dev-libs/F-1:1::repo2"], + ["=dev-libs/F-1:1::repo1"], success = True, check_repo_names = True, - mergelist = ["dev-libs/F-1::repo2"]), + mergelist = ["dev-libs/F-1::repo1"]), ) playground = ResolverPlayground(ebuilds=ebuilds, sets=sets)