EAPI 4 introduced the REQUIRED_USE variable, which allows to impose
restrictions on the allowed USE flag combinations for an ebuild.

On the other hand, according to the devmanual, our policy on
conflicting USE flags is as follows:

| 
<http://devmanual.gentoo.org/general-concepts/use-flags/#conflicting-use-flags>
| Occasionally, ebuilds will have conflicting USE flags for
| functionality. Checking for them and returning an error is not a
| viable solution. Instead, you must pick one of the USE flags in
| conflict to favour and should alert the user that a particular flag
| is being used instead.

Is this policy still valid, which would imply that REQUIRED_USE
should be used only sparingly? Or should it be used in all cases of
conflicting flags?

As an example for the two extreme cases, the app-editors/emacs-23.2-r3
ebuild currently has only the following minimal solution:

   REQUIRED_USE="aqua? ( !X )"

Whereas with taking account of all conflicts, it would look like this:

   REQUIRED_USE="
        alsa? ( sound )
        X? (
                !aqua
                m17n-lib? ( xft )
                ^^ (
                        gtk
                        motif
                        Xaw3d
                        ( !gtk !motif !Xaw3d )
                )
                toolkit-scroll-bars? ( || ( gtk motif Xaw3d ) )
        )
        !X? (
                !gconf
                !gif
                !gtk
                !imagemagick
                !jpeg
                !libxml
                !m17n-lib
                !motif
                !png
                !svg
                !tiff
                !toolkit-scroll-bars
                !Xaw3d
                !xft
                !xpm
        )"

If we really implemented it in this way, then I fear that it would be
difficult for users to find out what flag combinations they can use.
(As was pointed out in bug 347353, it is a satisfiability problem,
which in the general case is NP-complete ...)

Some possible middle ground would block only combinations that lead
to surprising results for the user. (Using the above example again,
one would allow only one of "gtk", "Xaw3d", and "motif". But with
USE="-X", one would simply ignore flags like "png" or "jpeg", because
it can't be surprising that images can't be displayed without X.)

So, what policy should we follow here?

Ulrich

Reply via email to