Repository: spack/spack

Issue:
mrnet can't detect version error
When I try to build mrnet with these commands I get the error message that spack can't detect the version of mrnet in https://github.com/dyninst/mrnet.git.
There seems to be a problem with the mrnet package.py file with regards to finding the source code to use for the build.

[jeg@localhost packages]$ spack install mrnet
==> Installing mrnet
==> boost is already installed in /home/jeg/spack/opt/spack/linux-fedora19-x86_64/gcc-4.8.3/boost-1.61.0-wngezegu6antkdja4gjfuo3h3xec5qpi
==> Error: Couldn't detect version in: https://github.com/dyninst/mrnet.git
==> Error: Installation process had nonzero exit code : 256
[jeg@localhost packages]$ 

spack install mrnet@5.0.1-2
==> Installing mrnet
==> boost is already installed in /home/jeg/spack/opt/spack/linux-fedora19-x86_64/gcc-4.8.3/boost-1.61.0-wngezegu6antkdja4gjfuo3h3xec5qpi
==> Error: Couldn't detect version in: https://github.com/dyninst/mrnet.git
==> Error: Installation process had nonzero exit code : 256
[jeg@localhost packages]$ 

[jeg@localhost packages]$ spack install mrnet@5.0.1:
==> Installing mrnet
==> boost is already installed in /home/jeg/spack/opt/spack/linux-fedora19-x86_64/gcc-4.8.3/boost-1.61.0-wngezegu6antkdja4gjfuo3h3xec5qpi
==> Error: Couldn't detect version in: https://github.com/dyninst/mrnet.git
==> Error: Installation process had nonzero exit code : 256
[jeg@localhost packages]$ spack install mrnet@5.0.1-2:
==> Installing mrnet
==> boost is already installed in /home/jeg/spack/opt/spack/linux-fedora19-x86_64/gcc-4.8.3/boost-1.61.0-wngezegu6antkdja4gjfuo3h3xec5qpi
==> Error: Couldn't detect version in: https://github.com/dyninst/mrnet.git
==> Error: Installation process had nonzero exit code : 256

If I comment out this line, then spack will build the 5.0.1 version by default (spack install mrnet)
version('5.0.1-2', git='https://github.com/dyninst/mrnet.git', commit='20b1eacfc6d680d9f6472146d2dfaa0f900cc2e9')

spack install mrnet@5.0.1 does work though.



Discussion:
This is related to #1346. What is happening is that when the default_fetcher object is parsed it throws an error as it can not determine the version from the git URL. The error is coming from `lib/spack/spack/util/web.py`. The mrnet package has a url and a list_url in the package file which are the conditions to do the check. I think the thing to do is catch that error, print a message, and move on. I will work up a PR for that.


Resolving patch:
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -321,15 +321,19 @@ def fetch(self, mirror_only=False):
             package_name = os.path.dirname(self.mirror_path)
             pkg = spack.repo.get(package_name)
             if pkg.list_url is not None and pkg.url is not None:
-                archive_version = spack.url.parse_version(
-                    self.default_fetcher.url)
-                versions = pkg.fetch_remote_versions()
                 try:
-                    url_from_list = versions[Version(archive_version)]
-                    fetchers.append(fs.URLFetchStrategy(url_from_list, digest))
-                except KeyError:
-                    tty.msg("Can not find version %s in url_list" %
-                            archive_version)
+                    archive_version = spack.url.parse_version(
+                        self.default_fetcher.url)
+                    versions = pkg.fetch_remote_versions()
+                    try:
+                        url_from_list = versions[Version(archive_version)]
+                        fetchers.append(fs.URLFetchStrategy(
+                            url_from_list, digest))
+                    except KeyError:
+                        tty.msg("Can not find version %s in url_list" %
+                                archive_version)
+                except:
+                    tty.msg("Could not determine url from list_url.")
 
         for fetcher in fetchers:
             try:


Test patch: