1 |
--- |
2 |
eclass/eutils.eclass | 30 ++++--------------------- |
3 |
eclass/tests/eutils_path_exists.sh | 35 ------------------------------ |
4 |
2 files changed, 4 insertions(+), 61 deletions(-) |
5 |
delete mode 100755 eclass/tests/eutils_path_exists.sh |
6 |
|
7 |
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
8 |
index 9b4767e1874a..3b9fc28319c6 100644 |
9 |
--- a/eclass/eutils.eclass |
10 |
+++ b/eclass/eutils.eclass |
11 |
@@ -181,33 +181,11 @@ make_wrapper() { |
12 |
fi |
13 |
} |
14 |
|
15 |
-# @FUNCTION: path_exists |
16 |
-# @USAGE: [-a|-o] <paths> |
17 |
-# @DESCRIPTION: |
18 |
-# Check if the specified paths exist. Works for all types of paths |
19 |
-# (files/dirs/etc...). The -a and -o flags control the requirements |
20 |
-# of the paths. They correspond to "and" and "or" logic. So the -a |
21 |
-# flag means all the paths must exist while the -o flag means at least |
22 |
-# one of the paths must exist. The default behavior is "and". If no |
23 |
-# paths are specified, then the return value is "false". |
24 |
path_exists() { |
25 |
- local opt=$1 |
26 |
- [[ ${opt} == -[ao] ]] && shift || opt="-a" |
27 |
- |
28 |
- # no paths -> return false |
29 |
- # same behavior as: [[ -e "" ]] |
30 |
- [[ $# -eq 0 ]] && return 1 |
31 |
- |
32 |
- local p r=0 |
33 |
- for p in "$@" ; do |
34 |
- [[ -e ${p} ]] |
35 |
- : $(( r += $? )) |
36 |
- done |
37 |
- |
38 |
- case ${opt} in |
39 |
- -a) return $(( r != 0 )) ;; |
40 |
- -o) return $(( r == $# )) ;; |
41 |
- esac |
42 |
+ eerror "path_exists has been removed. Please see the following post" |
43 |
+ eerror "for a replacement snippet:" |
44 |
+ eerror "https://blogs.gentoo.org/mgorny/2018/08/09/inlining-path_exists/" |
45 |
+ die "path_exists is banned" |
46 |
} |
47 |
|
48 |
# @FUNCTION: use_if_iuse |
49 |
diff --git a/eclass/tests/eutils_path_exists.sh b/eclass/tests/eutils_path_exists.sh |
50 |
deleted file mode 100755 |
51 |
index 00a89c7e446d..000000000000 |
52 |
--- a/eclass/tests/eutils_path_exists.sh |
53 |
+++ /dev/null |
54 |
@@ -1,35 +0,0 @@ |
55 |
-#!/bin/bash |
56 |
-# Copyright 1999-2015 Gentoo Foundation |
57 |
-# Distributed under the terms of the GNU General Public License v2 |
58 |
- |
59 |
-source tests-common.sh |
60 |
- |
61 |
-inherit eutils |
62 |
- |
63 |
-test-path_exists() { |
64 |
- local exp=$1; shift |
65 |
- tbegin "path_exists($*) == ${exp}" |
66 |
- path_exists "$@" |
67 |
- [[ ${exp} -eq $? ]] |
68 |
- tend $? |
69 |
-} |
70 |
- |
71 |
-test-path_exists 1 |
72 |
-test-path_exists 1 -a |
73 |
-test-path_exists 1 -o |
74 |
- |
75 |
-good="/ . tests-common.sh /bin/bash" |
76 |
-test-path_exists 0 ${good} |
77 |
-test-path_exists 0 -a ${good} |
78 |
-test-path_exists 0 -o ${good} |
79 |
- |
80 |
-bad="/asjdkfljasdlfkja jlakjdsflkasjdflkasdjflkasdjflaskdjf" |
81 |
-test-path_exists 1 ${bad} |
82 |
-test-path_exists 1 -a ${bad} |
83 |
-test-path_exists 1 -o ${bad} |
84 |
- |
85 |
-test-path_exists 1 ${good} ${bad} |
86 |
-test-path_exists 1 -a ${good} ${bad} |
87 |
-test-path_exists 0 -o ${good} ${bad} |
88 |
- |
89 |
-texit |
90 |
-- |
91 |
2.18.0 |