fff7d1bc / pkg-testing-tools

Archived project, no further development will happen in this repository. Set of tools to simplify package testing for arch stabilizations and package bumps in Gentoo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculating USE combos seemingly very inefficient

ajakk opened this issue · comments

commented

It seems to be practically impossible to use this for something like QEMU, seemingly due to inefficient USE combination calculations:

# time pkg-testing-tool -p '=app-emulation/qemu-6.2.0'
^CTraceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/pkg-testing-tool", line 33, in <module>
    sys.exit(load_entry_point('pkg-testing-tools==0.1.0', 'console_scripts', 'pkg-testing-tool')())
  File "/usr/lib/python3.9/site-packages/pkg_testing_tool/main.py", line 401, in main
    pkg_testing_tool(args, extra_args)
  File "/usr/lib/python3.9/site-packages/pkg_testing_tool/main.py", line 337, in pkg_testing_tool
    for new_job in define_jobs(atom, args):
  File "/usr/lib/python3.9/site-packages/pkg_testing_tool/main.py", line 241, in define_jobs
    use_combinations = get_use_combinations(package_metadata['iuse'], package_metadata['ruse'], args.max_use_combinations)
  File "/usr/lib/python3.9/site-packages/pkg_testing_tool/use.py", line 105, in get_use_combinations
    if portage.dep.check_required_use(" ".join(ruse), flags, iuse_match_always_true):
  File "/usr/lib/python3.9/site-packages/portage/dep/__init__.py", line 3100, in check_required_use
    stack[level].append(satisfied)
KeyboardInterrupt


real    51m2.786s
user    50m54.179s
sys     0m1.057s
commented

The pain persists with --max-use-combinations 1.

What made you believe it is very inefficient? QEMU have total of 125 USE flags which gives about 42535295865117307932921825928971026432 USE flags combinations, that needs to be then checked if they actually can be together.

Feel free to submit a PR with better algorithm.

I found the bug you are hitting. For common sense it drops some flags like python_target_ out of combinations, but then it is in REQUIRED_USE so every check will always fail. What it needs is a code that will probe ignored flags, preserve them, and then append to required_use check as static flags, this way it will work. I even have comment about it in code.

commented

Is it really correct to ignore Python flags? Surely it's usually a good idea to test each Python implementation when testing a package. Maybe ignored flags should be configurable from the command line, too?

They are ignored because they are not meant to be shuffled, this would lead to way too many bad things if you were to try to shuffle cpu_flags, python_targets etc.

The fix for it will be to first ask portage to calculate final USE flags set for package, and then extract the 'ignored' flags as they are, and append them to check_required_use() call to PORTAGE API. This way there is little chance that it will again not work, as long as 'emerge foo -pv' can get the required flags there.

Project now being archived and turned into read-only, no further development will happen in this repository.