Repository: spack/spack

Issue:
Installation issue: parse extension error of cray-libsci
When I tried to install the cray-libsci package, the following error occurred.
```
$ spack install cray-libsci
==> Warning: Missing a source id for cray-libsci@18.11.1.2
==> Error: Unable to parse extension from http://www.nersc.gov/users/software/programming-libraries/math-libraries/libsci/.

If this URL is for a tarball but does not include the file extension
in the name, you can explicitly declare it with the following syntax:

    version('1.2.3', 'hash', extension='tar.gz')

If this URL is for a download like a .jar or .whl that does not need
to be expanded, or an uncompressed installation script, you can tell
Spack not to expand it with the following syntax:

    version('1.2.3', 'hash', expand=False)
```
Is this package supposed to include external libraries?
In that case, it seems unnecessary to define `url` and `version`.

We also think that it is necessary to define a `conflict` if the available environment(ex. architecture) is limited.

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install cray-libsci
```
### Information on your system

* **Spack:** 0.11.2-8091-944ea18b9
* **Python:** 3.7.7
* **Platform:** linux-rhel8-a64fx

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [ ] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [ ] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:
This package cannot be downloaded, it comes vendored with Cray hardware. You're supposed to add it as an external package in `packages.yaml` to use it.

@tldahlgren is there any way we could make this more clear for packages like this? `spack external find` support would also help.
Note:
1) `spack maintainers cray-libsci` doesn't return anything because there are no maintainers listed in the package
2) Only two individuals have worked on this package: @junghans and @becker33 
3) The package's `homepage` and `url` are outdated
> This package cannot be downloaded, it comes vendored with Cray hardware. You're supposed to add it as an external package in `packages.yaml` to use it.
> 
> @tldahlgren is there any way we could make this more clear for packages like this?

Certainly, given the right information.

The warning and error each come from one place each in the code.  The first from `package.py` and the second from `mirror.py`.   So the issue would be how to determine that the package is external.  

> `spack external find` support would also help.

I am not familiar with this command so would have to dig into it to address the issue.



@tldahlgren I'm just wondering if we could do something similar to what you did for packages that must be manually downloaded and print a warning message saying that this package must be vendored.

`spack external find` searches for specific executables in your `PATH`, queries the version, and adds them to the `packages.yaml`. I'm not sure if `cray-libsci` has any corresponding executable though.
Right now the only thing I see in its package that even *hints* that it is external is the `external_prefix` property.  And it appears to be the only built-in package that has such a property.

Based on the `lustre` package's solution, it looks like this package should be raising an `InstallError`.
> `spack external find` searches for specific executables in your `PATH`, queries the version, and adds them to the `packages.yaml`. I'm not sure if `cray-libsci` has any corresponding executable though.

According to Greg B. it does not.  But options are being discussed that could help with this eventually.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/cray-libsci/package.py b/var/spack/repos/builtin/packages/cray-libsci/package.py
--- a/var/spack/repos/builtin/packages/cray-libsci/package.py
+++ b/var/spack/repos/builtin/packages/cray-libsci/package.py
@@ -2,7 +2,6 @@
 # Spack Project Developers. See the top-level COPYRIGHT file for details.
 #
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
-from spack.concretize import NoBuildError
 from spack.util.module_cmd import module
 from spack.util.module_cmd import get_path_args_from_module_line
 
@@ -11,8 +10,8 @@ class CrayLibsci(Package):
     """The Cray Scientific Libraries package, LibSci, is a collection of
     numerical routines optimized for best performance on Cray systems."""
 
-    homepage = "http://www.nersc.gov/users/software/programming-libraries/math-libraries/libsci/"
-    url      = "http://www.nersc.gov/users/software/programming-libraries/math-libraries/libsci/"
+    homepage = "https://docs.nersc.gov/development/libraries/libsci/"
+    has_code = False    # Skip attempts to fetch source that is not available
 
     version("18.11.1.2")
     version("16.11.1")
@@ -78,4 +77,6 @@ def scalapack_libs(self):
         return self.blas_libs
 
     def install(self, spec, prefix):
-        raise NoBuildError(spec)
+        raise InstallError(
+            self.spec.format('{name} is not installable, you need to specify '
+                             'it as an external package in packages.yaml'))


Test patch: