Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: eclass/
Date: Fri, 19 Feb 2016 10:12:25
Message-Id: 1455875770.44f2fd7fd15e4101c564f8d9f61310cb90dafac9.jlec@gentoo
1 commit: 44f2fd7fd15e4101c564f8d9f61310cb90dafac9
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 16 23:43:39 2016 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 19 09:56:10 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=44f2fd7f
7
8 eclass/intel-sdp-r1.eclass: Improve eclass to match modern QA standards
9
10 eclass/intel-sdp-r1.eclass | 566 ++++++++++++++++++++++++---------------------
11 1 file changed, 297 insertions(+), 269 deletions(-)
12
13 diff --git a/eclass/intel-sdp-r1.eclass b/eclass/intel-sdp-r1.eclass
14 index 14467b7..2f06ed3 100644
15 --- a/eclass/intel-sdp-r1.eclass
16 +++ b/eclass/intel-sdp-r1.eclass
17 @@ -9,62 +9,71 @@
18 # Sci Team <sci@g.o>
19 # @BLURB: Handling of Intel's Software Development Products package management
20
21 +MULTILIB_COMPAT=( abi_x86_{32,64} )
22 +
23 +inherit check-reqs eutils multilib-build versionator
24 +
25 +EXPORT_FUNCTIONS src_unpack src_install pkg_postinst pkg_postrm pkg_pretend
26 +
27 if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then
28
29 -case "${EAPI:-0}" in
30 +case "${EAPI}" in
31 6) ;;
32 *) die "EAPI=${EAPI} is not supported" ;;
33 esac
34
35 -# @ECLASS-VARIABLE: INTEL_DID
36 +# @ECLASS-VARIABLE: INTEL_DIST_SKU
37 # @DEFAULT_UNSET
38 # @DESCRIPTION:
39 # The package download ID from Intel.
40 -# To find out its value, see the links to download in
41 +# To determine its value, see the links to download in
42 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
43 #
44 # e.g. 8365
45 #
46 -# Must be defined before inheriting the eclass
47 +# Must be defined before inheriting the eclass.
48
49 -# @ECLASS-VARIABLE: INTEL_DPN
50 -# @DEFAULT_UNSET
51 +# @ECLASS-VARIABLE: INTEL_DIST_NAME
52 # @DESCRIPTION:
53 # The package name to download from Intel.
54 -# To find out its value, see the links to download in
55 +# To determine its value, see the links to download in
56 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
57 #
58 # e.g. parallel_studio_xe
59 #
60 -# Must be defined before inheriting the eclass
61 +# Must be defined before inheriting the eclass.
62 +: ${INTEL_DIST_NAME:=parallel_studio_xe}
63
64 -# @ECLASS-VARIABLE: INTEL_DPV
65 +# @ECLASS-VARIABLE: INTEL_DIST_PV
66 # @DEFAULT_UNSET
67 # @DESCRIPTION:
68 # The package download version from Intel.
69 -# To find out its value, see the links to download in
70 +# To determine its value, see the links to download in
71 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
72 #
73 # e.g. 2016_update1
74 #
75 -# Must be defined before inheriting the eclass
76 +# Must be defined before inheriting the eclass.
77
78 -# @ECLASS-VARIABLE: INTEL_TARX
79 +# @ECLASS-VARIABLE: INTEL_DIST_TARX
80 # @DESCRIPTION:
81 -# The package extention.
82 -# To find out its value, see the links to download in
83 +# The package distfile suffix.
84 +# To determine its value, see the links to download in
85 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
86 #
87 -# e.g. tar.gz
88 +# e.g. tgz
89 #
90 -# Must be defined before inheriting the eclass
91 -: ${INTEL_TARX:=tgz}
92 +# Must be defined before inheriting the eclass.
93 +: ${INTEL_DIST_TARX:=tgz}
94
95 # @ECLASS-VARIABLE: INTEL_SUBDIR
96 -# @DEFAULT_UNSET
97 # @DESCRIPTION:
98 -# The package sub-directory where it will end-up in /opt/intel
99 -# To find out its value, you have to do a raw install from the Intel tar ball
100 +# The package sub-directory (without version numbers) where it will end-up in /opt/intel
101 +#
102 +# e.g. compilers_and_libraries
103 +#
104 +# To determine its value, you have to do a raw install from the Intel tarball.
105 +: ${INTEL_SUBDIR:=compilers_and_libraries}
106
107 # @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
108 # @DEFAULT_UNSET
109 @@ -84,9 +93,9 @@ esac
110 # e.g. i486
111 : ${INTEL_X86:=i486}
112
113 -# @ECLASS-VARIABLE: INTEL_BIN_RPMS
114 +# @ECLASS-VARIABLE: INTEL_DIST_BIN_RPMS
115 # @DESCRIPTION:
116 -# Functional name of rpm without any version/arch tag
117 +# Functional name of rpm without any version/arch tag.
118 # Has to be a bash array
119 #
120 # e.g. ("icc-l-all-devel")
121 @@ -94,68 +103,95 @@ esac
122 # if the rpm is located in a directory other than INTEL_RPMS_DIR you can
123 # specify the full path
124 #
125 -# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
126 -: ${INTEL_BIN_RPMS:=()}
127 +# e.g. ("CLI_install/rpm/intel-vtune-amplifier-xe-cli")
128 +[[ ${INTEL_DIST_BIN_RPMS[@]} ]] || INTEL_DIST_BIN_RPMS=()
129
130 -# @ECLASS-VARIABLE: INTEL_AMD64_RPMS
131 +# @ECLASS-VARIABLE: INTEL_DIST_AMD64_RPMS
132 # @DESCRIPTION:
133 -# AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS
134 -# Has to be a bash array
135 -: ${INTEL_AMD64_RPMS:=()}
136 +# AMD64 single arch rpms. Same syntax as INTEL_DIST_BIN_RPMS.
137 +# Has to be a bash array.
138 +[[ ${INTEL_DIST_AMD64_RPMS[@]} ]] || INTEL_DIST_AMD64_RPMS=()
139
140 -# @ECLASS-VARIABLE: INTEL_X86_RPMS
141 +# @ECLASS-VARIABLE: INTEL_DIST_X86_RPMS
142 # @DESCRIPTION:
143 -# X86 single arch rpms. Same syntax as INTEL_BIN_RPMS
144 -# Has to be a bash array
145 -: ${INTEL_X86_RPMS:=()}
146 +# X86 single arch rpms. Same syntax as INTEL_DIST_BIN_RPMS.
147 +# Has to be a bash array.
148 +[[ ${INTEL_DIST_X86_RPMS[@]} ]] || INTEL_DIST_X86_RPMS=()
149
150 -# @ECLASS-VARIABLE: INTEL_DAT_RPMS
151 +# @ECLASS-VARIABLE: INTEL_DIST_DAT_RPMS
152 # @DESCRIPTION:
153 # Functional name of rpm of common data which are arch free
154 -# without any version tag
155 -# Has to be a bash array
156 +# without any version tag. Has to be a bash array.
157 #
158 # e.g. ("openmp-l-all-devel")
159 #
160 # if the rpm is located in a directory different to INTEL_RPMS_DIR you can
161 # specify the full path
162 #
163 -# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common
164 -: ${INTEL_DAT_RPMS:=()}
165 +# e.g. ("CLI_install/rpm/intel-vtune-amplifier-xe-cli-common")
166 +[[ ${INTEL_DIST_DAT_RPMS[@]} ]] || INTEL_DIST_DAT_RPMS=()
167
168 -# @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
169 +# @ECLASS-VARIABLE: INTEL_DIST_SPLIT_ARCH
170 # @DESCRIPTION:
171 -# Unset, if only the multilib package will be provided by intel
172 -: ${INTEL_SINGLE_ARCH:=true}
173 +# Set to "true" if arches are to be fetched separately, instead of using
174 +# the combined tarball.
175 +: ${INTEL_DIST_SPLIT_ARCH:=false}
176
177 -MULTILIB_COMPAT=( abi_x86_{32,64} )
178 +# @FUNCTION: _isdp_get-sdp-full-pv
179 +# @INTERNAL
180 +# @DESCRIPTION:
181 +# Gets the full internal Intel version specifier.
182 +_isdp_get-sdp-full-pv() {
183 + local _intel_pv=($(get_version_components))
184 + local _intel_pv_full="${_intel_pv[3]}-${_intel_pv[0]}.${_intel_pv[1]}.${_intel_pv[2]}-${_intel_pv[3]}"
185 + echo "${_intel_pv_full}"
186 +}
187
188 -inherit check-reqs eutils multilib-build versionator
189 +# @FUNCTION: _isdp_get-sdp-year
190 +# @INTERNAL
191 +# @DESCRIPTION:
192 +# Gets the year component from INTEL_DIST_PV
193 +_isdp_get-sdp-year() {
194 + local _intel_sdp_year
195 + _intel_sdp_year=${INTEL_DIST_PV}
196 + _intel_sdp_year=${_intel_sdp_year%_sp*}
197 + _intel_sdp_year=${_intel_sdp_year%_update*}
198 + echo "${_intel_sdp_year}"
199 +}
200
201 -_INTEL_PV1=$(get_version_component_range 1)
202 -_INTEL_PV2=$(get_version_component_range 2)
203 -_INTEL_PV3=$(get_version_component_range 3)
204 -_INTEL_PV4=$(get_version_component_range 4)
205 -_INTEL_PV=""
206 -[[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="${_INTEL_PV4}-"
207 -[[ -n ${_INTEL_PV1} ]] && _INTEL_PV+="${_INTEL_PV1}"
208 -[[ -n ${_INTEL_PV2} ]] && _INTEL_PV+=".${_INTEL_PV2}"
209 -[[ -n ${_INTEL_PV3} ]] && _INTEL_PV+=".${_INTEL_PV3}"
210 -[[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="-${_INTEL_PV4}"
211 +# @FUNCTION: isdp_get-sdp-dir
212 +# @DESCRIPTION:
213 +# Gets the full rootless path to the installation directory
214 +#
215 +# e.g. opt/intel/compilers_and_libraries_2016.1.150
216 +isdp_get-sdp-dir() {
217 + local _intel_sdp_dir="opt/intel/${INTEL_SUBDIR}_$(_isdp_get-sdp-year).$(get_version_component_range 3-4)"
218 + echo "${_intel_sdp_dir}"
219 +}
220
221 -_INTEL_URI="http://registrationcenter-download.intel.com/akdlm/irc_nas/${INTEL_DID}/${INTEL_DPN}"
222 +# @FUNCTION: isdp_get-sdp-edir
223 +# @DESCRIPTION:
224 +# Gets the full rooted/prefixed path to the installation directory
225 +#
226 +# e.g. /opt/intel/compilers_and_libraries_2016.1.150
227 +isdp_get-sdp-edir() {
228 + local _intel_sdp_edir="${EPREFIX%/}/$(isdp_get-sdp-dir)"
229 + echo "${_intel_sdp_edir}"
230 +}
231
232 -if [ ${INTEL_SINGLE_ARCH} == true ]; then
233 - SRC_URI="
234 - abi_x86_32? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.${INTEL_TARX} )
235 - abi_x86_64? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.${INTEL_TARX} )"
236 +_INTEL_URI="http://registrationcenter-download.intel.com/akdlm/irc_nas/${INTEL_DIST_SKU}/${INTEL_DIST_NAME}"
237 +if [[ "${INTEL_DIST_SPLIT_ARCH}" != true ]]; then
238 + SRC_URI="${_INTEL_URI}_${INTEL_DIST_PV}.${INTEL_DIST_TARX}"
239 else
240 - SRC_URI="${_INTEL_URI}_${INTEL_DPV}.${INTEL_TARX}"
241 + SRC_URI="
242 + abi_x86_32? ( ${_INTEL_URI}_${INTEL_DIST_PV}_ia32.${INTEL_DIST_TARX} )
243 + abi_x86_64? ( ${_INTEL_URI}_${INTEL_DIST_PV}_intel64.${INTEL_DIST_TARX} )"
244 fi
245 +unset _INTEL_URI
246
247 LICENSE="Intel-SDP"
248 +# TODO: Proper slotting
249 # Future work, #394411
250 -#SLOT="${_INTEL_PV1}.${_INTEL_PV2}"
251 SLOT="0"
252
253 RESTRICT="mirror"
254 @@ -163,32 +199,128 @@ RESTRICT="mirror"
255 RDEPEND=""
256 DEPEND="app-arch/rpm2targz"
257
258 -_INTEL_SDP_YEAR=${INTEL_DPV}
259 -_INTEL_SDP_YEAR=${_INTEL_SDP_YEAR%_sp*}
260 -_INTEL_SDP_YEAR=${_INTEL_SDP_YEAR%_update*}
261 +S="${WORKDIR}"
262
263 -# @ECLASS-VARIABLE: INTEL_SDP_DIR
264 +QA_PREBUILT="$(isdp_get-sdp-dir)/*"
265 +
266 +# @FUNCTION: isdp_convert2intel-arch
267 +# @USAGE: <arch>
268 # @DESCRIPTION:
269 -# Full rootless path to installation dir
270 -INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}_${_INTEL_SDP_YEAR:-${_INTEL_PV1}}"
271 -[[ -n ${_INTEL_PV3} ]] && INTEL_SDP_DIR+=".${_INTEL_PV3}"
272 -[[ -n ${_INTEL_PV4} ]] && INTEL_SDP_DIR+=".${_INTEL_PV4}"
273 +# Convert between portage arch (e.g. amd64, x86) and intel installed arch
274 +# nomenclature (e.g. intel64, ia32)
275 +isdp_convert2intel-arch() {
276 + debug-print-function ${FUNCNAME} "${@}"
277
278 -# @ECLASS-VARIABLE: INTEL_SDP_EDIR
279 + case $1 in
280 + *amd64*|abi_x86_64)
281 + echo "intel64"
282 + ;;
283 + *x86*)
284 + echo "ia32"
285 + ;;
286 + *)
287 + die "Abi \'$1\' is unsupported"
288 + ;;
289 + esac
290 +}
291 +
292 +# @FUNCTION: isdp_get-native-abi-arch
293 # @DESCRIPTION:
294 -# Full rooted path to installation dir
295 -INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}"
296 +# Determine the the intel arch string of the native ABI
297 +isdp_get-native-abi-arch() {
298 + debug-print-function ${FUNCNAME} "${@}"
299
300 -S="${WORKDIR}"
301 + use amd64 && echo "$(isdp_convert2intel-arch abi_x86_64)"
302 + use x86 && echo "$(isdp_convert2intel-arch abi_x86_32)"
303 +}
304
305 -QA_PREBUILT="${INTEL_SDP_DIR}/*"
306 +# @FUNCTION: isdp_get-sdp-installed-arches
307 +# @DESCRIPTION:
308 +# Returns a space separated list of the arch suffixes used in directory
309 +# names for enabled ABIs. Intel uses "ia32" for x86 and "intel64" for
310 +# amd64. The result would be "ia32 intel64" if both ABIs were enabled.
311 +isdp_get-sdp-installed-arches() {
312 + local arch=()
313 + use abi_x86_64 && arch+=($(isdp_convert2intel-arch abi_x86_64))
314 + use abi_x86_32 && arch+=($(isdp_convert2intel-arch abi_x86_32))
315 + echo "${arch[*]}"
316 +}
317
318 -# @ECLASS-VARIABLE: INTEL_ARCH
319 -# @DEFAULT_UNSET
320 +# @FUNCTION: _isdp_get-sdp-source-rpm-arches
321 +# @INTERNAL
322 # @DESCRIPTION:
323 -# Intels internal names of the arches; will be set at runtime accordingly
324 +# Returns a space separated list of the arch suffixes used in the RPM filenames, e.g.
325 #
326 -# e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
327 +# intel-openmp-l-all-150-16.0.1-150.i486.rpm
328 +# intel-openmp-l-all-150-16.0.1-150.x86_64.rpm
329 +#
330 +# the result would consist of "i486 x86_64".
331 +_isdp_get-sdp-source-rpm-arches() {
332 + local arch=()
333 + use abi_x86_64 && arch+=("x86_64")
334 + use abi_x86_32 && arch+=("${INTEL_X86}")
335 + echo "${arch[*]}"
336 +}
337 +
338 +# @FUNCTION: _isdp_generate-list-install-rpms
339 +# @INTERNAL
340 +# @DESCRIPTION:
341 +# Generates the list of fully expanded RPMs to be extracted.
342 +_isdp_generate-list-install-rpms() {
343 + debug-print-function ${FUNCNAME} "${@}"
344 +
345 + # Expand components into full RPM filenames
346 + expand_component_into_full_rpm() {
347 + local deref_var="${1}[@]"
348 + local arch="${2}"
349 + local p a rpm_prefix rpm_suffix expanded_full_rpms=()
350 +
351 + for p in "${!deref_var}"; do
352 + for a in ${arch}; do
353 + # check if a directory is prefixed
354 + if [[ "${p}" == "${p##*/}" ]]; then
355 + rpm_prefix="${INTEL_RPMS_DIR}/intel-"
356 + else
357 + rpm_prefix=""
358 + fi
359 +
360 + # check for variables ending in ".rpm"
361 + # these are excluded from version expansion, due to Intel's
362 + # idiosyncratic versioning scheme beginning with their 2016
363 + # suite of tools. For instance
364 + #
365 + # intel-ccompxe-2016.1-056.noarch.rpm
366 + #
367 + # which is completely unpredictable using versions
368 + if [[ "${p}" == *.rpm ]]; then
369 + rpm_suffix=""
370 + else
371 + rpm_suffix="-$(_isdp_get-sdp-full-pv).${a}.rpm"
372 + fi
373 +
374 + expanded_full_rpms+=( "${rpm_prefix}${p}${rpm_suffix}" )
375 + done
376 + done
377 + echo ${expanded_full_rpms[*]}
378 + }
379 +
380 + local vars_to_expand=("INTEL_DIST_BIN_RPMS" "INTEL_DIST_DAT_RPMS")
381 + local vars_to_expand_suffixes=("$(_isdp_get-sdp-source-rpm-arches)" "noarch")
382 + if use abi_x86_32; then
383 + vars_to_expand+=("INTEL_DIST_X86_RPMS")
384 + vars_to_expand_suffixes+=("${INTEL_X86}")
385 + fi
386 + if use abi_x86_64; then
387 + vars_to_expand+=("INTEL_DIST_AMD64_RPMS")
388 + vars_to_expand_suffixes+=("x86_64")
389 + fi
390 +
391 + local i fully_expanded_intel_rpms=()
392 + for ((i=0; i<${#vars_to_expand[@]}; i++)); do
393 + fully_expanded_intel_rpms+=($(expand_component_into_full_rpm "${vars_to_expand[i]}" "${vars_to_expand_suffixes[i]}"))
394 + done
395 + echo ${fully_expanded_intel_rpms[*]}
396 +}
397
398 # @FUNCTION: _isdp_big-warning
399 # @USAGE: [pre-check | test-failed]
400 @@ -200,23 +332,21 @@ _isdp_big-warning() {
401
402 case ${1} in
403 pre-check )
404 - echo ""
405 ewarn "License file not found!"
406 ;;
407
408 test-failed )
409 - echo ""
410 ewarn "Function test failed. Most probably due to an invalid license."
411 ewarn "This means you already tried to bypass the license check once."
412 ;;
413 esac
414
415 - echo ""
416 + ewarn
417 ewarn "Make sure you have received an Intel license."
418 ewarn "To receive a non-commercial license, you need to register at:"
419 ewarn "https://software.intel.com/en-us/qualify-for-free-software"
420 ewarn "Install the license file into ${EPREFIX}/opt/intel/licenses"
421 - ewarn ""
422 + ewarn
423 ewarn "Beginning with the 2016 suite of tools, license files are keyed"
424 ewarn "to the MAC address of the eth0 interface. In order to retrieve"
425 ewarn "a personalized license file, follow the instructions at"
426 @@ -225,22 +355,20 @@ _isdp_big-warning() {
427 case ${1} in
428 pre-check )
429 ewarn "before proceeding with installation of ${P}"
430 - echo ""
431 ;;
432 * )
433 - echo ""
434 ;;
435 - esac
436 + esac
437 }
438
439 # @FUNCTION: _isdp_version_test
440 # @INTERNAL
441 # @DESCRIPTION:
442 -# Testing for valid license by asking for version information of the compiler
443 +# Testing for valid license by asking for version information of the compiler.
444 _isdp_version_test() {
445 debug-print-function ${FUNCNAME} "${@}"
446
447 - local comp comp_full arch warn
448 + local comp
449 case ${PN} in
450 ifc )
451 debug-print "Testing ifort"
452 @@ -255,39 +383,39 @@ _isdp_version_test() {
453 ;;
454 esac
455
456 - for arch in ${INTEL_ARCH}; do
457 + local comp_full arch warn
458 + for arch in $(isdp_get-sdp-installed-arches); do
459 case ${EBUILD_PHASE} in
460 install )
461 - comp_full="${ED}/${INTEL_SDP_DIR}/linux/bin/${arch}/${comp}"
462 + comp_full="${ED%/}/$(isdp_get-sdp-dir)/linux/bin/${arch}/${comp}"
463 ;;
464 postinst )
465 - comp_full="${INTEL_SDP_EDIR}/linux/bin/${arch}/${comp}"
466 + comp_full="$(isdp_get-sdp-edir)/linux/bin/${arch}/${comp}"
467 ;;
468 * )
469 - ewarn "Compile test not supported in ${EBUILD_PHASE}"
470 - continue
471 + die "Compile test not supported in ${EBUILD_PHASE}"
472 ;;
473 esac
474
475 - debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/linux/bin/${arch}/\" \"${comp_full}\" -V"
476 + debug-print "LD_LIBRARY_PATH=\"$(isdp_get-sdp-edir)/linux/bin/${arch}/\" \"${comp_full}\" -V"
477
478 - LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/linux/bin/${arch}/" "${comp_full}" -V &>/dev/null
479 - [[ $? -ne 0 ]] && warn=yes
480 + LD_LIBRARY_PATH="$(isdp_get-sdp-edir)/linux/bin/${arch}/" "${comp_full}" -V &>/dev/null || warn=yes
481 done
482 - [[ "${warn}" == "yes" ]] && _isdp_big-warning test-failed
483 + [[ ${warn} == yes ]] && _isdp_big-warning test-failed
484 }
485
486 # @FUNCTION: _isdp_run-test
487 # @INTERNAL
488 # @DESCRIPTION:
489 -# Test if installed compiler is working
490 +# Test if installed compiler is working.
491 _isdp_run-test() {
492 debug-print-function ${FUNCNAME} "${@}"
493
494 if [[ -z ${INTEL_SKIP_LICENSE} ]]; then
495 case ${PN} in
496 ifc | icc )
497 - _isdp_version_test ;;
498 + _isdp_version_test
499 + ;;
500 * )
501 debug-print "No test available for ${PN}"
502 ;;
503 @@ -295,33 +423,13 @@ _isdp_run-test() {
504 fi
505 }
506
507 -# @FUNCTION: convert2intel_arch
508 -# @USAGE: <arch>
509 -# @DESCRIPTION:
510 -# Convert between portage arch (e.g. amd64, x86) and intel arch
511 -# nomenclature (e.g. intel64, ia32)
512 -convert2intel_arch() {
513 - debug-print-function ${FUNCNAME} "${@}"
514 -
515 - case $1 in
516 - amd64|abi_x86_64|*amd64*)
517 - echo "intel64"
518 - ;;
519 - x86|abi_x86_32|*x86*)
520 - echo "ia32"
521 - ;;
522 - *)
523 - die "Abi \'$1\' is unsupported"
524 - ;;
525 - esac
526 -}
527 -
528 # @FUNCTION: intel-sdp-r1_pkg_pretend
529 # @DESCRIPTION:
530 -# @CODE
531 -# * Check that the user has a (valid) license file before going on.
532 -# * Check for space requirements being fullfilled
533 -# @CODE
534 +#
535 +# * Check for a (valid) license before proceeding.
536 +#
537 +# * Check for space requirements being fulfilled.
538 +#
539 intel-sdp-r1_pkg_pretend() {
540 debug-print-function ${FUNCNAME} "${@}"
541
542 @@ -331,7 +439,7 @@ intel-sdp-r1_pkg_pretend() {
543 check-reqs_pkg_pretend
544
545 if [[ -z ${INTEL_SKIP_LICENSE} ]]; then
546 - if echo ${INTEL_LICENSE_FILE} | grep -q @; then
547 + if [[ ${INTEL_LICENSE_FILE} == *@* ]]; then
548 einfo "Looks like you are using following license server:"
549 einfo " ${INTEL_LICENSE_FILE}"
550 return 0
551 @@ -339,20 +447,15 @@ intel-sdp-r1_pkg_pretend() {
552
553 dirs=(
554 "${EPREFIX}/opt/intel/licenses"
555 - "${INTEL_SDP_EDIR}/licenses"
556 - "${INTEL_SDP_EDIR}/Licenses"
557 + "$(isdp_get-sdp-edir)/licenses"
558 + "$(isdp_get-sdp-edir)/Licenses"
559 )
560 for dir in "${dirs[@]}" ; do
561 ebegin "Checking for a license in: ${dir}"
562 - #maybe use nullglob or [[ $(echo ${dir/*lic) != "${dir}/*lic" ]]
563 - [[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?
564 - eend ${ret}
565 - if [[ ${ret} == "0" ]]; then
566 - warn=${ret}
567 - break
568 - fi
569 + path_exists "${dir}"/*lic && warn=0
570 + eend ${warn} && break
571 done
572 - if [[ ${warn} == "1" ]]; then
573 + if [[ ${warn} == 1 ]]; then
574 _isdp_big-warning pre-check
575 die "Could not find license file"
576 fi
577 @@ -362,127 +465,29 @@ intel-sdp-r1_pkg_pretend() {
578 fi
579 }
580
581 -# @FUNCTION: intel-sdp-r1_pkg_setup
582 -# @DESCRIPTION:
583 -# Setting up and sorting some internal variables
584 -intel-sdp-r1_pkg_setup() {
585 - debug-print-function ${FUNCNAME} "${@}"
586 - local arch a p
587 -
588 - INTEL_ARCH=""
589 -
590 - if use abi_x86_64; then
591 - arch+=" x86_64"
592 - INTEL_ARCH+=" intel64"
593 - fi
594 - if use abi_x86_32; then
595 - arch+=" ${INTEL_X86}"
596 - INTEL_ARCH+=" ia32"
597 - fi
598 - INTEL_RPMS=()
599 - INTEL_RPMS_FULL=()
600 -
601 - for p in "${INTEL_BIN_RPMS[@]}"; do
602 - for a in ${arch}; do
603 - if [ ${p} == $(basename ${p}) ]; then
604 - # check for variables ending in ".rpm"
605 - # these are excluded from version expansion, due to Intel's
606 - # idiosyncratic versioning scheme beginning with their 2016
607 - # suite of tools.
608 - if [[ "${p}" == *.rpm ]]; then
609 - INTEL_RPMS+=( intel-${p} )
610 - else
611 - INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.${a}.rpm )
612 - fi
613 - else
614 - if [[ "${p}" == *.rpm ]]; then
615 - INTEL_RPMS_FULL+=( ${p} )
616 - else
617 - INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.${a}.rpm )
618 - fi
619 - fi
620 - done
621 - done
622 -
623 - if use amd64; then
624 - for p in "${INTEL_AMD64_RPMS[@]}"; do
625 - if [ ${p} == $(basename ${p}) ]; then
626 - if [[ "${p}" == *.rpm ]]; then
627 - INTEL_RPMS+=( intel-${p} )
628 - else
629 - INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.x86_64.rpm )
630 - fi
631 - else
632 - if [[ "${p}" == *.rpm ]]; then
633 - INTEL_RPMS_FULL+=( ${p} )
634 - else
635 - INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.x86_64.rpm )
636 - fi
637 - fi
638 - done
639 - fi
640 -
641 - for p in "${INTEL_X86_RPMS[@]}"; do
642 - if [ ${p} == $(basename ${p}) ]; then
643 - if [[ "${p}" == *.rpm ]]; then
644 - INTEL_RPMS+=( intel-${p} )
645 - else
646 - INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.${INTEL_X86}.rpm )
647 - fi
648 - else
649 - if [[ "${p}" == *.rpm ]]; then
650 - INTEL_RPMS_FULL+=( ${p} )
651 - else
652 - INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.${INTEL_X86}.rpm )
653 - fi
654 - fi
655 - done
656 -
657 - for p in "${INTEL_DAT_RPMS[@]}"; do
658 - if [ ${p} == $(basename ${p}) ]; then
659 - if [[ "${p}" == *.rpm ]]; then
660 - INTEL_RPMS+=( intel-${p} )
661 - else
662 - INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.noarch.rpm )
663 - fi
664 - else
665 - if [[ "${p}" == *.rpm ]]; then
666 - INTEL_RPMS_FULL+=( ${p} )
667 - else
668 - INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.noarch.rpm )
669 - fi
670 - fi
671 - done
672 -}
673 -
674 # @FUNCTION: intel-sdp-r1_src_unpack
675 # @DESCRIPTION:
676 # Unpacking necessary rpms from tarball, extract them and rearrange the output.
677 intel-sdp-r1_src_unpack() {
678 - local l r subdir rb t list=() debug_list
679 -
680 + local t
681 for t in ${A}; do
682 - for r in "${INTEL_RPMS[@]}"; do
683 - rpmdir=${t%%.*}/${INTEL_RPMS_DIR}
684 - list+=( ${rpmdir}/${r} )
685 - done
686 -
687 - for r in "${INTEL_RPMS_FULL[@]}"; do
688 + local r list=() source_rpms=($(_isdp_generate-list-install-rpms))
689 + for r in "${source_rpms[@]}"; do
690 list+=( ${t%%.*}/${r} )
691 done
692
693 + local debug_list
694 debug_list="$(IFS=$'\n'; echo ${list[@]} )"
695
696 debug-print "Adding to decompression list:"
697 debug-print ${debug_list}
698
699 - tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log
700 + tar -xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log
701
702 for r in ${list[@]}; do
703 - rb=$(basename ${r})
704 - einfo "Unpacking ${rb}"
705 - rpm2tar -O ${r} | tar xvf - | sed -e \
706 - "s:^\.:${EROOT#/}:g" > /dev/null; assert "unpacking ${r} failed"
707 + einfo "Unpacking ${r}"
708 + printf "\nUnpacking %s\n" "${r}" >> "${T}"/rpm-extraction.log
709 + rpm2tar -O ${r} | tar -xvf - &>> "${T}"/rpm-extraction.log; assert "Unpacking ${r} failed"
710 done
711 done
712 }
713 @@ -493,61 +498,86 @@ intel-sdp-r1_src_unpack() {
714 intel-sdp-r1_src_install() {
715 debug-print-function ${FUNCNAME} "${@}"
716
717 + local i
718 # remove uninstall information
719 - if path_exists opt/intel/"${INTEL_DPN}"*/uninstall; then
720 - ebegin "Cleaning out uninstall"
721 - rm -r opt/intel/"${INTEL_DPN}"*/uninstall || die
722 + ebegin "Cleaning out uninstall"
723 + while IFS='\n' read -r -d '' i; do
724 + rm -r "${i}" || die
725 + done < <(find opt -regextype posix-extended -regex '.*(uninstall|uninstall.sh)$' -print0)
726 + eend
727 +
728 + # remove remaining japanese stuff
729 + if ! use linguas_ja; then
730 + ebegin "Cleaning out japanese language directories"
731 + while IFS='\n' read -r -d '' i; do
732 + rm -r "${i}" || die
733 + done < <(find opt -type d -regextype posix-extended -regex '.*(ja|ja_JP)$' -print0)
734 eend
735 fi
736
737 # handle documentation
738 - if path_exists "opt/intel/documentation_${_INTEL_SDP_YEAR}"; then
739 - if path_exists "opt/intel/documentation_${_INTEL_SDP_YEAR}/en/man/common/man1"; then
740 - doman opt/intel/documentation_"${_INTEL_SDP_YEAR}"/en/man/common/man1/*
741 - rm -r opt/intel/documentation_"${_INTEL_SDP_YEAR}"/en/man || die
742 + if path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)"; then
743 + # normal man pages
744 + if path_exists "opt/intel/documentation_$(_isdp_get-sdp-year)/en/man/common/man1"; then
745 + doman opt/intel/documentation_"$(_isdp_get-sdp-year)"/en/man/common/man1/*
746 + rm -r opt/intel/documentation_"$(_isdp_get-sdp-year)"/en/man || die
747 fi
748
749 - if use doc; then
750 - if ! use linguas_ja; then
751 - rm -r opt/intel/documentation_"${_INTEL_SDP_YEAR}"/ja || die
752 - fi
753 - dodoc -r opt/intel/documentation_"${_INTEL_SDP_YEAR}"/*
754 - fi
755 + use doc && dodoc -r opt/intel/documentation_"$(_isdp_get-sdp-year)"/*
756
757 ebegin "Cleaning out documentation"
758 - rm -r "opt/intel/documentation_${_INTEL_SDP_YEAR}" || die
759 - rm "${INTEL_SDP_DIR}"/linux/{documentation,man} || die
760 + rm -r "opt/intel/documentation_$(_isdp_get-sdp-year)" || die
761 + rm -rf "$(isdp_get-sdp-dir)"/linux/{documentation,man} || die
762 eend
763 fi
764
765 + # MPI man pages
766 + if path_exists "$(isdp_get-sdp-dir)/linux/mpi/man/man3"; then
767 + doman "$(isdp_get-sdp-dir)"/linux/mpi/man/man3/*
768 + rm -r "$(isdp_get-sdp-dir)"/linux/mpi/man || die
769 + fi
770 +
771 + # licensing docs
772 + if path_exists "$(isdp_get-sdp-dir)/licensing/documentation"; then
773 + dodoc -r "$(isdp_get-sdp-dir)/licensing/documentation"/*
774 + rm -rf "$(isdp_get-sdp-dir)/licensing/documentation" || die
775 + fi
776 +
777 + if path_exists opt/intel/"${INTEL_DIST_NAME}"*/licensing; then
778 + dodoc -r opt/intel/"${INTEL_DIST_NAME}"*/licensing
779 + rm -rf opt/intel/"${INTEL_DIST_NAME}"* || die
780 + fi
781 +
782 # handle examples
783 - if path_exists "opt/intel/samples_${_INTEL_SDP_YEAR}"; then
784 - if use examples; then
785 - if ! use linguas_ja; then
786 - rm -r opt/intel/samples_"${_INTEL_SDP_YEAR}"/ja || die
787 - fi
788 - dodoc -r opt/intel/samples_"${_INTEL_SDP_YEAR}"/*
789 - fi
790 + if path_exists "opt/intel/samples_$(_isdp_get-sdp-year)"; then
791 + use examples && dodoc -r opt/intel/samples_"$(_isdp_get-sdp-year)"/*
792
793 ebegin "Cleaning out examples"
794 - rm -r "opt/intel/samples_${_INTEL_SDP_YEAR}" || die
795 + rm -r "opt/intel/samples_$(_isdp_get-sdp-year)" || die
796 eend
797 fi
798
799 - # remove eclipse
800 + # remove eclipse unconditionally
801 + ebegin "Cleaning out eclipse files"
802 rm -rf opt/intel/ide_support_* || die
803 + eend
804
805 + # repair shell scripts used for sourcing PATH (iccvars.sh and such)
806 ebegin "Tagging ${PN}"
807 find opt -name \*sh -type f -exec sed -i \
808 - -e "s:<.*DIR>:${INTEL_SDP_EDIR}/linux:g" \
809 + -e "s:<.*DIR>:$(isdp_get-sdp-edir)/linux:g" \
810 '{}' + || die
811 eend
812
813 - [[ -d "${ED}" ]] || dodir /
814 - mv opt "${ED}"/ || die "moving files failed"
815 + ebegin "Removing broken symlinks"
816 + while IFS='\n' read -r -d '' i; do
817 + rm "${i}" || die
818 + done < <(find opt -xtype l -print0)
819 + eend
820 +
821 + mv opt "${ED%/}"/ || die "moving files failed"
822
823 - dodir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm
824 - keepdir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm
825 + keepdir "$(isdp_get-sdp-dir)"/licenses /opt/intel/ism/rm
826 }
827
828 # @FUNCTION: intel-sdp-r1_pkg_postinst
829 @@ -580,7 +610,5 @@ intel-sdp-r1_pkg_postrm() {
830 fi
831 }
832
833 -EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm pkg_pretend
834 -
835 _INTEL_SDP_R1_ECLASS_=1
836 fi