[Exherbo-dev] [RFC] || ( ) dependencies and virtuals

Quentin Glidic sardemff7 at exherbo.org
Mon Dec 30 21:55:29 UTC 2013


Hello there,

In the last days, I have been fighting against || ( ) dependencies.
Here are the most common use cases:
— virtuals
— autotools.exlib (and similar slotted tools like vala.exlib)
— ffmpeg vs. libav
— vim vs. gvim
— cdrtools and friends
— ruby vs. rake/rubygems
— text-based browsers
There are a few other cases but I am not familiar enough with these so I 
will focus on the list above before “fixing” corner cases.

 From bottom to top:
The last cases (from vim to text-based browsers) can be solved with 
virtuals quite easily. I will just wait for the virtuals case to be 
decided to update them.


The ffmpeg vs. libav case is a bit more tricky. I will need the answer 
to one question to decide here: can you *always* runtime-switch between 
libav and ffmpeg? IOW, are some packages using build-time #ifs to use them?
If we *can* runtime-switch, a virtual is good here too.
If we *cannot*, here are two and a half solutions:
1. a slot-based virtual. With a := slot dependency, that would force 
people to rebuild packages if they change from libav to ffmpeg
2. use [ffmpeg] and [libav] on each package, two variants here:
a. make them mutually exclusive (but this is not 
DEFAULT_SRC_CONFIGURE_*-friendly, unless we add something to handle that 
choose-between -two-implementations case, which is quite common)
b. make [libav] prefer libav over ffmpeg, while [ffmpeg] is always “use 
that feature” (which may confuse people for packages non-libav-aware 
that will lead to a blocker)


The autotools.exlib case can be solved in two ways:
1. a new annotation "|| ( ) [[ selection = first-unmasked ]]"
2. always use the best slot available (which would simplify a lot of things)

With 1., we can simplify the resolver work by always picking the best 
version while the use is still able to mask newer slots to keep only one 
(older) slot installed.
With 2. we just force everyone to have all the needed slots installed.


Last but not least, the virtuals. Simple: || ( ) dependencies in 
virtuals need to die. The elegant solution came from Ciaran: 
option-driven virtuals. You will find attached to this email an example.
The first part is such a virtual created by hand. The second part is the 
same virtual using virtual.exlib to fill MYOPTIONS and DEPENDENCIES 
automatically. The last part is the resulting "cave show -c".
Which solution (manual or exlib) do you prefer, or do you have another idea?


Of course, I will happily update everything we have currently to the new 
decided style.

Comments and questions are welcome.


Cheers,

-- 

Quentin “Sardem FF7” Glidic
-------------- next part --------------
Manual virtual/notification-daemon.exheres-0:
# Copyright 2009 Mike Kelly
# Copyright 2013 Quentin "Sardem FF7" Glidic <sardemff7 at exherbo.org>
# Distributed under the terms of the GNU General Public License v2

SUMMARY="virtual for notification-daemon providers"

PLATFORMS="~amd64 ~x86"
MYOPTIONS="
    ( virtuals:
        awesome                  [[ description = [ Use Awesome as a notification daemon (with the naughty library) ] ]]
        dunst                    [[ description = [ Use dunst as a notification daemon ] ]]
        eventd                   [[ description = [ Use eventd as a notification daemon ] ]]
        gnome-shell              [[ description = [ Use GNOME-Shell as a notification daemon ] ]]
        kde-runtime              [[ description = [ Use KDE as a notification daemon (with knotify) ] ]]
        notification-daemon      [[ description = [ Use notification-daemon as a notification daemon ] ]]
        notification-daemon-xfce [[ description = [ Use notification-daemon-xfce as a notification daemon ] ]]
        notify-osd               [[ description = [ Use Notify-OSD as a notification daemon ] ]]
    ) [[ number-selected = exactly-one ]]
"

