Re: [gentoo-dev] Choosing GUI toolkits from multiple choices

2016-06-04 Thread Mart Raudsepp
> I drafted that mentioned USE_EXPAND idea as a means to get some
> 'design from the scratch' discussion going and flesh out this way of
> potentially doing it (such a USE_EXPAND was idly mentioned at start
> by
> others as something that was deemed too crazy, but I didn't find any
> references). It is currently still as a draft over at
> http://piratepad.net/iwvgjB1P5d

For the javascript restricted and for purposes of in-line quoted
replies, here's the current state of my braindump there copied to e-
mail here:


The following draft concerns only applications.
Libraries should continue using qt4 and qt5 USE flags when they are
about libraries (linking against qt4 or qt5), where it's mostly a
matter of USE depends by consumer apps or higher level libraries, not
user choice for applications.
For gtk case, we would use IUSE="gtk2" and IUSE="gtk3" in this case,
but ideally they would be in separate slots or packages. In gtk case,
this is for things like avahi, gtk-vnc, caribou, libcanberra - things
that provide a library or module that links against given gtk SLOT or
implements a gtk module for that SLOT with the given IUSE.
The remainder concerns only applications, as we don't like to use the
same flag name for different concepts (library support vs application
toolkit version choice), and USE="gtk" might be something we could
perhaps get rid of, in favor of moving gtk2 libraries to IUSE="gtk2"
and application choice to IUSE="gui" or the proposed GUI USE_EXPAND.



use.desc:

gui - Enable an optional GUI

use.desc/gui.desc:

athena - Choose the MIT Athena widget set
gtk - Build a x11-libs/gtk+ based GUI
motif - Build a  toolkit based GUI
sdl - ...
qt4 - Build a Qt4 toolkit based GUI
qt5 - Build a Qt5 toolkit based GUI
wxwidgets - Build a wxWidgets based GUI
Xaw3d - Build a 3d athena widget set based GUI


Many of current IUSE=gtk should move to IUSE=gui when it's about
application GUIs.
Some of IUSE=gtk will move to version specific IUSE=gtk2 and IUSE=gtk3
when it's about libraries.
Not sure if anything will remain then. If it does, we'll need to think
about it then, or figure it out of the masses of IUSE=gtk users
beforehand.
An old mapping was partially conducted a while ago on https://docs.goog
le.com/spreadsheets/d/19sJuupspkY65FrU6b4U7gEWKiOgFGQwyXYdPCAvPqBo/edit
#gid=0

In no circumstance is a REQUIRED_USE or an equivalent pkg_pretend
limitation allowed when dealing with gui USE_EXPAND.

- A package has optional support for a GUI, written in any GUI toolkit
(but only one)
-- IUSE="gui" and depend and build against the toolkit it uses. No
toolkit specific USE_EXPAND should exist, as there's nothing to choose.
Example: wicd. USE="gui" shall build the gtk based GUI

- A package has optional support for a GUI, and that GUI can be chosen
to be either gtk, qt4 or qt5 based, but only one of them
-- IUSE="gui gui_gtk gui_qt4 gui_qt5". If user has USE="gui" disabled
for the package, don't build any GUI. If it's enabled, have a
maintainer chosen preferred order of toolkit to use, then choose
whichever highest priority toolkit flag is enabled by user. If no
supported toolkit flag is chosen, choose the highest priority one.
Example: ???

- A package has a required GUI, but the GUI can be chosen to be either
gtk, qt4 or qt5 based, but only one of them
-- Same as previous, but no IUSE="gui" as a GUI is not optional
Example: ???

- A package has optional GUI frontends in a way that multiple can be
built and shipped at once.
-- IUSE="gui" to have any GUI at all, if user hasn't it set, gui_*
values do not matter - no GUI will be built at all. If user has
USE="gui" set, all of the user enabled gui_* frontends will be built.
If user has no gui_* enabled at all that this package implements, but
USE="gui" is set, then a maintainer chosen first choice GUI is built.
Example: transmission with IUSE="gui gui_gtk gui_qt"

- Same case as previous, but some toolkits are exclusive, e.g one can
build both a gtk frontend and a qt frontend, but not both qt4 and qt5
frontend.
-- Same USE="gui" behaviour. If multiple exclusive flags are set, they
have an independent priority order, similar to when only one can be
built. So with GUI="gtk qt4 qt5", a gtk and a qt5 frontend would be
built when both qt4 and qt5 can't be. To choose qt4 frontend, qt5 has
to be disabled by user for this package.

