Repository: spack/spack

Issue:
Issues with installing licensed software
I'm not sure exactly when this bug was introduced, but I'm trying to install `intel-parallel-studio` and it's crashing with the following error message:

```
Traceback (most recent call last):
  File "/soft/spack-0.9.1/bin/spack", line 202, in <module>
    main()
  File "/soft/spack-0.9.1/bin/spack", line 179, in main
    return_val = command(parser, args)
  File "/blues/gpfs/home/software/spack-0.9.1/lib/spack/spack/cmd/install.py", line 340, in install
    package.do_install(**kwargs)
  File "/blues/gpfs/home/software/spack-0.9.1/lib/spack/spack/package.py", line 1270, in do_install
    spack.build_environment.fork(self, build_process, dirty=dirty)
  File "/blues/gpfs/home/software/spack-0.9.1/lib/spack/spack/build_environment.py", line 547, in fork
    raise exception
OSError: [Errno 2] No such file or directory: '/blues/gpfs/home/software/spack-0.9.1/opt/spack/linux-centos6-x86_64/gcc-4.4.7/intel-parallel-studio-professional.2017.0-7o7tfdlavk3ibijg7mnqwpnutao5busx/inspector_xe/licenses'
```

The way I understand it, the license hooks I added create a global license file before installing and then create symlinks afterwards. So I'm guessing it's not creating the symlinks afterwards anymore? 

@lee218llnl @alalazo



Discussion:
@adamjstewart Not sure if this is the issue, but with the 2017 version Intel dropped the "_xe" suffix for Inspector, so you may want to modify the license directory from  os.mkdir(os.path.join(self.prefix, "inspector_xe/licenses")) to os.mkdir(os.path.join(self.prefix, "inspector/licenses")). The same is true with Advisor. And to make things fuzzy, this is NOT the case with VTune, which keeps the _xe suffix.

Great, that's confusing. Also, I'm now getting the following error message:

```
'./install.sh' '--silent' 'silent.cfg'
COMPONENTS parameter in silent configuration file contains invalid values:
intel-icsxe-pset
```

That component is in `pset/mediaconfig.xml`, but apparently it's invalid? Looks like we need a workaround for this too.


Resolving patch:
diff --git a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
--- a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
+++ b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py
@@ -184,15 +184,24 @@ def install(self, spec, prefix):
                                                           "license.lic"))
         if spec.satisfies('+tools') and (spec.satisfies('@cluster') or
                                          spec.satisfies('@professional')):
-            os.mkdir(os.path.join(self.prefix, "inspector_xe/licenses"))
+            inspector_dir = "inspector_xe/licenses"
+            advisor_dir = "advisor_xe/licenses"
+            vtune_amplifier_dir = "vtune_amplifier_xe/licenses"
+
+            year = int(str(self.version).split('.')[1])
+            if year >= 2017:
+                inspector_dir = "inspector/licenses"
+                advisor_dir = "advisor/licenses"
+
+            os.mkdir(os.path.join(self.prefix, inspector_dir))
             os.symlink(self.global_license_file, os.path.join(
-                self.prefix, "inspector_xe/licenses", "license.lic"))
-            os.mkdir(os.path.join(self.prefix, "advisor_xe/licenses"))
+                self.prefix, inspector_dir, "license.lic"))
+            os.mkdir(os.path.join(self.prefix, advisor_dir))
             os.symlink(self.global_license_file, os.path.join(
-                self.prefix, "advisor_xe/licenses", "license.lic"))
-            os.mkdir(os.path.join(self.prefix, "vtune_amplifier_xe/licenses"))
+                self.prefix, advisor_dir, "license.lic"))
+            os.mkdir(os.path.join(self.prefix, vtune_amplifier_dir))
             os.symlink(self.global_license_file, os.path.join(
-                self.prefix, "vtune_amplifier_xe/licenses", "license.lic"))
+                self.prefix, vtune_amplifier_dir, "license.lic"))
 
         if (spec.satisfies('+all') or spec.satisfies('+mpi')) and \
                 spec.satisfies('@cluster'):


Test patch: