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

Bug 541378

Summary: non-incremental USE_EXPAND-ed variables should be allowed to increment explicitly
Product: Gentoo Hosted Projects Reporter: SpanKY <vapier>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: CONFIRMED ---    
Severity: enhancement    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=530222
Whiteboard:
Package list:
Runtime testing required: ---

Description SpanKY gentoo-dev 2015-02-25 23:43:41 UTC
currently, "incremental variables" are defined as "variables that the PM will implicitly append when stacking profiles and will allow for collapsing of values via -foo syntax".

that means you can do:
  foo/make.defaults:USE="a"
  bar/make.defaults:USE="a b"
  cow/make.defaults:USE="-a"

and when you load both foo & bar, you end up with (the collapsed value):
  USE="a b"
and if you load all three, you end up with (the collapsed value):
  USE="b"

but when dealing with USE_EXPAND-ed non-incremental variables, you might want to generally accept the defaults, and remove only one or two items (rather than duplicate the entire thing and manually keep in sync).  but at least portage rejects this:
  $ VIDEO_CARDS='a b -a' portageq envvar VIDEO_CARDS
  Invalid '-' operator in non-incremental variable 'VIDEO_CARDS': '-a'
  a b
  $ VIDEO_CARDS='a b a a' portageq envvar VIDEO_CARDS
  a b a a

there's no real reason we couldn't allow collapsing of values in USE_EXPAND-ed but non-incremental variables.

the practical scenario would be something like:
  x86/make.defaults:VIDEO_CARDS="nvidia nv nouveau ati r128 radeon vga" 
  x86/ati/make.defaults:VIDEO_CARDS="${VIDEO_CARDS} -nvidia -nv -nouveau"
  x86/nvidia/make.defaults:VIDEO_CARDS="${VIDEO_CARDS} -ati -r128 -radeon"
Comment 1 Zac Medico gentoo-dev 2015-02-25 23:59:47 UTC
(In reply to SpanKY from comment #0)
>   $ VIDEO_CARDS='a b -a' portageq envvar VIDEO_CARDS
>   Invalid '-' operator in non-incremental variable 'VIDEO_CARDS': '-a'
>   a b

This behavior has changes since portage-2.2.15 (see bug 530222), but it only applies to make.defaults (so your environment override will fail).
Comment 2 Zac Medico gentoo-dev 2015-02-26 00:03:35 UTC
(In reply to SpanKY from comment #0)
> the practical scenario would be something like:
>   x86/make.defaults:VIDEO_CARDS="nvidia nv nouveau ati r128 radeon vga" 
>   x86/ati/make.defaults:VIDEO_CARDS="${VIDEO_CARDS} -nvidia -nv -nouveau"
>   x86/nvidia/make.defaults:VIDEO_CARDS="${VIDEO_CARDS} -ati -r128 -radeon"

This works since portage-2.2.15 (see bug 530222). For compatibility with older portage, use the equivalent USE settings, like USE="-video_cards_ati".
Comment 3 SpanKY gentoo-dev 2015-02-26 04:18:20 UTC
(In reply to Zac Medico from comment #1)

thanks, we're still on 2.2.12.  i'll see about upgrading to 2.2.17.

before we punt the bug, is this spelled out in the PMS and i'm not seeing it ?