diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-09-22 10:50:17 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-26 23:50:14 -0700 |
commit | e5fb61a392ebd22b761e10f85e22243a52555b67 (patch) | |
tree | baf6afc5e3943c4d6484f28830eaf4670d34bd2f | |
parent | 616a4c9aed8897abc5c3da6305bb1508d969a6d4 (diff) | |
download | portage-e5fb61a392ebd22b761e10f85e22243a52555b67.tar.gz portage-e5fb61a392ebd22b761e10f85e22243a52555b67.tar.bz2 portage-e5fb61a392ebd22b761e10f85e22243a52555b67.zip |
reposyntax: Let portdbapi.getRepositories return repos sorted by priority
-rw-r--r-- | pym/portage/dbapi/porttree.py | 5 | ||||
-rw-r--r-- | pym/portage/tests/resolver/test_multirepo.py | 14 |
2 files changed, 11 insertions, 8 deletions
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) |