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

Bug 702464

Summary: [Future EAPI] Cross-flag USE dependencies
Product: Gentoo Hosted Projects Reporter: Michał Górny <mgorny>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: CONFIRMED ---    
Severity: normal CC: esigra
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 174380    

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-12-10 14:22:21 UTC
I'd like to propose adding two new operators, or rather extending the existing USE dependency operators with an 'arrow' syntax to allow dependee flag name to be different.

Killer rationale: we have 2-style and 4-style USE dependencies.  We inevitably need to have 8-style USE dependencies, and then we're good till EAPI 16.


New syntax
==========

The new USE dependency syntax I'd like to see is (square brackets indicate optional parts):

  [!]a?>[-]b

meaning 'if a is enabled (disabled) on this package, require b to be enabled (disabled) on the other package', and:

  [!]a=>[-]b

meaning the above + 'and vice versa'.


Expanded forms
==============

  a?>b    <=>  a? ( ...[b] )
  !a?>b   <=> !a? ( ...[b] )
  a?>-b   <=>  a? ( ...[-b] )
  !a?->-b <=> !a? ( ...[-b] )

  a=>b    <=>  a? ( ...[b] )   !a? ( ...[-b] )
  !a=>b   <=> !a? ( ...[b] )    a? ( ...[-b] )
  a=>-b   <=>  a? ( ...[-b] )  !a? ( ...[b] )
  !a=>-b  <=> !a? ( ...[-b] )   a? ( ...[b] )

Naturally, the => forms are equivalent in pairs.


Equivalent same-flag forms
==========================

  a?  <=> a?>a
  !a? <=> !a?>-a
  a=  <=> a=>a
  !a= <=> !a=>-a

While they're obviously redundant, I believe that at least '!a?' is less readable (counter-intuitive) than the expanded form.


Use cases
=========

I can think of two primary USE cases for it.

Firstly, python-single-r1 ebuilds with new API could be simplified.  Currently, they do:

  pst1? ( ...[pt1] )
  pst2? ( ...[pt2] )
  ...

With the new syntax, they could generate a PYTHON_MULTI_USEDEP having:

  pst1?>pt1,pst2?>pt2,...

Secondly, static-enabled ebuilds.  They currently do, usually via a gross hack:

  dev-libs/foo
  static? ( dev-libs/foo[static-libs(+)] )

The new syntax would allow:

  dev-libs/foo[static?>static-libs(+)]