[gentoo-dev] RFC: intel-sdp-r1.eclass, Take #2

2016-02-20 Thread David Seifert
Dear all,
after much criticism, I present you with an improved eclass for
handling the Intel 2016 (and hopefully beyond) suite of software.

We have improved the following:
* Made variables names more clear, to separate upstream vars from
internal/Gentoo vars.
* Practically no more global state in the eclass. Everything is handled
by getter functions now. Due to strong concerns voiced with regards to
egencache, getter functions are NOT used in global scope, except for
one occurrence. We believe the improved abstraction/encapsulation makes
this one use of a function in global scope bearable.

Regards
David
diff --git a/eclass/intel-sdp-r1.eclass b/eclass/intel-sdp-r1.eclass
index 14467b7..1413109 100644
--- a/eclass/intel-sdp-r1.eclass
+++ b/eclass/intel-sdp-r1.eclass
@@ -9,62 +9,71 @@
 # Sci Team 
 # @BLURB: Handling of Intel's Software Development Products package management
 
+MULTILIB_COMPAT=( abi_x86_{32,64} )
+
+inherit check-reqs eutils multilib-build versionator
+
+EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm pkg_pretend
+
 if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then
 
-case "${EAPI:-0}" in
+case "${EAPI}" in
 	6) ;;
 	*) die "EAPI=${EAPI} is not supported" ;;
 esac
 
-# @ECLASS-VARIABLE: INTEL_DID
+# @ECLASS-VARIABLE: INTEL_DIST_SKU
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # The package download ID from Intel.
-# To find out its value, see the links to download in
+# To determine its value, see the links to download in
 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
 #
 # e.g. 8365
 #
-# Must be defined before inheriting the eclass
+# Must be defined before inheriting the eclass.
 
-# @ECLASS-VARIABLE: INTEL_DPN
+# @ECLASS-VARIABLE: INTEL_DIST_NAME
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # The package name to download from Intel.
-# To find out its value, see the links to download in
+# To determine its value, see the links to download in
 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
 #
 # e.g. parallel_studio_xe
 #
-# Must be defined before inheriting the eclass
+# Must be defined before inheriting the eclass.
 
-# @ECLASS-VARIABLE: INTEL_DPV
+# @ECLASS-VARIABLE: INTEL_DIST_PV
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # The package download version from Intel.
-# To find out its value, see the links to download in
+# To determine its value, see the links to download in
 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
 #
 # e.g. 2016_update1
 #
-# Must be defined before inheriting the eclass
+# Must be defined before inheriting the eclass.
 
 # @ECLASS-VARIABLE: INTEL_TARX
 # @DESCRIPTION:
-# The package extention.
-# To find out its value, see the links to download in
+# The package suffix.
+# To determine its value, see the links to download in
 # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
 #
 # e.g. tar.gz
 #
-# Must be defined before inheriting the eclass
+# Must be defined before inheriting the eclass.
 : ${INTEL_TARX:=tgz}
 
 # @ECLASS-VARIABLE: INTEL_SUBDIR
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# The package sub-directory where it will end-up in /opt/intel
-# To find out its value, you have to do a raw install from the Intel tar ball
+# The package sub-directory (without version numbers) where it will end-up in /opt/intel
+#
+# e.g. compilers_and_libraries
+#
+# To determine its value, you have to do a raw install from the Intel tarball.
 
 # @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
 # @DEFAULT_UNSET
@@ -86,7 +95,7 @@ esac
 
 # @ECLASS-VARIABLE: INTEL_BIN_RPMS
 # @DESCRIPTION:
-# Functional name of rpm without any version/arch tag
+# Functional name of rpm without any version/arch tag.
 # Has to be a bash array
 #
 # e.g. ("icc-l-all-devel")
@@ -94,63 +103,81 @@ esac
 # if the rpm is located in a directory other than INTEL_RPMS_DIR you can
 # specify the full path
 #
-# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
-: ${INTEL_BIN_RPMS:=()}
+# e.g. ("CLI_install/rpm/intel-vtune-amplifier-xe-cli")
+[[ ${INTEL_BIN_RPMS[@]} ]] || INTEL_BIN_RPMS=()
 
 # @ECLASS-VARIABLE: INTEL_AMD64_RPMS
 # @DESCRIPTION:
-# AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS
-# Has to be a bash array
-: ${INTEL_AMD64_RPMS:=()}
+# AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS.
+# Has to be a bash array.
+[[ ${INTEL_AMD64_RPMS[@]} ]] || INTEL_AMD64_RPMS=()
 
 # @ECLASS-VARIABLE: INTEL_X86_RPMS
 # @DESCRIPTION:
-# X86 single arch rpms. Same syntax as INTEL_BIN_RPMS
-# Has to be a bash array
-: ${INTEL_X86_RPMS:=()}
+# X86 single arch rpms. Same syntax as INTEL_BIN_RPMS.
+# Has to be a bash array.
+[[ ${INTEL_X86_RPMS[@]} ]] || INTEL_X86_RPMS=()
 
 # @ECLASS-VARIABLE: INTEL_DAT_RPMS
 # @DESCRIPTION:
 # Functional name of rpm of common data which are arch free
-# without any version tag
-# Has to be a bash array
+# without any version tag. Has to be a bash array.
 #
 # e.g. ("openmp-l-all-devel")
 #
 # if the rpm is located in a directory different to INTEL_RPMS_DIR you can
 # specify the full path
 #
-# 

Re: [gentoo-dev] RFC: intel-sdp-r1.eclass

2016-02-15 Thread Michał Górny
On Mon, 15 Feb 2016 15:41:58 +0100
"Justin Lecher (jlec)"  wrote:

> On 15/02/16 15:35, Michał Górny wrote:
> > On Mon, 15 Feb 2016 14:37:41 +0100
> > "Justin Lecher (jlec)"  wrote:
> >   
> >> On 15/02/16 13:59, Michał Górny wrote:  
> >>> On Mon, 15 Feb 2016 09:16:53 +0100
> >>> "Justin Lecher (jlec)"  wrote:
> >>> 
>  # @ECLASS-VARIABLE: INTEL_SUBDIR
>  # @DEFAULT_UNSET
>  # @DESCRIPTION:
>  # The package sub-directory where it will end-up in /opt/intel
>  # To find out its value, you have to do a raw install from the Intel tar 
>  ball
> >>>
> >>> To be honest, I find this kinda terrible. There's a huge block of docs
> >>> which makes me feel small and confused. Maybe it'd useful to give some
> >>> semi-complete example on top (in global doc)?
> >>
> >> That makes definitely make sense. We will add one.
> >>
> >> Although nobody other then the maintainer of this eclass will ever use it. 
> >>  
> > 
> > Remember that maintainers can change. It's better to have good then
> > have new maintainers figure out all stuff over again.
> >   
>  # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
>  : ${INTEL_BIN_RPMS:=()}
> >>>
> >>> $ : ${foo:=()}
> >>> $ declare -p foo
> >>> declare -- foo="()"
> >>>
> >>> In other words, it doesn't work the way you expect it to.
> >>
> >> I already wondered about this. Is there any way to force a variable to
> >> be an array in bash? Or define it as an empty array?  
> > 
> > Look at e.g. python-utils-r1.
> > 
> > To check for array:
> > 
> >   if [[ $(declare -p foo) != "declare -a"* ]]; then
> > ...
> >   fi
> > 
> > To default to empty, simple (yet a bit imperfect) way:
> > 
> >   [[ ${foo[@]} }] || foo=()  
> 
> And what about the default assignment for the man page?

Have no clue. I think someone mentioned some hack somewhere. Or maybe
we could finally fix eclass-manpages script to handle this.

> >>> Err, this is not code, you know.
> >>
> >> This is needed for nice formatting. Otherwise there is no line break  
> > 
> > Add an empty line between the two. That should do it correctly, without
> > code blocks in devmanual.  
> 
> That will introduce an empty line between the two points.

Which is quite correct. And in any case, it's definitely not worse than
what you're causing now:

https://devmanual.gentoo.org/eclass-reference/intel-sdp.eclass/index.html

> >>> Wouldn't you be able to collapse that into one loop?
> >>
> >> no, because the first has ${INTEL_X86}.rpm as suffeix and the later has
> >> ${INTEL_X86}.rpm.  
> > 
> > Er... am I reading wrong, or did you just type the same thing twice?  
> 
> right, it should be ${INTEL_X86}.rpm vs noarch.rpm

Well, I think you still could handle this with some extra code
and conditionals, at least reduced code duplication.

-- 
Best regards,
Michał Górny



pgpGHuwi5LopO.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: intel-sdp-r1.eclass

2016-02-15 Thread Justin Lecher (jlec)
On 15/02/16 15:35, Michał Górny wrote:
> On Mon, 15 Feb 2016 14:37:41 +0100
> "Justin Lecher (jlec)"  wrote:
> 
>> On 15/02/16 13:59, Michał Górny wrote:
>>> On Mon, 15 Feb 2016 09:16:53 +0100
>>> "Justin Lecher (jlec)"  wrote:
>>>   
 # @ECLASS-VARIABLE: INTEL_SUBDIR
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # The package sub-directory where it will end-up in /opt/intel
 # To find out its value, you have to do a raw install from the Intel tar 
 ball  
