1 |
commit: 84431fe188ed1b3e2e7b52918329bd696d8304b1 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 16 05:07:10 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 16 05:18:51 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=84431fe1 |
7 |
|
8 |
portdbapi.cp_list: honor porttrees modifications (bug 650814) |
9 |
|
10 |
Consumers, such as repoman and emirrordist, may modify the porttrees |
11 |
attribute in order to modify the effective set of repositories for all |
12 |
portdbapi operations. |
13 |
|
14 |
Fixes: 27eeeb6e4fc8 ("portdbapi.cp_list: cache repo associations (bug 650814)") |
15 |
Bug: https://bugs.gentoo.org/650814 |
16 |
|
17 |
pym/portage/dbapi/porttree.py | 25 +++++++++++++++++++++++-- |
18 |
1 file changed, 23 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py |
21 |
index 2e271ea76..677452273 100644 |
22 |
--- a/pym/portage/dbapi/porttree.py |
23 |
+++ b/pym/portage/dbapi/porttree.py |
24 |
@@ -322,6 +322,26 @@ class portdbapi(dbapi): |
25 |
self._better_cache = None |
26 |
self._broken_ebuilds = set() |
27 |
|
28 |
+ def _set_porttrees(self, porttrees): |
29 |
+ """ |
30 |
+ Consumers, such as repoman and emirrordist, may modify the porttrees |
31 |
+ attribute in order to modify the effective set of repositories for |
32 |
+ all portdbapi operations. |
33 |
+ |
34 |
+ @param porttrees: list of repo locations, in ascending order by |
35 |
+ repo priority |
36 |
+ @type porttrees: list |
37 |
+ """ |
38 |
+ self._porttrees_repos = portage.OrderedDict((repo.name, repo) |
39 |
+ for repo in (self.repositories.get_repo_for_location(location) |
40 |
+ for location in porttrees)) |
41 |
+ self._porttrees = tuple(porttrees) |
42 |
+ |
43 |
+ def _get_porttrees(self): |
44 |
+ return self._porttrees |
45 |
+ |
46 |
+ porttrees = property(_get_porttrees, _set_porttrees) |
47 |
+ |
48 |
@property |
49 |
def _event_loop(self): |
50 |
if portage._internal_caller: |
51 |
@@ -972,9 +992,10 @@ class portdbapi(dbapi): |
52 |
repos = [self.repositories.get_repo_for_location(location) |
53 |
for location in mytree] |
54 |
elif self._better_cache is None: |
55 |
- repos = list(self.repositories) |
56 |
+ repos = self._porttrees_repos.values() |
57 |
else: |
58 |
- repos = reversed(self._better_cache[mycp]) |
59 |
+ repos = [repo for repo in reversed(self._better_cache[mycp]) |
60 |
+ if repo.name in self._porttrees_repos] |
61 |
mylist = [] |
62 |
for repo in repos: |
63 |
oroot = repo.location |