- Same as prior 2 cases but a GUI is not optional (e.g lack of frontend
doesn't make sense)
-- Same, but no IUSE="gui"



Suggestions for users approach of the GUI="" setting in make.conf:

* If you don't care which toolkit is used, but rather would have the
preferred one chosen for you, don't set it at all, but keep it empty.
Do set USE="gui" if you want a GUI for where it's optional.
* If you strongly prefer a given toolkit or toolkits, set that/those in
GUI="..."; it will be then chosen whenever possible (if multiple, a
maintainer decided preference will be chosen, if only one toolkit
frontend is available; otherwise all of them will be built). 

[gentoo-dev] Choosing GUI toolkits from multiple choices

2016-06-04 Thread Mart Raudsepp
Ühel kenal päeval, R, 03.06.2016 kell 22:40, kirjutas Daniel Campbell:
> You touched on the part that I'm most concerned about: choosing. If
> the
> 'GUI' USE_EXPAND gets in, do we maintainers check that variable and
> if
> there's no preference just build whatever? Will we not be expected to
> emit an ewarn or something similar to clarify *why* the package is
> being
> built a certain way? Granted, if a user has a problem and reports a
> bug,
> their make.conf's GUI variable should be present in emerge -v output,
> easily explaining the issue.

Said 'GUI' USE_EXPAND is outside the intended scope of the USE=gui
thread, but anticipating discussion will happen regardless now, I've
cut the thread and named it something else.
Many discussions have happened on IRC on this as well, which is where
Daniel got this from.


I think it's actually a rather corner-case to have an optional GUI, and
then that GUI being buildable against a selection of toolkits. Arguably
in some of those cases it might be more ideal to have the GUI parts in
a separate package too, but usually upstream sources aren't so
accommodating to our source-based case (while binary distributions
split it up into multiple binary packages, built from one source in one
go).
In most cases when there's a choice, a GUI imho isn't usually optional.
You choose e.g qt4 or qt5, or gtk3 or qt5 and having both shipped is
not so common from the same package. Transmission is an example where
it is, because they have a multiple frontend system (arguably it would
be neat to have these in separate transmission-qt, transmission-gtk and
so on packages), and one of these can be a web service UI instead of a
dedicated graphics toolkit.

USE=gui would replace a ton of USE=gtk's at least, where it's mostly
about simple extra GUI tools added with a gtk2 dep, but I've seen it in
other toolkit cases too, but I don't know how common it is there.
Ideally USE=gui can be agreed upon while ignoring the corner-case of
multiple choices; in some of these cases it might make sense to ignore
USE=gui at the start, until the multiple choice case gets some
resolution though, e.g emacs and perhaps transmission could just keep
the current way until we agree how to express multiple choice cases
universally.

I drafted that mentioned USE_EXPAND idea as a means to get some 'design
from the scratch' discussion going and flesh out this way of
potentially doing it (such a USE_EXPAND was idly mentioned at start by
others as something that was deemed too crazy, but I didn't find any
references). It is currently still as a draft over at
http://piratepad.net/iwvgjB1P5d -  but I didn't want the original
USE=gui thread to discuss this, as it's a separate and much more
complex matter really, and would work in tandem with USE=gui when
appropriate.

> It's the implementation that gets me here, not the idea. The idea
> could
> be neat and make Gentoo management easier at the expense of some
> (hopefully) minor ebuild bloat. Another issue that hasn't been
> covered
> well yet is how are we going to select DEPENDs? I was told DEPEND
> doesn't support exactly-one-of, and we don't want extraneous
> dependencies.

The part of it being not clear (due to the intentional lack of
REQUIRED_USE usage in that design) what is getting built is probably
the main drawback of that drafted idea, and some QA members tell me
this would be outright vetoed as a QA violation.

This uncertainty also echoes in the need for these complex DEPEND atoms
as well then, based on maintainer chosen preference, combined with user
set flags.

So it isn't ideal at all indeed, and we'd need to really do the
suggested EAPI/package manager improvements first, to express this
maintainer order of preference to the user and filter the flags somehow
to what will actually be chosen then before the DEPEND atoms get
processed, which would make the *DEPENDs feasible, as you could
simplify the conditionals, because the unused (but set by user) USE
flags are already filtered out then (or one added when user didn't have
any, and one would be chosen by default).

I ruled out REQUIRED_USE because I don't like it at all when it is used
together with common global USE flags, as opposed to just some local
flags. In my opinion it tends to results in users disabling or enabling
something globally, instead of locally for the package in question. And
with that having made the choice unknowingly for a ton of future
packages to be installed as well. pkg_pretend is a bit better, because
you can customize the error message to be readable, but it's still
something that takes away my choice of not having to care.. just give
me a GUI, preferably a gtk3 one, ok? thx.

> Transmission is a good example: supports gtk3, qt4, qt5. Let's say
> the
> maintainer prefers the qt5 version. Would we do this?:
> 
> DEPEND="gui_qt5? ( dev-qt/qtcore:5 ) gui_qt4? ( dev-qt/qtcore:4 )
> gui_gtk3? ( x11-libs/gtk+:3 )"
> 
> or this?:
> 
> DEPEND="gui_qt5? ( !gui_qt4? ( !gui_gtk3? (