Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] eutils.eclass: Remove built_with_use().
Date: Fri, 19 Jan 2018 21:08:49
Message-Id: 23138.24145.6720.263374@a1i15.kph.uni-mainz.de
1 The function was deprecated in 2010 and is no longer used in the tree.
2 Use EAPI 2 use deps and has_version as replacement.
3
4 Closes: https://bugs.gentoo.org/261562
5 ---
6 To be committed after removal of x-modular.eclass which is scheduled
7 for 2018-02-01.
8
9 eclass/eutils.eclass | 92 ----------------------------------------------------
10 1 file changed, 92 deletions(-)
11
12 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
13 index 63f73db290f4..be8251f5794a 100644
14 --- a/eclass/eutils.eclass
15 +++ b/eclass/eutils.eclass
16 @@ -164,98 +164,6 @@ strip-linguas() {
17 export LINGUAS=${newls:1}
18 }
19
20 -# @FUNCTION: built_with_use
21 -# @USAGE: [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags>
22 -# @DESCRIPTION:
23 -#
24 -# Deprecated: Use EAPI 2 use deps in DEPEND|RDEPEND and with has_version calls.
25 -#
26 -# A temporary hack until portage properly supports DEPENDing on USE
27 -# flags being enabled in packages. This will check to see if the specified
28 -# DEPEND atom was built with the specified list of USE flags. The
29 -# --missing option controls the behavior if called on a package that does
30 -# not actually support the defined USE flags (aka listed in IUSE).
31 -# The default is to abort (call die). The -a and -o flags control
32 -# the requirements of the USE flags. They correspond to "and" and "or"
33 -# logic. So the -a flag means all listed USE flags must be enabled
34 -# while the -o flag means at least one of the listed IUSE flags must be
35 -# enabled. The --hidden option is really for internal use only as it
36 -# means the USE flag we're checking is hidden expanded, so it won't be found
37 -# in IUSE like normal USE flags.
38 -#
39 -# Remember that this function isn't terribly intelligent so order of optional
40 -# flags matter.
41 -built_with_use() {
42 - local hidden="no"
43 - if [[ $1 == "--hidden" ]] ; then
44 - hidden="yes"
45 - shift
46 - fi
47 -
48 - local missing_action="die"
49 - if [[ $1 == "--missing" ]] ; then
50 - missing_action=$2
51 - shift ; shift
52 - case ${missing_action} in
53 - true|false|die) ;;
54 - *) die "unknown action '${missing_action}'";;
55 - esac
56 - fi
57 -
58 - local opt=$1
59 - [[ ${opt:0:1} = "-" ]] && shift || opt="-a"
60 -
61 - local PKG=$(best_version $1)
62 - [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package"
63 - shift
64 -
65 - has "${EAPI:-0}" 0 1 2 && local EROOT=${ROOT}
66 - local USEFILE=${EROOT}/var/db/pkg/${PKG}/USE
67 - local IUSEFILE=${EROOT}/var/db/pkg/${PKG}/IUSE
68 -
69 - # if the IUSE file doesn't exist, the read will error out, we need to handle
70 - # this gracefully
71 - if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]] ; then
72 - case ${missing_action} in
73 - true) return 0;;
74 - false) return 1;;
75 - die) die "Unable to determine what USE flags $PKG was built with";;
76 - esac
77 - fi
78 -
79 - if [[ ${hidden} == "no" ]] ; then
80 - local IUSE_BUILT=( $(<"${IUSEFILE}") )
81 - # Don't check USE_EXPAND #147237
82 - local expand
83 - for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]') ; do
84 - if [[ $1 == ${expand}_* ]] ; then
85 - expand=""
86 - break
87 - fi
88 - done
89 - if [[ -n ${expand} ]] ; then
90 - if ! has $1 ${IUSE_BUILT[@]#[-+]} ; then
91 - case ${missing_action} in
92 - true) return 0;;
93 - false) return 1;;
94 - die) die "$PKG does not actually support the $1 USE flag!";;
95 - esac
96 - fi
97 - fi
98 - fi
99 -
100 - local USE_BUILT=$(<${USEFILE})
101 - while [[ $# -gt 0 ]] ; do
102 - if [[ ${opt} = "-o" ]] ; then
103 - has $1 ${USE_BUILT} && return 0
104 - else
105 - has $1 ${USE_BUILT} || return 1
106 - fi
107 - shift
108 - done
109 - [[ ${opt} = "-a" ]]
110 -}
111 -
112 # @FUNCTION: make_wrapper
113 # @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
114 # @DESCRIPTION:
115 --
116 2.16.0