1 |
On Mon, 15 Feb 2016 09:16:53 +0100 |
2 |
"Justin Lecher (jlec)" <jlec@g.o> wrote: |
3 |
|
4 |
> # Copyright 1999-2016 Gentoo Foundation |
5 |
> # Distributed under the terms of the GNU General Public License v2 |
6 |
> # $Id$ |
7 |
> |
8 |
> # @ECLASS: intel-sdp-r1.eclass |
9 |
> # @MAINTAINER: |
10 |
> # Justin Lecher <jlec@g.o> |
11 |
> # David Seifert <soap@g.o> |
12 |
> # Sci Team <sci@g.o> |
13 |
> # @BLURB: Handling of Intel's Software Development Products package management |
14 |
> |
15 |
> if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then |
16 |
> |
17 |
> case "${EAPI:-0}" in |
18 |
|
19 |
:-0 is meaningless here. |
20 |
|
21 |
> 6) ;; |
22 |
> *) die "EAPI=${EAPI} is not supported" ;; |
23 |
|
24 |
If at all, it could be helpful here. |
25 |
|
26 |
> esac |
27 |
> |
28 |
> # @ECLASS-VARIABLE: INTEL_DID |
29 |
> # @DEFAULT_UNSET |
30 |
> # @DESCRIPTION: |
31 |
> # The package download ID from Intel. |
32 |
> # To find out its value, see the links to download in |
33 |
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx |
34 |
> # |
35 |
> # e.g. 8365 |
36 |
> # |
37 |
> # Must be defined before inheriting the eclass |
38 |
> |
39 |
> # @ECLASS-VARIABLE: INTEL_DPN |
40 |
> # @DEFAULT_UNSET |
41 |
> # @DESCRIPTION: |
42 |
> # The package name to download from Intel. |
43 |
> # To find out its value, see the links to download in |
44 |
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx |
45 |
> # |
46 |
> # e.g. parallel_studio_xe |
47 |
> # |
48 |
> # Must be defined before inheriting the eclass |
49 |
> |
50 |
> # @ECLASS-VARIABLE: INTEL_DPV |
51 |
> # @DEFAULT_UNSET |
52 |
> # @DESCRIPTION: |
53 |
> # The package download version from Intel. |
54 |
> # To find out its value, see the links to download in |
55 |
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx |
56 |
> # |
57 |
> # e.g. 2016_update1 |
58 |
> # |
59 |
> # Must be defined before inheriting the eclass |
60 |
> |
61 |
> # @ECLASS-VARIABLE: INTEL_TARX |
62 |
> # @DESCRIPTION: |
63 |
> # The package extention. |
64 |
|
65 |
Extension. Or if you're not on Windows, then 'suffix'. |
66 |
|
67 |
> # To find out its value, see the links to download in |
68 |
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx |
69 |
> # |
70 |
> # e.g. tar.gz |
71 |
> # |
72 |
> # Must be defined before inheriting the eclass |
73 |
> : ${INTEL_TARX:=tgz} |
74 |
> |
75 |
> # @ECLASS-VARIABLE: INTEL_SUBDIR |
76 |
> # @DEFAULT_UNSET |
77 |
> # @DESCRIPTION: |
78 |
> # The package sub-directory where it will end-up in /opt/intel |
79 |
> # To find out its value, you have to do a raw install from the Intel tar ball |
80 |
|
81 |
To be honest, I find this kinda terrible. There's a huge block of docs |
82 |
which makes me feel small and confused. Maybe it'd useful to give some |
83 |
semi-complete example on top (in global doc)? |
84 |
|
85 |
> # @ECLASS-VARIABLE: INTEL_SKIP_LICENSE |
86 |
> # @DEFAULT_UNSET |
87 |
> # @DESCRIPTION: |
88 |
> # Possibility to skip the mandatory check for licenses. Only set this if there |
89 |
> # is really no fix. |
90 |
> |
91 |
> # @ECLASS-VARIABLE: INTEL_RPMS_DIR |
92 |
> # @DESCRIPTION: |
93 |
> # Main subdirectory which contains the rpms to extract. |
94 |
> : ${INTEL_RPMS_DIR:=rpm} |
95 |
> |
96 |
> # @ECLASS-VARIABLE: INTEL_X86 |
97 |
> # @DESCRIPTION: |
98 |
> # 32bit arch in rpm names |
99 |
> # |
100 |
> # e.g. i486 |
101 |
> : ${INTEL_X86:=i486} |
102 |
> |
103 |
> # @ECLASS-VARIABLE: INTEL_BIN_RPMS |
104 |
> # @DESCRIPTION: |
105 |
> # Functional name of rpm without any version/arch tag |
106 |
> # Has to be a bash array |
107 |
> # |
108 |
> # e.g. ("icc-l-all-devel") |
109 |
> # |
110 |
> # if the rpm is located in a directory other than INTEL_RPMS_DIR you can |
111 |
> # specify the full path |
112 |
> # |
113 |
> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli |
114 |
> : ${INTEL_BIN_RPMS:=()} |
115 |
|
116 |
$ : ${foo:=()} |
117 |
$ declare -p foo |
118 |
declare -- foo="()" |
119 |
|
120 |
In other words, it doesn't work the way you expect it to. |
121 |
|
122 |
> # @ECLASS-VARIABLE: INTEL_AMD64_RPMS |
123 |
> # @DESCRIPTION: |
124 |
> # AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS |
125 |
> # Has to be a bash array |
126 |
> : ${INTEL_AMD64_RPMS:=()} |
127 |
> |
128 |
> # @ECLASS-VARIABLE: INTEL_X86_RPMS |
129 |
> # @DESCRIPTION: |
130 |
> # X86 single arch rpms. Same syntax as INTEL_BIN_RPMS |
131 |
> # Has to be a bash array |
132 |
> : ${INTEL_X86_RPMS:=()} |
133 |
> |
134 |
> # @ECLASS-VARIABLE: INTEL_DAT_RPMS |
135 |
> # @DESCRIPTION: |
136 |
> # Functional name of rpm of common data which are arch free |
137 |
> # without any version tag |
138 |
> # Has to be a bash array |
139 |
> # |
140 |
> # e.g. ("openmp-l-all-devel") |
141 |
> # |
142 |
> # if the rpm is located in a directory different to INTEL_RPMS_DIR you can |
143 |
> # specify the full path |
144 |
> # |
145 |
> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common |
146 |
> : ${INTEL_DAT_RPMS:=()} |
147 |
> |
148 |
> # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH |
149 |
> # @DESCRIPTION: |
150 |
> # Unset, if only the multilib package will be provided by intel |
151 |
> : ${INTEL_SINGLE_ARCH:=true} |
152 |
|
153 |
This is really weird. It sounds like I'm supposed to do: |
154 |
|
155 |
inherit intel-sdp-r1 |
156 |
unset INTEL_SINGLE_ARCH |
157 |
|
158 |
I suggest you used positive logic instead. |
159 |
|
160 |
> MULTILIB_COMPAT=( abi_x86_{32,64} ) |
161 |
> |
162 |
> inherit check-reqs eutils multilib-build versionator |
163 |
> |
164 |
> _INTEL_PV1=$(get_version_component_range 1) |
165 |
> _INTEL_PV2=$(get_version_component_range 2) |
166 |
> _INTEL_PV3=$(get_version_component_range 3) |
167 |
> _INTEL_PV4=$(get_version_component_range 4) |
168 |
|
169 |
I'm pretty sure there's a better way than calling the same function |
170 |
four times. For example: |
171 |
|
172 |
_INTEL_PV=( $(get_version_components) ) |
173 |
|
174 |
Plus, please reduce the environment pollution. Either unset all those |
175 |
variables when no longer needed, or preferably create a function for |
176 |
setting globals and make them local. |
177 |
|
178 |
> _INTEL_PV="" |
179 |
> [[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="${_INTEL_PV4}-" |
180 |
> [[ -n ${_INTEL_PV1} ]] && _INTEL_PV+="${_INTEL_PV1}" |
181 |
> [[ -n ${_INTEL_PV2} ]] && _INTEL_PV+=".${_INTEL_PV2}" |
182 |
> [[ -n ${_INTEL_PV3} ]] && _INTEL_PV+=".${_INTEL_PV3}" |
183 |
> [[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="-${_INTEL_PV4}" |
184 |
|
185 |
Now, this is crazy ;-). I don't see immediately how to improve that, |
186 |
but I suggest you thought about that. |
187 |
|
188 |
Plus, it's kinda confusing having _INTEL_PV and INTEL_DPV used in all |
189 |
different places. Could you try to use more explanatory names? |
190 |
|
191 |
> _INTEL_URI="http://registrationcenter-download.intel.com/akdlm/irc_nas/${INTEL_DID}/${INTEL_DPN}" |
192 |
> |
193 |
> if [ ${INTEL_SINGLE_ARCH} == true ]; then |
194 |
|
195 |
Please use [[ ]] for consistency, and quoting safety. |
196 |
|
197 |
> SRC_URI=" |
198 |
> abi_x86_32? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.${INTEL_TARX} ) |
199 |
> abi_x86_64? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.${INTEL_TARX} )" |
200 |
> else |
201 |
> SRC_URI="${_INTEL_URI}_${INTEL_DPV}.${INTEL_TARX}" |
202 |
> fi |
203 |
> |
204 |
> LICENSE="Intel-SDP" |
205 |
> # Future work, #394411 |
206 |
> #SLOT="${_INTEL_PV1}.${_INTEL_PV2}" |
207 |
> SLOT="0" |
208 |
> |
209 |
> RESTRICT="mirror" |
210 |
> |
211 |
> RDEPEND="" |
212 |
> DEPEND="app-arch/rpm2targz" |
213 |
> |
214 |
> _INTEL_SDP_YEAR=${INTEL_DPV} |
215 |
> _INTEL_SDP_YEAR=${_INTEL_SDP_YEAR%_sp*} |
216 |
> _INTEL_SDP_YEAR=${_INTEL_SDP_YEAR%_update*} |
217 |
> |
218 |
> # @ECLASS-VARIABLE: INTEL_SDP_DIR |
219 |
> # @DESCRIPTION: |
220 |
> # Full rootless path to installation dir |
221 |
> INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}_${_INTEL_SDP_YEAR:-${_INTEL_PV1}}" |
222 |
> [[ -n ${_INTEL_PV3} ]] && INTEL_SDP_DIR+=".${_INTEL_PV3}" |
223 |
> [[ -n ${_INTEL_PV4} ]] && INTEL_SDP_DIR+=".${_INTEL_PV4}" |
224 |
> |
225 |
> # @ECLASS-VARIABLE: INTEL_SDP_EDIR |
226 |
> # @DESCRIPTION: |
227 |
> # Full rooted path to installation dir |
228 |
> INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}" |
229 |
|
230 |
EROOT can't be used in global scope. Doing things like this, you could |
231 |
end up with wrong value being carried on to phases. |
232 |
|
233 |
> S="${WORKDIR}" |
234 |
> |
235 |
> QA_PREBUILT="${INTEL_SDP_DIR}/*" |
236 |
> |
237 |
> # @ECLASS-VARIABLE: INTEL_ARCH |
238 |
> # @DEFAULT_UNSET |
239 |
> # @DESCRIPTION: |
240 |
> # Intels internal names of the arches; will be set at runtime accordingly |
241 |
> # |
242 |
> # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32" |
243 |
|
244 |
So we're not supposed to set this? |
245 |
|
246 |
> # @FUNCTION: _isdp_big-warning |
247 |
> # @USAGE: [pre-check | test-failed] |
248 |
> # @INTERNAL |
249 |
> # @DESCRIPTION: |
250 |
> # warn user that we really require a license |
251 |
|
252 |
Description really need to be improved. They should tell how to call |
253 |
the function and what it does accordingly. This applies to all |
254 |
functions. |
255 |
|
256 |
> _isdp_big-warning() { |
257 |
> debug-print-function ${FUNCNAME} "${@}" |
258 |
> |
259 |
> case ${1} in |
260 |
> pre-check ) |
261 |
> echo "" |
262 |
|
263 |
Don't mix echo with ewarn. |
264 |
|
265 |
> ewarn "License file not found!" |
266 |
> ;; |
267 |
> |
268 |
> test-failed ) |
269 |
> echo "" |
270 |
> ewarn "Function test failed. Most probably due to an invalid license." |
271 |
> ewarn "This means you already tried to bypass the license check once." |
272 |
> ;; |
273 |
> esac |
274 |
> |
275 |
> echo "" |
276 |
> ewarn "Make sure you have received an Intel license." |
277 |
> ewarn "To receive a non-commercial license, you need to register at:" |
278 |
> ewarn "https://software.intel.com/en-us/qualify-for-free-software" |
279 |
> ewarn "Install the license file into ${EPREFIX}/opt/intel/licenses" |
280 |
> ewarn "" |
281 |
> ewarn "Beginning with the 2016 suite of tools, license files are keyed" |
282 |
> ewarn "to the MAC address of the eth0 interface. In order to retrieve" |
283 |
> ewarn "a personalized license file, follow the instructions at" |
284 |
> ewarn "https://software.intel.com/en-us/articles/how-do-i-get-my-license-file-for-intel-parallel-studio-xe-2016" |
285 |
> |
286 |
> case ${1} in |
287 |
> pre-check ) |
288 |
> ewarn "before proceeding with installation of ${P}" |
289 |
> echo "" |
290 |
> ;; |
291 |
> * ) |
292 |
> echo "" |
293 |
> ;; |
294 |
> esac |
295 |
> } |
296 |
> |
297 |
> # @FUNCTION: _isdp_version_test |
298 |
> # @INTERNAL |
299 |
> # @DESCRIPTION: |
300 |
> # Testing for valid license by asking for version information of the compiler |
301 |
> _isdp_version_test() { |
302 |
> debug-print-function ${FUNCNAME} "${@}" |
303 |
> |
304 |
> local comp comp_full arch warn |
305 |
> case ${PN} in |
306 |
> ifc ) |
307 |
> debug-print "Testing ifort" |
308 |
> comp=ifort |
309 |
> ;; |
310 |
> icc ) |
311 |
> debug-print "Testing icc" |
312 |
> comp=icc |
313 |
> ;; |
314 |
> *) |
315 |
> die "${PN} is not supported for testing" |
316 |
> ;; |
317 |
> esac |
318 |
> |
319 |
> for arch in ${INTEL_ARCH}; do |
320 |
> case ${EBUILD_PHASE} in |
321 |
> install ) |
322 |
> comp_full="${ED}/${INTEL_SDP_DIR}/linux/bin/${arch}/${comp}" |
323 |
|
324 |
Double slash imminent (ED has one). |
325 |
|
326 |
> ;; |
327 |
> postinst ) |
328 |
> comp_full="${INTEL_SDP_EDIR}/linux/bin/${arch}/${comp}" |
329 |
> ;; |
330 |
> * ) |
331 |
> ewarn "Compile test not supported in ${EBUILD_PHASE}" |
332 |
|
333 |
Why not die? It's a new eclass after all. |
334 |
|
335 |
> continue |
336 |
> ;; |
337 |
> esac |
338 |
> |
339 |
> debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/linux/bin/${arch}/\" \"${comp_full}\" -V" |
340 |
> |
341 |
> LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/linux/bin/${arch}/" "${comp_full}" -V &>/dev/null |
342 |
> [[ $? -ne 0 ]] && warn=yes |
343 |
|
344 |
Why not just: |
345 |
|
346 |
LD_L... "${comp_full}" -V &>/dev/null || warn=yes |
347 |
|
348 |
> done |
349 |
> [[ "${warn}" == "yes" ]] && _isdp_big-warning test-failed |
350 |
|
351 |
Unnecessary quoting. |
352 |
|
353 |
> } |
354 |
> |
355 |
> # @FUNCTION: _isdp_run-test |
356 |
> # @INTERNAL |
357 |
> # @DESCRIPTION: |
358 |
> # Test if installed compiler is working |
359 |
> _isdp_run-test() { |
360 |
> debug-print-function ${FUNCNAME} "${@}" |
361 |
> |
362 |
> if [[ -z ${INTEL_SKIP_LICENSE} ]]; then |
363 |
> case ${PN} in |
364 |
> ifc | icc ) |
365 |
> _isdp_version_test ;; |
366 |
> * ) |
367 |
> debug-print "No test available for ${PN}" |
368 |
> ;; |
369 |
> esac |
370 |
> fi |
371 |
> } |
372 |
> |
373 |
> # @FUNCTION: convert2intel_arch |
374 |
> # @USAGE: <arch> |
375 |
> # @DESCRIPTION: |
376 |
> # Convert between portage arch (e.g. amd64, x86) and intel arch |
377 |
> # nomenclature (e.g. intel64, ia32) |
378 |
> convert2intel_arch() { |
379 |
|
380 |
Namespace, please. |
381 |
|
382 |
> debug-print-function ${FUNCNAME} "${@}" |
383 |
> |
384 |
> case $1 in |
385 |
> amd64|abi_x86_64|*amd64*) |
386 |
|
387 |
Err, *amd64* catches amd64, you know. |
388 |
|
389 |
> echo "intel64" |
390 |
> ;; |
391 |
> x86|abi_x86_32|*x86*) |
392 |
> echo "ia32" |
393 |
> ;; |
394 |
> *) |
395 |
> die "Abi \'$1\' is unsupported" |
396 |
> ;; |
397 |
> esac |
398 |
> } |
399 |
> |
400 |
> # @FUNCTION: intel-sdp-r1_pkg_pretend |
401 |
> # @DESCRIPTION: |
402 |
> # @CODE |
403 |
> # * Check that the user has a (valid) license file before going on. |
404 |
> # * Check for space requirements being fullfilled |
405 |
|
406 |
fulfilled. |
407 |
|
408 |
> # @CODE |
409 |
|
410 |
Err, this is not code, you know. |
411 |
|
412 |
> intel-sdp-r1_pkg_pretend() { |
413 |
> debug-print-function ${FUNCNAME} "${@}" |
414 |
> |
415 |
> local warn=1 dir dirs ret arch a p |
416 |
> |
417 |
> : ${CHECKREQS_DISK_BUILD:=256M} |
418 |
> check-reqs_pkg_pretend |
419 |
> |
420 |
> if [[ -z ${INTEL_SKIP_LICENSE} ]]; then |
421 |
> if echo ${INTEL_LICENSE_FILE} | grep -q @; then |
422 |
|
423 |
Err... is this some fancy way of saying: |
424 |
|
425 |
[[ ${INTEL_LICENSE_FILE} == *@* ]] |
426 |
|
427 |
? Or is @ special here? |
428 |
|
429 |
> einfo "Looks like you are using following license server:" |
430 |
> einfo " ${INTEL_LICENSE_FILE}" |
431 |
> return 0 |
432 |
> fi |
433 |
> |
434 |
> dirs=( |
435 |
> "${EPREFIX}/opt/intel/licenses" |
436 |
> "${INTEL_SDP_EDIR}/licenses" |
437 |
> "${INTEL_SDP_EDIR}/Licenses" |
438 |
> ) |
439 |
> for dir in "${dirs[@]}" ; do |
440 |
> ebegin "Checking for a license in: ${dir}" |
441 |
> #maybe use nullglob or [[ $(echo ${dir/*lic) != "${dir}/*lic" ]] |
442 |
> [[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$? |
443 |
|
444 |
Maybe you should use something sane indeed. |
445 |
|
446 |
> eend ${ret} |
447 |
> if [[ ${ret} == "0" ]]; then |
448 |
> warn=${ret} |
449 |
> break |
450 |
> fi |
451 |
|
452 |
I would have to check PMS here but I think eend preserves (returns) |
453 |
the status passed to it. |
454 |
|
455 |
> done |
456 |
> if [[ ${warn} == "1" ]]; then |
457 |
> _isdp_big-warning pre-check |
458 |
> die "Could not find license file" |
459 |
> fi |
460 |
> else |
461 |
> eqawarn "The ebuild doesn't check for presence of a proper intel license!" |
462 |
> eqawarn "This shouldn't be done unless there is a very good reason." |
463 |
|
464 |
This looks like a bad idea. You either require it, and fail it doesn't |
465 |
exist, or let people disable it. You don't warn endlessly if this is |
466 |
allowed. |
467 |
|
468 |
> fi |
469 |
> } |
470 |
> |
471 |
> # @FUNCTION: intel-sdp-r1_pkg_setup |
472 |
> # @DESCRIPTION: |
473 |
> # Setting up and sorting some internal variables |
474 |
> intel-sdp-r1_pkg_setup() { |
475 |
> debug-print-function ${FUNCNAME} "${@}" |
476 |
> local arch a p |
477 |
> |
478 |
> INTEL_ARCH="" |
479 |
> |
480 |
> if use abi_x86_64; then |
481 |
> arch+=" x86_64" |
482 |
> INTEL_ARCH+=" intel64" |
483 |
|
484 |
Wouldn't it be better to use an array here? |
485 |
|
486 |
> fi |
487 |
> if use abi_x86_32; then |
488 |
> arch+=" ${INTEL_X86}" |
489 |
> INTEL_ARCH+=" ia32" |
490 |
> fi |
491 |
> INTEL_RPMS=() |
492 |
> INTEL_RPMS_FULL=() |
493 |
> |
494 |
> for p in "${INTEL_BIN_RPMS[@]}"; do |
495 |
> for a in ${arch}; do |
496 |
> if [ ${p} == $(basename ${p}) ]; then |
497 |
|
498 |
${p##*/}. |
499 |
|
500 |
> # check for variables ending in ".rpm" |
501 |
> # these are excluded from version expansion, due to Intel's |
502 |
> # idiosyncratic versioning scheme beginning with their 2016 |
503 |
> # suite of tools. |
504 |
> if [[ "${p}" == *.rpm ]]; then |
505 |
> INTEL_RPMS+=( intel-${p} ) |
506 |
> else |
507 |
> INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.${a}.rpm ) |
508 |
> fi |
509 |
> else |
510 |
> if [[ "${p}" == *.rpm ]]; then |
511 |
> INTEL_RPMS_FULL+=( ${p} ) |
512 |
> else |
513 |
> INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.${a}.rpm ) |
514 |
> fi |
515 |
> fi |
516 |
> done |
517 |
> done |
518 |
> |
519 |
> if use amd64; then |
520 |
> for p in "${INTEL_AMD64_RPMS[@]}"; do |
521 |
> if [ ${p} == $(basename ${p}) ]; then |
522 |
> if [[ "${p}" == *.rpm ]]; then |
523 |
> INTEL_RPMS+=( intel-${p} ) |
524 |
> else |
525 |
> INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.x86_64.rpm ) |
526 |
> fi |
527 |
> else |
528 |
> if [[ "${p}" == *.rpm ]]; then |
529 |
> INTEL_RPMS_FULL+=( ${p} ) |
530 |
> else |
531 |
> INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.x86_64.rpm ) |
532 |
> fi |
533 |
> fi |
534 |
> done |
535 |
> fi |
536 |
> |
537 |
> for p in "${INTEL_X86_RPMS[@]}"; do |
538 |
> if [ ${p} == $(basename ${p}) ]; then |
539 |
> if [[ "${p}" == *.rpm ]]; then |
540 |
> INTEL_RPMS+=( intel-${p} ) |
541 |
> else |
542 |
> INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.${INTEL_X86}.rpm ) |
543 |
> fi |
544 |
> else |
545 |
> if [[ "${p}" == *.rpm ]]; then |
546 |
> INTEL_RPMS_FULL+=( ${p} ) |
547 |
> else |
548 |
> INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.${INTEL_X86}.rpm ) |
549 |
> fi |
550 |
> fi |
551 |
> done |
552 |
> |
553 |
> for p in "${INTEL_DAT_RPMS[@]}"; do |
554 |
> if [ ${p} == $(basename ${p}) ]; then |
555 |
> if [[ "${p}" == *.rpm ]]; then |
556 |
> INTEL_RPMS+=( intel-${p} ) |
557 |
> else |
558 |
> INTEL_RPMS+=( intel-${p}-${_INTEL_PV}.noarch.rpm ) |
559 |
> fi |
560 |
> else |
561 |
> if [[ "${p}" == *.rpm ]]; then |
562 |
> INTEL_RPMS_FULL+=( ${p} ) |
563 |
> else |
564 |
> INTEL_RPMS_FULL+=( ${p}-${_INTEL_PV}.noarch.rpm ) |
565 |
> fi |
566 |
> fi |
567 |
> done |
568 |
|
569 |
Wouldn't you be able to collapse that into one loop? |
570 |
|
571 |
> } |
572 |
> |
573 |
> # @FUNCTION: intel-sdp-r1_src_unpack |
574 |
> # @DESCRIPTION: |
575 |
> # Unpacking necessary rpms from tarball, extract them and rearrange the output. |
576 |
> intel-sdp-r1_src_unpack() { |
577 |
> local l r subdir rb t list=() debug_list |
578 |
> |
579 |
> for t in ${A}; do |
580 |
> for r in "${INTEL_RPMS[@]}"; do |
581 |
> rpmdir=${t%%.*}/${INTEL_RPMS_DIR} |
582 |
> list+=( ${rpmdir}/${r} ) |
583 |
> done |
584 |
> |
585 |
> for r in "${INTEL_RPMS_FULL[@]}"; do |
586 |
> list+=( ${t%%.*}/${r} ) |
587 |
> done |
588 |
> |
589 |
> debug_list="$(IFS=$'\n'; echo ${list[@]} )" |
590 |
> |
591 |
> debug-print "Adding to decompression list:" |
592 |
> debug-print ${debug_list} |
593 |
> |
594 |
> tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log |
595 |
|
596 |
I suggest -xvf. Looks more friendly than ye-ol-syntax. |
597 |
|
598 |
> |
599 |
> for r in ${list[@]}; do |
600 |
> rb=$(basename ${r}) |
601 |
|
602 |
basename again. |
603 |
|
604 |
> einfo "Unpacking ${rb}" |
605 |
> rpm2tar -O ${r} | tar xvf - | sed -e \ |
606 |
> "s:^\.:${EROOT#/}:g" > /dev/null; assert "unpacking ${r} failed" |
607 |
|
608 |
What's the deal with this sed? |
609 |
|
610 |
> done |
611 |
> done |
612 |
> } |
613 |
> |
614 |
> # @FUNCTION: intel-sdp-r1_src_install |
615 |
> # @DESCRIPTION: |
616 |
> # Install everything |
617 |
> intel-sdp-r1_src_install() { |
618 |
> debug-print-function ${FUNCNAME} "${@}" |
619 |
> |
620 |
> # remove uninstall information |
621 |
> if path_exists opt/intel/"${INTEL_DPN}"*/uninstall; then |
622 |
> ebegin "Cleaning out uninstall" |
623 |
> rm -r opt/intel/"${INTEL_DPN}"*/uninstall || die |
624 |
> eend |
625 |
> fi |
626 |
> |
627 |
> # handle documentation |
628 |
> if path_exists "opt/intel/documentation_${_INTEL_SDP_YEAR}"; then |
629 |
> if path_exists "opt/intel/documentation_${_INTEL_SDP_YEAR}/en/man/common/man1"; then |
630 |
> doman opt/intel/documentation_"${_INTEL_SDP_YEAR}"/en/man/common/man1/* |
631 |
> rm -r opt/intel/documentation_"${_INTEL_SDP_YEAR}"/en/man || die |
632 |
> fi |
633 |
> |
634 |
> if use doc; then |
635 |
> if ! use linguas_ja; then |
636 |
> rm -r opt/intel/documentation_"${_INTEL_SDP_YEAR}"/ja || die |
637 |
> fi |
638 |
> dodoc -r opt/intel/documentation_"${_INTEL_SDP_YEAR}"/* |
639 |
> fi |
640 |
> |
641 |
> ebegin "Cleaning out documentation" |
642 |
> rm -r "opt/intel/documentation_${_INTEL_SDP_YEAR}" || die |
643 |
> rm "${INTEL_SDP_DIR}"/linux/{documentation,man} || die |
644 |
> eend |
645 |
> fi |
646 |
> |
647 |
> # handle examples |
648 |
> if path_exists "opt/intel/samples_${_INTEL_SDP_YEAR}"; then |
649 |
> if use examples; then |
650 |
> if ! use linguas_ja; then |
651 |
> rm -r opt/intel/samples_"${_INTEL_SDP_YEAR}"/ja || die |
652 |
> fi |
653 |
> dodoc -r opt/intel/samples_"${_INTEL_SDP_YEAR}"/* |
654 |
> fi |
655 |
> |
656 |
> ebegin "Cleaning out examples" |
657 |
> rm -r "opt/intel/samples_${_INTEL_SDP_YEAR}" || die |
658 |
> eend |
659 |
> fi |
660 |
> |
661 |
> # remove eclipse |
662 |
> rm -rf opt/intel/ide_support_* || die |
663 |
> |
664 |
> ebegin "Tagging ${PN}" |
665 |
> find opt -name \*sh -type f -exec sed -i \ |
666 |
> -e "s:<.*DIR>:${INTEL_SDP_EDIR}/linux:g" \ |
667 |
> '{}' + || die |
668 |
> eend |
669 |
> |
670 |
> [[ -d "${ED}" ]] || dodir / |
671 |
|
672 |
Do we actually need that, ever? |
673 |
|
674 |
> mv opt "${ED}"/ || die "moving files failed" |
675 |
> |
676 |
> dodir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm |
677 |
> keepdir "${INTEL_SDP_DIR}"/licenses /opt/intel/ism/rm |
678 |
|
679 |
dodir is redundant. |
680 |
|
681 |
> } |
682 |
> |
683 |
> # @FUNCTION: intel-sdp-r1_pkg_postinst |
684 |
> # @DESCRIPTION: |
685 |
> # Test for all things working |
686 |
> intel-sdp-r1_pkg_postinst() { |
687 |
> debug-print-function ${FUNCNAME} "${@}" |
688 |
> |
689 |
> _isdp_run-test |
690 |
> |
691 |
> if [[ ${PN} = icc ]] && has_version ">=dev-util/ccache-3.1.9-r2" ; then |
692 |
> #add ccache links as icc might get installed after ccache |
693 |
> "${EROOT}"/usr/bin/ccache-config --install-links |
694 |
> fi |
695 |
> |
696 |
> elog "Beginning with the 2016 suite of Intel tools, Gentoo has removed" |
697 |
> elog "support for the eclipse plugin. If you require the IDE support," |
698 |
> elog "you will have to install the suite on your own, outside portage." |
699 |
> } |
700 |
> |
701 |
> # @FUNCTION: intel-sdp-r1_pkg_postrm |
702 |
> # @DESCRIPTION: |
703 |
> # Sanitize cache links |
704 |
> intel-sdp-r1_pkg_postrm() { |
705 |
> debug-print-function ${FUNCNAME} "${@}" |
706 |
> |
707 |
> if [[ ${PN} = icc ]] && has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then |
708 |
> # --remove-links would remove all links, --install-links updates them |
709 |
> "${EROOT}"/usr/bin/ccache-config --install-links |
710 |
> fi |
711 |
> } |
712 |
> |
713 |
> EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm pkg_pretend |
714 |
|
715 |
We usually do this on top, and it's better to do it outside guards so |
716 |
that order from inherit is always respected. |
717 |
|
718 |
> |
719 |
> _INTEL_SDP_R1_ECLASS_=1 |
720 |
> fi |
721 |
|
722 |
|
723 |
|
724 |
-- |
725 |
Best regards, |
726 |
Michał Górny |
727 |
<http://dev.gentoo.org/~mgorny/> |