Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Cc: David Seifert <soap@g.o>
Subject: [gentoo-dev] [PATCH 2/2] eutils.eclass: Use optfeature() from optfeature.eclass
Date: Sun, 06 Sep 2020 15:48:24
Message-Id: 20200906154731.162917-2-soap@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/2] optfeature.eclass: New eclass with definition from eutils by David Seifert
1 Signed-off-by: David Seifert <soap@g.o>
2 ---
3 eclass/eutils.eclass | 49 ++------------------------------------------
4 1 file changed, 2 insertions(+), 47 deletions(-)
5
6 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
7 index 20dec774f2f..4255056f310 100644
8 --- a/eclass/eutils.eclass
9 +++ b/eclass/eutils.eclass
10 @@ -1,4 +1,4 @@
11 -# Copyright 1999-2019 Gentoo Authors
12 +# Copyright 1999-2020 Gentoo Authors
13 # Distributed under the terms of the GNU General Public License v2
14
15 # @ECLASS: eutils.eclass
16 @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1
17 # implicitly inherited (now split) eclasses
18 case ${EAPI:-0} in
19 0|1|2|3|4|5|6)
20 - inherit desktop epatch estack ltprune multilib preserve-libs \
21 + inherit desktop epatch estack ltprune multilib optfeature preserve-libs \
22 toolchain-funcs vcs-clean
23 ;;
24 esac
25 @@ -186,51 +186,6 @@ use_if_iuse() {
26 use $1
27 }
28
29 -# @FUNCTION: optfeature
30 -# @USAGE: <short description> <package atom to match> [other atoms]
31 -# @DESCRIPTION:
32 -# Print out a message suggesting an optional package (or packages)
33 -# not currently installed which provides the described functionality.
34 -#
35 -# The following snippet would suggest app-misc/foo for optional foo support,
36 -# app-misc/bar or app-misc/baz[bar] for optional bar support
37 -# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
38 -# @CODE
39 -# optfeature "foo support" app-misc/foo
40 -# optfeature "bar support" app-misc/bar app-misc/baz[bar]
41 -# optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
42 -# @CODE
43 -optfeature() {
44 - debug-print-function ${FUNCNAME} "$@"
45 - local i j msg
46 - local desc=$1
47 - local flag=0
48 - shift
49 - for i; do
50 - for j in ${i}; do
51 - if has_version "${j}"; then
52 - flag=1
53 - else
54 - flag=0
55 - break
56 - fi
57 - done
58 - if [[ ${flag} -eq 1 ]]; then
59 - break
60 - fi
61 - done
62 - if [[ ${flag} -eq 0 ]]; then
63 - for i; do
64 - msg=" "
65 - for j in ${i}; do
66 - msg+=" ${j} and"
67 - done
68 - msg="${msg:0: -4} for ${desc}"
69 - elog "${msg}"
70 - done
71 - fi
72 -}
73 -
74 case ${EAPI:-0} in
75 0|1|2|3|4)
76
77 --
78 2.28.0

Replies