1 |
Looks like some people aren't sure about how use.mask works, or why arch |
2 |
developers tend to hate noblah USE flags... Hopefully this'll clear |
3 |
things up. |
4 |
|
5 |
Consider a hypothetical package named 'vplayer' which plays videos [1]. |
6 |
This package has optional support, via USE flags, for various sound and |
7 |
video output modes, video codecs and so on. |
8 |
|
9 |
One of vplayer's optional features is support for the 'fakemedia' codec, |
10 |
which is unfortunately only available as a dodgy x86 binary. So how do |
11 |
we handle this? We *could* do something like the following: > |
12 |
|
13 |
RDEPEND="x86? ( fakemedia? ( >=media-libs/fakemedia-1.1 ) )" |
14 |
|
15 |
< However, that's not really very nice -- what happens when an amd64 |
16 |
binary is made as well? Also, users on other archs will see the |
17 |
fakemedia flag listed in emerge -pv output, even though it's not |
18 |
actually available. |
19 |
|
20 |
Or, from the other side... vplayer supports output via ALSA as one |
21 |
option. Unfortunately, ALSA isn't available on sparc [2] or alpha. So, |
22 |
you could do: > |
23 |
|
24 |
DEPEND="!sparc? ( !alpha? ( media-libs/alsa-lib ) )" |
25 |
|
26 |
< Again, this is messy, and alsa still shows up as an option in emerge |
27 |
-pv. Also, when we get ALSA working on sparc, we'd have to go through |
28 |
every single ebuild that does this and remove the !sparc? stuff. |
29 |
|
30 |
The solution is use.mask. Each profile can have a use.mask file which |
31 |
can be used to force certain USE flags to be disabled on a given arch |
32 |
(or, for that matter, on, say, selinux systems or a particular subarch). |
33 |
Say the'fakemedia' USE flag was masked on non-x86, the following would |
34 |
be totally legal and wouldn't break anything: > |
35 |
|
36 |
RDEPEND="fakemedia? ( >=media-libs/fakemedia-1-1 )" |
37 |
|
38 |
< Anyone on a non-x86 box would see the following when doing emerge -pv |
39 |
vplayer: > |
40 |
|
41 |
[ebuild R ] media-video/vplayer-1.2 alsa -arts (-fakemedia) |
42 |
|
43 |
< So, if you're thinking about doing an arch? DEPEND, please think |
44 |
again. It's easy to get things added to use.mask, just file a bug or ask |
45 |
the arch people on IRC. We'd much rather add a line into a couple of |
46 |
textfiles than have to screw around with arch? flags. Really, the only |
47 |
time you should be using arch? flags for *DEPEND [3] is when a |
48 |
particular feature usually works on a given arch but doesn't for one |
49 |
particular package (for example, maybe vplayer's opengl support is |
50 |
broken on 64bit systems). |
51 |
|
52 |
Now we get onto those pesky no* flags. Currently there is no way for us |
53 |
to force a USE flag on on a given profile [4]. So, if you do something |
54 |
like this: > |
55 |
|
56 |
RDEPEND="!noalsa? ( media-libs/alsa )" |
57 |
|
58 |
< you're screwing over those archs that don't have alsa support, and |
59 |
there's nothing we can do about it short of those hideous arch? flags. |
60 |
|
61 |
[1]: This isn't a dig at the mplayer guys, just that sound/video apps |
62 |
are an easy example here :) |
63 |
|
64 |
[2]: Well... Not entirely true... ALSA itself will mostly work on some |
65 |
sparc boxes with a 2.6.x kernel, but the mixer hates our userland. |
66 |
|
67 |
[3]: In other places it does of course have perfectly valid uses. |
68 |
|
69 |
[4]: This may or may not be a portage deficiency. Point is, it's an |
70 |
issue, and whilst complaining that portage needs to be fixed is a viable |
71 |
long term solution, right now it's no use. Although if someone files a |
72 |
bug requesting a use.force, please Cc: me. |
73 |
|
74 |
-- |
75 |
Ciaran McCreesh : Gentoo Developer (Sparc, MIPS, Vim, Fluxbox) |
76 |
Mail : ciaranm at gentoo.org |
77 |
Web : http://dev.gentoo.org/~ciaranm |