>>>
>>> To be honest, I find this kinda terrible. There's a huge block of docs
>>> which makes me feel small and confused. Maybe it'd useful to give some
>>> semi-complete example on top (in global doc)?  
>>
>> That makes definitely make sense. We will add one.
>>
>> Although nobody other then the maintainer of this eclass will ever use it.
> 
> Remember that maintainers can change. It's better to have good then
> have new maintainers figure out all stuff over again.
> 
 # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
 : ${INTEL_BIN_RPMS:=()}  
>>>
>>> $ : ${foo:=()}
>>> $ declare -p foo
>>> declare -- foo="()"
>>>
>>> In other words, it doesn't work the way you expect it to.  
>>
>> I already wondered about this. Is there any way to force a variable to
>> be an array in bash? Or define it as an empty array?
> 
> Look at e.g. python-utils-r1.
> 
> To check for array:
> 
>   if [[ $(declare -p foo) != "declare -a"* ]]; then
> ...
>   fi
> 
> To default to empty, simple (yet a bit imperfect) way:
> 
>   [[ ${foo[@]} }] || foo=()

And what about the default assignment for the man page?

> 
 # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
 # @DESCRIPTION:
 # Unset, if only the multilib package will be provided by intel
 : ${INTEL_SINGLE_ARCH:=true}  
>>>
>>> This is really weird. It sounds like I'm supposed to do:
>>>
>>>   inherit intel-sdp-r1
>>>   unset INTEL_SINGLE_ARCH
>>>
>>> I suggest you used positive logic instead.  
>>
>> The wording is wrong. Setting it to anything but "true" like
>> "INTEL_SINGLE_ARCH=false" works. We will fix the wording.
> 
> I still think positive logic is better. That is, a variable which
> defaults to, say, unset, and changes behavior if it becomes set to
> non-empty value.

we will look into that.

> 
 _isdp_big-warning() {
debug-print-function ${FUNCNAME} "${@}"

case ${1} in
pre-check )
echo ""  
>>>
>>> Don't mix echo with ewarn.  
>>
>> Why?
> 
> Because they won't go through the same output channels.
> 

 comp_full="${ED}/${INTEL_SDP_DIR}/linux/bin/${arch}/${comp}"  
>>>
>>> Double slash imminent (ED has one).  
>>
>> Always? Per definition?
> 
> Yes, sadly. i wanted to change this but it's unlikely to go since it
> makes EAPI migration hard. If you really want to cover both cases, you
> can always do ${foo%/}/bar.
> 
 # @CODE  
>>>
>>> Err, this is not code, you know.  
>>
>> This is needed for nice formatting. Otherwise there is no line break
> 
> Add an empty line between the two. That should do it correctly, without
> code blocks in devmanual.

That will introduce an empty line between the two points.

> 
#maybe use nullglob or [[ $(echo ${dir/*lic) != 
 "${dir}/*lic" ]]
