1 |
commit: ae4963d44f80465b8f31aab5d8656d00293f5e2f |
2 |
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 31 03:03:31 2018 +0000 |
4 |
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 31 03:04:13 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=ae4963d4 |
7 |
|
8 |
eclass/intel-sdp-r1: Add path_exists workaround |
9 |
|
10 |
eclass/intel-sdp-r1.eclass | 48 +++++++++++++++++++++++++++++++++++++++------- |
11 |
1 file changed, 41 insertions(+), 7 deletions(-) |
12 |
|
13 |
diff --git a/eclass/intel-sdp-r1.eclass b/eclass/intel-sdp-r1.eclass |
14 |
index e6d8f3ee7..12d1f868d 100644 |
15 |
--- a/eclass/intel-sdp-r1.eclass |
16 |
+++ b/eclass/intel-sdp-r1.eclass |
17 |
@@ -118,6 +118,40 @@ esac |
18 |
# the combined tarball. |
19 |
: ${INTEL_DIST_SPLIT_ARCH:=false} |
20 |
|
21 |
+# @FUNCTION: _isdp_path_exists |
22 |
+# @INTERNAL |
23 |
+# @USAGE: [-a|-o] <paths> |
24 |
+# @DESCRIPTION: |
25 |
+# Check if the specified paths exist. Works for all types of paths |
26 |
+# (files/dirs/etc...). The -a and -o flags control the requirements |
27 |
+# of the paths. They correspond to "and" and "or" logic. So the -a |
28 |
+# flag means all the paths must exist while the -o flag means at least |
29 |
+# one of the paths must exist. The default behavior is "and". If no |
30 |
+# paths are specified, then the return value is "false". |
31 |
+_isdp_path_exists() { |
32 |
+ local opt=$1 |
33 |
+ [[ ${opt} == -[ao] ]] && shift || opt="-a" |
34 |
+ |
35 |
+ # no paths -> return false |
36 |
+ # same behavior as: [[ -e "" ]] |
37 |
+ [[ $# -eq 0 ]] && return 1 |
38 |
+ |
39 |
+ local p r=0 |
40 |
+ for p in "$@" ; do |
41 |
+ [[ -e ${p} ]] |
42 |
+ : $(( r += $? )) |
43 |
+ done |
44 |
+ |
45 |
+ case ${opt} in |
46 |
+ -a) return $(( r != 0 )) ;; |
47 |
+ -o) return $(( r == $# )) ;; |
48 |
+ esac |
49 |
+ eerror "path_exists has been removed. Please see the following post" |
50 |
+ eerror "for a replacement snippet:" |
51 |
+ eerror "https://blogs.gentoo.org/mgorny/2018/08/09/inlining-path_exists/" |
52 |
+ die "path_exists is banned" |
53 |
+} |
54 |
+ |
55 |
# @FUNCTION: _isdp_get-sdp-year |
56 |
# @INTERNAL |
57 |
# @DESCRIPTION: |
58 |
@@ -373,7 +407,7 @@ intel-sdp-r1_pkg_pretend() { |
59 |
) |
60 |
for dir in "${dirs[@]}" ; do |
61 |
ebegin "Checking for a license in: ${dir}" |
62 |
- path_exists "${dir}"/*lic && warn=0 |
63 |
+ _isdp_path_exists "${dir}"/*lic && warn=0 |
64 |
eend ${warn} && break |
65 |
done |
66 |
if [[ ${warn} == 1 ]]; then |
67 |
@@ -439,9 +473,9 @@ intel-sdp-r1_src_install() { |
68 |
eend |
69 |
|
70 |
# handle documentation |
71 |
- if path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)"; then |
72 |
+ if _isdp_path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)"; then |
73 |
# normal man pages |
74 |
- if path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)/en/man/common/man1"; then |
75 |
+ if _isdp_path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)/en/man/common/man1"; then |
76 |
doman opt/intel/documentation_"$(_isdp_get-sdp-year)"/en/man/common/man1/* |
77 |
rm -r opt/intel/documentation_"$(_isdp_get-sdp-year)"/en/man || die |
78 |
fi |
79 |
@@ -455,24 +489,24 @@ intel-sdp-r1_src_install() { |
80 |
fi |
81 |
|
82 |
# MPI man pages |
83 |
- if path_exists "$(isdp_get-sdp-dir)/linux/mpi/man/man3"; then |
84 |
+ if _isdp_path_exists "$(isdp_get-sdp-dir)/linux/mpi/man/man3"; then |
85 |
doman "$(isdp_get-sdp-dir)"/linux/mpi/man/man3/* |
86 |
rm -r "$(isdp_get-sdp-dir)"/linux/mpi/man || die |
87 |
fi |
88 |
|
89 |
# licensing docs |
90 |
- if path_exists "$(isdp_get-sdp-dir)/licensing/documentation"; then |
91 |
+ if _isdp_path_exists "$(isdp_get-sdp-dir)/licensing/documentation"; then |
92 |
dodoc -r "$(isdp_get-sdp-dir)/licensing/documentation"/* |
93 |
rm -rf "$(isdp_get-sdp-dir)/licensing/documentation" || die |
94 |
fi |
95 |
|
96 |
- if path_exists opt/intel/"${INTEL_DIST_NAME}"*/licensing; then |
97 |
+ if _isdp_path_exists opt/intel/"${INTEL_DIST_NAME}"*/licensing; then |
98 |
dodoc -r opt/intel/"${INTEL_DIST_NAME}"*/licensing |
99 |
rm -rf opt/intel/"${INTEL_DIST_NAME}"* || die |
100 |
fi |
101 |
|
102 |
# handle examples |
103 |
- if path_exists "opt/intel/samples_$(_isdp_get-sdp-year)"; then |
104 |
+ if _isdp_path_exists "opt/intel/samples_$(_isdp_get-sdp-year)"; then |
105 |
use examples && dodoc -r opt/intel/samples_"$(_isdp_get-sdp-year)"/* |
106 |
|
107 |
ebegin "Cleaning out examples" |