Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 23826 - Give more visibility to ebuilds variables (ALSA_CARDS, etc.)
Summary: Give more visibility to ebuilds variables (ALSA_CARDS, etc.)
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 115839
  Show dependency tree
 
Reported: 2003-07-01 12:55 UTC by TGL
Modified: 2011-10-30 22:19 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ivars_display--2.0.49-r7.patch (ivars_display--2.0.49-r7.patch,4.67 KB, patch)
2003-09-26 17:38 UTC, TGL
Details | Diff
vars.desc (vars.desc,1.90 KB, text/plain)
2003-09-26 17:41 UTC, TGL
Details
2.0.50_pre16--iuse_expand.patch (2.0.50_pre16--iuse_expand.patch,1.10 KB, patch)
2004-01-20 17:02 UTC, TGL
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description TGL 2003-07-01 12:55:13 UTC
Hi,

Following the today discution on -dev ml about "Dynamic config files for
portage", I've understood that ebuild-specific variables like "ALSA_CARDS" or
"VIDEO_CARDS" can be defined in "/etc/make.conf". That's a good news, I've
always wonder what was a clean way to define this variables once for all. (That
said, it doesn't implies the need for splitting the file imho...).

I suggest to make this more explicit in "make.conf", adding something like this:

--------------------------------------------------------------------------------
# A few ebuilds use, instead of USE flags, specific variables for their 
# configuration, for instance media-sound/alsa-driver which uses ALSA_CARDS. 
# See "/usr/portage/profiles/ebuilds-var.desc" for an exhaustive list.
# You can define this variables here:
# ALSA_CARDS='emu10k1 intel8x0'
--------------------------------------------------------------------------------

Where "/usr/portage/profiles/ebuilds-var.desc" would be a list of ebuilds,
variables name and descriptions (and possible values). Something like this:

--------------------------------------------------------------------------------
* media-sound/alsa-driver:
ALSA_CARDS: By default, drivers for all supported cards will be compiled. If you
want to only compile for specific card(s), set ALSA_CARDS to a space-separated 
list of drivers that you want to build.

* x11-base/xfree-drm:
VIDEO_CARDS: used to indicate which card(s) a user wishes to build support for.  
Possible values: 3dfx gamma i810 i830 matrox rage128 radeon sis

[...]
--------------------------------------------------------------------------------

I don't know if there are many such ebuilds, but at least for that reason, I 
really think some documentation is needed somewhere out of the ebuilds. This is 
the only solution I've found to unhide this without modifying portage code.

Thanks, (and sorry if this should have gone to Documentation instead of Portage,
I was not really sure.)

TGL.

Reproducible: Always
Steps to Reproduce:
Comment 1 SpanKY gentoo-dev 2003-07-02 09:44:57 UTC
imo this would lead to incredible bloat 
Comment 2 TGL 2003-07-02 11:13:05 UTC
> imo this would lead to incredible bloat 

I don't know:

 * If there are only a few such ebuild-specific variables in use (lets say less 
than 10), and a typical user only need to specify 3 or 4 of them, then I don't 
call it a bloat. I don't want to document them in make.conf (that would be a 
bloat), but in a separate file. And even if you don't want to talk about it in
make.conf, I think this documentation file is really needed. 

 * If there are more than that, then the situation is worst than what I've 
thought, and need to be adressed at portage level. A possible approach would be:

 - declare them in ebuilds: 
|   CONFIG_VARS="ALSA_CARDS"

 - display what is declared on "emerge -p -v":
| Calculating dependencies ...done!
| [ebuild   R  ] media-sound/alsa-driver-0.9.4-r1  +oss  [vars: ALSA_CARDS]

 - document them somewhere, for instance in ebuild's metadata.xml:
|<variables>
| <var name="ALSA_CARDS">
|   <description> By default, drivers for all supported cards will be compiled. 
|       If you want to only compile for specific card(s), set ALSA_CARDS to a 
|       space-separated list of drivers that you want to build.
|   </description>
|   <values> ad1816a ad1848 als100 azt2320 cmi8330 cmipci cs4231 cs4232 cs4236
|       cs46xx dt019x emu10k1 ens1370 ens1371 es1688 es18xx es1938 es1968 es968 
|       fm801 gusclassic gusextreme gusmax ice1712 intel8x0 interwave interwave
|       mtpav opl3sa2 opti92x opti92x opti93x:ti pdplus rme96 rme9652 sb16 sb8
|       sbawe serial sgalaxy sonicvibes trident via686a wavefront ymfpci
|   </values> 
| </var>
|<variables>

 - I guess there will be a small script at some point to display ebuild's 
 metadata, and it will be easy to add variables description printing to it:
|  # metadata --var-desc alsa-driver
|  media-sound/alsa-driver:
|    * ALSA_CARDS: By default, drivers for all supported cards...
|      Possible values: ad1816a ad1848 als100...
(or it could be added to the "emerge -s" output, I don't care)

 - users would be free to define this vars in make.conf, or in environment, or 
 on command line when needed. Since this variables would be declared, meaning 
 known by emerge, they would also be good candidate to be sticky if "sticky 
 variables" support comes at some point.


My point is really that this variables are just as important as USE flags. If 
they are not USE flag's, it's only to avoid the USE flags list bloat. But hiding
them is a bad thing.
Comment 3 SpanKY gentoo-dev 2003-07-02 15:05:55 UTC
we have local USE flags to avoid global bloat ... technically they are currently hidden ;) 
 
i wasnt knocking the idea of having *somewhere* to put it, just not in make.conf 
 
maybe this could work off of the /etc/make.conf.d/ idea for dynamic config files 
Comment 4 TGL 2003-09-26 17:38:01 UTC
Created attachment 18387 [details, diff]
ivars_display--2.0.49-r7.patch

Here is a small patch that implements the portage part of what I've described

in comment #2. With this, you can add a new optionnal field to ebuilds, IVARS,
to declare ebuild-specific variables. Such declared variables names will
be 
displayed by "emerge -pv".

  I've added IVARS="ALSA_CARDS" to media-sound/alsa-driver ebuild, and 
IVARS="LIRC_OPTS" to app-misc/lirc ebuild:

$ emerge -pv alsa-driver lirc
[...]
[ebuild  N    ] media-sound/alsa-driver-0.9.6  +oss   [vars: ALSA_CARDS(!)]
[ebuild  N    ] app-misc/lirc-0.6.6-r1	  [vars: LIRC_OPTS(?)]

"ALSA_CARDS" appears in red with a "(!)" mark because it is already set in

my env (in make.conf). "LIRC_OPTS" appears in blue with a "(?)" mark because
it is not set anywhere.

I think this patch + a variables description file (copying comments from

ebuilds should be enough in most cases, see next attachment for a possible

starting point) + a few lines of doc in emerge manpage (ask me if you agree,
I can write it) would be enough to give the needed visibility to this vars.
Comment 5 TGL 2003-09-26 17:41:18 UTC
Created attachment 18388 [details]
vars.desc

Here s a possible starting point for the variables description file. I
suggest "/usr/portage/profile" for its location (like "use.desc", etc.)
Comment 6 Marius Mauch (RETIRED) gentoo-dev 2003-09-29 06:04:54 UTC
I like the idea of IVAR (although I would rename it to IUSE_EXPAND).
Comment 7 TGL 2004-01-19 05:48:51 UTC
I've updated world a few minutes ago, and have seen at postinst of the dillo package:
 * This ebuild for dillo comes with different toolbar icons
 * If you want mozilla style icons then try
 * DILLO_ICONSET="mozilla" emerge dillo
 *
 * If you prefer konqueror style icons then try
<big snip>

Okay, then I have to reemerge it... Not a big issue since the package is fast to compile, but it would have been better to know that during the pretend phase. 

And it reminded me this bugreport... What is its status? The code part to support displaying special variables on verbose pretend is really trivial, I can update it for recent portage if there is any interest. And for the documentation file, it's just an annoucement to do so that devs slowly add what they have to add there, and declare their special variables in their ebuilds. The whole thing seems quite easy to solve, no?

Okay, that's it, my small *bump*.
Comment 8 SpanKY gentoo-dev 2004-01-19 16:01:16 UTC
TGL: the dillo bug is different ... imo, it should be a local use flag ...

IVAR is more for driver specific variable setup which makes more sense
Comment 9 TGL 2004-01-19 16:33:18 UTC
I don't really see why limitating this to drivers. Imho, the same ideas can apply to any multiple choices package setting. What makes this settings different is that there are not yes/no questions. In the Dillo case, there was several (maybe five) choices like this, all mutually exclusive: this doesn't well fit the use flags system, and here a variable makes sense, no? 
Comment 10 SpanKY gentoo-dev 2004-01-19 17:08:01 UTC
with dillo it should have been a local use flag

it's not so much limiting to drivers as drivers is really the only thing that makes too much sense ...

you want to say 'i have an nvidia card !' whereas with dillo you want 'USE mozilla icons !' ... it fits with local use flags for dillo whereas drivers are a global system thang
Comment 11 TGL 2004-01-20 17:02:45 UTC
Created attachment 24150 [details, diff]
2.0.50_pre16--iuse_expand.patch