[[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?  
>>>
>>> Maybe you should use something sane indeed.
> 
> Maybe file_exists from eutils could help here btw.
> 
>>> Wouldn't you be able to collapse that into one loop?  
>>
>> no, because the first has ${INTEL_X86}.rpm as suffeix and the later has
>> ${INTEL_X86}.rpm.
> 
> Er... am I reading wrong, or did you just type the same thing twice?

right, it should be ${INTEL_X86}.rpm vs noarch.rpm

> 
einfo "Unpacking ${rb}"
rpm2tar -O ${r} | tar xvf - | sed -e \
"s:^\.:${EROOT#/}:g" > /dev/null; assert 
 "unpacking ${r} failed"  
>>>
>>> What's the deal with this sed?  
>>
>> Good question, but it was there since always and probably the original
>> author had good reasons for it. We will look into it and comment the code.
> 
> Didn't it change in the past? As I see it, tar here outputs file names,
> sed edits them and then you discard them to /dev/null. In this case,
> sed doesn't return any specific exit code so it seems to be a complete
> no-op.
> 
> Maybe originally it verbosely output the extracted files.
> 
 EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm 
 pkg_pretend  
>>>
>>> We usually do this on top, and it's better to do it outside guards so
>>> that order from inherit is always respected.  
>>
>> we will move it up. I don't get your second comment. Do you mean the
>> case someone does
>>
>> inherit intel-sdp-r1 some-other-eclass intel-sdp
>>
>> ?
> 
> Rather something unlikely like:
> 
>   inherit foo bar intel-sdp-r1
> 
> where foo inherits 

Re: [gentoo-dev] RFC: intel-sdp-r1.eclass

2016-02-15 Thread Michał Górny
On Mon, 15 Feb 2016 14:37:41 +0100
"Justin Lecher (jlec)"  wrote:

> On 15/02/16 13:59, Michał Górny wrote:
> > On Mon, 15 Feb 2016 09:16:53 +0100
> > "Justin Lecher (jlec)"  wrote:
> >   
> >> # @ECLASS-VARIABLE: INTEL_SUBDIR
> >> # @DEFAULT_UNSET
> >> # @DESCRIPTION:
> >> # The package sub-directory where it will end-up in /opt/intel
> >> # To find out its value, you have to do a raw install from the Intel tar 
> >> ball  
> > 
> > To be honest, I find this kinda terrible. There's a huge block of docs
> > which makes me feel small and confused. Maybe it'd useful to give some
> > semi-complete example on top (in global doc)?  
> 
> That makes definitely make sense. We will add one.
> 
> Although nobody other then the maintainer of this eclass will ever use it.

Remember that maintainers can change. It's better to have good then
have new maintainers figure out all stuff over again.

> >> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
> >> : ${INTEL_BIN_RPMS:=()}  
> > 
> > $ : ${foo:=()}
> > $ declare -p foo
> > declare -- foo="()"
> > 
> > In other words, it doesn't work the way you expect it to.  
> 
> I already wondered about this. Is there any way to force a variable to
> be an array in bash? Or define it as an empty array?

Look at e.g. python-utils-r1.

To check for array:

  if [[ $(declare -p foo) != "declare -a"* ]]; then
...
  fi

To default to empty, simple (yet a bit imperfect) way:

  [[ ${foo[@]} }] || foo=()

> >> # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
> >> # @DESCRIPTION:
> >> # Unset, if only the multilib package will be provided by intel
> >> : ${INTEL_SINGLE_ARCH:=true}  
> > 
> > This is really weird. It sounds like I'm supposed to do:
> > 
> >   inherit intel-sdp-r1
> >   unset INTEL_SINGLE_ARCH
> > 
> > I suggest you used positive logic instead.  
> 
> The wording is wrong. Setting it to anything but "true" like
> "INTEL_SINGLE_ARCH=false" works. We will fix the wording.

I still think positive logic is better. That is, a variable which
defaults to, say, unset, and changes behavior if it becomes set to
non-empty value.

> >> _isdp_big-warning() {
> >>debug-print-function ${FUNCNAME} "${@}"
> >>
> >>case ${1} in
> >>pre-check )
> >>echo ""  
> > 
> > Don't mix echo with ewarn.  
> 
> Why?

Because they won't go through the same output channels.

> >>
> >> comp_full="${ED}/${INTEL_SDP_DIR}/linux/bin/${arch}/${comp}"  
> > 
> > Double slash imminent (ED has one).  
> 
> Always? Per definition?

Yes, sadly. i wanted to change this but it's unlikely to go since it
makes EAPI migration hard. If you really want to cover both cases, you
can always do ${foo%/}/bar.

> >> # @CODE  
> > 
> > Err, this is not code, you know.  
> 
> This is needed for nice formatting. Otherwise there is no line break

Add an empty line between the two. That should do it correctly, without
code blocks in devmanual.

> >>#maybe use nullglob or [[ $(echo ${dir/*lic) != 
> >> "${dir}/*lic" ]]
> >>[[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?  
> > 
> > Maybe you should use something sane indeed.

Maybe file_exists from eutils could help here btw.

> > Wouldn't you be able to collapse that into one loop?  
> 
> no, because the first has ${INTEL_X86}.rpm as suffeix and the later has
> ${INTEL_X86}.rpm.

Er... am I reading wrong, or did you just type the same thing twice?

> >>einfo "Unpacking ${rb}"
> >>rpm2tar -O ${r} | tar xvf - | sed -e \
> >>"s:^\.:${EROOT#/}:g" > /dev/null; assert 
> >> "unpacking ${r} failed"  
> > 
> > What's the deal with this sed?  
> 
> Good question, but it was there since always and probably the original
> author had good reasons for it. We will look into it and comment the code.

Didn't it change in the past? As I see it, tar here outputs file names,
sed edits them and then you discard them to /dev/null. In this case,
sed doesn't return any specific exit code so it seems to be a complete
no-op.

Maybe originally it verbosely output the extracted files.

> >> EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm 
> >> pkg_pretend  
> > 
> > We usually do this on top, and it's better to do it outside guards so
> > that order from inherit is always respected.  
> 
> we will move it up. I don't get your second comment. Do you mean the
> case someone does
> 
> inherit intel-sdp-r1 some-other-eclass intel-sdp
> 
> ?

Rather something unlikely like:

  inherit foo bar intel-sdp-r1

where foo inherits intel-sdp-r1, and therefore the exports occur before
bar, and bar takes over even though intel-sdp-r1 is explicitly
listed last.

-- 
Best regards,
Michał Górny



pgphcHLAeH1_H.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: intel-sdp-r1.eclass

2016-02-15 Thread Justin Lecher (jlec)
On 15/02/16 13:59, Michał Górny wrote:
> On Mon, 15 Feb 2016 09:16:53 +0100
> "Justin Lecher (jlec)"  wrote:
> 
>> # Copyright 1999-2016 Gentoo Foundation
>> # Distributed under the terms of the GNU General Public License v2
>> # $Id$
>>
>> # @ECLASS: intel-sdp-r1.eclass
>> # @MAINTAINER:
>> # Justin Lecher 
>> # David Seifert 
>> # Sci Team 
>> # @BLURB: Handling of Intel's Software Development Products package 
>> management
>>
>> if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then
>>
>> case "${EAPI:-0}" in
> 
> :-0 is meaningless here.
> 
>>  6) ;;
>>  *) die "EAPI=${EAPI} is not supported" ;;
> 
> If at all, it could be helpful here.

