Gentoo Archives: gentoo-dev

From: Jonathan Callen <jcallen@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: RFC: USE flags in virtuals, to allow a specific provider to be determined
Date: Sat, 26 Jul 2014 17:46:13
Message-Id: 53D3E94A.9000100@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: USE flags in virtuals, to allow a specific provider to be determined by William Hubbs
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA512
3
4 On 07/25/2014 05:23 PM, William Hubbs wrote:
5 > On Fri, Jul 25, 2014 at 03:54:53PM -0400, Ian Stakenvicius wrote:
6 >> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
7 >>
8 >> On 25/07/14 03:51 PM, Pacho Ramos wrote:
9 >>> El vie, 25-07-2014 a las 20:46 +0100, Ciaran McCreesh
10 >>> escribió:
11 >>>> On Fri, 25 Jul 2014 21:44:02 +0200 Luis Ressel
12 >>>> <aranea@×××××.de> wrote:
13 >>>>> Okay, I didn't think of that. I'm not sure if the blocker
14 >>>>> deps or the REQUIRED_USE would be more helpful for Portage,
15 >>>>> but generally I think that the REQUIRED_USE error message
16 >>>>> is quite hard to understand for unexperienced users -- much
17 >>>>> more so than the error generated by a blocker dep.
18 >>>>
19 >>>> ...and the fix for that is to scrap REQUIRED_USE and use
20 >>>> pkg_pretend instead.
21 >>>>
22 >>>
23 >>> Could you give an example to let us see how pkg_pretend could
24 >>> be used to achieve the same as REQUIRED_USE?
25 >>>
26 >>> Thanks
27 >>>
28 >>>
29 >>
30 >> pkg_pretend() { if use heimdal && use mit-krb5; then eerror
31 >> "Please set only one of the use following flags:" eerror
32 >> "heimdal, mit-krb5" die "conflicting use flags set" fi }
33 >
34 > I think this could get complicated really quick though. For
35 > example, if I have an ebuild with three use flags,
36 > flag1/flag2/flag3 with the requirement that one and only one of
37 > them must be set, unless bash has an xor operator I don't know
38 > about, that is going to need a lot of nesting etc to get right.
39 >
40 > William
41 >
42
43 If you want to say "At most one of the flags 'foo', 'bar', and 'baz'
44 may be selected", then you say it like so (requires EAPI=5):
45
46 REQUIRED_USE="?? ( foo bar baz )"
47
48 If you want to say "Exactly one of the flags ...", then you use:
49
50 REQUIRED_USE="^^ ( foo bar baz )"
51
52 And, as always, you can say "At least one of the flags ..." with:
53
54 REQUIRED_USE="|| ( foo bar baz )"
55
56 While each of these can be written using the "foo? ( !bar )"-type
57 primitives, the messages portage outputs are generally better with
58 '??', '^^', and '||', as you might see something like:
59
60 "
61 The following REQUIRED_USE flag constraints are unsatisfied:
62 at-most-one-of ( foo bar baz )
63 "
64
65 Which is, in my opinion, more readable.
66
67 - --
68 Jonathan Callen
69 -----BEGIN PGP SIGNATURE-----
70 Version: GnuPG v2
71 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
72
73 iQIcBAEBCgAGBQJT0+lKAAoJELHSF2kinlg4T8sQAKLq2d4x8UfDTxm8FP6yX5zv
74 g0GGjPe6TNSwJT83FIw2Bof85u2xGUHaozUaxr+3wwgYVmSaH8BcuEc41reaNZu0
75 aRhFonAySSTVW/OFEW/X+kpfxAgtFAVGsZ2MBXuFLshB+z/OPDL4lPS7pvUCSZVG
76 iXPlLNE05ZvF+mxSU4enKEChRPxYTBso3cXGqog0qAZrefv8I9w+QeesaGvXlr7v
77 65S9qPcgOhQRz1q5HfoQ55fdGHy53+/9ny86Gpxpg7xbEYUe0t2LCInFPT4ivL28
78 OAnSbwML7bMzphvT4EM+eHghfWIATRmnY5O7O9X66sOUB/JrtG3eQei/9EyAHwhA
79 JurcdfUu8zcsSjocuqxbQpMGeiEa1bcfzl3u39WUuFAoVsayzXEI3U9SziemmCpU
80 CCeRF+A5mV6PhFQBYczkdeu3xKc9zQoA3s/EaUYybmTli4oVwtMJUm224TWJEFg+
81 d7AxM49dyRPLHrHxbK69G7RVowXlaPlISCA/hahAmcgtZVD8y1phwP1qB9j8OBlL
82 DTrcuqiv9Ba4J+DmdhsjB/uvVZpoyfMVl9z1ytLKFjiEpo/PyJAPWRlRrAwq/Gz8
83 1rh4MrSqAEMGB4mEQaohDfMVVaCQmhGXZkpaBMtARiV3BDlI3W0bKPPh+r435ZZc
84 Z7PHHOimf/6acsprx/wI
85 =vExv
86 -----END PGP SIGNATURE-----

Replies