Here is a patch that allows to declare this variables in ebuilds, and then
display them on verbose pretend (just like in comment #4). The implementation
does not use an additional auxdbkey, because this was problematic, as carpaski
explained me on irc. Instead, the variables can be declared in RESTRICT flags,
which is complete non-sense from a semantics point of view, but is convenient
because the key is already there and nothing breaks if you add noise there.
Well, I don't really like this solution neither, but i've not found anything
better without a new auxdbkey.

Syntax for a variable declaration is "iuse_expand_YOUR_VARIABLE_NAME". In the
case of alsa-driver, adding "iuse_expand_ALSA_CARDS" to RESTRICT gives this
output:

[ebuild  N    ] media-sound/alsa-driver-1.0.1  +oss  [vars: ALSA_CARDS(!)] 0 kB


(with a "(!)" because it is set in my environnement, would be a "(?)"
otherwise)
Comment 12 Eric Shattow 2004-12-27 16:21:35 UTC
my 2 cents:   IMO this belongs in an equivillent to /etc/portage/package.keywords

i have all my local USE flags in /etc/portage/package.keywords and it works nicely (except the lack of ufed support for what i'm doing, not a big problem, can be fixed in ufed code).

the same should be done for local env variables, how about /etc/portage/package.environment?
Comment 13 TGL 2004-12-28 15:38:52 UTC
> how about /etc/portage/package.environment

Imho, package.env(ironment) is a powerful but tricky idea. Take this /etc/portage/bashrc that was introduced in 2.0.51: it is great for tweaking CFLAGS  on a per-package basis, because CFLAGS is an ebuild-time only variable. It also works fine for some FEATURES flag (the ebuild-time ones, like "noman" and friends for instance), but not for others which affect the python level of emerge. And it completly breaks emerge if you set USE there.

The problem with ebuild-specific variables is that some are only interpreted at bash level (like LIRC_OPTS - that's the easy case), whereas other are expanded into USE flags at python level (the USE_EXPAND ones, like ALSA_CARDS or LINGUAS iirc).

Imho, it would be very convenient to have a package.env file where one could specify all variable he wants (both bash level and python level), including CFLAGS, USE, FEATURES, and the ebuild-specific variables we were talking about here. But that's complicated to implement (well, for what it worths, i tried and didn't manage to do something really satisfying). And if we can't get something correct for all kind of variables, then such a file would be really missleading, and it's probably better not to have it. 
Comment 14 genbug 2005-06-19 02:35:14 UTC
I think documenting this in make.conf makes sense and is consistent with the 
treatment of the rest of the features available in that file. I've added this 
comment to my config, I dont call two lines bloat. It would have saved me 
consideralbe time searching forum. 

Nowhere had I seen _why_ this variable needed to be there nor that it related to 
the alsa-driver package. 

I realised myself whilst trying to clean up the mess of mixed up drivers I had 
on my system. Two lines like this would save a lot of time and increase 
understanding.


#define drivers req when compiling alsa-driver (not kernel alsa).
ALSA_CARDS="ens1371 cmipci es1938 "  # not snd-ens1371 !

LINGUAS would probably merit similar treatment and probably VIDEO_CARDS.

Regards
Comment 15 Jason Stubbs (RETIRED) gentoo-dev 2005-06-19 02:47:57 UTC
Not a scalable solution. Every time a package was added that used a new 
variable, make.conf.example would need to be updated. 
Comment 16 Jason Stubbs (RETIRED) gentoo-dev 2005-06-19 07:32:29 UTC
Last few details are being worked out, but this will be done for next version. 
Output goes something like: 
 
[ebuild   R   ] sys-apps/portage-2.0.51.22-r1  -build (-selinux) LINGUAS="+en 
+ja" 0 kB 
 
The format follows how USE is outputted so that the choices are clearly 
displayed. 
Comment 17 Jason Stubbs (RETIRED) gentoo-dev 2005-07-28 07:25:28 UTC
Putting a hold on feature requests for portage as they are drowning out the 
bugs. Most of these features should be available in the next major version of 
portage. But for the time being, they are just drowning out the major bugs and 
delaying the next version's progress. 
 
Any bugs that contain patches and any bugs for etc-update or dispatch-conf can 
be reopened. Sorry, I'm just not good enough with bugzilla. ;) 
Comment 18 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-12-27 19:20:16 UTC
Portage will now print USE_EXPAND with other use flags.  Please continue discussion on what else you want to do here, if anything.
Comment 19 Zac Medico gentoo-dev 2006-02-22 09:50:41 UTC
Released in 2.1_pre2.