We had that before, will fix it.

> 
>> esac
>>
>> # @ECLASS-VARIABLE: INTEL_DID
>> # @DEFAULT_UNSET
>> # @DESCRIPTION:
>> # The package download ID from Intel.
>> # To find out its value, see the links to download in
>> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
>> #
>> # e.g. 8365
>> #
>> # Must be defined before inheriting the eclass
>>
>> # @ECLASS-VARIABLE: INTEL_DPN
>> # @DEFAULT_UNSET
>> # @DESCRIPTION:
>> # The package name to download from Intel.
>> # To find out its value, see the links to download in
>> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
>> #
>> # e.g. parallel_studio_xe
>> #
>> # Must be defined before inheriting the eclass
>>
>> # @ECLASS-VARIABLE: INTEL_DPV
>> # @DEFAULT_UNSET
>> # @DESCRIPTION:
>> # The package download version from Intel.
>> # To find out its value, see the links to download in
>> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
>> #
>> # e.g. 2016_update1
>> #
>> # Must be defined before inheriting the eclass
>>
>> # @ECLASS-VARIABLE: INTEL_TARX
>> # @DESCRIPTION:
>> # The package extention.
> 
> Extension. Or if you're not on Windows, then 'suffix'.

Fair enough.

> 
>> # To find out its value, see the links to download in
>> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
>> #
>> # e.g. tar.gz
>> #
>> # Must be defined before inheriting the eclass
>> : ${INTEL_TARX:=tgz}
>>
>> # @ECLASS-VARIABLE: INTEL_SUBDIR
>> # @DEFAULT_UNSET
>> # @DESCRIPTION:
>> # The package sub-directory where it will end-up in /opt/intel
>> # To find out its value, you have to do a raw install from the Intel tar ball
> 
> To be honest, I find this kinda terrible. There's a huge block of docs
> which makes me feel small and confused. Maybe it'd useful to give some
> semi-complete example on top (in global doc)?

That makes definitely make sense. We will add one.

Although nobody other then the maintainer of this eclass will ever use it.

> 
>> # @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
>> # @DEFAULT_UNSET
>> # @DESCRIPTION:
>> # Possibility to skip the mandatory check for licenses. Only set this if 
>> there
>> # is really no fix.
>>
>> # @ECLASS-VARIABLE: INTEL_RPMS_DIR
>> # @DESCRIPTION:
>> # Main subdirectory which contains the rpms to extract.
>> : ${INTEL_RPMS_DIR:=rpm}
>>
>> # @ECLASS-VARIABLE: INTEL_X86
>> # @DESCRIPTION:
>> # 32bit arch in rpm names
>> #
>> # e.g. i486
>> : ${INTEL_X86:=i486}
>>
>> # @ECLASS-VARIABLE: INTEL_BIN_RPMS
>> # @DESCRIPTION:
>> # Functional name of rpm without any version/arch tag
>> # Has to be a bash array
>> #
>> # e.g. ("icc-l-all-devel")
>> #
>> # if the rpm is located in a directory other than INTEL_RPMS_DIR you can
>> # specify the full path
>> #
>> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
>> : ${INTEL_BIN_RPMS:=()}
> 
> $ : ${foo:=()}
> $ declare -p foo
> declare -- foo="()"
> 
> In other words, it doesn't work the way you expect it to.

