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