Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 656994 - =app-portage/gentoolkit-0.4.2-r1 does not work in prefix: KeyError: '/'
Summary: =app-portage/gentoolkit-0.4.2-r1 does not work in prefix: KeyError: '/'
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-31 19:35 UTC by Sergei Trofimovich (RETIRED)
Modified: 2021-01-10 19:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich (RETIRED) gentoo-dev 2018-05-31 19:35:14 UTC
Noticed today when tried to keyword ebuild from prefix system:

$ ekeyword ~ia64 dev-haskell/shelly/shelly-1.6.8.1.ebuild 
Traceback (most recent call last):
  File "/home/siarheit/gentoo/rap/usr/lib/python-exec/python3.5/ekeyword", line 41, in <module>
    ekeyword.main(sys.argv[1:])
  File "/home/siarheit/gentoo/rap/usr/lib64/python3.5/site-packages/gentoolkit/ekeyword/ekeyword.py", line 528, in main
    if not portage_settings().get('NOCOLOR', 'false').lower() in ('no', 'false'):
  File "/home/siarheit/gentoo/rap/usr/lib64/python3.5/site-packages/gentoolkit/ekeyword/ekeyword.py", line 347, in portage_settings
    return portage.db['/']['vartree'].settings
  File "/home/siarheit/gentoo/rap/usr/lib64/python3.5/site-packages/portage/proxy/objectproxy.py", line 44, in __getitem__
    return object.__getattribute__(self, '_get_target')()[key]
KeyError: '/'

$ portageq envvar EROOT
/home/siarheit/gentoo/rap/

I've worked it around locally as [1] but not sure if it's ok or 'portage.root' should be used instead of 'portage.settings['EROOT']'.

[1]: workaround

--- a/pym/gentoolkit/ekeyword/ekeyword.py
+++ b/pym/gentoolkit/ekeyword/ekeyword.py
@@ -344,7 +344,8 @@ def portage_settings():
        """Return the portage settings we care about."""
        # Portage creates the db member on the fly which confuses the linter.
        # pylint: disable=no-member
-       return portage.db['/']['vartree'].settings
+       eroot = portage.settings['EROOT']
+       return portage.db[eroot]['vartree'].settings
 
 
 def load_profile_data(portdir=None, repo='gentoo'):
Comment 1 Fabian Groffen gentoo-dev 2021-01-10 19:44:34 UTC
ekeyword works for me in Prefix, I think this is fixed nowadays