I already wondered about this. Is there any way to force a variable to
be an array in bash? Or define it as an empty array?

> 
>> # @ECLASS-VARIABLE: INTEL_AMD64_RPMS
>> # @DESCRIPTION:
>> # AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS
>> # Has to be a bash array
>> : ${INTEL_AMD64_RPMS:=()}
>>
>> # @ECLASS-VARIABLE: INTEL_X86_RPMS
>> # @DESCRIPTION:
>> # X86 single arch rpms. Same syntax as INTEL_BIN_RPMS
>> # Has to be a bash array
>> : ${INTEL_X86_RPMS:=()}
>>
>> # @ECLASS-VARIABLE: INTEL_DAT_RPMS
>> # @DESCRIPTION:
>> # Functional name of rpm of common data which are arch free
>> # without any version tag
>> # Has to be a bash array
>> #
>> # e.g. ("openmp-l-all-devel")
>> #
>> # if the rpm is located in a directory different to INTEL_RPMS_DIR you can
>> # specify the full path
>> #
>> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common
>> : ${INTEL_DAT_RPMS:=()}
>>
>> # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
>> # @DESCRIPTION:
>> # Unset, if only the multilib package will be provided by intel
>> : ${INTEL_SINGLE_ARCH:=true}
> 
> This is really weird. It sounds like I'm supposed to do:
> 
>   inherit intel-sdp-r1
>   unset INTEL_SINGLE_ARCH
> 
> I suggest you used positive logic instead.

The wording is wrong. Setting it to anything but "true" like
"INTEL_SINGLE_ARCH=false" works. We will fix the wording.

> 
>> 

Re: [gentoo-dev] RFC: intel-sdp-r1.eclass

2016-02-15 Thread Michał Górny
On Mon, 15 Feb 2016 09:16:53 +0100
"Justin Lecher (jlec)"  wrote:

> # Copyright 1999-2016 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> # $Id$
> 
> # @ECLASS: intel-sdp-r1.eclass
> # @MAINTAINER:
> # Justin Lecher 
> # David Seifert 
> # Sci Team 
> # @BLURB: Handling of Intel's Software Development Products package management
> 
> if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then
> 
> case "${EAPI:-0}" in

:-0 is meaningless here.

>   6) ;;
>   *) die "EAPI=${EAPI} is not supported" ;;

If at all, it could be helpful here.

> esac
> 
> # @ECLASS-VARIABLE: INTEL_DID
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # The package download ID from Intel.
> # To find out its value, see the links to download in
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
> #
> # e.g. 8365
> #
> # Must be defined before inheriting the eclass
> 
> # @ECLASS-VARIABLE: INTEL_DPN
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # The package name to download from Intel.
> # To find out its value, see the links to download in
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
> #
> # e.g. parallel_studio_xe
> #
> # Must be defined before inheriting the eclass
> 
> # @ECLASS-VARIABLE: INTEL_DPV
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # The package download version from Intel.
> # To find out its value, see the links to download in
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
> #
> # e.g. 2016_update1
> #
> # Must be defined before inheriting the eclass
> 
> # @ECLASS-VARIABLE: INTEL_TARX
> # @DESCRIPTION:
> # The package extention.

Extension. Or if you're not on Windows, then 'suffix'.

> # To find out its value, see the links to download in
> # https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
> #
> # e.g. tar.gz
> #
> # Must be defined before inheriting the eclass
> : ${INTEL_TARX:=tgz}
> 
> # @ECLASS-VARIABLE: INTEL_SUBDIR
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # The package sub-directory where it will end-up in /opt/intel
> # To find out its value, you have to do a raw install from the Intel tar ball

To be honest, I find this kinda terrible. There's a huge block of docs
which makes me feel small and confused. Maybe it'd useful to give some
semi-complete example on top (in global doc)?

