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: Thu, 29 Nov 2012 07:03:43
Message-Id: 1354103928.e4eaa4da3b98bbcebcc90a5131ac3f72a7f258d2.jlec@gentoo
1 commit: e4eaa4da3b98bbcebcc90a5131ac3f72a7f258d2
2 Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 28 11:58:48 2012 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 28 11:58:48 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=e4eaa4da
7
8 Implemented comments from g-dev review
9
10 * Fix whitespacing
11 * Fix man pages tags
12 * rename local functions to somethings which potentionaly doesn't
13 conflict globally
14 * remove _ from local variables
15 * Move checks from pkg_setup to pkg_pretend
16
17 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>
18
19 ---
20 eclass/intel-sdp.eclass | 255 +++++++++++++++++++++++++----------------------
21 1 files changed, 136 insertions(+), 119 deletions(-)
22
23 diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass
24 index badb68b..1b60514 100644
25 --- a/eclass/intel-sdp.eclass
26 +++ b/eclass/intel-sdp.eclass
27 @@ -91,7 +91,7 @@ _INTEL_URI="http://registrationcenter-download.intel.com/irc_nas/${INTEL_DID}/${
28 SRC_URI="
29 amd64? ( multilib? ( ${_INTEL_URI}_${INTEL_DPV}.tgz ) )
30 amd64? ( !multilib? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.tgz ) )
31 - x86? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.tgz )"
32 + x86? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.tgz )"
33
34 LICENSE="Intel-SDP"
35 # Future work, #394411
36 @@ -124,11 +124,6 @@ S="${WORKDIR}"
37
38 QA_PREBUILT="${INTEL_SDP_DIR}/*"
39
40 -intel-sdp_pkg_pretend() {
41 - : ${CHECKREQS_DISK_BUILD:=256M}
42 - check-reqs_pkg_pretend
43 -}
44 -
45 # @ECLASS-VARIABLE: INTEL_ARCH
46 # @DEFAULT_UNSET
47 # @DESCRIPTION:
48 @@ -136,138 +131,160 @@ intel-sdp_pkg_pretend() {
49 #
50 # e.g. amd64-multilib -> INTEL_ARCH="intel64 ia32"
51
52 -# @ECLASS-FUNCTION: intel_link_eclipse_plugins
53 +# @FUNCTION: _isdp_link_eclipse_plugins
54 +# @INTERNAL
55 # @DESCRIPTION:
56 # Creating necessary links to use intel compiler with eclipse
57 -intel_link_eclipse_plugins() {
58 - local c f
59 - pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
60 - for c in cdt*; do
61 - local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
62 - if has_version "dev-util/eclipse-sdk:${ev}"; then
63 - einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
64 - for f in cdt${cv}/eclipse/features/*; do
65 - dodir /usr/$(get_libdir)/eclipse-${ev}/features
66 - dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
67 - /usr/$(get_libdir)/eclipse-${ev}/features/ || die
68 - done
69 - for f in cdt${cv}/eclipse/plugins/*; do
70 - dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
71 - dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
72 - /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
73 - done
74 - fi
75 - done
76 - popd > /dev/null
77 +_isdp_link_eclipse_plugins() {
78 + local c f
79 + pushd ${INTEL_SDP_DIR}/eclipse_support > /dev/null
80 + for c in cdt*; do
81 + local cv=${c#cdt} ev=3.$(( ${cv:0:1} - 1))
82 + if has_version "dev-util/eclipse-sdk:${ev}"; then
83 + einfo "Linking eclipse (v${ev}) plugin cdt (v${cv})"
84 + for f in cdt${cv}/eclipse/features/*; do
85 + dodir /usr/$(get_libdir)/eclipse-${ev}/features
86 + dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
87 + /usr/$(get_libdir)/eclipse-${ev}/features/ || die
88 + done
89 + for f in cdt${cv}/eclipse/plugins/*; do
90 + dodir /usr/$(get_libdir)/eclipse-${ev}/plugins
91 + dosym "${INTEL_SDP_EDIR}"/eclipse_support/${f} \
92 + /usr/$(get_libdir)/eclipse-${ev}/plugins/ || die
93 + done
94 + fi
95 + done
96 + popd > /dev/null
97 }
98
99 -# @ECLASS-FUNCTION: big-warning
100 +# @FUNCTION: _isdp_big-warning
101 +# @USAGE: [pre-check | test-failed]
102 # @INTERNAL
103 +# @DESCRIPTION:
104 # warn user that we really require a license
105 -big-warning() {
106 - case ${1} in
107 - test-failed )
108 - echo
109 - ewarn "Function test failed. Most probably due to an invalid license."
110 - ewarn "This means you already tried to bypass the license check once."
111 - ;;
112 - esac
113 -
114 - echo ""
115 - ewarn "Make sure you have recieved the an Intel license."
116 - ewarn "To receive a non-commercial license, you need to register at:"
117 - ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/"
118 - ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/"
119 -
120 - case ${1} in
121 - pre-check )
122 - ewarn "before proceeding with installation of ${P}"
123 - echo ""
124 - ;;
125 - * )
126 - echo ""
127 - ;;
128 - esac
129 +_isdp_big-warning() {
130 + case ${1} in
131 + pre-check )
132 + echo ""
133 + ewarn "License file not found!"
134 + ;;
135 +
136 + test-failed )
137 + echo
138 + ewarn "Function test failed. Most probably due to an invalid license."
139 + ewarn "This means you already tried to bypass the license check once."
140 + ;;
141 + esac
142 +
143 + echo ""
144 + ewarn "Make sure you have recieved the an Intel license."
145 + ewarn "To receive a non-commercial license, you need to register at:"
146 + ewarn "http://software.intel.com/en-us/articles/non-commercial-software-development/"
147 + ewarn "Install the license file into ${INTEL_SDP_EDIR}/licenses/"
148 +
149 + case ${1} in
150 + pre-check )
151 + ewarn "before proceeding with installation of ${P}"
152 + echo ""
153 + ;;
154 + * )
155 + echo ""
156 + ;;
157 + esac
158 }
159
160 -# @ECLASS-FUNCTION: _version_test
161 +# @FUNCTION: _isdp_version_test
162 # @INTERNAL
163 +# @DESCRIPTION:
164 # Testing for valid license by asking for version information of the compiler
165 -_version_test() {
166 - local _comp _comp_full _arch _file _warn
167 - case ${PN} in
168 - ifc )
169 - debug-print "Testing ifort"
170 - _comp=ifort
171 - ;;
172 - icc )
173 - debug-print "Testing icc"
174 - _comp=icc
175 - ;;
176 - *)
177 - die "${PN} is not supported for testing"
178 - ;;
179 - esac
180 -
181 - for _arch in ${INTEL_ARCH}; do
182 - case ${EBUILD_PHASE} in
183 - install )
184 - _comp_full="${ED}/${INTEL_SDP_DIR}/bin/${_arch}/${_comp}"
185 - ;;
186 - postinst )
187 - _comp_full="${INTEL_SDP_EDIR}/bin/${_arch}/${_comp}"
188 - ;;
189 - * )
190 - ewarn "Compile test not supported in ${EBUILD_PHASE}"
191 - continue
192 - ;;
193 - esac
194 -
195 - debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${_arch}/\" \"${_comp_full}\" -V"
196 -
197 - LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${_arch}/" "${_comp_full}" -V &>/dev/null
198 - [[ $? -ne 0 ]] && _warn=yes
199 - done
200 - [[ "${_warn}" == "yes" ]] && big-warning test-failed
201 +_isdp_version_test() {
202 + local comp comp_full arch warn
203 + case ${PN} in
204 + ifc )
205 + debug-print "Testing ifort"
206 + comp=ifort
207 + ;;
208 + icc )
209 + debug-print "Testing icc"
210 + comp=icc
211 + ;;
212 + *)
213 + die "${PN} is not supported for testing"
214 + ;;
215 + esac
216 +
217 + for arch in ${INTEL_ARCH}; do
218 + case ${EBUILD_PHASE} in
219 + install )
220 + comp_full="${ED}/${INTEL_SDP_DIR}/bin/${arch}/${comp}"
221 + ;;
222 + postinst )
223 + comp_full="${INTEL_SDP_EDIR}/bin/${arch}/${comp}"
224 + ;;
225 + * )
226 + ewarn "Compile test not supported in ${EBUILD_PHASE}"
227 + continue
228 + ;;
229 + esac
230 +
231 + debug-print "LD_LIBRARY_PATH=\"${INTEL_SDP_EDIR}/bin/${arch}/\" \"${comp_full}\" -V"
232 +
233 + LD_LIBRARY_PATH="${INTEL_SDP_EDIR}/bin/${arch}/" "${comp_full}" -V &>/dev/null
234 + [[ $? -ne 0 ]] && warn=yes
235 + done
236 + [[ "${warn}" == "yes" ]] && _isdp_big-warning test-failed
237 }
238
239 -# @ECLASS-FUNCTION: run-test
240 +# @FUNCTION: _isdp_run-test
241 # @INTERNAL
242 # Test if installed compiler is working
243 -run-test() {
244 - case ${PN} in
245 - ifc | icc )
246 - _version_test ;;
247 - * )
248 - debug-print "No test available for ${PN}"
249 - ;;
250 - esac
251 +_isdp_run-test() {
252 + case ${PN} in
253 + ifc | icc )
254 + _isdp_version_test ;;
255 + * )
256 + debug-print "No test available for ${PN}"
257 + ;;
258 + esac
259 }
260
261 -# @ ECLASS-FUNCTION: intel-sdp_pkg_setup
262 +# @FUNCTION: intel-sdp_pkg_pretend
263 # @DESCRIPTION:
264 -# The setup finction serves two purposes:
265 -#
266 +# @CODE
267 # * Check that the user has a (valid) license file before going on.
268 -#
269 -# * Setting up and sorting some internal variables
270 -intel-sdp_pkg_setup() {
271 - local _warn=1 _dirs i _ret arch a p
272 +# * Check for space requirements being fullfilled
273 +# @CODE
274 +intel-sdp_pkg_pretend() {
275 + local warn=1 dir dirs i ret arch a p
276 +
277 + : ${CHECKREQS_DISK_BUILD:=256M}
278 + check-reqs_pkg_pretend
279 +
280 _dirs=(
281 "${INTEL_SDP_EDIR}/licenses"
282 "${INTEL_SDP_EDIR}/Licenses"
283 "${EPREFIX}/opt/intel/licenses"
284 )
285 - for ((i = 0; i < ${#_dirs[@]}; i++)); do
286 - ebegin "Checking for a license in: ${_dirs[$i]}"
287 - [[ $( ls "${_dirs[$i]}"/*lic 2>/dev/null ) ]]; _ret=$?
288 - eend ${_ret}
289 - if [[ ${_ret} == "0" ]]; then
290 - _warn=${_ret}
291 + for dir in "${dirs[@]}" ; do
292 + ebegin "Checking for a license in: ${dirs[$i]}"
293 + [[ $( ls "${dirs[$i]}"/*lic 2>/dev/null ) ]]; ret=$?
294 + eend ${ret}
295 + if [[ ${ret} == "0" ]]; then
296 + warn=${ret}
297 break
298 fi
299 done
300 - [[ ${_warn} == "0" ]] || big-warning pre-check
301 + if [[ ${warn} == "1" ]]; then
302 + _isdp_big-warning pre-check
303 + die "Could not find license file"
304 + fi
305 +}
306 +
307 +# @FUNCTION: intel-sdp_pkg_setup
308 +# @DESCRIPTION:
309 +# Setting up and sorting some internal variables
310 +intel-sdp_pkg_setup() {
311 + local arch a p
312
313 if use x86; then
314 arch=${INTEL_X86}
315 @@ -295,7 +312,7 @@ intel-sdp_pkg_setup() {
316 esac
317 }
318
319 -# @ ECLASS-FUNCTION: intel-sdp_src_unpack
320 +# @FUNCTION: intel-sdp_src_unpack
321 # @DESCRIPTION:
322 # Unpacking necessary rpms from tarball, extract them and rearrange the output.
323 intel-sdp_src_unpack() {
324 @@ -308,7 +325,7 @@ intel-sdp_src_unpack() {
325 list+=( ${rpmdir}/${r})
326 done
327 done
328 - tar xf "${DISTDIR}"/${t} ${list[@]} 2> /dev/null || die
329 + tar xf "${DISTDIR}"/${t} ${list[@]} 2> /dev/null || die
330 for r in ${list[@]}; do
331 rb=$(basename ${r})
332 l=.${rb}_$(date +'%d%m%y_%H%M%S').log
333 @@ -322,7 +339,7 @@ intel-sdp_src_unpack() {
334 mv opt/intel/* ${INTEL_SDP_DIR} || die "mv to INTEL_SDP_DIR failed"
335 }
336
337 -# @ ECLASS-FUNCTION: intel-sdp_src_install
338 +# @FUNCTION: intel-sdp_src_install
339 # @DESCRIPTION:
340 # Install everything
341 intel-sdp_src_install() {
342 @@ -346,7 +363,7 @@ intel-sdp_src_install() {
343
344 if [[ -d "${INTEL_SDP_DIR}"/eclipse_support ]]; then
345 if has eclipse ${IUSE} && use eclipse; then
346 - intel_link_eclipse_plugins
347 + _isdp_link_eclipse_plugins
348 else
349 ebegin "Cleaning out eclipse plugin"
350 find "${INTEL_SDP_DIR}"/eclipse_support -delete || die
351 @@ -379,7 +396,7 @@ intel-sdp_src_install() {
352 keepdir "${INTEL_SDP_EDIR}"/licenses
353 }
354
355 -# @ECLASS-FUNCTION
356 +# @FUNCTION: intel-sdp_pkg_postinst
357 # @DESCRIPTION:
358 # Add things to intel database
359 intel-sdp_pkg_postinst() {
360 @@ -390,10 +407,10 @@ intel-sdp_pkg_postinst() {
361 echo >> ${INTEL_SDP_DB} \
362 "<:${r%-${_INTEL_PV4}*}-${_INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>"
363 done
364 - run-test
365 + _isdp_run-test
366 }
367
368 -# @ECLASS-FUNCTION
369 +# @FUNCTION: intel-sdp_pkg_postrm
370 # @DESCRIPTION:
371 # Sanitize intel database
372 intel-sdp_pkg_postrm() {