DEPENDENCIES="
    virtuals:awesome? ( x11-wm/awesome[>=3.1] )
    virtuals:dunst? ( x11-apps/dunst )
    virtuals:eventd? ( net/eventd[dbus] )
    virtuals:gnome-shell? ( gnome-desktop/gnome-shell )
    virtuals:kde-runtime? ( kde/kde-runtime )
    virtuals:notification-daemon? ( x11-apps/notification-daemon )
    virtuals:notification-daemon-xfce? ( xfce-extra/notification-daemon-xfce )
    virtuals:notify-osd? ( x11-apps/notify-osd )
"

exlib virtual/notification-daemon.exheres-0:
# Copyright 2009 Mike Kelly
# Copyright 2013 Quentin "Sardem FF7" Glidic <sardemff7 at exherbo.org>
# Distributed under the terms of the GNU General Public License v2

VIRTUAL_PACKAGES=(
    'x11-wm/awesome[>=3.1] Awesome with the naughty library'
    'x11-apps/dunst dunst'
    'net/eventd[dbus] eventd'
    'gnome-desktop/gnome-shell GNOME-Shell'
    'kde/kde-runtime KDE with knotify'
    'x11-apps/notification-daemon notification-daemon'
    'xfce-extra/notification-daemon-xfce notification-daemon-xfce'
    'x11-apps/notify-osd Notify-OSD'
)
require virtual [ usage="as a notification daemon" ]

SUMMARY="virtual for notification-daemon providers"

PLATFORMS="~amd64 ~x86"
MYOPTIONS=""

DEPENDENCIES=""

$ cave show -c notification-daemon::arbor
* virtual/notification-daemon::arbor
    ::arbor                   0(~)* {:0}
    virtual/notification-daemon-0:0::arbor
    Homepage
    Summary                   virtual for notification-daemon providers
    Options
        virtuals
            -awesome          Use Awesome as a notification daemon (with the naughty library)
            -dunst            Use dunst as a notification daemon
            -eventd           Use eventd as a notification daemon
            -gnome-shell      Use GNOME-Shell as a notification daemon
            -kde-runtime      Use KDE as a notification daemon (with knotify)
            -notification-daemon Use notification-daemon as a notification daemon
            -notification-daemon-xfce Use notification-daemon-xfce as a notification daemon
            -notify-osd       Use Notify-OSD as a notification daemon
        Build Options
            symbols=compress  How to handle debug symbols in installed files
                              Permitted values:
                                  compress:  Split and compress debug symbols
                                  preserve:  Preserve debug symbols
                                  split:     Split debug symbols
                                  strip:     Strip debug symbols
            jobs=5            How many jobs the package's build system should use, where supported
                              Should be an integer >= 1
            -dwarf_compress   Compress DWARF2+ debug information
            recommended_tests Run tests considered by the package to be recommended
            -trace            Trace actions executed by the package (very noisy, for debugging broken builds only)
            work=tidyup       Whether to preserve or remove working directories
                              Permitted values:
                                  leave:     Do not remove, but allow destructive merges
                                  preserve:  Preserve the working directory
                                  remove:    Always remove the working directory
                                  tidyup:    Tidy up work directory after a successful build
    Dependencies
                              (
                                  virtuals:awesome? (
                                      x11-wm/awesome[>=3.1]
                                  )
                                  virtuals:dunst? (
                                      x11-apps/dunst
                                  )
                                  virtuals:eventd? (
                                      net/eventd[dbus]
                                  )
                                  virtuals:gnome-shell? (
                                      gnome-desktop/gnome-shell
                                  )
                                  virtuals:kde-runtime? (
                                      kde/kde-runtime
                                  )
                                  virtuals:notification-daemon? (
                                      x11-apps/notification-daemon
                                  )
                                  virtuals:notification-daemon-xfce? (
                                      xfce-extra/notification-daemon-xfce
                                  )
                                  virtuals:notify-osd? (
                                      x11-apps/notify-osd
                                  )
                              ) [[ defined-in = [ virtual.exlib ] ]]
    Downloads
        Overridden Masks
            Supported platforms ~amd64 ~x86



More information about the Exherbo-dev mailing list