> # @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # Possibility to skip the mandatory check for licenses. Only set this if there
> # is really no fix.
> 
> # @ECLASS-VARIABLE: INTEL_RPMS_DIR
> # @DESCRIPTION:
> # Main subdirectory which contains the rpms to extract.
> : ${INTEL_RPMS_DIR:=rpm}
> 
> # @ECLASS-VARIABLE: INTEL_X86
> # @DESCRIPTION:
> # 32bit arch in rpm names
> #
> # e.g. i486
> : ${INTEL_X86:=i486}
> 
> # @ECLASS-VARIABLE: INTEL_BIN_RPMS
> # @DESCRIPTION:
> # Functional name of rpm without any version/arch tag
> # Has to be a bash array
> #
> # e.g. ("icc-l-all-devel")
> #
> # if the rpm is located in a directory other than INTEL_RPMS_DIR you can
> # specify the full path
> #
> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
> : ${INTEL_BIN_RPMS:=()}

$ : ${foo:=()}
$ declare -p foo
declare -- foo="()"

In other words, it doesn't work the way you expect it to.

> # @ECLASS-VARIABLE: INTEL_AMD64_RPMS
> # @DESCRIPTION:
> # AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS
> # Has to be a bash array
> : ${INTEL_AMD64_RPMS:=()}
> 
> # @ECLASS-VARIABLE: INTEL_X86_RPMS
> # @DESCRIPTION:
> # X86 single arch rpms. Same syntax as INTEL_BIN_RPMS
> # Has to be a bash array
> : ${INTEL_X86_RPMS:=()}
> 
> # @ECLASS-VARIABLE: INTEL_DAT_RPMS
> # @DESCRIPTION:
> # Functional name of rpm of common data which are arch free
> # without any version tag
> # Has to be a bash array
> #
> # e.g. ("openmp-l-all-devel")
> #
> # if the rpm is located in a directory different to INTEL_RPMS_DIR you can
> # specify the full path
> #
> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common
> : ${INTEL_DAT_RPMS:=()}
> 
> # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
> # @DESCRIPTION:
> # Unset, if only the multilib package will be provided by intel
> : ${INTEL_SINGLE_ARCH:=true}

This is really weird. It sounds like I'm supposed to do:

  inherit intel-sdp-r1
  unset INTEL_SINGLE_ARCH

I suggest you used positive logic instead.

> MULTILIB_COMPAT=( abi_x86_{32,64} )
> 
> inherit check-reqs eutils multilib-build versionator
> 
> _INTEL_PV1=$(get_version_component_range 1)
> _INTEL_PV2=$(get_version_component_range 2)
> _INTEL_PV3=$(get_version_component_range 3)
> _INTEL_PV4=$(get_version_component_range 4)

I'm pretty sure there's a better way than calling the same function
four times. For example:

  _INTEL_PV=( $(get_version_components) )

Plus, please reduce the environment pollution. Either unset all those
variables when no longer needed, or preferably create a function for
setting globals and make them local.

> _INTEL_PV=""
> [[ -n ${_INTEL_PV4} ]] && 

[gentoo-dev] RFC: intel-sdp-r1.eclass

2016-02-15 Thread Justin Lecher (jlec)
Hi everyone,

We (actually mostly soap) rewrote parts of the intel-sdp.eclass and
decided to revbump it. Please review our changes.

Changes are:

* Move from EAPI=5 to 6
* Adopt to changed packaging layout
* Use ABI_ instead of multilib
* Drop eclipse support
* Require all RPM lists to be arrays
* Don't record in installation db


Thanks,

Justin
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

# @ECLASS: intel-sdp-r1.eclass
# @MAINTAINER:
# Justin Lecher 
# David Seifert 
# Sci Team 
# @BLURB: Handling of Intel's Software Development Products package management

if [[ ! ${_INTEL_SDP_R1_ECLASS_} ]]; then

case "${EAPI:-0}" in
6) ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac

# @ECLASS-VARIABLE: INTEL_DID
# @DEFAULT_UNSET
# @DESCRIPTION:
# The package download ID from Intel.
# To find out its value, see the links to download in
# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
#
# e.g. 8365
#
# Must be defined before inheriting the eclass

# @ECLASS-VARIABLE: INTEL_DPN
# @DEFAULT_UNSET
# @DESCRIPTION:
# The package name to download from Intel.
# To find out its value, see the links to download in
# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
#
# e.g. parallel_studio_xe
#
# Must be defined before inheriting the eclass

# @ECLASS-VARIABLE: INTEL_DPV
# @DEFAULT_UNSET
# @DESCRIPTION:
# The package download version from Intel.
# To find out its value, see the links to download in
# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
#
# e.g. 2016_update1
#
# Must be defined before inheriting the eclass

