Portage version: 3.0.51 coming from: https://github.com/slashbeast/pkg-testing-tools/issues/16 I have an ebuild sci-physics/looptools-2.16-r1.ebuild and _no_ sci-physics/looptools-2.16.ebuild. Then the look up for flags in dbapi/portree fails. If I however add the r0 ebuild sci-physics/looptools-2.16.ebuild. Then it works again. Traceback (most recent call last): File "/root/.cache/pypoetry/virtualenvs/pkg-testing-tools-sUsJM4fC-py3.11/bin/pkg-testing-tool", line 6, in <module> sys.exit(main()) ^^^^^^ File "/home/apn/git/pkg-testing-tools/pkg_testing_tools/main.py", line 414, in main pkg_testing_tool(args, extra_args) File "/home/apn/git/pkg-testing-tools/pkg_testing_tools/main.py", line 350, in pkg_testing_tool for new_job in define_jobs(atom, args): ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/apn/git/pkg-testing-tools/pkg_testing_tools/main.py", line 242, in define_jobs package_metadata = get_package_metadata(atom) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/apn/git/pkg-testing-tools/pkg_testing_tools/main.py", line 133, in get_package_metadata iuse, ruse = get_package_flags(cpv) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/apn/git/pkg-testing-tools/pkg_testing_tools/use.py", line 58, in get_package_flags flags = portage.db[portage.root]['porttree'].dbapi.aux_get(cpv, ['IUSE', 'REQUIRED_USE']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/portage/dbapi/porttree.py", line 669, in aux_get return loop.run_until_complete( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ portage.exception.PortageKeyError: 'sci-physics/looptools-2.16'
The dbapi.aux_get method is supposed to raise an error if the exact requested version does not exist. You can use the dbapi.match method if you want to match an atom, and then use the returned cpv(s) for aux_get calls.
Note that the -r1 is considered part of the version, and dbapi.aux_get with 'sci-physics/looptools-2.16' as input is supposed to raise an error if the -r0 does not exist.
Thanks! pkg-testing-tool was using portage.dep.dep_getcpv to get the cpv, but dbapi.match(...)[0] does the trick.