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.
This commit is contained in:
parent
95c8ecb6f5
commit
5ebddcd5e3
@ -960,7 +960,7 @@ def from_list_url(pkg):
|
|||||||
the specified package's version."""
|
the specified package's version."""
|
||||||
if pkg.list_url:
|
if pkg.list_url:
|
||||||
try:
|
try:
|
||||||
versions = pkg.fetch_remote_package_versions()
|
versions = pkg.fetch_remote_versions()
|
||||||
try:
|
try:
|
||||||
url_from_list = versions[pkg.version]
|
url_from_list = versions[pkg.version]
|
||||||
digest = None
|
digest = None
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
from llnl.util.filesystem import working_dir, is_exe
|
from llnl.util.filesystem import working_dir, is_exe
|
||||||
|
|
||||||
import spack
|
import spack
|
||||||
|
from spack.fetch_strategy import from_list_url, URLFetchStrategy
|
||||||
from spack.spec import Spec
|
from spack.spec import Spec
|
||||||
from spack.version import ver
|
from spack.version import ver
|
||||||
import spack.util.crypto as crypto
|
import spack.util.crypto as crypto
|
||||||
@ -82,6 +83,20 @@ def test_fetch(
|
|||||||
assert 'echo Building...' in contents
|
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):
|
def test_hash_detection(checksum_type):
|
||||||
algo = crypto.hashes[checksum_type]()
|
algo = crypto.hashes[checksum_type]()
|
||||||
h = 'f' * (algo.digest_size * 2) # hex -> bytes
|
h = 'f' * (algo.digest_size * 2) # hex -> bytes
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
##############################################################################
|
||||||
|
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
|
||||||
|
# Produced at the Lawrence Livermore National Laboratory.
|
||||||
|
#
|
||||||
|
# This file is part of Spack.
|
||||||
|
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
||||||
|
# LLNL-CODE-647188
|
||||||
|
#
|
||||||
|
# For details, see https://github.com/llnl/spack
|
||||||
|
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License (as
|
||||||
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
|
||||||
|
# conditions of the GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
##############################################################################
|
||||||
|
from spack import *
|
||||||
|
|
||||||
|
import os
|
||||||
|
import spack
|
||||||
|
|
||||||
|
|
||||||
|
class UrlListTest(Package):
|
||||||
|
"""Mock package with url_list."""
|
||||||
|
homepage = "http://www.url-list-example.com"
|
||||||
|
|
||||||
|
web_data_path = os.path.join(spack.test_path, 'data', 'web')
|
||||||
|
url = 'file://' + web_data_path + '/foo-0.0.0.tar.gz'
|
||||||
|
list_url = 'file://' + web_data_path + '/index.html'
|
||||||
|
list_depth = 3
|
||||||
|
|
||||||
|
version('0.0.0')
|
||||||
|
version('1.0.0')
|
||||||
|
version('3.0')
|
||||||
|
version('4.5')
|
||||||
|
version('2.0.0b2')
|
||||||
|
version('3.0a1')
|
||||||
|
version('4.5-rc5')
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user