# @ECLASS-VARIABLE: INTEL_TARX
# @DESCRIPTION:
# The package extention.
# To find out its value, see the links to download in
# https://registrationcenter.intel.com/RegCenter/MyProducts.aspx
#
# e.g. tar.gz
#
# Must be defined before inheriting the eclass
: ${INTEL_TARX:=tgz}

# @ECLASS-VARIABLE: INTEL_SUBDIR
# @DEFAULT_UNSET
# @DESCRIPTION:
# The package sub-directory where it will end-up in /opt/intel
# To find out its value, you have to do a raw install from the Intel tar ball

# @ECLASS-VARIABLE: INTEL_SKIP_LICENSE
# @DEFAULT_UNSET
# @DESCRIPTION:
# Possibility to skip the mandatory check for licenses. Only set this if there
# is really no fix.

# @ECLASS-VARIABLE: INTEL_RPMS_DIR
# @DESCRIPTION:
# Main subdirectory which contains the rpms to extract.
: ${INTEL_RPMS_DIR:=rpm}

# @ECLASS-VARIABLE: INTEL_X86
# @DESCRIPTION:
# 32bit arch in rpm names
#
# e.g. i486
: ${INTEL_X86:=i486}

# @ECLASS-VARIABLE: INTEL_BIN_RPMS
# @DESCRIPTION:
# Functional name of rpm without any version/arch tag
# Has to be a bash array
#
# e.g. ("icc-l-all-devel")
#
# if the rpm is located in a directory other than INTEL_RPMS_DIR you can
# specify the full path
#
# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
: ${INTEL_BIN_RPMS:=()}

# @ECLASS-VARIABLE: INTEL_AMD64_RPMS
# @DESCRIPTION:
# AMD64 single arch rpms. Same syntax as INTEL_BIN_RPMS
# Has to be a bash array
: ${INTEL_AMD64_RPMS:=()}

# @ECLASS-VARIABLE: INTEL_X86_RPMS
# @DESCRIPTION:
# X86 single arch rpms. Same syntax as INTEL_BIN_RPMS
# Has to be a bash array
: ${INTEL_X86_RPMS:=()}

# @ECLASS-VARIABLE: INTEL_DAT_RPMS
# @DESCRIPTION:
# Functional name of rpm of common data which are arch free
# without any version tag
# Has to be a bash array
#
# e.g. ("openmp-l-all-devel")
#
# if the rpm is located in a directory different to INTEL_RPMS_DIR you can
# specify the full path
#
# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common
: ${INTEL_DAT_RPMS:=()}

# @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
# @DESCRIPTION:
# Unset, if only the multilib package will be provided by intel
: ${INTEL_SINGLE_ARCH:=true}

MULTILIB_COMPAT=( abi_x86_{32,64} )

inherit check-reqs eutils multilib-build versionator

_INTEL_PV1=$(get_version_component_range 1)
_INTEL_PV2=$(get_version_component_range 2)
_INTEL_PV3=$(get_version_component_range 3)
_INTEL_PV4=$(get_version_component_range 4)
_INTEL_PV=""
[[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="${_INTEL_PV4}-"
[[ -n ${_INTEL_PV1} ]] && _INTEL_PV+="${_INTEL_PV1}"
[[ -n ${_INTEL_PV2} ]] && _INTEL_PV+=".${_INTEL_PV2}"
[[ -n ${_INTEL_PV3} ]] && _INTEL_PV+=".${_INTEL_PV3}"
[[ -n ${_INTEL_PV4} ]] && _INTEL_PV+="-${_INTEL_PV4}"

_INTEL_URI="http://registrationcenter-download.intel.com/akdlm/irc_nas/${INTEL_DID}/${INTEL_DPN};

if [ ${INTEL_SINGLE_ARCH} == true ]; then
SRC_URI="
abi_x86_32? ( ${_INTEL_URI}_${INTEL_DPV}_ia32.${INTEL_TARX} )
abi_x86_64? ( ${_INTEL_URI}_${INTEL_DPV}_intel64.${INTEL_TARX} 
)"
else
SRC_URI="${_INTEL_URI}_${INTEL_DPV}.${INTEL_TARX}"
fi

LICENSE="Intel-SDP"
# Future work, #394411
#SLOT="${_INTEL_PV1}.${_INTEL_PV2}"
SLOT="0"

RESTRICT="mirror"

RDEPEND=""
DEPEND="app-arch/rpm2targz"

_INTEL_SDP_YEAR=${INTEL_DPV}
_INTEL_SDP_YEAR=${_INTEL_SDP_YEAR%_sp*}
_INTEL_SDP_YEAR=${_INTEL_SDP_YEAR%_update*}

#