diff options
author | Chris Reffett <creffett@gentoo.org> | 2014-03-15 00:47:42 +0000 |
---|---|---|
committer | Chris Reffett <creffett@gentoo.org> | 2014-03-15 00:47:42 +0000 |
commit | e40a6607223fe329560cfe573c1589ed1d307ea9 (patch) | |
tree | 55351906645cfff3cf196957d9382e4fc6d4b3b7 /eclass/eutils.eclass | |
parent | x86 stable, bug #499534 (diff) | |
download | gentoo-2-e40a6607223fe329560cfe573c1589ed1d307ea9.tar.gz gentoo-2-e40a6607223fe329560cfe573c1589ed1d307ea9.tar.bz2 gentoo-2-e40a6607223fe329560cfe573c1589ed1d307ea9.zip |
Add optfeature to eutils.eclass wrt bug 498988, ACKed by WilliamH
Diffstat (limited to 'eclass/eutils.eclass')
-rw-r--r-- | eclass/eutils.eclass | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 53ae2e45f4ac..82c6117ed40f 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.431 2014/01/08 06:46:18 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.432 2014/03/15 00:47:42 creffett Exp $ # @ECLASS: eutils.eclass # @MAINTAINER: @@ -1729,4 +1729,49 @@ einstalldocs() { check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; } +# @FUNCTION: optfeature +# @USAGE: <short description> <package atom to match> [other atoms] +# @DESCRIPTION: +# Print out a message suggesting an optional package (or packages) which +# provide the described functionality +# +# The following snippet would suggest app-misc/foo for optional foo support, +# app-misc/bar or app-misc/baz[bar] for optional bar support +# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support. +# @CODE: +# optfeature "foo support" app-misc/foo +# optfeature "bar support" app-misc/bar app-misc/baz[bar] +# optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c +# +optfeature() { + debug-print-function ${FUNCNAME} "$@" + local i j msg + local desc=$1 + local flag=0 + shift + for i; do + for j in $i; do + if has_version "$j"; then + flag=1 + else + flag=0 + break + fi + done + if [[ $flag -eq 1 ]]; then + break + fi + done + if [[ $flag -eq 0 ]]; then + for i; do + msg=" " + for j in $i; do + msg="${msg} ${j} and" + done + msg="${msg:0: -4} for ${desc}" + elog "${msg}" + done + fi +} + fi |