Add tests for spack external dependencies, plus fixes for issues found by those tests.
This commit is contained in:
parent
e4d2ba30b5
commit
18f0b24a7f
8 changed files with 191 additions and 5 deletions
|
@ -85,8 +85,8 @@ def _valid_virtuals_and_externals(self, spec):
|
|||
provider_cmp = partial(spack.pkgsort.provider_compare, spec_w_preferred_providers.name, spec.name)
|
||||
packages = sorted(providers, cmp=provider_cmp)
|
||||
else:
|
||||
if not spec_externals(spec) or spec.external:
|
||||
return None
|
||||
if spec.external:
|
||||
return False
|
||||
packages = [spec]
|
||||
|
||||
# For each candidate package, if it has externals add those to the candidates
|
||||
|
@ -129,7 +129,7 @@ def concretize_virtual_and_external(self, spec):
|
|||
#Try a looser ABI matching
|
||||
candidate = next((c for c in candidates if spack.abi.compatible(c[0], other_spec, loose=True)), None)
|
||||
if not candidate:
|
||||
#Pick the first choice
|
||||
#No ABI matches. Pick the top choice based on the orignal preferences.
|
||||
candidate = candidates[0]
|
||||
external = candidate[1]
|
||||
candidate_spec = candidate[0]
|
||||
|
@ -144,10 +144,11 @@ def concretize_virtual_and_external(self, spec):
|
|||
if not spec.external and external:
|
||||
spec.external = external
|
||||
changed = True
|
||||
|
||||
#If we're external then trim the dependencies
|
||||
if external and spec.dependencies:
|
||||
changed = True
|
||||
spec.depencencies = DependencyMap()
|
||||
spec.dependencies = DependencyMap()
|
||||
|
||||
return changed
|
||||
|
||||
|
|
|
@ -1022,7 +1022,7 @@ def _normalize_helper(self, visited, spec_deps, provider_index):
|
|||
|
||||
# if we descend into a virtual spec, there's nothing more
|
||||
# to normalize. Concretize will finish resolving it later.
|
||||
if self.virtual:
|
||||
if self.virtual or self.external:
|
||||
return False
|
||||
|
||||
# Combine constraints from package deps with constraints from
|
||||
|
|
|
@ -192,3 +192,31 @@ def test_compiler_inheritance(self):
|
|||
# TODO: not exactly the syntax I would like.
|
||||
self.assertTrue(spec['libdwarf'].compiler.satisfies('clang'))
|
||||
self.assertTrue(spec['libelf'].compiler.satisfies('clang'))
|
||||
|
||||
|
||||
def test_external_package(self):
|
||||
spec = Spec('externaltool')
|
||||
spec.concretize()
|
||||
|
||||
self.assertEqual(spec['externaltool'].external, '/path/to/external_tool')
|
||||
self.assertFalse('externalprereq' in spec)
|
||||
self.assertTrue(spec['externaltool'].compiler.satisfies('gcc'))
|
||||
|
||||
|
||||
def test_nobuild_package(self):
|
||||
got_error = False
|
||||
spec = Spec('externaltool%clang')
|
||||
try:
|
||||
spec.concretize()
|
||||
except spack.concretize.NoBuildError:
|
||||
got_error = True
|
||||
self.assertTrue(got_error)
|
||||
|
||||
|
||||
def test_external_and_virtual(self):
|
||||
spec = Spec('externaltest')
|
||||
spec.concretize()
|
||||
self.assertTrue(spec['externaltool'].external, '/path/to/external_tool')
|
||||
self.assertTrue(spec['stuff'].external, '/path/to/external_virtual_gcc')
|
||||
self.assertTrue(spec['externaltool'].compiler.satisfies('gcc'))
|
||||
self.assertTrue(spec['stuff'].compiler.satisfies('gcc'))
|
||||
|
|
13
var/spack/mock_configs/site_spackconfig/packages.yaml
Normal file
13
var/spack/mock_configs/site_spackconfig/packages.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
packages:
|
||||
- externaltool:
|
||||
nobuild: True
|
||||
- externaltool@1.0%gcc@4.5.0:
|
||||
path: /path/to/external_tool
|
||||
- externalvirtual@2.0%clang@3.3:
|
||||
path: /path/to/external_virtual_clang
|
||||
nobuild: True
|
||||
- externalvirtual@1.0%gcc@4.5.0:
|
||||
path: /path/to/external_virtual_gcc
|
||||
nobuild: True
|
||||
|
||||
|
34
var/spack/mock_packages/externalprereq/package.py
Normal file
34
var/spack/mock_packages/externalprereq/package.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
##############################################################################
|
||||
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
|
||||
# Produced at the Lawrence Livermore National Laboratory.
|
||||
#
|
||||
# This file is part of Spack.
|
||||
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
||||
# LLNL-CODE-647188
|
||||
#
|
||||
# For details, see https://scalability-llnl.github.io/spack
|
||||
# Please also see the LICENSE file 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 General Public License (as published by
|
||||
# the Free Software Foundation) version 2.1 dated 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 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 *
|
||||
|
||||
class Externalprereq(Package):
|
||||
homepage = "http://somewhere.com"
|
||||
url = "http://somewhere.com/prereq-1.0.tar.gz"
|
||||
|
||||
version('1.4', 'f1234567890abcdef1234567890abcde')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
37
var/spack/mock_packages/externaltest/package.py
Normal file
37
var/spack/mock_packages/externaltest/package.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
##############################################################################
|
||||
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
|
||||
# Produced at the Lawrence Livermore National Laboratory.
|
||||
#
|
||||
# This file is part of Spack.
|
||||
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
||||
# LLNL-CODE-647188
|
||||
#
|
||||
# For details, see https://scalability-llnl.github.io/spack
|
||||
# Please also see the LICENSE file 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 General Public License (as published by
|
||||
# the Free Software Foundation) version 2.1 dated 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 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 *
|
||||
|
||||
class Externaltest(Package):
|
||||
homepage = "http://somewhere.com"
|
||||
url = "http://somewhere.com/test-1.0.tar.gz"
|
||||
|
||||
version('1.0', '1234567890abcdef1234567890abcdef')
|
||||
|
||||
depends_on('stuff')
|
||||
depends_on('externaltool')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
36
var/spack/mock_packages/externaltool/package.py
Normal file
36
var/spack/mock_packages/externaltool/package.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
##############################################################################
|
||||
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
|
||||
# Produced at the Lawrence Livermore National Laboratory.
|
||||
#
|
||||
# This file is part of Spack.
|
||||
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
||||
# LLNL-CODE-647188
|
||||
#
|
||||
# For details, see https://scalability-llnl.github.io/spack
|
||||
# Please also see the LICENSE file 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 General Public License (as published by
|
||||
# the Free Software Foundation) version 2.1 dated 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 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 *
|
||||
|
||||
class Externaltool(Package):
|
||||
homepage = "http://somewhere.com"
|
||||
url = "http://somewhere.com/tool-1.0.tar.gz"
|
||||
|
||||
version('1.0', '1234567890abcdef1234567890abcdef')
|
||||
|
||||
depends_on('externalprereq')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
37
var/spack/mock_packages/externalvirtual/package.py
Normal file
37
var/spack/mock_packages/externalvirtual/package.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
##############################################################################
|
||||
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
|
||||
# Produced at the Lawrence Livermore National Laboratory.
|
||||
#
|
||||
# This file is part of Spack.
|
||||
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
||||
# LLNL-CODE-647188
|
||||
#
|
||||
# For details, see https://scalability-llnl.github.io/spack
|
||||
# Please also see the LICENSE file 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 General Public License (as published by
|
||||
# the Free Software Foundation) version 2.1 dated 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 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 *
|
||||
|
||||
class Externalvirtual(Package):
|
||||
homepage = "http://somewhere.com"
|
||||
url = "http://somewhere.com/stuff-1.0.tar.gz"
|
||||
|
||||
version('1.0', '1234567890abcdef1234567890abcdef')
|
||||
version('2.0', '234567890abcdef1234567890abcdef1')
|
||||
|
||||
provides('stuff')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
Loading…
Reference in a new issue