summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Kosukhin <skosukhin@gmail.com>2017-10-28 02:41:41 +0200
committerscheibelp <scheibel1@llnl.gov>2017-10-27 17:41:41 -0700
commit5ebddcd5e3491887e34571e0d02e4c992ab531c0 (patch)
treea519c61c8844ff4ebd456a28131e55399ef9281f /lib
parent95c8ecb6f503fada33056aabcf081bf857c28f53 (diff)
downloadspack-5ebddcd5e3491887e34571e0d02e4c992ab531c0.tar.gz
spack-5ebddcd5e3491887e34571e0d02e4c992ab531c0.tar.bz2
spack-5ebddcd5e3491887e34571e0d02e4c992ab531c0.tar.xz
spack-5ebddcd5e3491887e34571e0d02e4c992ab531c0.zip
Bugfix: from_list_url(). (#5780)
This fixes a bug in from_list_url where it was referring to a method which no longer exists. This also adds a test for the from_list_url function.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/fetch_strategy.py2
-rw-r--r--lib/spack/spack/test/url_fetch.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 9aa6b9afd1..45513654c9 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -960,7 +960,7 @@ def from_list_url(pkg):
the specified package's version."""
if pkg.list_url:
try:
- versions = pkg.fetch_remote_package_versions()
+ versions = pkg.fetch_remote_versions()
try:
url_from_list = versions[pkg.version]
digest = None
diff --git a/lib/spack/spack/test/url_fetch.py b/lib/spack/spack/test/url_fetch.py
index fba087dc99..8ce8be5e9d 100644
--- a/lib/spack/spack/test/url_fetch.py
+++ b/lib/spack/spack/test/url_fetch.py
@@ -28,6 +28,7 @@ import pytest
from llnl.util.filesystem import working_dir, is_exe
import spack
+from spack.fetch_strategy import from_list_url, URLFetchStrategy
from spack.spec import Spec
from spack.version import ver
import spack.util.crypto as crypto
@@ -82,6 +83,20 @@ def test_fetch(
assert 'echo Building...' in contents
+def test_from_list_url(builtin_mock, config):
+ pkg = spack.repo.get('url-list-test', new=True)
+ for ver_str in ['0.0.0', '1.0.0', '2.0.0',
+ '3.0', '4.5', '2.0.0b2',
+ '3.0a1', '4.5-rc5']:
+ spec = Spec('url-list-test@%s' % ver_str)
+ spec.concretize()
+ pkg.spec = spec
+ fetch_strategy = from_list_url(pkg)
+ assert isinstance(fetch_strategy, URLFetchStrategy)
+ assert (os.path.basename(fetch_strategy.url) ==
+ ('foo-' + ver_str + '.tar.gz'))
+
+
def test_hash_detection(checksum_type):
algo = crypto.hashes[checksum_type]()
h = 'f' * (algo.digest_size * 2) # hex -> bytes