pkgdev icon indicating copy to clipboard operation
pkgdev copied to clipboard

pkgdev tatt: Automatically satisfy REQUIRED_USE when generating --use-combos

Open anthonyryan1 opened this issue 2 years ago • 5 comments

I'm looking to exhaustively test all possible USE flag combinations on a package that has over 100 USE flags (www-servers/nginx).

As part of my work to fix https://bugs.gentoo.org/578658 I'm in the process of updating the ebuild to properly define all of the USE inter-dependencies using REQUIRED_USE, resulting in a almost 100 USE flag combination constraints.

If I run:

pkgdev tatt --use-combos 1000 --package www-servers/nginx --job-name nginx

Almost all of the generated USE flag combinations will fail to satisfy at least one REQUIRED_USE constraint, making it impossible to use this tool for testing all of the valid combinations.

I think it would be nice to update tatt to compare generated USE flag combinations against REQUIRED_USE and automatically add or remove from the randomly generated USE set to satisfy REQUIRED_USE.

This reduces randomness but ensures all combinations are valid.

The alternative, throwing away the USE flags and generating a new set until it passes REQUIRE_USE is going to be impossibly slow. On a package with 100 use flags that can each be enabled or disabled, we've got 2^100 possible combinations. With even a handful of REQUIRED_USE constraints it's going to be statistically impossible to guess a valid combination randomly.

anthonyryan1 avatar Jul 17 '23 02:07 anthonyryan1

Can you please give me the ebuild, since I want to verify it. I'm preety sure I convert all REQUIRED_USE flags to correct constaints, making it always give correct answer if such exists? Running this command on my PC with current nginx ebuild finishs in milliseconds, so I suspect I need your ebuild.

arthurzam avatar Jul 23 '23 18:07 arthurzam

(I was going to say - I thought pkgdev did this already.)

thesamesam avatar Jul 23 '23 18:07 thesamesam

You can see the ebuild I intend to test and upstream here:

https://github.com/anthonyryan1/gentoo/blob/ea7ddba658a1fcf89f4126c94a648957e9ff9566/www-servers/nginx/nginx-1.25.1-r4.ebuild

The failure may have to do with the fact that I'm defining REQUIRED_USE in a loop, which is a less common pattern but significantly simplifies the ebuild code for something with so many relationships.

anthonyryan1 avatar Jul 23 '23 19:07 anthonyryan1

Also, to clarify:

tatt does complete in a reasonable amount of time without error. It's the nginx.sh file it generates that's failing. Virtually all combinations it generates with my command above are invalid USE flags combinations that fail to satisfy REQUIRED_USE constrains.

anthonyryan1 avatar Jul 23 '23 19:07 anthonyryan1

Can you try once again with master branch? I think I might have fixed it now.

arthurzam avatar Dec 17 '23 05:12 arthurzam