From cd04109e175fdc8223a5d922c7d3995496a23936 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 2 Feb 2022 19:05:24 +0100 Subject: Add a "sticky" property to variants (#28630) * Add sticky variants * Add unit tests for sticky variants * Add documentation for sticky variants * Revert "Revert 19736 because conflicts are avoided by clingo by default (#26721)" This reverts commit 33ef7d57c1a09d6ce454503e9ff5638747e4f4a2. * Add stickiness to "allow-unsupported-compiler" --- .../builtin.mock/packages/sticky-variant/package.py | 18 ++++++++++++++++++ var/spack/repos/builtin/packages/cuda/package.py | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 var/spack/repos/builtin.mock/packages/sticky-variant/package.py (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/sticky-variant/package.py b/var/spack/repos/builtin.mock/packages/sticky-variant/package.py new file mode 100644 index 0000000000..a1fea2d531 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/sticky-variant/package.py @@ -0,0 +1,18 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack import * + + +class StickyVariant(AutotoolsPackage): + """Package with a sticky variant and a conflict""" + + homepage = "http://www.example.com" + url = "http://www.example.com/a-1.0.tar.gz" + + version('1.0', '0123456789abcdef0123456789abcdef') + + variant('allow-gcc', description='', default=False, sticky=True) + + conflicts('%gcc', when='~allow-gcc') diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py index 378a9b0295..aa76935965 100644 --- a/var/spack/repos/builtin/packages/cuda/package.py +++ b/var/spack/repos/builtin/packages/cuda/package.py @@ -144,6 +144,8 @@ class Cuda(Package): conflicts('arch=darwin-mojave-x86_64') variant('dev', default=False, description='Enable development dependencies, i.e to use cuda-gdb') + variant('allow-unsupported-compilers', default=False, sticky=True, + description='Allow unsupported host compiler and CUDA version combinations') depends_on('libxml2', when='@10.1.243:') # cuda-gdb needed libncurses.so.5 before 11.4.0 -- cgit v1.2.3-70-g09d2