Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 628004

Summary: Please implement GLEP73 REQUIRED_USE enforcing support
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: esigra, pacho, sam, tsmksubc
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=609338
https://bugs.gentoo.org/show_bug.cgi?id=632598
https://bugs.gentoo.org/show_bug.cgi?id=733424
https://bugs.gentoo.org/show_bug.cgi?id=513750
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 615824    
Bug Blocks: 155723, 660810    

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-08-16 11:48:56 UTC
Please implement enforcing of REQUIRED_USE as a new FEATURES value, e.g.:

  FEATURES=enforce-required-use

Having it would be really useful to do some live testing of the idea before it is included in a future EAPI. The implementation should be based on points 3.1&3.2 of GLEP 73 [1]. The additional repoman checks are not strictly needed at the moment since they are implemented in pkgcheck already, and are part of the CI [2].

I've tried to do something myself but the dependency resolver code is horrible with all the autounmasking hacks. The algorithms themselves are already implemented stand-alone in [3]. If necessary, I can reimplement them to fit Portage structures if you provide the necessary call sites.

FWICS, we need to start with the depgraph bit that verifies REQUIRED_USE, and add the conditional solving magic there, getting the relevant USE flag change in some additional variable (that is not stored permanently like autounmask changes). We should also be able to clearly distinguish those changes in the depgraph output (i.e. colorful with some magical symbols on the flags that changed).

[1]:https://wiki.gentoo.org/wiki/GLEP:73
[2]:https://qa-reports.gentoo.org/output/gentoo-ci/output.html
[3]:https://github.com/mgorny/required-use
Comment 1 Zac Medico gentoo-dev 2017-09-18 09:24:59 UTC
I've started working on this. Seems like it shouldn't be too much work. Hopefully I can finish it by the end of next weekend.

(In reply to Michał Górny from comment #0)
> FWICS, we need to start with the depgraph bit that verifies REQUIRED_USE,
> and add the conditional solving magic there, getting the relevant USE flag
> change in some additional variable (that is not stored permanently like
> autounmask changes). We should also be able to clearly distinguish those
> changes in the depgraph output (i.e. colorful with some magical symbols on
> the flags that changed).

This can be handled similarly to how Package.use.mask/force are propagated to the depgraph output. It's just another thing for the config.setcpv() method to calculate that will get passed on to the Package instance. For any autounmask USE changes, the REQUIRED_USE solving algorithm will have to be re-applied in cases where it matters.
Comment 2 Zac Medico gentoo-dev 2017-09-25 09:34:20 UTC
My work in progress is in this branch:

https://github.com/zmedico/portage/tree/glep-73

The tree structure returned from portage's check_required_use function has an ast property that yields an ast of the type used by the reference implementation.

I have started playing with the solver, and it appears to work nicely. Now I need to refactor it some. After that, I can make config.setcpv and depgraph._pkg_use_enabled methods use it. After that, I can update the merge list display to render the flag modifications somehow.