Hello Exherbo,
Here is another take on that || ( ) thingy.
You will find attached [any-deps.log] the list of currents (non-virtual)
|| ( ) dependencies.
It is a light version, I removed from the full list the few cases which
will disappear in a near future.
All remaining uses (except gcc[ada]) can be solved with the following
proposal. (We should probably drop the ada option from GCC for know, as
gnat is ::unwritten so that we cannot install gcc[ada] currently anyway.)
Now let me introduce you “providers”.
Providers is a suboption to select the provider of a feature. Its usage
is *not* limited to virtuals, they are a special case of package using
providers.
The attached e-f-s patch should explain the design well enough.
All packages using || ( ) dependencies to let the user choose should use
providers.
I think we should go in two (or three) steps:
1. Migrate virtuals (cf. attached scripts)
2. Migrate the rest of the || ( ) list
(3. Migrate (“back”) ffmpeg/libav packages, maybe do that with 2.)
Here is the rationale for some design choices:
— Using a suboption avoids name collisions between normal options and
providers (ffmpeg vs. providers:ffmpeg)
— Having one shared suboption allows to add providers to any package
without requiring a modification in ::arbor.
— The options’ descriptions: It should be clear what you are enabling
when you see the option. The option name is a package name, so one can
simply "cave show" it for a more precise description. Having a shared
description in a group allows the user to understand which providers are
about a specific feature in the options summary of a cave resolve.
Duplicating “Use X as Y feature provider” is IMO counter-productive.
Comments are welcome.
Thanks,
--
Quentin “Sardem FF7” Glidic
Pure exlibs:
icedtea.exlib ::java
-----------------------
|| (
dev-lang/icedtea7
dev-lang/icedtea6
)
-----------------------
vim-plugin.exlib::arbor
-----------------------
|| (
app-editors/vim[>=${VIM_PLUGIN_VIM_VERSION}]${VIM_PLUGIN_VIM_OPTIONS}
app-editors/gvim[>=${VIM_PLUGIN_VIM_VERSION}]${VIM_PLUGIN_VIM_OPTIONS}
)
-----------------------
Exheres:
app-cdr /dvd+rw-tools ::arbor
----------------------------------------------------------------------
|| (
app-cdr/cdrtools
app-cdr/cdrkit
)
----------------------------------------------------------------------
app-cdr /k3b ::kde
----------------------------------------------------------------------
|| (
app-cdr/cdrtools
app-cdr/cdrkit
app-cdr/libburn
)
----------------------------------------------------------------------
app-crypt /signing-party ::nicoo
----------------------------------------------------------------------
|| (
dev-perl/libintl-perl
dev-perl/Text-Iconv
app-text/recode
)
----------------------------------------------------------------------
app-text /djvu ::arbor
----------------------------------------------------------------------
|| (
media-gfx/ImageMagick
media-gfx/GraphicsMagick
gnome-desktop/librsvg:2
media-gfx/inkscape
) [[ note = [ for icon generation in desktopfiles/Makefile.in ] ]]
----------------------------------------------------------------------
app-text /sgmltools-lite ::arbor
----------------------------------------------------------------------
|| (
net-www/w3m
net-www/lynx
)
----------------------------------------------------------------------
app-vim /YouCompleteMe ::pyro
----------------------------------------------------------------------
|| (
app-editors/gvim[python][>=7.3.584][python_abis:*(-)?]
app-editors/vim[python][>=7.3.584][python_abis:*(-)?]
)
----------------------------------------------------------------------
app-vim /pyclewn ::pyro
----------------------------------------------------------------------
|| (
app-editors/gvim[python]
app-editors/vim[python]
)
----------------------------------------------------------------------
app-virtualization/virtualbox-ose ::SuperHeron-misc
----------------------------------------------------------------------
|| (
app-cdr/genisoimage
app-cdr/cdrtools
app-cdr/cdrkit
)
----------------------------------------------------------------------
dev-java /apache-ant ::java
----------------------------------------------------------------------
|| (
dev-java/jakarta-oro[>=2.0.8]
dev-java/jakarta-regexp
)
----------------------------------------------------------------------
dev-lang /icedtea-web ::java
----------------------------------------------------------------------
|| (
dev-lang/icedtea7
dev-lang/icedtea6[>=1.9.7]
)
----------------------------------------------------------------------
dev-perl /JSON-Any ::perl
----------------------------------------------------------------------
|| (
dev-perl/JSON-XS
dev-perl/JSON
)"
----------------------------------------------------------------------
dev-perl /XML-Simple ::perl
----------------------------------------------------------------------
|| ( dev-perl/XML-SAX dev-perl/XML-Parser )"
----------------------------------------------------------------------
gnome-desktop /brasero ::gnome
----------------------------------------------------------------------
|| ( app-cdr/dvd+rw-tools [[ description = [ needed to burn files larger than 2 GiB ] ]]
----------------------------------------------------------------------
kde /kde-baseapps ::kde
----------------------------------------------------------------------
|| (
app-text/tidy
app-text/tidy-html5
)
----------------------------------------------------------------------
net-proxy /sshuttle ::lipidity
----------------------------------------------------------------------
|| (
net/dropbear
net-misc/openssh
)
----------------------------------------------------------------------
sys-devel /gcc ::arbor
----------------------------------------------------------------------
|| ( sys-devel/gcc[ada] dev-lang/gnat )
|| ( dev-libs/cloog[>=0.16.1] dev-libs/cloog-ppl[>=0.15.5] )
----------------------------------------------------------------------
text /springer_download ::moben
----------------------------------------------------------------------
|| (
text/stapler
app-text/pdftk
)
----------------------------------------------------------------------
www-servers /apache ::net
----------------------------------------------------------------------
|| (
net-www/links
net-www/elinks
net-www/lynx
) [[ description = [ Used by apachectl ] ]]
----------------------------------------------------------------------
x11-apps /xdg-utils ::desktop
----------------------------------------------------------------------
|| (
net-www/links
net-www/lynx
net-www/w3m
)
----------------------------------------------------------------------
>From 6f2b288817c5f5b74804f28bc16192e0c6d3c29e Mon Sep 17 00:00:00 2001
From: Quentin Glidic <[email protected]>
Date: Tue, 18 Feb 2014 19:41:09 +0100
Subject: [PATCH] e-f-s: Document providers suboption (and virtuals)
Signed-off-by: Quentin Glidic <[email protected]>
---
eapi/exheres-for-smarties.mkd | 92 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/eapi/exheres-for-smarties.mkd b/eapi/exheres-for-smarties.mkd
index 4854cae..1c4b7a4 100644
--- a/eapi/exheres-for-smarties.mkd
+++ b/eapi/exheres-for-smarties.mkd
@@ -721,6 +721,7 @@ for applying the requirement to each child:
Here, `gtk` requires both `X` and `python` (but we discourage this style -- see
[below](#annotations_style)).
+{#number_selected_annotation}
All-of blocks also support a `number-selected` annotation, which can have the value `at-least-one`,
`at-most-one` or `exactly-one`:
@@ -1928,6 +1929,97 @@ they want these, although this should not require them to alter packages other t
want to customise. In other words, if you make a definite decision instead of providing an option,
avoid making other packages rely on that decision whenever reasonably possible.
+## Providers
+
+`providers` is a suboption for the specific case when the same feature is provided by two or more
+similar packages.
+
+* Optionsâ descriptions should state the topic (`<topic> provider` is a nice default)
+* Options must be grouped (by topic) and you must use
+ [`[[ number-selected = at-least-one ]]`](#number_selected_annotation)
+
+Here is a example package (dvd+rw-tools) using providers:
+
+ # Copyright 2008 Ingmar Vanhassel <[email protected]>
+ # Distributed under the terms of the GNU General Public License v2
+
+ SUMMARY="A frontend to mkisofs to facilitate mastering Blu-ray Disc and DVD media, both +RW/+R and -R[W]"
+ HOMEPAGE="http://fy.chalmers.se/~appro/linux/DVD+RW/"
+ DOWNLOADS="${HOMEPAGE}/tools/${PNV}.tar.gz"
+
+ LICENCES="GPL-2"
+ SLOT="0"
+ PLATFORMS="~amd64 ~x86"
+ MYOPTIONS="
+ ( providers:
+ cdrtools
+ cdrkit
+ ) [[
+ *description = [ ISOfs manipulation tools provider ]
+ number-selected = at-least-one
+ ]]
+ "
+
+ DEPENDENCIES="
+ build:
+ sys-devel/m4
+ run:
+ providers:cdrtools? ( app-cdr/cdrtools )
+ providers:cdrkit? ( app-cdr/cdrkit )
+ "
+ [â¦]
+
+### Virtuals
+
+Virtuals are packages without contents. Their sole purpose is to list providers of the exact same
+feature to ease specifying dependencies in packages requiring said feature. They rely entirely on
+the `providers` suboption.
+
+Some specific packaging rules apply to virtuals:
+
+* `DOWNLOADS` should not be specified
+* `HOMEPAGE` should point to a document describing the provided feature or be empty
+* `SUMMARY` should be of the form `Virtual: <topic> providers`
+* You may rely upon the default `build+run` dependencies label
+
+Here is an example virtual (notification-daemon) for Freedesktop notifications providers:
+
+ # Copyright 2009 Mike Kelly
+ # Copyright 2014 Quentin "Sardem FF7" Glidic <[email protected]>
+ # Distributed under the terms of the GNU General Public License v2
+
+ SUMMARY="Virtual: Freedesktop notifications providers"
+ HOMEPAGE=""
+
+ SLOT="0"
+ PLATFORMS="~amd64 ~x86"
+ MYOPTIONS="
+ ( providers:
+ notification-daemon
+ notify-osd
+ dunst
+ eventd
+ awesome
+ notification-daemon-xfce
+ gnome-shell
+ kde-runtime
+ ) [[
+ *description = [ Freedesktop notifications provider ]
+ number-selected = at-least-one
+ ]]
+ "
+
+ DEPENDENCIES="
+ providers:notification-daemon? ( x11-apps/notification-daemon )
+ providers:notify-osd? ( x11-apps/notify-osd )
+ providers:dunst? ( x11-apps/dunst )
+ providers:eventd? ( net/eventd[dbus] )
+ providers:awesome? ( x11-wm/awesome[>=3.1] [[ description = [ with the naughty library ] ]] )
+ providers:notification-daemon-xfce? ( xfce-extra/notification-daemon-xfce )
+ providers:gnome-shell? ( gnome-desktop/gnome-shell )
+ providers:kde-runtime? ( kde/kde-runtime [[ description = [ with knotify ] ]] )
+ "
+
--
Copyright 2008, 2009 Ciaran McCreesh
--
1.8.5.4
#! /bin/bash
usage() {
cat <<EOF
Usage:
${0} <package name> <package version> <package repository> [<package
revision>] [OPTIONS...]
Will read the standard input for providers, one per line, using the
DEPENDENCIES syntax
Options:
--header The full header to use in your file
--copyright The copyright to use in your file (with default header)
--slot Slot of the virtual
--platforms Platforms of the virtual
--description Description of the virtual, will be used in SUMMARY and in
options’ descriptions
--myoptions Additional MYOPTIONS
--dependencies Additional DEPENDENCIES
EOF
exit 0
}
# Defaults
COPYRIGHT="$(date +%Y) <name>"
SUMMARY="Virtual: "
HOMEPAGE=""
SLOT="0"
case "$(uname -m)" in
x86) PLATFORMS="~x86" ;;
x86_64) PLATFORMS="~amd64" ;;
esac
MYOPTIONS=""
DEPENDENCIES=""
args=()
while [[ ${#} > 0 ]]; do
case "${1}" in
--help|-h) usage ;;
# Revision
-r*) revision=${1#-r} ;;
# Header
--header) HEADER=${2}; shift ;;
--copyright) COPYRIGHT=${2}; shift ;;
# SLOT
--slot) SLOT=${2}; shift ;;
# PLATFORMS
--platforms) PLATFORMS=${2}; shift ;;
# SUMMARY
--description) description=${2}; shift ;;
# MYOPTIONS
--myoptions) MYOPTIONS=${2}; shift ;;
# DEPENDENCIES
--dependencies) DEPENDENCIES=${2}; shift ;;
*) args+=( "${1}" ) ;;
esac
shift
done
set -- "${args[@]}"
name=${1}
version=${2}
repository=${3}
revision=${4}
shift 4
[[ -z "${HEADER}" ]] && HEADER="# Copyright ${COPYRIGHT}
# Distributed under the terms of the GNU General Public License v2"
while read dependency; do
[[ -z "${dependency}" ]] && continue
option=${dependency%% *}
option=${option##*/}
option=${option%%[*}
option=${option%%:*}
PROVIDERS_OPTIONS+="
${option}"
PROVIDERS_DEPENDENCIES+="
providers:${option}? ( ${dependency} )"
done
PROVIDERS_OPTIONS+=$'\n'
PROVIDERS_DEPENDENCIES+=$'\n'
exheres=${repository}/packages/virtual/${name}/${name}-${version}${revision:+-r}${revision}.exheres-0
mkdir -p $(dirname ${exheres})
cat > ${exheres} <<EOF
${HEADER}
SUMMARY="Virtual: ${description} providers"
HOMEPAGE="${HOMEPAGE}"
SLOT="${SLOT}"
PLATFORMS="${PLATFORMS}"
MYOPTIONS="
( providers:${PROVIDERS_OPTIONS} ) [[
*description = [ ${description} provider ]
number-selected = at-least-one
]]
${MYOPTIONS}"
DEPENDENCIES="${PROVIDERS_DEPENDENCIES}${DEPENDENCIES}"
EOF
#! /bin/bash
usage() {
cat <<EOF
Usage:
${0} <package name> <package version> <package repository> [<package
revision>] [create-virtual arguments...]
EOF
exit 0
}
[[ ${1} == --help ]] && usage
name=${1}
version=${2}
repository=${3}
revision=${4#-r}
shift 4
(( new_revision = ${revision} + 1 ))
revision=${revision:+-r}${revision}
spec="virtual/${name}::${repository}[=${version}${revision}]"
dir=${repository}/packages/virtual/${name}
exheres=${name}-${version}${revision}.exheres-0
new_exheres=${name}-${version}-r${new_revision}.exheres-0
description() {
local d dd l p s
d="$(cave print-id-metadata --raw-name SUMMARY --format %v ${spec})"
for p in 'a ' 'virtual ' 'for ' 'providing '; do # strip some prefixes
dd=${d,,}
l=${#p}
[[ "${dd:0:${l}}" == "${p}" ]] && d=${d:${l}}
done
for s in ' provider' ' providers'; do # strip some suffixes
dd=${d,,}
(( l = ${#d} - ${#s} ))
[[ "${dd:${l}}" == "${s}" ]] && d=${d:0:${l}}
done
echo "${d}"
}
incremental_metadata() {
local m=${1} d
d="$(cave print-id-metadata --raw-name ${m} --format %v ${spec})"
d="${d#( }"
d="${d% ) \[\[ defined-in = \[ ${exheres} \] \]\]}"
echo "${d}" | grep -q defined-in && exit 1 # Do not allow virtuals with
requires
echo "${d}" | sed -r \
-e 's:((\|\| )?\() :\1\n:'\
-e 's: *([a-z][^ ]+( \[\[( [^ ]+ = (\[[^]]+\]|[^ ]+))+ \]\])?) *:\1\n:g'
}
args=( ${name} ${version} ${repository} ${new_revision} )
args+=( --header "$(sed -n -e '1,/^$/p' ${dir}/${exheres})" )
args+=( --description "$(description)" )
args+=( --homepage "$(cave print-id-metadata --raw-name HOMEPAGE --format %v
${spec})" )
args+=( --slot "$(cave print-id-metadata --raw-name SLOT --format %v ${spec})" )
args+=( --platforms "$(cave print-id-metadata --raw-name PLATFORMS --format %v
${spec})" )
args+=( --myoptions "$(incremental_metadata MYOPTIONS)" )
dependencies="$(incremental_metadata DEPENDENCIES)"
echo "${dependencies}" | grep -q '|| (' || exit 0
DEPENDENCIES="$(echo "${dependencies}" | sed -e '0,/|| (/d' -e '/)/,$d')"
args+=( --dependencies "$(echo "${dependencies}" | sed -e '/|| (/,/)/d')" )
echo "${DEPENDENCIES}" | $(dirname ${0})/create-virtual.bash "${args[@]}" "${@}"
diff -u ${dir}/${exheres} ${dir}/${new_exheres}
#! /bin/bash
cave print-ids -m virtual/* -f '%p %v %r\n'|grep -v installed|grep -v
graveyard|grep -v unavailable|\
while read name full_version repository; do
version=${full_version%-r*}
revision=${full_version#${version}}
./migrate-virtual.bash ${name} ${version} ${repository} ${revision#-r}
done
_______________________________________________
Exherbo-dev mailing list
[email protected]
http://lists.exherbo.org/mailman/listinfo/exherbo-dev