Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 581586 - sys-apps/portage-9999: emerge crash: KeyError: 'sourcefile'
Summary: sys-apps/portage-9999: emerge crash: KeyError: 'sourcefile'
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: portage-2.3.0
  Show dependency tree
 
Reported: 2016-04-29 19:54 UTC by Coacher
Modified: 2017-08-11 19:58 UTC (History)
0 users

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 Coacher 2016-04-29 19:54:20 UTC
Hello.

This is portage from master @ c65d9bc.

With every emerge command I get this traceback:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/emerge", line 44, in <module>
    from _emerge.main import emerge_main
  File "/usr/lib64/python3.4/site-packages/_emerge/main.py", line 23, in <module>
    from portage.sync import _SUBMODULE_PATH_MAP
  File "/usr/lib64/python3.4/site-packages/portage/sync/__init__.py", line 21, in <module>
    module_controller = Modules(path=path, namepath="portage.sync.modules")
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 85, in __init__
    self._modules = self._get_all_modules()
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 110, in _get_all_modules
    new_module = Module(entry, self._namepath)
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 30, in __init__
    self.initialized = self._initialize()
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 49, in _initialize
    kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
KeyError: 'sourcefile'

Same with gentoolkit utilities like equery/eshowkw/epkginfo.

Please fix.

Reproducible: Always
Comment 1 Coacher 2016-04-29 19:55:36 UTC
I cannot get you `emerge --info` even.
Comment 2 Coacher 2016-04-29 21:28:36 UTC
The problem seems to be with laymansync module:

$ python -m pdb /usr/bin/emerge
> /usr/bin/emerge(11)<module>()
-> from __future__ import with_statement
(Pdb) continue
Traceback (most recent call last):
  File "/usr/lib64/python3.4/pdb.py", line 1661, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
    self.run(statement)
  File "/usr/lib64/python3.4/bdb.py", line 431, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/usr/bin/emerge", line 11, in <module>
    from __future__ import with_statement
  File "<string>", line 44, in <module>
  File "/usr/lib64/python3.4/site-packages/_emerge/main.py", line 23, in <module>
    from portage.sync import _SUBMODULE_PATH_MAP
  File "/usr/lib64/python3.4/site-packages/portage/sync/__init__.py", line 21, in <module>
    module_controller = Modules(path=path, namepath="portage.sync.modules")
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 85, in __init__
    self._modules = self._get_all_modules()
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 110, in _get_all_modules
    new_module = Module(entry, self._namepath)
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 30, in __init__
    self.initialized = self._initialize()
  File "/usr/lib64/python3.4/site-packages/portage/module.py", line 49, in _initialize
    kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
KeyError: 'sourcefile'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib64/python3.4/site-packages/portage/module.py(49)_initialize()
-> kid['module_name'] = '.'.join([mod_name, kid['sourcefile']])
(Pdb) p kid
{'functions': ['sync', 'new', 'exists'], 'description': 'Layman plug-in module for portage.\nPerforms layman sync actions for layman overlays.\n', 'func_desc': {'exists': 'Returns a boolean of whether the specified dir exists and is a valid repository', 'new': 'Performs a layman add of the specified overlay', 'sync': 'Performs a layman sync of the specified overlay'}, 'validate_config': <class 'portage.sync.config_checks.CheckSyncConfig'>, 'class': 'PyLayman', 'name': 'laymansync'}

I have app-portage/layman-2.3.0-r1 installed.
Comment 3 Coacher 2016-04-29 21:37:09 UTC
Manually adding 

'sourcefile': 'laymansync',

to module_spec variable in portage/sync/modules/laymansync/__init__.py solves the problem for me.

Note that this change is not in layman master yet: https://gitweb.gentoo.org/proj/layman.git/tree/pm_plugins/portage/sync/modules/laymansync/__init__.py?id=b15d33d547a8fa99f6919036991e2a7e539fe04c
Comment 4 Coacher 2016-04-29 21:38:40 UTC
Please fix layman, or add a blocker for portage-9999, or at least add a warning.
Comment 5 Zac Medico gentoo-dev 2016-04-29 21:41:16 UTC
We'll have to make it disable broken modules like this, with a warning message.
Comment 6 Brian Dolbec (RETIRED) gentoo-dev 2016-04-29 22:32:05 UTC
I'm adding backwards compatibility fallback with a warning the module_spec needs updating.

I'll update layman's module_spec too.  Likely revision bump it with the updated module_spec.
Comment 7 Coacher 2016-04-29 22:43:31 UTC
(In reply to Brian Dolbec from comment #6)
> I'm adding backwards compatibility fallback with a warning the module_spec
> needs updating.
> 
> I'll update layman's module_spec too.  Likely revision bump it with the
> updated module_spec.

Great! I am awaiting your changes to show up at https://github.com/gentoo/portage/commits/master so I can test them right away.
Comment 8 Brian Dolbec (RETIRED) gentoo-dev 2016-04-29 23:29:51 UTC
Fixed in git:

 https://gitweb.gentoo.org/proj/portage.git/commit/?id=75fbbcf58f244717712602a83765bcdc6f07ddcf

Also layman's module_spec is updated in git:

https://gitweb.gentoo.org/proj/layman.git/commit/?id=53b41cb4d01a7b6f31d09f7fdb0a0292b633b7e3

Sorry, my development checkouts lost laymansync capability, plus I hadn't done layman operations recently using the development code.

Thank you for finding this quickly after I pushed the repoman stage2 re-write merge.
 

Also, I noticed with layman's git HEAD code, layman-updater -R is not generating a proper repos.conf/layman.conf file.  I'll get that fixed soon.  But layman-2.3.0 will work properly with the new portage code.  It'll just spit out a warning the module_spec is old and needs updating.
Comment 9 Coacher 2016-04-29 23:34:54 UTC
I can confirm that with portage-9999 from master @ 75fbbcf and layman-2.3.0-r1 this issue is no longer reproducible.

Thank you very much.
Comment 10 Zac Medico gentoo-dev 2017-08-11 19:58:42 UTC
Fixed in 2.3.0.