1 |
commit: 84aa6c743581222a3f4a8a855dbcb77a2774c5b6 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 3 06:08:13 2016 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 3 17:50:27 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=84aa6c74 |
7 |
|
8 |
eshowkw: migrate to PORTAGE_REPOSITORIES (bug 587856) |
9 |
|
10 |
Since PORTDIR_OVERLAY is deprecated, migrate to PORTAGE_REPOSITORIES. |
11 |
|
12 |
X-Gentoo-bug: 587856 |
13 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=587856 |
14 |
|
15 |
pym/gentoolkit/eshowkw/__init__.py | 32 +++++++++++++++++++++++++++----- |
16 |
1 file changed, 27 insertions(+), 5 deletions(-) |
17 |
|
18 |
diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py |
19 |
index ded166d..42a3860 100644 |
20 |
--- a/pym/gentoolkit/eshowkw/__init__.py |
21 |
+++ b/pym/gentoolkit/eshowkw/__init__.py |
22 |
@@ -1,5 +1,5 @@ |
23 |
# vim:fileencoding=utf-8 |
24 |
-# Copyright 2010 Gentoo Foundation |
25 |
+# Copyright 2010-2016 Gentoo Foundation |
26 |
# Distributed under the terms of the GNU General Public License v2 |
27 |
|
28 |
__package__ = 'gentoolkit.eshowkw' |
29 |
@@ -122,10 +122,32 @@ def main(argv, indirect = False): |
30 |
msg_err = 'No ebuilds at "%s"' % currdir |
31 |
raise SystemExit(msg_err) |
32 |
package= '%s/%s' % (os.path.basename(os.path.abspath('../')), os.path.basename(currdir)) |
33 |
- ourtree = os.path.abspath('../../') |
34 |
- overlays = '%s %s' % (ports['PORTDIR_OVERLAY'], ourtree) |
35 |
- mysettings = portc(local_config=False, env={'PORTDIR_OVERLAY': overlays}) |
36 |
- dbapi = portdbapi(mysettings=mysettings) |
37 |
+ ourtree = os.path.realpath('../..') |
38 |
+ ourstat = os.stat(ourtree) |
39 |
+ ourstat = (ourstat.st_ino, ourstat.st_dev) |
40 |
+ for repo in ports.repositories: |
41 |
+ try: |
42 |
+ repostat = os.stat(repo.location) |
43 |
+ except OSError: |
44 |
+ continue |
45 |
+ if ourstat == (repostat.st_ino, repostat.st_dev): |
46 |
+ dbapi = portdbapi(mysettings=portc(local_config=False)) |
47 |
+ break |
48 |
+ else: |
49 |
+ repos = {} |
50 |
+ for repo in ports.repositories: |
51 |
+ repos[repo.name] = repo.location |
52 |
+ |
53 |
+ with open(os.path.join(ourtree, 'profiles', 'repo_name'), |
54 |
+ 'rt') as f: |
55 |
+ repo_name = f.readline().strip() |
56 |
+ |
57 |
+ repos[repo_name] = ourtree |
58 |
+ repos = ''.join('[{}]\nlocation={}\n'.format(k, v) |
59 |
+ for k, v in repos.items()) |
60 |
+ mysettings = portc(local_config=False, |
61 |
+ env={'PORTAGE_REPOSITORIES': repos}) |
62 |
+ dbapi = portdbapi(mysettings=mysettings) |
63 |
# specify that we want just our nice tree we are in cwd |
64 |
dbapi.porttrees = [ourtree] |
65 |
process_display(package, keywords, dbapi) |