1 |
commit: 5f41f024c7b6c5ffb10be5ae271b5063400c8aea |
2 |
Author: Justin Lecher <jlec <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 25 20:16:56 2016 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 27 09:44:49 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f41f024 |
7 |
|
8 |
cmake-utils.eclass: Use bash internal testing instead of has() |
9 |
|
10 |
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> |
11 |
|
12 |
eclass/cmake-utils.eclass | 18 +++++++++--------- |
13 |
1 file changed, 9 insertions(+), 9 deletions(-) |
14 |
|
15 |
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass |
16 |
index 9e8e71e..fb7f5ca 100644 |
17 |
--- a/eclass/cmake-utils.eclass |
18 |
+++ b/eclass/cmake-utils.eclass |
19 |
@@ -127,7 +127,7 @@ case ${WANT_CMAKE} in |
20 |
always) |
21 |
;; |
22 |
*) |
23 |
- has "${EAPI:-0}" 2 3 4 5 || die "WANT_CMAKE is banned in EAPI 6 and later" |
24 |
+ [[ ${EAPI} == [2345] ]] || die "WANT_CMAKE is banned in EAPI 6 and later" |
25 |
IUSE+=" ${WANT_CMAKE}" |
26 |
CMAKEDEPEND+="${WANT_CMAKE}? ( " |
27 |
;; |
28 |
@@ -164,7 +164,7 @@ _cmake_use_me_now() { |
29 |
local arg=$2 |
30 |
[[ ! -z $3 ]] && arg=$3 |
31 |
|
32 |
- has "${EAPI:-0}" 2 3 4 5 || die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" instead" |
33 |
+ [[ ${EAPI} == [2345] ]] || die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" instead" |
34 |
|
35 |
local uper capitalised x |
36 |
[[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]" |
37 |
@@ -186,7 +186,7 @@ _cmake_use_me_now_inverted() { |
38 |
local arg=$2 |
39 |
[[ ! -z $3 ]] && arg=$3 |
40 |
|
41 |
- if ! has "${EAPI:-0}" 2 3 4 5 && [[ "${FUNCNAME[1]}" != cmake-utils_use_find_package ]] ; then |
42 |
+ if [[ ${EAPI} != [2345] ]] && [[ "${FUNCNAME[1]}" != cmake-utils_use_find_package ]] ; then |
43 |
die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" insteadss" |
44 |
fi |
45 |
|
46 |
@@ -283,7 +283,7 @@ cmake_comment_add_subdirectory() { |
47 |
# Comment out an add_subdirectory call in CMakeLists.txt in the current directory |
48 |
# Banned in EAPI 6 and later - use cmake_comment_add_subdirectory instead. |
49 |
comment_add_subdirectory() { |
50 |
- has "${EAPI:-0}" 2 3 4 5 || die "comment_add_subdirectory is banned in EAPI 6 and later - use cmake_comment_add_subdirectory instead" |
51 |
+ [[ ${EAPI} == [2345] ]] || die "comment_add_subdirectory is banned in EAPI 6 and later - use cmake_comment_add_subdirectory instead" |
52 |
|
53 |
cmake_comment_add_subdirectory "$@" |
54 |
} |
55 |
@@ -315,7 +315,7 @@ cmake-utils_use_enable() { _cmake_use_me_now ENABLE_ "$@" ; } |
56 |
# if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=ON if it is disabled. |
57 |
# This can be used to make find_package optional. |
58 |
cmake-utils_use_find_package() { |
59 |
- if ! has "${EAPI:-0}" 2 3 4 5 && [[ "$#" != 2 ]] ; then |
60 |
+ if [[ ${EAPI} != [2345] ]] && [[ "$#" != 2 ]] ; then |
61 |
die "Usage: cmake-utils_use_find_package <USE flag> <package name>" |
62 |
fi |
63 |
|
64 |
@@ -456,7 +456,7 @@ enable_cmake-utils_src_prepare() { |
65 |
|
66 |
pushd "${S}" > /dev/null || die |
67 |
|
68 |
- if ! has "${EAPI:-0}" 2 3 4 5 ; then |
69 |
+ if [[ ${EAPI} != [2345] ]]; then |
70 |
default_src_prepare |
71 |
_cmake_cleanup_cmake |
72 |
else |
73 |
@@ -488,7 +488,7 @@ enable_cmake-utils_src_prepare() { |
74 |
enable_cmake-utils_src_configure() { |
75 |
debug-print-function ${FUNCNAME} "$@" |
76 |
|
77 |
- has "${EAPI:-0}" 2 3 4 5 && _cmake_cleanup_cmake |
78 |
+ [[ ${EAPI} == [2345] ]] && _cmake_cleanup_cmake |
79 |
|
80 |
_cmake_check_build_dir |
81 |
|
82 |
@@ -564,7 +564,7 @@ enable_cmake-utils_src_configure() { |
83 |
fi |
84 |
fi |
85 |
|
86 |
- has "${EAPI:-0}" 0 1 2 && ! use prefix && local EPREFIX= |
87 |
+ [[ ${EAPI} == 2 ]] && ! use prefix && local EPREFIX= |
88 |
|
89 |
if [[ ${EPREFIX} ]]; then |
90 |
cat >> "${build_rules}" <<- _EOF_ || die |
91 |
@@ -604,7 +604,7 @@ enable_cmake-utils_src_configure() { |
92 |
local mycmakeargstype=$(declare -p mycmakeargs 2>&-) |
93 |
if [[ "${mycmakeargstype}" != "declare -a mycmakeargs="* ]]; then |
94 |
if [[ -n "${mycmakeargstype}" ]] ; then |
95 |
- if has "${EAPI:-0}" 2 3 4 5 ; then |
96 |
+ if [[ ${EAPI} != [2345] ]]; then |
97 |
eqawarn "Declaring mycmakeargs as a variable is deprecated. Please use an array instead." |
98 |
else |
99 |
die "Declaring mycmakeargs as a variable is banned in EAPI=${EAPI}. Please use an array instead." |