From 5774df6b7a295a397e30a843f5ef14b339535b64 Mon Sep 17 00:00:00 2001 From: Richarda Butler <39577672+RikkiButler20@users.noreply.github.com> Date: Tue, 7 Nov 2023 12:04:41 -0800 Subject: Propagate variant across nodes that don't have that variant (#38512) Before this PR, variant were not propagated to leaf nodes that could accept the propagated value, if some intermediate node couldn't accept it. This PR fixes that issue by marking nodes as "candidate" for propagation and by setting the variant only if it can be accepted by the node. Co-authored-by: Massimiliano Culpo --- .../repos/builtin.mock/packages/adios2/package.py | 22 ++++++++++++++++++++++ .../repos/builtin.mock/packages/ascent/package.py | 21 +++++++++++++++++++++ .../repos/builtin.mock/packages/bzip2/package.py | 19 +++++++++++++++++++ .../packages/dependency-foo-bar/package.py | 20 ++++++++++++++++++++ .../packages/parent-foo-bar/package.py | 22 ++++++++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 var/spack/repos/builtin.mock/packages/adios2/package.py create mode 100644 var/spack/repos/builtin.mock/packages/ascent/package.py create mode 100644 var/spack/repos/builtin.mock/packages/bzip2/package.py create mode 100644 var/spack/repos/builtin.mock/packages/dependency-foo-bar/package.py create mode 100644 var/spack/repos/builtin.mock/packages/parent-foo-bar/package.py (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/adios2/package.py b/var/spack/repos/builtin.mock/packages/adios2/package.py new file mode 100644 index 0000000000..fb2f43ea0e --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/adios2/package.py @@ -0,0 +1,22 @@ +# Copyright 2013-2023 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.package import * + + +class Adios2(Package): + """This packagae has the variants shared and + bzip2, both defaulted to True""" + + homepage = "https://example.com" + url = "https://example.com/adios2.tar.gz" + + version("2.9.1", sha256="ddfa32c14494250ee8a48ef1c97a1bf6442c15484bbbd4669228a0f90242f4f9") + + variant("shared", default=True, description="Build shared libraries") + variant("bzip2", default=True, description="Enable BZip2 compression") + + depends_on("bzip2") diff --git a/var/spack/repos/builtin.mock/packages/ascent/package.py b/var/spack/repos/builtin.mock/packages/ascent/package.py new file mode 100644 index 0000000000..9a8db472dc --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/ascent/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2023 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.package import * + + +class Ascent(Package): + """This packagae has the variants shared, defaulted + to True and adios2 defaulted to False""" + + homepage = "https://github.com/Alpine-DAV/ascent" + url = "http://www.example.com/ascent-1.0.tar.gz" + + version("0.9.2", sha256="44cd954aa5db478ab40042cd54fd6fcedf25000c3bb510ca23fcff8090531b91") + + variant("adios2", default=False, description="Build Adios2 filter support") + variant("shared", default=True, description="Build Ascent as shared libs") + + depends_on("adios2", when="+adios2") diff --git a/var/spack/repos/builtin.mock/packages/bzip2/package.py b/var/spack/repos/builtin.mock/packages/bzip2/package.py new file mode 100644 index 0000000000..326533ac5e --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/bzip2/package.py @@ -0,0 +1,19 @@ +# Copyright 2013-2023 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.package import * + + +class Bzip2(Package): + """This packagae has the variants shared + defaulted to True""" + + homepage = "https://example.com" + url = "https://example.com/bzip2-1.0.8tar.gz" + + version("1.0.8", sha256="ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269") + + variant("shared", default=True, description="Enables the build of shared libraries.") diff --git a/var/spack/repos/builtin.mock/packages/dependency-foo-bar/package.py b/var/spack/repos/builtin.mock/packages/dependency-foo-bar/package.py new file mode 100644 index 0000000000..21e67f8a61 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/dependency-foo-bar/package.py @@ -0,0 +1,20 @@ +# Copyright 2013-2023 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.package import * + + +class DependencyFooBar(Package): + """This package has a variant "bar", which is False by default, and + variant "foo" which is True by default. + """ + + homepage = "http://www.example.com" + url = "http://www.example.com/dependency-foo-bar-1.0.tar.gz" + + version("1.0", md5="1234567890abcdefg1234567890098765") + + variant("foo", default=True, description="") + variant("bar", default=False, description="") diff --git a/var/spack/repos/builtin.mock/packages/parent-foo-bar/package.py b/var/spack/repos/builtin.mock/packages/parent-foo-bar/package.py new file mode 100644 index 0000000000..14516566a9 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/parent-foo-bar/package.py @@ -0,0 +1,22 @@ +# Copyright 2013-2023 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.package import * + + +class ParentFooBar(Package): + """This package has a variant "bar", which is True by default, and depends on another + package which has the same variant defaulting to False. + """ + + homepage = "http://www.example.com" + url = "http://www.example.com/parent-foo-bar-1.0.tar.gz" + + version("1.0", md5="abcdefg0123456789abcdefghfedcba0") + + variant("foo", default=True, description="") + variant("bar", default=True, description="") + + depends_on("dependency-foo-bar") -- cgit v1.2.3-60-g2f50