From c4d18671fe027c2a409512bce08baf39184fa091 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 5 Sep 2024 18:32:15 +0200 Subject: [PATCH 001/687] Avoid best-effort expansion of stacks (#40792) fixes #40791 Currently stacks behave differently if used in unify:false environments, which leads to inconsistencies during concretization. For instance, we might have two abstract user specs that do not intersect with each other map to the same concrete spec in the environment. This is clearly wrong. This PR removes the best effort expansion, so that user specs are always applied strictly. --- lib/spack/spack/environment/environment.py | 52 ++---------- lib/spack/spack/test/cmd/env.py | 97 ---------------------- lib/spack/spack/test/env.py | 30 +++++++ 3 files changed, 35 insertions(+), 144 deletions(-) diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 877e294b743e60..f6f4ffa0adf865 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -58,9 +58,8 @@ from spack.installer import PackageInstaller from spack.schema.env import TOP_LEVEL_KEY from spack.spec import Spec -from spack.spec_list import InvalidSpecConstraintError, SpecList +from spack.spec_list import SpecList from spack.util.path import substitute_path_variables -from spack.variant import UnknownVariantError #: environment variable used to indicate the active environment spack_env_var = "SPACK_ENV" @@ -1625,10 +1624,10 @@ def _concretize_separately(self, tests=False): # Concretize any new user specs that we haven't concretized yet args, root_specs, i = [], [], 0 - for uspec, uspec_constraints in zip(self.user_specs, self.user_specs.specs_as_constraints): + for uspec in self.user_specs: if uspec not in old_concretized_user_specs: root_specs.append(uspec) - args.append((i, [str(x) for x in uspec_constraints], tests)) + args.append((i, str(uspec), tests)) i += 1 # Ensure we don't try to bootstrap clingo in parallel @@ -2508,52 +2507,11 @@ def display_specs(specs): print(tree_string) -def _concretize_from_constraints(spec_constraints, tests=False): - # Accept only valid constraints from list and concretize spec - # Get the named spec even if out of order - root_spec = [s for s in spec_constraints if s.name] - if len(root_spec) != 1: - m = "The constraints %s are not a valid spec " % spec_constraints - m += "concretization target. all specs must have a single name " - m += "constraint for concretization." - raise InvalidSpecConstraintError(m) - spec_constraints.remove(root_spec[0]) - - invalid_constraints = [] - while True: - # Attach all anonymous constraints to one named spec - s = root_spec[0].copy() - for c in spec_constraints: - if c not in invalid_constraints: - s.constrain(c) - try: - return s.concretized(tests=tests) - except spack.spec.InvalidDependencyError as e: - invalid_deps_string = ["^" + d for d in e.invalid_deps] - invalid_deps = [ - c - for c in spec_constraints - if any(c.satisfies(invd) for invd in invalid_deps_string) - ] - if len(invalid_deps) != len(invalid_deps_string): - raise e - invalid_constraints.extend(invalid_deps) - except UnknownVariantError as e: - invalid_variants = e.unknown_variants - inv_variant_constraints = [ - c for c in spec_constraints if any(name in c.variants for name in invalid_variants) - ] - if len(inv_variant_constraints) != len(invalid_variants): - raise e - invalid_constraints.extend(inv_variant_constraints) - - def _concretize_task(packed_arguments) -> Tuple[int, Spec, float]: - index, spec_constraints, tests = packed_arguments - spec_constraints = [Spec(x) for x in spec_constraints] + index, spec_str, tests = packed_arguments with tty.SuppressOutput(msg_enabled=False): start = time.time() - spec = _concretize_from_constraints(spec_constraints, tests) + spec = Spec(spec_str).concretized(tests=tests) return index, spec, time.time() - start diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index 9c32ab7610eb01..ee725770cb88dc 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -2336,103 +2336,6 @@ def test_stack_yaml_force_remove_from_matrix(tmpdir): assert mpileaks_spec not in after_conc -def test_stack_concretize_extraneous_deps(tmpdir, mock_packages): - # FIXME: The new concretizer doesn't handle yet soft - # FIXME: constraints for stacks - # FIXME: This now works for statically-determinable invalid deps - # FIXME: But it still does not work for dynamically determined invalid deps - - filename = str(tmpdir.join("spack.yaml")) - with open(filename, "w") as f: - f.write( - """\ -spack: - definitions: - - packages: [libelf, mpileaks] - - install: - - matrix: - - [$packages] - - ['^zmpi', '^mpich'] - specs: - - $install -""" - ) - with tmpdir.as_cwd(): - env("create", "test", "./spack.yaml") - with ev.read("test"): - concretize() - - test = ev.read("test") - - for user, concrete in test.concretized_specs(): - assert concrete.concrete - assert not user.concrete - if user.name == "libelf": - assert not concrete.satisfies("^mpi") - elif user.name == "mpileaks": - assert concrete.satisfies("^mpi") - - -def test_stack_concretize_extraneous_variants(tmpdir, mock_packages): - filename = str(tmpdir.join("spack.yaml")) - with open(filename, "w") as f: - f.write( - """\ -spack: - definitions: - - packages: [libelf, mpileaks] - - install: - - matrix: - - [$packages] - - ['~shared', '+shared'] - specs: - - $install -""" - ) - with tmpdir.as_cwd(): - env("create", "test", "./spack.yaml") - with ev.read("test"): - concretize() - - test = ev.read("test") - - for user, concrete in test.concretized_specs(): - assert concrete.concrete - assert not user.concrete - if user.name == "libelf": - assert "shared" not in concrete.variants - if user.name == "mpileaks": - assert concrete.variants["shared"].value == user.variants["shared"].value - - -def test_stack_concretize_extraneous_variants_with_dash(tmpdir, mock_packages): - filename = str(tmpdir.join("spack.yaml")) - with open(filename, "w") as f: - f.write( - """\ -spack: - definitions: - - packages: [libelf, mpileaks] - - install: - - matrix: - - [$packages] - - ['shared=False', '+shared-libs'] - specs: - - $install -""" - ) - with tmpdir.as_cwd(): - env("create", "test", "./spack.yaml") - with ev.read("test"): - concretize() - - ev.read("test") - - # Regression test for handling of variants with dashes in them - # will fail before this point if code regresses - assert True - - def test_stack_definition_extension(tmpdir): filename = str(tmpdir.join("spack.yaml")) with open(filename, "w") as f: diff --git a/lib/spack/spack/test/env.py b/lib/spack/spack/test/env.py index 2452cd937a76cd..b239301680ae30 100644 --- a/lib/spack/spack/test/env.py +++ b/lib/spack/spack/test/env.py @@ -860,3 +860,33 @@ def test_env_view_on_non_empty_dir_errors(tmp_path, config, mock_packages, tempo env.install_all(fake=True) with pytest.raises(ev.SpackEnvironmentError, match="because it is a non-empty dir"): env.regenerate_views() + + +@pytest.mark.parametrize( + "matrix_line", [("^zmpi", "^mpich"), ("~shared", "+shared"), ("shared=False", "+shared-libs")] +) +@pytest.mark.regression("40791") +def test_stack_enforcement_is_strict(tmp_path, matrix_line, config, mock_packages): + """Ensure that constraints in matrices are applied strictly after expansion, to avoid + inconsistencies between abstract user specs and concrete specs. + """ + manifest = tmp_path / "spack.yaml" + manifest.write_text( + f"""\ +spack: + definitions: + - packages: [libelf, mpileaks] + - install: + - matrix: + - [$packages] + - [{", ".join(item for item in matrix_line)}] + specs: + - $install + concretizer: + unify: false +""" + ) + # Here we raise different exceptions depending on whether we solve serially or not + with pytest.raises(Exception): + with ev.Environment(tmp_path) as e: + e.concretize() From 055eb3cd94b9b3721d4e8914dfb9d031523a4b42 Mon Sep 17 00:00:00 2001 From: etiennemlb <72296335+etiennemlb@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:43:28 +0200 Subject: [PATCH 002/687] PLUMED: Using a C compiler variable (#46082) * Using a C compiler variable * homogeneity --- var/spack/repos/builtin/packages/plumed/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/plumed/package.py b/var/spack/repos/builtin/packages/plumed/package.py index ed5ba3db72d2a4..2aa0149b7a13e2 100644 --- a/var/spack/repos/builtin/packages/plumed/package.py +++ b/var/spack/repos/builtin/packages/plumed/package.py @@ -261,8 +261,8 @@ def filter_gslcblas(self): def patch(self): # Ensure Spack's wrappers are used to compile the Python interface env = ( - 'CXX={0} LDSHARED="{0} -pthread -shared" ' - 'LDCXXSHARED="{0} -pthread -shared"'.format(spack_cxx) + 'CC="{0}" LDSHARED="{0} -pthread -shared" ' + 'CXX="{1}" LDCXXSHARED="{1} -pthread -shared"'.format(spack_cc, spack_cxx) ) filter_file( "plumed_program_name=plumed", From 33621a986017873884d330023935d4b27bb6b198 Mon Sep 17 00:00:00 2001 From: estewart08 Date: Thu, 5 Sep 2024 12:27:50 -0500 Subject: [PATCH 003/687] [rocm-openmp-extras] - Add support for flang-legacy in 6.1.2 (#46130) * [rocm-openmp-extras] - Add support for flang-legacy in 6.1.2 * [rocm-openmp-extras] - Remove unused variable flang_legacy_dir * [rocm-openmp-extras] - Limit flang-legacy build to 6.1 and newer ROCm versions --- .../builtin/packages/llvm-amdgpu/package.py | 2 +- .../packages/rocm-openmp-extras/package.py | 80 ++++++++++++++++--- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py index 405ea30a1bcfae..ee98ca82c8708d 100644 --- a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py +++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py @@ -260,7 +260,7 @@ def cmake_args(self): args.append(self.define("LLVM_ENABLE_PROJECTS", llvm_projects)) args.append(self.define("LLVM_ENABLE_RUNTIMES", llvm_runtimes)) args.append(self.define("LLVM_ENABLE_LIBCXX", "OFF")) - args.append(self.define("CLANG_LINK_FLANG_LEGACY", False)) + args.append(self.define("CLANG_LINK_FLANG_LEGACY", True)) args.append(self.define("CMAKE_CXX_STANDARD", 17)) args.append(self.define("FLANG_INCLUDE_DOCS", False)) args.append(self.define("LLVM_BUILD_DOCS", "ON")) diff --git a/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py b/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py index 506a43ec5fe4ea..54402bdfc085f4 100644 --- a/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py +++ b/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py @@ -481,6 +481,9 @@ def install(self, spec, prefix): os.unlink(os.path.join(bin_dir, "flang1")) if os.path.islink((os.path.join(bin_dir, "flang2"))): os.unlink(os.path.join(bin_dir, "flang2")) + if self.spec.version >= Version("6.1.0"): + if os.path.islink((os.path.join(bin_dir, "flang-legacy"))): + os.unlink(os.path.join(bin_dir, "flang-legacy")) if os.path.islink((os.path.join(lib_dir, "libdevice"))): os.unlink(os.path.join(lib_dir, "libdevice")) if os.path.islink((os.path.join(llvm_prefix, "lib-debug"))): @@ -488,6 +491,11 @@ def install(self, spec, prefix): os.symlink(os.path.join(omp_bin_dir, "flang1"), os.path.join(bin_dir, "flang1")) os.symlink(os.path.join(omp_bin_dir, "flang2"), os.path.join(bin_dir, "flang2")) + + if self.spec.version >= Version("6.1.0"): + os.symlink( + os.path.join(omp_bin_dir, "flang-legacy"), os.path.join(bin_dir, "flang-legacy") + ) os.symlink(os.path.join(omp_lib_dir, "libdevice"), os.path.join(lib_dir, "libdevice")) os.symlink( os.path.join(openmp_extras_prefix, "lib-debug"), os.path.join(llvm_prefix, "lib-debug") @@ -579,6 +587,40 @@ def install(self, spec, prefix): components["pgmath"] += flang_common_args + flang_legacy_version = "17.0-4" + + components["flang-legacy-llvm"] = [ + "-DLLVM_ENABLE_PROJECTS=clang", + "-DCMAKE_BUILD_TYPE=Release", + "-DLLVM_ENABLE_ASSERTIONS=ON", + "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86", + "-DCLANG_DEFAULT_LINKER=lld", + "-DLLVM_INCLUDE_BENCHMARKS=0", + "-DLLVM_INCLUDE_RUNTIMES=0", + "-DLLVM_INCLUDE_EXAMPLES=0", + "-DLLVM_INCLUDE_TESTS=0", + "-DLLVM_INCLUDE_DOCS=0", + "-DLLVM_INCLUDE_UTILS=0", + "-DCLANG_DEFAULT_PIE_ON_LINUX=0", + "../../rocm-openmp-extras/flang/flang-legacy/{0}/llvm-legacy/llvm".format( + flang_legacy_version + ), + ] + + components["flang-legacy"] = [ + "-DCMAKE_C_COMPILER={0}/clang".format(bin_dir), + "-DCMAKE_CXX_COMPILER={0}/clang++".format(bin_dir), + "../rocm-openmp-extras/flang/flang-legacy/{0}".format(flang_legacy_version), + ] + + if ( + self.compiler.name == "gcc" + and self.compiler.version >= Version("7.0.0") + and self.compiler.version < Version("9.0.0") + ): + components["flang-legacy-llvm"] += ["-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"] + components["flang-legacy"] += ["-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"] + components["flang"] = [ "../rocm-openmp-extras/flang", "-DFLANG_OPENMP_GPU_AMD=ON", @@ -595,22 +637,38 @@ def install(self, spec, prefix): ] components["flang-runtime"] += flang_common_args - build_order = ["aomp-extras", "openmp", "openmp-debug", "pgmath", "flang", "flang-runtime"] + build_order = ["aomp-extras", "openmp"] + if self.spec.version >= Version("6.1.0"): + build_order += ["flang-legacy-llvm", "flang-legacy"] + build_order += ["pgmath", "flang", "flang-runtime"] # Override standard CMAKE_BUILD_TYPE for arg in std_cmake_args: found = re.search("CMAKE_BUILD_TYPE", arg) if found: std_cmake_args.remove(arg) for component in build_order: - with working_dir("spack-build-{0}".format(component), create=True): - cmake_args = components[component] - cmake_args.extend(std_cmake_args) - # OpenMP build needs to be run twice(Release, Debug) - if component == "openmp-debug": - cmake_args.append("-DCMAKE_BUILD_TYPE=Debug") - else: + cmake_args = components[component] + cmake_args.extend(std_cmake_args) + if component == "flang-legacy-llvm": + with working_dir("spack-build-{0}/llvm-legacy".format(component), create=True): + cmake_args.append("-DCMAKE_BUILD_TYPE=Release") + cmake(*cmake_args) + make() + elif component == "flang-legacy": + with working_dir("spack-build-flang-legacy-llvm"): cmake_args.append("-DCMAKE_BUILD_TYPE=Release") - cmake(*cmake_args) - make() - make("install") + cmake(*cmake_args) + make() + make("install") + os.symlink(os.path.join(bin_dir, "clang"), os.path.join(omp_bin_dir, "clang")) + else: + with working_dir("spack-build-{0}".format(component), create=True): + # OpenMP build needs to be run twice(Release, Debug) + if component == "openmp-debug": + cmake_args.append("-DCMAKE_BUILD_TYPE=Debug") + else: + cmake_args.append("-DCMAKE_BUILD_TYPE=Release") + cmake(*cmake_args) + make() + make("install") From c3a1d1f91e1c3989f6e0cf4dc136cfdc0c924a7e Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Thu, 5 Sep 2024 10:35:01 -0700 Subject: [PATCH 004/687] Add when's to some tau dependencies (#46212) * Add when's to some tau dependencies * [@spackbot] updating style on behalf of AlexanderRichert-NOAA --- .../repos/builtin/packages/tau/package.py | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py index fd499910dd1ad6..94d939c03fd6f5 100644 --- a/var/spack/repos/builtin/packages/tau/package.py +++ b/var/spack/repos/builtin/packages/tau/package.py @@ -79,23 +79,39 @@ class Tau(Package): variant("pdt", default=True, description="Use PDT for source code instrumentation") variant("comm", default=False, description=" Generate profiles with MPI communicator info") variant("python", default=False, description="Activates Python support") - variant("likwid", default=False, description="Activates LIKWID support") + variant("likwid", default=False, description="Activates LIKWID support", when="@2.27") variant("ompt", default=False, description="Activates OMPT instrumentation") variant("opari", default=False, description="Activates Opari2 instrumentation") variant("shmem", default=False, description="Activates SHMEM support") variant("gasnet", default=False, description="Activates GASNET support") variant("cuda", default=False, description="Activates CUDA support") - variant("rocm", default=False, description="Activates ROCm support") - variant("level_zero", default=False, description="Activates Intel OneAPI Level Zero support") - variant("rocprofiler", default=False, description="Activates ROCm rocprofiler support") - variant("roctracer", default=False, description="Activates ROCm roctracer support") - variant("rocprofv2", default=False, description="Activates ROCm rocprofiler support") + variant("rocm", default=False, description="Activates ROCm support", when="@2.28:") + variant( + "level_zero", + default=False, + description="Activates Intel OneAPI Level Zero support", + when="@2.30:", + ) + variant( + "rocprofiler", + default=False, + description="Activates ROCm rocprofiler support", + when="@2.29.1:", + ) + variant( + "roctracer", default=False, description="Activates ROCm roctracer support", when="@2.28.1:" + ) + variant( + "rocprofv2", default=False, description="Activates ROCm rocprofiler support", when="@2.34:" + ) variant("opencl", default=False, description="Activates OpenCL support") variant("fortran", default=darwin_default, description="Activates Fortran support") variant("io", default=True, description="Activates POSIX I/O support") - variant("adios2", default=False, description="Activates ADIOS2 output support") + variant( + "adios2", default=False, description="Activates ADIOS2 output support", when="@2.26.3:" + ) variant("sqlite", default=False, description="Activates SQLite3 output support") - variant("syscall", default=False, description="Activates syscall wrapper") + variant("syscall", default=False, description="Activates syscall wrapper", when="@2.33:") variant( "profileparam", default=False, From 93d31225dbded0682fea521ee98123a34987d739 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 19:52:21 +0200 Subject: [PATCH 005/687] py-tifffile: add v2024 (#46232) --- var/spack/repos/builtin/packages/py-tifffile/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-tifffile/package.py b/var/spack/repos/builtin/packages/py-tifffile/package.py index 7e6a9e6555553d..0d7893262e508d 100644 --- a/var/spack/repos/builtin/packages/py-tifffile/package.py +++ b/var/spack/repos/builtin/packages/py-tifffile/package.py @@ -14,6 +14,7 @@ class PyTifffile(PythonPackage): license("BSD-3-Clause") + version("2024.8.30", sha256="2c9508fe768962e30f87def61819183fb07692c258cb175b3c114828368485a4") version("2023.8.30", sha256="6a8c53b012a286b75d09a1498ab32f202f24cc6270a105b5d5911dc4426f162a") version( "2022.10.10", sha256="50b61ba943b866d191295bc38a00191c9fdab23ece063544c7f1a264e3f6aa8e" From 47bd8a6b2600615919d53ccde9d6a4e38ee83d81 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 19:53:42 +0200 Subject: [PATCH 006/687] py-pyvista: add v0.44.1 (#46231) --- var/spack/repos/builtin/packages/py-pyvista/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-pyvista/package.py b/var/spack/repos/builtin/packages/py-pyvista/package.py index 6ff66b6f69ea05..358e417dffb5d7 100644 --- a/var/spack/repos/builtin/packages/py-pyvista/package.py +++ b/var/spack/repos/builtin/packages/py-pyvista/package.py @@ -19,12 +19,14 @@ class PyPyvista(PythonPackage): license("MIT") + version("0.44.1", sha256="63976f5d57d151b3f7e1616dde40dcf56a66d1f37f6db067087fa9cc9667f512") version("0.42.3", sha256="00159cf0dea05c1ecfd1695c8c6ccfcfff71b0744c9997fc0276e661dc052351") version("0.37.0", sha256="d36a2c6d5f53f473ab6a9241669693acee7a5179394dc97595da14cc1de23141") version("0.32.1", sha256="585ac79524e351924730aff9b7207d6c5ac4175dbb5d33f7a9a2de22ae53dbf9") depends_on("py-setuptools", type="build") depends_on("py-matplotlib@3.0.1:", when="@0.39:", type=("build", "run")) + depends_on("py-numpy@1.21:", when="@0.44:", type=("build", "run")) depends_on("py-numpy", type=("build", "run")) # https://github.com/pyvista/pyvista/releases/tag/v0.44.0 depends_on("py-numpy@:1", when="@:0.43", type=("build", "run")) From 618866b35cfac00da0294455f177aa438c2a763f Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 19:56:51 +0200 Subject: [PATCH 007/687] py-laspy: add v2.3.5 (#46228) --- var/spack/repos/builtin/packages/py-laspy/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-laspy/package.py b/var/spack/repos/builtin/packages/py-laspy/package.py index 1e90f03aaa58cb..f78b90fa3c0f46 100644 --- a/var/spack/repos/builtin/packages/py-laspy/package.py +++ b/var/spack/repos/builtin/packages/py-laspy/package.py @@ -14,6 +14,7 @@ class PyLaspy(PythonPackage): license("BSD-2-Clause") + version("2.5.4", sha256="eebdbf3379afbc0b24e7e4812fac567bff880d1e851f70175d22375aaecdf7e1") version("2.2.0", sha256="69d36f01acecd719cbe3c3cf58353f247f391ccadb1da37731d45bfe919685df") version("2.0.3", sha256="95c6367bc3a7c1e0d8dc118ae4a6b038bf9e8ad3e60741ecb8d59c36d32f822a") From 69b54d903990953b9feb0bc8cee21844759dc562 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 19:57:57 +0200 Subject: [PATCH 008/687] py-imageio: add v2.35.1 (#46227) --- var/spack/repos/builtin/packages/py-imageio/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-imageio/package.py b/var/spack/repos/builtin/packages/py-imageio/package.py index c204ef6c61d730..9e2f04478ce876 100644 --- a/var/spack/repos/builtin/packages/py-imageio/package.py +++ b/var/spack/repos/builtin/packages/py-imageio/package.py @@ -19,6 +19,7 @@ class PyImageio(PythonPackage): license("BSD-2-Clause") + version("2.35.1", sha256="4952dfeef3c3947957f6d5dedb1f4ca31c6e509a476891062396834048aeed2a") version("2.34.0", sha256="ae9732e10acf807a22c389aef193f42215718e16bd06eed0c5bb57e1034a4d53") version("2.30.0", sha256="7fc6ad5b5677cb1e58077875a72512aa8c392b6d40885eca0a6ab250efb4b8f4") version("2.22.0", sha256="a332d127ec387b2d3dca967fd065a90f1c1a4ba2343570b03fe2cebb6ed064ea") From d4378b6e095bb65feca717dea3559c63fd560692 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 20:04:56 +0200 Subject: [PATCH 009/687] awscli-v2: remove upperbound on cryptography (#46222) --- var/spack/repos/builtin/packages/awscli-v2/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/awscli-v2/package.py b/var/spack/repos/builtin/packages/awscli-v2/package.py index 15dad8150a3bbc..ea9973c1257db5 100644 --- a/var/spack/repos/builtin/packages/awscli-v2/package.py +++ b/var/spack/repos/builtin/packages/awscli-v2/package.py @@ -23,7 +23,9 @@ class AwscliV2(PythonPackage): depends_on("py-flit-core@3.7.1:3.8.0") depends_on("py-colorama@0.2.5:0.4.6") depends_on("py-docutils@0.10:0.19") - depends_on("py-cryptography@3.3.2:40.0.1") + # Remove upper bound to enable Python 3.12 support + # depends_on("py-cryptography@3.3.2:40.0.1") + depends_on("py-cryptography@3.3.2:") depends_on("py-ruamel-yaml@0.15:0.17.21") depends_on("py-ruamel-yaml-clib@0.2:0.2.7", when="^python@:3.9") depends_on("py-prompt-toolkit@3.0.24:3.0.38") From 636843f3308cb89458220bf10497912a9debbb16 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 20:06:57 +0200 Subject: [PATCH 010/687] PyTorch: update ecosystem (#46220) --- var/spack/repos/builtin/packages/py-torch/package.py | 1 + var/spack/repos/builtin/packages/py-torchaudio/package.py | 2 ++ var/spack/repos/builtin/packages/py-torchvision/package.py | 2 ++ 3 files changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py index 327034ed7bdb34..830aa41e7052a4 100644 --- a/var/spack/repos/builtin/packages/py-torch/package.py +++ b/var/spack/repos/builtin/packages/py-torch/package.py @@ -26,6 +26,7 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage): license("BSD-3-Clause") version("main", branch="main") + version("2.4.1", tag="v2.4.1", commit="ee1b6804381c57161c477caa380a840a84167676") version("2.4.0", tag="v2.4.0", commit="d990dada86a8ad94882b5c23e859b88c0c255bda") version("2.3.1", tag="v2.3.1", commit="63d5e9221bedd1546b7d364b5ce4171547db12a9") version("2.3.0", tag="v2.3.0", commit="97ff6cfd9c86c5c09d7ce775ab64ec5c99230f5d") diff --git a/var/spack/repos/builtin/packages/py-torchaudio/package.py b/var/spack/repos/builtin/packages/py-torchaudio/package.py index 52370110d7bbd7..e1e5236340cb0c 100644 --- a/var/spack/repos/builtin/packages/py-torchaudio/package.py +++ b/var/spack/repos/builtin/packages/py-torchaudio/package.py @@ -18,6 +18,7 @@ class PyTorchaudio(PythonPackage): maintainers("adamjstewart") version("main", branch="main") + version("2.4.1", tag="v2.4.1", commit="e8cbe17769796ce963fbc71b8990f1474774e6d2") version("2.4.0", tag="v2.4.0", commit="69d40773dc4ed86643820c21a8a880e4d074a46e") version("2.3.1", tag="v2.3.1", commit="3edcf69e78a3c9a3077a11159861422440ec7d4a") version("2.3.0", tag="v2.3.0", commit="952ea7457bcc3ed0669e7741ff23015c426d6322") @@ -61,6 +62,7 @@ class PyTorchaudio(PythonPackage): depends_on("python@:3.8", when="@:0.7.0") depends_on("py-torch@main", when="@main") + depends_on("py-torch@2.4.1", when="@2.4.1") depends_on("py-torch@2.4.0", when="@2.4.0") depends_on("py-torch@2.3.1", when="@2.3.1") depends_on("py-torch@2.3.0", when="@2.3.0") diff --git a/var/spack/repos/builtin/packages/py-torchvision/package.py b/var/spack/repos/builtin/packages/py-torchvision/package.py index 2bfe45fe87b443..d5ea32a137dcf4 100644 --- a/var/spack/repos/builtin/packages/py-torchvision/package.py +++ b/var/spack/repos/builtin/packages/py-torchvision/package.py @@ -19,6 +19,7 @@ class PyTorchvision(PythonPackage): license("BSD-3-Clause") version("main", branch="main") + version("0.19.1", sha256="083e75c467285595ec3eb3c7aa8493c19e53d7eb42f13046fb56a07c8897e5a8") version("0.19.0", sha256="4c499d0a412b5a21d55ac3c0a37e80ecd7e1f002f2a7b6b3b38a2de2544acbb6") version("0.18.1", sha256="347d472a9ceecc44e0bee1eda140d63cfaffc74a54ec07d4b98da7698ce75516") version("0.18.0", sha256="3e61cbac33986a862a59cd733fd65da8b2c2a6160a66556cfa0e850f62fd43c7") @@ -74,6 +75,7 @@ class PyTorchvision(PythonPackage): # https://github.com/pytorch/vision#installation depends_on("py-torch@main", when="@main") + depends_on("py-torch@2.4.1", when="@0.19.1") depends_on("py-torch@2.4.0", when="@0.19.0") depends_on("py-torch@2.3.1", when="@0.18.1") depends_on("py-torch@2.3.0", when="@0.18.0") From 4d36b0a5efe78c2f32aaadd1026bd52ab41096d1 Mon Sep 17 00:00:00 2001 From: Fernando Ayats Date: Thu, 5 Sep 2024 20:27:15 +0200 Subject: [PATCH 011/687] npb: fix mpi rank mismatch errors (#46075) MPI variant has several rank mismatch errors, which are silently ignored. This downgrades the errors to warnings. --- var/spack/repos/builtin/packages/npb/package.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/npb/package.py b/var/spack/repos/builtin/packages/npb/package.py index 439a09e45ce9fb..62d5b86d0ec330 100644 --- a/var/spack/repos/builtin/packages/npb/package.py +++ b/var/spack/repos/builtin/packages/npb/package.py @@ -122,6 +122,10 @@ def edit(self, spec, prefix): nprocs = spec.variants["nprocs"].value if "implementation=mpi" in spec: + fflags = fflags = ["-O3"] + if spec.satisfies("%gcc@10:"): + fflags.append("-fallow-argument-mismatch") + definitions = { # Parallel Fortran "MPIFC": spec["mpi"].mpifc, @@ -129,7 +133,7 @@ def edit(self, spec, prefix): "FLINK": spec["mpi"].mpif77, "FMPI_LIB": spec["mpi"].libs.ld_flags, "FMPI_INC": "-I" + spec["mpi"].prefix.include, - "FFLAGS": "-O3", + "FFLAGS": " ".join(fflags), "FLINKFLAGS": "-O3", # Parallel C "MPICC": spec["mpi"].mpicc, From 6b05a807452035f56b7dbfaa9b9c5264abb56684 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 5 Sep 2024 12:29:26 -0600 Subject: [PATCH 012/687] Bug fixes for building py-netcdf4 and py-ruamel-yaml-clib with apple-clang@15 (#46184) * Fix compiler flags in py-netcdf4 for apple-clang@15: * Fix compiler flags in py-ruamel-yaml-clib for apple-clang@15: --- var/spack/repos/builtin/packages/py-netcdf4/package.py | 2 +- var/spack/repos/builtin/packages/py-ruamel-yaml-clib/package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-netcdf4/package.py b/var/spack/repos/builtin/packages/py-netcdf4/package.py index e36ed870ea0073..5b2be09a60054e 100644 --- a/var/spack/repos/builtin/packages/py-netcdf4/package.py +++ b/var/spack/repos/builtin/packages/py-netcdf4/package.py @@ -59,7 +59,7 @@ class PyNetcdf4(PythonPackage): def flag_handler(self, name, flags): if name == "cflags": - if self.spec.satisfies("%oneapi"): + if self.spec.satisfies("%oneapi") or self.spec.satisfies("%apple-clang@15:"): flags.append("-Wno-error=int-conversion") return flags, None, None diff --git a/var/spack/repos/builtin/packages/py-ruamel-yaml-clib/package.py b/var/spack/repos/builtin/packages/py-ruamel-yaml-clib/package.py index 0989481157965c..82bbd8db2e99e5 100644 --- a/var/spack/repos/builtin/packages/py-ruamel-yaml-clib/package.py +++ b/var/spack/repos/builtin/packages/py-ruamel-yaml-clib/package.py @@ -28,6 +28,6 @@ class PyRuamelYamlClib(PythonPackage): def flag_handler(self, name, flags): if name == "cflags": - if self.spec.satisfies("%oneapi"): + if self.spec.satisfies("%oneapi") or self.spec.satisfies(" %apple-clang@15:"): flags.append("-Wno-error=incompatible-function-pointer-types") return (flags, None, None) From 1be9b7f53c8565bc025091eef00c68b4804b7d78 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 5 Sep 2024 22:09:34 +0200 Subject: [PATCH 013/687] expat: Add 2.6.3 with security fixes + deprecate vulnerable 2.6.2 (#46208) --- var/spack/repos/builtin/packages/expat/package.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/expat/package.py b/var/spack/repos/builtin/packages/expat/package.py index 893fd1037afa9a..a41d4912de8415 100644 --- a/var/spack/repos/builtin/packages/expat/package.py +++ b/var/spack/repos/builtin/packages/expat/package.py @@ -17,8 +17,16 @@ class Expat(AutotoolsPackage, CMakePackage): license("MIT") - version("2.6.2", sha256="9c7c1b5dcbc3c237c500a8fb1493e14d9582146dd9b42aa8d3ffb856a3b927e0") - # deprecate all releases before 2.6.2 because of security issues + version("2.6.3", sha256="b8baef92f328eebcf731f4d18103951c61fa8c8ec21d5ff4202fb6f2198aeb2d") + # deprecate all releases before 2.6.3 because of security issues + # CVE-2024-45490 (fixed in 2.6.3) + # CVE-2024-45491 (fixed in 2.6.3) + # CVE-2024-45492 (fixed in 2.6.3) + version( + "2.6.2", + sha256="9c7c1b5dcbc3c237c500a8fb1493e14d9582146dd9b42aa8d3ffb856a3b927e0", + deprecated=True, + ) # CVE-2024-28757 (fixed in 2.6.2) version( "2.6.1", From a42108438dee05140e785804a16699debb00e8ea Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 5 Sep 2024 22:16:14 +0200 Subject: [PATCH 014/687] py-contourpy: add v1.3.0 (#46225) --- .../builtin/packages/py-contourpy/package.py | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-contourpy/package.py b/var/spack/repos/builtin/packages/py-contourpy/package.py index 963e3e1255fb69..4020cbf679bf2c 100644 --- a/var/spack/repos/builtin/packages/py-contourpy/package.py +++ b/var/spack/repos/builtin/packages/py-contourpy/package.py @@ -14,17 +14,31 @@ class PyContourpy(PythonPackage): license("BSD-3-Clause") + version("1.3.0", sha256="7ffa0db17717a8ffb127efd0c95a4362d996b892c2904db72428d5b52e1938a4") version("1.0.7", sha256="d8165a088d31798b59e91117d1f5fc3df8168d8b48c4acc10fc0df0d0bdbcc5e") version("1.0.5", sha256="896631cd40222aef3697e4e51177d14c3709fda49d30983269d584f034acc8a4") - depends_on("cxx", type="build") # generated + depends_on("cxx", type="build") - depends_on("python@3.8:", when="@1.0.7:", type=("build", "link", "run")) - depends_on("python@3.7:", type=("build", "link", "run")) - depends_on("py-pybind11@2.6:", type=("build", "link")) - depends_on("py-setuptools@42:", type="build") - depends_on("py-numpy@1.16:", type=("build", "run")) - # https://github.com/numpy/numpy/issues/26191 - depends_on("py-numpy@:1", when="@:1.2.0", type=("build", "run")) + with default_args(type="build"): + depends_on("meson@1.2:") + depends_on("py-meson-python@0.13.1:") + depends_on("py-pybind11@2.13.1:", when="@1.3:") + depends_on("py-pybind11@2.6:") + + # Historical dependencies + depends_on("py-setuptools@42:", when="@:1.0") + depends_on("py-build", when="@:1.0.5") + + with default_args(type=("build", "link", "run")): + depends_on("python@3.9:", when="@1.3:") + depends_on("python@3.8:", when="@1.0.7:") + depends_on("python@3.7:") - depends_on("py-build", when="@:1.0.5", type="build") + with default_args(type=("build", "run")): + depends_on("py-numpy@1.23:", when="@1.3:") + depends_on("py-numpy@1.16:") + + # https://github.com/numpy/numpy/issues/26191 + conflicts("py-numpy@2:", when="@:1.2.0") + conflicts("py-pybind11@2.13.3") From 434a703bcf2f8a41ffebbd1ede73e55bdd178893 Mon Sep 17 00:00:00 2001 From: "Nicole C." <48625123+nicolecheetham@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:34:19 -0400 Subject: [PATCH 015/687] Windows: Update pytest with echo and remove others (#45620) * Windows: Update pytest with echo and remove others * Fix style * Remove unused pytest import in undevelop * Update test_test_part_pass to be Window compatible * Style --- lib/spack/spack/test/cmd/develop.py | 2 -- lib/spack/spack/test/cmd/find.py | 1 - lib/spack/spack/test/cmd/gc.py | 2 -- lib/spack/spack/test/cmd/stage.py | 1 - lib/spack/spack/test/cmd/undevelop.py | 6 ------ lib/spack/spack/test/cmd/uninstall.py | 1 - lib/spack/spack/test/concretize_errors.py | 2 -- lib/spack/spack/test/concretize_requirements.py | 2 -- lib/spack/spack/test/container/cli.py | 1 - lib/spack/spack/test/package_class.py | 1 + lib/spack/spack/test/test_suite.py | 8 ++++++-- lib/spack/spack/test/views.py | 1 - 12 files changed, 7 insertions(+), 21 deletions(-) diff --git a/lib/spack/spack/test/cmd/develop.py b/lib/spack/spack/test/cmd/develop.py index b090f0d21b5f21..440a008a3c7383 100644 --- a/lib/spack/spack/test/cmd/develop.py +++ b/lib/spack/spack/test/cmd/develop.py @@ -18,8 +18,6 @@ develop = SpackCommand("develop") env = SpackCommand("env") -pytestmark = pytest.mark.not_on_windows("does not run on windows") - @pytest.mark.usefixtures("mutable_mock_env_path", "mock_packages", "mock_fetch", "mutable_config") class TestDevelop: diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py index 46f05ab6e9ca65..59370b0d845c9a 100644 --- a/lib/spack/spack/test/cmd/find.py +++ b/lib/spack/spack/test/cmd/find.py @@ -334,7 +334,6 @@ def test_find_command_basic_usage(database): assert "mpileaks" in output -@pytest.mark.not_on_windows("envirnment is not yet supported on windows") @pytest.mark.regression("9875") def test_find_prefix_in_env( mutable_mock_env_path, install_mockery, mock_fetch, mock_packages, mock_archive diff --git a/lib/spack/spack/test/cmd/gc.py b/lib/spack/spack/test/cmd/gc.py index e646f8f8d5a43f..883d37ae33e252 100644 --- a/lib/spack/spack/test/cmd/gc.py +++ b/lib/spack/spack/test/cmd/gc.py @@ -16,8 +16,6 @@ add = spack.main.SpackCommand("add") install = spack.main.SpackCommand("install") -pytestmark = pytest.mark.not_on_windows("does not run on windows") - @pytest.mark.db def test_gc_without_build_dependency(mutable_database): diff --git a/lib/spack/spack/test/cmd/stage.py b/lib/spack/spack/test/cmd/stage.py index 26e88e4280c38b..e91d2ed7662528 100644 --- a/lib/spack/spack/test/cmd/stage.py +++ b/lib/spack/spack/test/cmd/stage.py @@ -50,7 +50,6 @@ def fake_stage(pkg, mirror_only=False): return expected_path -@pytest.mark.not_on_windows("PermissionError") def test_stage_path(check_stage_path): """Verify that --path only works with single specs.""" stage("--path={0}".format(check_stage_path), "trivial-install-test-package") diff --git a/lib/spack/spack/test/cmd/undevelop.py b/lib/spack/spack/test/cmd/undevelop.py index 9b5a2a5692f073..684a9f50198b9e 100644 --- a/lib/spack/spack/test/cmd/undevelop.py +++ b/lib/spack/spack/test/cmd/undevelop.py @@ -2,10 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -import pytest - import spack.environment as ev import spack.spec from spack.main import SpackCommand @@ -14,8 +10,6 @@ env = SpackCommand("env") concretize = SpackCommand("concretize") -pytestmark = pytest.mark.not_on_windows("does not run on windows") - def test_undevelop(tmpdir, mutable_config, mock_packages, mutable_mock_env_path): # setup environment diff --git a/lib/spack/spack/test/cmd/uninstall.py b/lib/spack/spack/test/cmd/uninstall.py index 78a5f10d5e62ac..35b6a15455aa04 100644 --- a/lib/spack/spack/test/cmd/uninstall.py +++ b/lib/spack/spack/test/cmd/uninstall.py @@ -205,7 +205,6 @@ def _warn(*args, **kwargs): # Note: I want to use https://docs.pytest.org/en/7.1.x/how-to/skipping.html#skip-all-test-functions-of-a-class-or-module # the style formatter insists on separating these two lines. -@pytest.mark.not_on_windows("Envs unsupported on Windows") class TestUninstallFromEnv: """Tests an installation with two environments e1 and e2, which each have shared package installations: diff --git a/lib/spack/spack/test/concretize_errors.py b/lib/spack/spack/test/concretize_errors.py index 114942bc6de3c1..0b3cf10933b8d8 100644 --- a/lib/spack/spack/test/concretize_errors.py +++ b/lib/spack/spack/test/concretize_errors.py @@ -8,8 +8,6 @@ import spack.solver.asp import spack.spec -pytestmark = [pytest.mark.not_on_windows("Windows uses old concretizer")] - version_error_messages = [ "Cannot satisfy 'fftw@:1.0' and 'fftw@1.1:", " required because quantum-espresso depends on fftw@:1.0", diff --git a/lib/spack/spack/test/concretize_requirements.py b/lib/spack/spack/test/concretize_requirements.py index 38fe4c296ffdae..386ad1c1940bf5 100644 --- a/lib/spack/spack/test/concretize_requirements.py +++ b/lib/spack/spack/test/concretize_requirements.py @@ -19,8 +19,6 @@ from spack.test.conftest import create_test_repo from spack.util.url import path_to_file_url -pytestmark = [pytest.mark.not_on_windows("Windows uses old concretizer")] - def update_packages_config(conf_str): conf = syaml.load_config(conf_str) diff --git a/lib/spack/spack/test/container/cli.py b/lib/spack/spack/test/container/cli.py index fa57eac723bfc0..660f84aef19d50 100644 --- a/lib/spack/spack/test/container/cli.py +++ b/lib/spack/spack/test/container/cli.py @@ -27,7 +27,6 @@ def test_listing_possible_os(): assert expected_os in output -@pytest.mark.not_on_windows("test unsupported on Windows") @pytest.mark.maybeslow @pytest.mark.requires_executables("git") def test_bootstrap_phase(minimal_configuration, config_dumper, capsys): diff --git a/lib/spack/spack/test/package_class.py b/lib/spack/spack/test/package_class.py index 07a82c5358564e..1a44c19fb73362 100644 --- a/lib/spack/spack/test/package_class.py +++ b/lib/spack/spack/test/package_class.py @@ -286,6 +286,7 @@ def compilers(compiler, arch_spec): # TODO (post-34236): Remove when remove deprecated run_test(), etc. +@pytest.mark.not_on_windows("echo not available on Windows") @pytest.mark.parametrize( "msg,installed,purpose,expected", [ diff --git a/lib/spack/spack/test/test_suite.py b/lib/spack/spack/test/test_suite.py index 8820abe602e070..708c4788be76e4 100644 --- a/lib/spack/spack/test/test_suite.py +++ b/lib/spack/spack/test/test_suite.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import collections import os +import sys import pytest @@ -315,8 +316,11 @@ def test_test_part_pass(install_mockery, mock_fetch, mock_test_stage): name = "test_echo" msg = "nothing" with spack.install_test.test_part(pkg, name, "echo"): - echo = which("echo") - echo(msg) + if sys.platform == "win32": + print(msg) + else: + echo = which("echo") + echo(msg) for part_name, status in pkg.tester.test_parts.items(): assert part_name.endswith(name) diff --git a/lib/spack/spack/test/views.py b/lib/spack/spack/test/views.py index d32d8e01505bd0..c8ff50eeb9a2fa 100644 --- a/lib/spack/spack/test/views.py +++ b/lib/spack/spack/test/views.py @@ -12,7 +12,6 @@ from spack.spec import Spec -@pytest.mark.not_on_windows("Not supported on Windows (yet)") def test_remove_extensions_ordered(install_mockery, mock_fetch, tmpdir): view_dir = str(tmpdir.join("view")) layout = DirectoryLayout(view_dir) From 9a8bff01adc1239c4bea338f96ea3222162b621e Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 6 Sep 2024 00:33:20 +0200 Subject: [PATCH 016/687] Allow deprecating more than one property in config (#46221) * Allow deprecating more than one property in config This internal change allows the customization of errors and warnings to be printed when deprecating a property. Signed-off-by: Massimiliano Culpo * fix Signed-off-by: Massimiliano Culpo * Use a list comprehension for "issues" Signed-off-by: Massimiliano Culpo --------- Signed-off-by: Massimiliano Culpo --- lib/spack/spack/schema/__init__.py | 50 ++++++++++++++++++------------ lib/spack/spack/schema/config.py | 14 +++++---- lib/spack/spack/schema/packages.py | 44 ++++++++++++++------------ lib/spack/spack/test/schema.py | 20 +++++------- 4 files changed, 70 insertions(+), 58 deletions(-) diff --git a/lib/spack/spack/schema/__init__.py b/lib/spack/spack/schema/__init__.py index 03fe4039a8b74b..5ccb7dd709c998 100644 --- a/lib/spack/spack/schema/__init__.py +++ b/lib/spack/spack/schema/__init__.py @@ -3,22 +3,28 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """This module contains jsonschema files for all of Spack's YAML formats.""" +import typing import warnings import llnl.util.lang +class DeprecationMessage(typing.NamedTuple): + message: str + error: bool + + # jsonschema is imported lazily as it is heavy to import # and increases the start-up time def _make_validator(): import jsonschema - import spack.parser - def _validate_spec(validator, is_spec, instance, schema): """Check if the attributes on instance are valid specs.""" import jsonschema + import spack.parser + if not validator.is_type(instance, "object"): return @@ -32,27 +38,31 @@ def _deprecated_properties(validator, deprecated, instance, schema): if not (validator.is_type(instance, "object") or validator.is_type(instance, "array")): return + if not deprecated: + return + + deprecations = { + name: DeprecationMessage(message=x["message"], error=x["error"]) + for x in deprecated + for name in x["names"] + } + # Get a list of the deprecated properties, return if there is none - deprecated_properties = [x for x in instance if x in deprecated["properties"]] - if not deprecated_properties: + issues = [entry for entry in instance if entry in deprecations] + if not issues: return - # Retrieve the template message - msg_str_or_func = deprecated["message"] - if isinstance(msg_str_or_func, str): - msg = msg_str_or_func.format(properties=deprecated_properties) - else: - msg = msg_str_or_func(instance, deprecated_properties) - if msg is None: - return - - is_error = deprecated["error"] - if not is_error: - warnings.warn(msg) - else: - import jsonschema - - yield jsonschema.ValidationError(msg) + # Process issues + errors = [] + for name in issues: + msg = deprecations[name].message.format(name=name) + if deprecations[name].error: + errors.append(msg) + else: + warnings.warn(msg) + + if errors: + yield jsonschema.ValidationError("\n".join(errors)) return jsonschema.validators.extend( jsonschema.Draft4Validator, diff --git a/lib/spack/spack/schema/config.py b/lib/spack/spack/schema/config.py index 78b988e4459913..468af55fc6bb22 100644 --- a/lib/spack/spack/schema/config.py +++ b/lib/spack/spack/schema/config.py @@ -96,12 +96,14 @@ "binary_index_ttl": {"type": "integer", "minimum": 0}, "aliases": {"type": "object", "patternProperties": {r"\w[\w-]*": {"type": "string"}}}, }, - "deprecatedProperties": { - "properties": ["concretizer"], - "message": "Spack supports only clingo as a concretizer from v0.23. " - "The config:concretizer config option is ignored.", - "error": False, - }, + "deprecatedProperties": [ + { + "names": ["concretizer"], + "message": "Spack supports only clingo as a concretizer from v0.23. " + "The config:concretizer config option is ignored.", + "error": False, + } + ], } } diff --git a/lib/spack/spack/schema/packages.py b/lib/spack/spack/schema/packages.py index 0acf8411fa20ea..9e8b7f21c0a587 100644 --- a/lib/spack/spack/schema/packages.py +++ b/lib/spack/spack/schema/packages.py @@ -140,14 +140,16 @@ }, "variants": variants, }, - "deprecatedProperties": { - "properties": ["version"], - "message": "setting version preferences in the 'all' section of packages.yaml " - "is deprecated and will be removed in v0.23\n\n\tThese preferences " - "will be ignored by Spack. You can set them only in package-specific sections " - "of the same file.\n", - "error": False, - }, + "deprecatedProperties": [ + { + "names": ["version"], + "message": "setting version preferences in the 'all' section of " + "packages.yaml is deprecated and will be removed in v0.23" + "\n\n\tThese preferences will be ignored by Spack. You can " + "set them only in package-specific sections of the same file.\n", + "error": False, + } + ], } }, "patternProperties": { @@ -204,18 +206,20 @@ }, }, }, - "deprecatedProperties": { - "properties": ["target", "compiler", "providers"], - "message": "setting 'compiler:', 'target:' or 'provider:' preferences in " - "a package-specific section of packages.yaml is deprecated, and will be " - "removed in v0.23.\n\n\tThese preferences will be ignored by Spack, and " - "can be set only in the 'all' section of the same file. " - "You can run:\n\n\t\t$ spack audit configs\n\n\tto get better diagnostics, " - "including files:lines where the deprecated attributes are used.\n\n" - "\tUse requirements to enforce conditions on specific packages: " - f"{REQUIREMENT_URL}\n", - "error": False, - }, + "deprecatedProperties": [ + { + "names": ["target", "compiler", "providers"], + "message": "setting '{name}:' preferences in " + "a package-specific section of packages.yaml is deprecated, and will be " + "removed in v0.23.\n\n\tThis preferences will be ignored by Spack, and " + "can be set only in the 'all' section of the same file. " + "You can run:\n\n\t\t$ spack audit configs\n\n\tto get better " + "diagnostics, including files:lines where the deprecated " + "attributes are used.\n\n\tUse requirements to enforce conditions" + f" on specific packages: {REQUIREMENT_URL}\n", + "error": False, + } + ], } }, } diff --git a/lib/spack/spack/test/schema.py b/lib/spack/spack/test/schema.py index 2bf18f9195f26d..509bfd331a644a 100644 --- a/lib/spack/spack/test/schema.py +++ b/lib/spack/spack/test/schema.py @@ -105,25 +105,21 @@ def test_schema_validation(meta_schema, config_name): def test_deprecated_properties(module_suffixes_schema): # Test that an error is reported when 'error: True' - msg_fmt = r"deprecated properties detected [properties={properties}]" - module_suffixes_schema["deprecatedProperties"] = { - "properties": ["tcl"], - "message": msg_fmt, - "error": True, - } + msg_fmt = r"{name} is deprecated" + module_suffixes_schema["deprecatedProperties"] = [ + {"names": ["tcl"], "message": msg_fmt, "error": True} + ] v = spack.schema.Validator(module_suffixes_schema) data = {"tcl": {"all": {"suffixes": {"^python": "py"}}}} - expected_match = "deprecated properties detected" + expected_match = "tcl is deprecated" with pytest.raises(jsonschema.ValidationError, match=expected_match): v.validate(data) # Test that just a warning is reported when 'error: False' - module_suffixes_schema["deprecatedProperties"] = { - "properties": ["tcl"], - "message": msg_fmt, - "error": False, - } + module_suffixes_schema["deprecatedProperties"] = [ + {"names": ["tcl"], "message": msg_fmt, "error": False} + ] v = spack.schema.Validator(module_suffixes_schema) data = {"tcl": {"all": {"suffixes": {"^python": "py"}}}} # The next validation doesn't raise anymore From 9d754c127a2ea70d6882ec2ce730375ea9272959 Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Fri, 6 Sep 2024 01:12:46 -0400 Subject: [PATCH 017/687] Require a newer version of cudnn for cupy (#46247) cupy 12 needs a newer version of cudnn as documented here. Supercedes #46128 Co-authored-by: Robert Underwood --- var/spack/repos/builtin/packages/py-cupy/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-cupy/package.py b/var/spack/repos/builtin/packages/py-cupy/package.py index 8865cb68060b32..1e54a36779f39b 100644 --- a/var/spack/repos/builtin/packages/py-cupy/package.py +++ b/var/spack/repos/builtin/packages/py-cupy/package.py @@ -53,7 +53,8 @@ class PyCupy(PythonPackage, CudaPackage, ROCmPackage): for a in CudaPackage.cuda_arch_values: depends_on("nccl +cuda cuda_arch={0}".format(a), when="+cuda cuda_arch={0}".format(a)) - depends_on("cudnn", when="+cuda") + depends_on("cudnn@8.8", when="@12.0.0: +cuda") + depends_on("cudnn@8.5", when="@11.2.0:11.6.0 +cuda") depends_on("cutensor", when="@:12.1.0 +cuda") depends_on("cutensor@2.0.1.2", when="@13.1: +cuda") From 7c473937ba93421c6cbba09c78427366a172f014 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 6 Sep 2024 09:13:14 +0200 Subject: [PATCH 018/687] db: more type hints (#46242) --- lib/spack/spack/database.py | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index 5d19f73f6b81c6..2b0c4f4c37ee15 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -212,7 +212,7 @@ def __init__( ref_count: int = 0, explicit: bool = False, installation_time: Optional[float] = None, - deprecated_for: Optional["spack.spec.Spec"] = None, + deprecated_for: Optional[str] = None, in_buildcache: bool = False, origin=None, ): @@ -1028,7 +1028,7 @@ def _check_ref_counts(self): Does no locking. """ - counts = {} + counts: Dict[str, int] = {} for key, rec in self._data.items(): counts.setdefault(key, 0) for dep in rec.spec.dependencies(deptype=_TRACKED_DEPENDENCIES): @@ -1218,7 +1218,7 @@ def _add( self._data[key].explicit = explicit @_autospec - def add(self, spec: "spack.spec.Spec", *, explicit=False) -> None: + def add(self, spec: "spack.spec.Spec", *, explicit: bool = False) -> None: """Add spec at path to database, locking and reading DB to sync. ``add()`` will lock and read from the DB on disk. @@ -1229,7 +1229,7 @@ def add(self, spec: "spack.spec.Spec", *, explicit=False) -> None: with self.write_transaction(): self._add(spec, explicit=explicit) - def _get_matching_spec_key(self, spec, **kwargs): + def _get_matching_spec_key(self, spec: "spack.spec.Spec", **kwargs) -> str: """Get the exact spec OR get a single spec that matches.""" key = spec.dag_hash() upstream, record = self.query_by_spec_hash(key) @@ -1241,12 +1241,12 @@ def _get_matching_spec_key(self, spec, **kwargs): return key @_autospec - def get_record(self, spec, **kwargs): + def get_record(self, spec: "spack.spec.Spec", **kwargs) -> Optional[InstallRecord]: key = self._get_matching_spec_key(spec, **kwargs) upstream, record = self.query_by_spec_hash(key) return record - def _decrement_ref_count(self, spec): + def _decrement_ref_count(self, spec: "spack.spec.Spec") -> None: key = spec.dag_hash() if key not in self._data: @@ -1263,7 +1263,7 @@ def _decrement_ref_count(self, spec): for dep in spec.dependencies(deptype=_TRACKED_DEPENDENCIES): self._decrement_ref_count(dep) - def _increment_ref_count(self, spec): + def _increment_ref_count(self, spec: "spack.spec.Spec") -> None: key = spec.dag_hash() if key not in self._data: @@ -1272,14 +1272,14 @@ def _increment_ref_count(self, spec): rec = self._data[key] rec.ref_count += 1 - def _remove(self, spec): + def _remove(self, spec: "spack.spec.Spec") -> "spack.spec.Spec": """Non-locking version of remove(); does real work.""" key = self._get_matching_spec_key(spec) rec = self._data[key] # This install prefix is now free for other specs to use, even if the # spec is only marked uninstalled. - if not rec.spec.external and rec.installed: + if not rec.spec.external and rec.installed and rec.path: self._installed_prefixes.remove(rec.path) if rec.ref_count > 0: @@ -1303,7 +1303,7 @@ def _remove(self, spec): return rec.spec @_autospec - def remove(self, spec): + def remove(self, spec: "spack.spec.Spec") -> "spack.spec.Spec": """Removes a spec from the database. To be called on uninstall. Reads the database, then: @@ -1318,7 +1318,7 @@ def remove(self, spec): with self.write_transaction(): return self._remove(spec) - def deprecator(self, spec): + def deprecator(self, spec: "spack.spec.Spec") -> Optional["spack.spec.Spec"]: """Return the spec that the given spec is deprecated for, or None""" with self.read_transaction(): spec_key = self._get_matching_spec_key(spec) @@ -1329,14 +1329,14 @@ def deprecator(self, spec): else: return None - def specs_deprecated_by(self, spec): + def specs_deprecated_by(self, spec: "spack.spec.Spec") -> List["spack.spec.Spec"]: """Return all specs deprecated in favor of the given spec""" with self.read_transaction(): return [ rec.spec for rec in self._data.values() if rec.deprecated_for == spec.dag_hash() ] - def _deprecate(self, spec, deprecator): + def _deprecate(self, spec: "spack.spec.Spec", deprecator: "spack.spec.Spec") -> None: spec_key = self._get_matching_spec_key(spec) spec_rec = self._data[spec_key] @@ -1354,17 +1354,17 @@ def _deprecate(self, spec, deprecator): self._data[spec_key] = spec_rec @_autospec - def mark(self, spec, key, value): + def mark(self, spec: "spack.spec.Spec", key, value) -> None: """Mark an arbitrary record on a spec.""" with self.write_transaction(): return self._mark(spec, key, value) - def _mark(self, spec, key, value): + def _mark(self, spec: "spack.spec.Spec", key, value) -> None: record = self._data[self._get_matching_spec_key(spec)] setattr(record, key, value) @_autospec - def deprecate(self, spec, deprecator): + def deprecate(self, spec: "spack.spec.Spec", deprecator: "spack.spec.Spec") -> None: """Marks a spec as deprecated in favor of its deprecator""" with self.write_transaction(): return self._deprecate(spec, deprecator) @@ -1372,16 +1372,16 @@ def deprecate(self, spec, deprecator): @_autospec def installed_relatives( self, - spec, - direction="children", - transitive=True, + spec: "spack.spec.Spec", + direction: str = "children", + transitive: bool = True, deptype: Union[dt.DepFlag, dt.DepTypes] = dt.ALL, - ): + ) -> Set["spack.spec.Spec"]: """Return installed specs related to this one.""" if direction not in ("parents", "children"): raise ValueError("Invalid direction: %s" % direction) - relatives = set() + relatives: Set[spack.spec.Spec] = set() for spec in self.query(spec): if transitive: to_add = spec.traverse(direction=direction, root=False, deptype=deptype) @@ -1408,7 +1408,7 @@ def installed_relatives( return relatives @_autospec - def installed_extensions_for(self, extendee_spec): + def installed_extensions_for(self, extendee_spec: "spack.spec.Spec"): """Returns the specs of all packages that extend the given spec""" for spec in self.query(): if spec.package.extends(extendee_spec): @@ -1667,7 +1667,7 @@ def unused_specs( self, root_hashes: Optional[Container[str]] = None, deptype: Union[dt.DepFlag, dt.DepTypes] = dt.LINK | dt.RUN, - ) -> "List[spack.spec.Spec]": + ) -> List["spack.spec.Spec"]: """Return all specs that are currently installed but not needed by root specs. By default, roots are all explicit specs in the database. If a set of root From 814f4f20c0dda13cc5668bb26ef9d09e876a5d75 Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Fri, 6 Sep 2024 10:38:35 +0200 Subject: [PATCH 019/687] py-pybind11: add v2.13.0-v2.13.4 and new conflict (#45872) This PR adds py-pybind11 versions 2.13.0, 2.13.1, 2.13.2, 2.13.3, and 2.13.4. It also adds a new conflict between gcc 14 and pybind versions up to and including 2.13.1. --- var/spack/repos/builtin/packages/py-pybind11/package.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py index 887f2b8d311ec6..daaa541afa1e2b 100644 --- a/var/spack/repos/builtin/packages/py-pybind11/package.py +++ b/var/spack/repos/builtin/packages/py-pybind11/package.py @@ -27,6 +27,11 @@ class PyPybind11(CMakePackage, PythonExtension): maintainers("ax3l") version("master", branch="master") + version("2.13.4", sha256="efc901aa0aab439a3fea6efeaf930b5a349fb06394bf845c64ce15a9cf8f0240") + version("2.13.3", sha256="6e7a84ec241544f2f5e30c7a82c09c81f0541dd14e9d9ef61051e07105f9c445") + version("2.13.2", sha256="50eebef369d28f07ce1fe1797f38149e5928817be8e539239f2aadfd95b227f3") + version("2.13.1", sha256="51631e88960a8856f9c497027f55c9f2f9115cafb08c0005439838a05ba17bfc") + version("2.13.0", sha256="8ac2bd138ea3c12683d3496361af6bee0f7754f86bf050e6c61e3966de688215") version("2.12.0", sha256="bf8f242abd1abcd375d516a7067490fb71abd79519a282d22b6e4d19282185a7") version("2.11.1", sha256="d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c") version("2.11.0", sha256="7af30a84c6810e721829c4646e31927af9d8861e085aa5dd37c3c8b8169fcda1") @@ -77,6 +82,9 @@ class PyPybind11(CMakePackage, PythonExtension): conflicts("%msvc@:16") conflicts("%intel@:17") + # https://github.com/pybind/pybind11/pull/5208 + conflicts("%gcc@14:", when="@:2.13.1") + # https://github.com/pybind/pybind11/pull/1995 @when("@:2.4") def patch(self): From 7fdf1029b747555f1d3040075bfeaf322ee6837e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 6 Sep 2024 13:38:14 +0200 Subject: [PATCH 020/687] fish: use shlex.quote instead of custom quote (#46251) --- lib/spack/spack/cmd/commands.py | 113 ++++++++++++------------------ share/spack/spack-completion.fish | 90 ++++++++++++------------ 2 files changed, 88 insertions(+), 115 deletions(-) diff --git a/lib/spack/spack/cmd/commands.py b/lib/spack/spack/cmd/commands.py index c6e775dd4329c8..a6616061ed726a 100644 --- a/lib/spack/spack/cmd/commands.py +++ b/lib/spack/spack/cmd/commands.py @@ -7,6 +7,7 @@ import copy import os import re +import shlex import sys from argparse import ArgumentParser, Namespace from typing import IO, Any, Callable, Dict, Iterable, List, Optional, Sequence, Set, Tuple, Union @@ -18,6 +19,7 @@ import spack.cmd import spack.main import spack.paths +import spack.platforms from spack.main import section_descriptions description = "list available spack commands" @@ -139,7 +141,7 @@ def usage(self, usage: str) -> str: cmd = self.parser.prog.replace(" ", "-") if cmd in self.documented: - string += "\n:ref:`More documentation `\n".format(cmd) + string = f"{string}\n:ref:`More documentation `\n" return string @@ -249,33 +251,27 @@ def body( Function body. """ if positionals: - return """ + return f""" if $list_options then - {0} + {self.optionals(optionals)} else - {1} + {self.positionals(positionals)} fi -""".format( - self.optionals(optionals), self.positionals(positionals) - ) +""" elif subcommands: - return """ + return f""" if $list_options then - {0} + {self.optionals(optionals)} else - {1} + {self.subcommands(subcommands)} fi -""".format( - self.optionals(optionals), self.subcommands(subcommands) - ) +""" else: - return """ - {0} -""".format( - self.optionals(optionals) - ) + return f""" + {self.optionals(optionals)} +""" def positionals(self, positionals: Sequence[str]) -> str: """Return the syntax for reporting positional arguments. @@ -304,7 +300,7 @@ def optionals(self, optionals: Sequence[str]) -> str: Returns: Syntax for optional flags. """ - return 'SPACK_COMPREPLY="{0}"'.format(" ".join(optionals)) + return f'SPACK_COMPREPLY="{" ".join(optionals)}"' def subcommands(self, subcommands: Sequence[str]) -> str: """Return the syntax for reporting subcommands. @@ -315,7 +311,7 @@ def subcommands(self, subcommands: Sequence[str]) -> str: Returns: Syntax for subcommand parsers """ - return 'SPACK_COMPREPLY="{0}"'.format(" ".join(subcommands)) + return f'SPACK_COMPREPLY="{" ".join(subcommands)}"' # Map argument destination names to their complete commands @@ -395,7 +391,7 @@ def _fish_dest_get_complete(prog: str, dest: str) -> Optional[str]: subcmd = s[1] if len(s) == 2 else "" for (prog_key, pos_key), value in _dest_to_fish_complete.items(): - if subcmd.startswith(prog_key) and re.match("^" + pos_key + "$", dest): + if subcmd.startswith(prog_key) and re.match(f"^{pos_key}$", dest): return value return None @@ -427,24 +423,6 @@ def format(self, cmd: Command) -> str: + self.complete(cmd.prog, positionals, optionals, subcommands) ) - def _quote(self, string: str) -> str: - """Quote string and escape special characters if necessary. - - Args: - string: Input string. - - Returns: - Quoted string. - """ - # Goal here is to match fish_indent behavior - - # Strings without spaces (or other special characters) do not need to be escaped - if not any([sub in string for sub in [" ", "'", '"']]): - return string - - string = string.replace("'", r"\'") - return f"'{string}'" - def optspecs( self, prog: str, @@ -463,7 +441,7 @@ def optspecs( optspec_var = "__fish_spack_optspecs_" + prog.replace(" ", "_").replace("-", "_") if optionals is None: - return "set -g %s\n" % optspec_var + return f"set -g {optspec_var}\n" # Build optspec by iterating over options args = [] @@ -490,11 +468,11 @@ def optspecs( long = [f[2:] for f in flags if f.startswith("--")] while len(short) > 0 and len(long) > 0: - arg = "%s/%s%s" % (short.pop(), long.pop(), required) + arg = f"{short.pop()}/{long.pop()}{required}" while len(short) > 0: - arg = "%s/%s" % (short.pop(), required) + arg = f"{short.pop()}/{required}" while len(long) > 0: - arg = "%s%s" % (long.pop(), required) + arg = f"{long.pop()}{required}" args.append(arg) @@ -503,7 +481,7 @@ def optspecs( # indicate that such subcommand exists. args = " ".join(args) - return "set -g %s %s\n" % (optspec_var, args) + return f"set -g {optspec_var} {args}\n" @staticmethod def complete_head( @@ -524,12 +502,14 @@ def complete_head( subcmd = s[1] if len(s) == 2 else "" if index is None: - return "complete -c %s -n '__fish_spack_using_command %s'" % (s[0], subcmd) + return f"complete -c {s[0]} -n '__fish_spack_using_command {subcmd}'" elif nargs in [argparse.ZERO_OR_MORE, argparse.ONE_OR_MORE, argparse.REMAINDER]: - head = "complete -c %s -n '__fish_spack_using_command_pos_remainder %d %s'" + return ( + f"complete -c {s[0]} -n '__fish_spack_using_command_pos_remainder " + f"{index} {subcmd}'" + ) else: - head = "complete -c %s -n '__fish_spack_using_command_pos %d %s'" - return head % (s[0], index, subcmd) + return f"complete -c {s[0]} -n '__fish_spack_using_command_pos {index} {subcmd}'" def complete( self, @@ -597,25 +577,18 @@ def positionals( if choices is not None: # If there are choices, we provide a completion for all possible values. - commands.append(head + " -f -a %s" % self._quote(" ".join(choices))) + commands.append(f"{head} -f -a {shlex.quote(' '.join(choices))}") else: # Otherwise, we try to find a predefined completion for it value = _fish_dest_get_complete(prog, args) if value is not None: - commands.append(head + " " + value) + commands.append(f"{head} {value}") return "\n".join(commands) + "\n" def prog_comment(self, prog: str) -> str: - """Return a comment line for the command. - - Args: - prog: Program name. - - Returns: - Comment line. - """ - return "\n# %s\n" % prog + """Return a comment line for the command.""" + return f"\n# {prog}\n" def optionals( self, @@ -658,28 +631,28 @@ def optionals( for f in flags: if f.startswith("--"): long = f[2:] - prefix += " -l %s" % long + prefix = f"{prefix} -l {long}" elif f.startswith("-"): short = f[1:] assert len(short) == 1 - prefix += " -s %s" % short + prefix = f"{prefix} -s {short}" # Check if option require argument. # Currently multi-argument options are not supported, so we treat it like one argument. if nargs != 0: - prefix += " -r" + prefix = f"{prefix} -r" if dest is not None: # If there are choices, we provide a completion for all possible values. - commands.append(prefix + " -f -a %s" % self._quote(" ".join(dest))) + commands.append(f"{prefix} -f -a {shlex.quote(' '.join(dest))}") else: # Otherwise, we try to find a predefined completion for it value = _fish_dest_get_complete(prog, dest) if value is not None: - commands.append(prefix + " " + value) + commands.append(f"{prefix} {value}") if help: - commands.append(prefix + " -d %s" % self._quote(help)) + commands.append(f"{prefix} -d {shlex.quote(help)}") return "\n".join(commands) + "\n" @@ -697,11 +670,11 @@ def subcommands(self, prog: str, subcommands: List[Tuple[ArgumentParser, str, st head = self.complete_head(prog, 0) for _, subcommand, help in subcommands: - command = head + " -f -a %s" % self._quote(subcommand) + command = f"{head} -f -a {shlex.quote(subcommand)}" if help is not None and len(help) > 0: help = help.split("\n")[0] - command += " -d %s" % self._quote(help) + command = f"{command} -d {shlex.quote(help)}" commands.append(command) @@ -747,7 +720,7 @@ def rst_index(out: IO) -> None: for i, cmd in enumerate(sorted(commands)): description = description.capitalize() if i == 0 else "" - ref = ":ref:`%s `" % (cmd, cmd) + ref = f":ref:`{cmd} `" comma = "," if i != len(commands) - 1 else "" bar = "| " if i % 8 == 0 else " " out.write(line % (description, bar + ref + comma)) @@ -858,10 +831,10 @@ def _commands(parser: ArgumentParser, args: Namespace) -> None: # check header first so we don't open out files unnecessarily if args.header and not os.path.exists(args.header): - tty.die("No such file: '%s'" % args.header) + tty.die(f"No such file: '{args.header}'") if args.update: - tty.msg("Updating file: %s" % args.update) + tty.msg(f"Updating file: {args.update}") with open(args.update, "w") as f: prepend_header(args, f) formatter(args, f) diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index de2c7ded6de1f2..0a20a82d57ce24 100644 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -353,7 +353,7 @@ complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a arch -d 'print ar complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a audit -d 'audit configuration files, packages, etc.' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a blame -d 'show contributors to packages' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a bootstrap -d 'manage bootstrap configuration' -complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a build-env -d 'run a command in a spec\'s install environment, or dump its environment to screen or file' +complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a build-env -d 'run a command in a spec'"'"'s install environment, or dump its environment to screen or file' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a buildcache -d 'create, download and install binary packages' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a cd -d 'cd to spack directories in the shell' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a change -d 'change an existing spec in an environment' @@ -376,7 +376,7 @@ complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a dependencies -d ' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a dependents -d 'show packages that depend on another' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a deprecate -d 'replace one package with another via symlinks' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a dev-build -d 'developer build: build from code in current working directory' -complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a develop -d 'add a spec to an environment\'s dev-build information' +complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a develop -d 'add a spec to an environment'"'"'s dev-build information' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a diff -d 'compare two specs' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a docs -d 'open spack documentation in a web browser' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a edit -d 'open package files in $EDITOR' @@ -407,7 +407,7 @@ complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a pkg -d 'query pac complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a providers -d 'list packages that provide a particular virtual package' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a pydoc -d 'run pydoc from within spack' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a python -d 'launch an interpreter as spack would launch a command' -complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a reindex -d 'rebuild Spack\'s package database' +complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a reindex -d 'rebuild Spack'"'"'s package database' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a remove -d 'remove specs from an environment' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a rm -d 'remove specs from an environment' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a repo -d 'manage package source repositories' @@ -418,12 +418,12 @@ complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a spec -d 'show wha complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a stage -d 'expand downloaded archive in preparation for install' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a style -d 'runs source code style checks on spack' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a tags -d 'show package tags and associated packages' -complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a test -d 'run spack\'s tests for an install' -complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a test-env -d 'run a command in a spec\'s test environment, or dump its environment to screen or file' +complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a test -d 'run spack'"'"'s tests for an install' +complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a test-env -d 'run a command in a spec'"'"'s test environment, or dump its environment to screen or file' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a tutorial -d 'set up spack for our tutorial (WARNING: modifies config!)' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a undevelop -d 'remove specs from an environment' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a uninstall -d 'remove installed packages' -complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a unit-test -d 'run spack\'s unit tests (wrapper around pytest)' +complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a unit-test -d 'run spack'"'"'s unit tests (wrapper around pytest)' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a unload -d 'remove package from the user environment' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a url -d 'debugging tool for url parsing' complete -c spack -n '__fish_spack_using_command_pos 0 ' -f -a verify -d 'check that all spack packages are on disk as installed' @@ -468,7 +468,7 @@ complete -c spack -n '__fish_spack_using_command ' -s p -l profile -d 'profile e complete -c spack -n '__fish_spack_using_command ' -l sorted-profile -r -f -a sorted_profile complete -c spack -n '__fish_spack_using_command ' -l sorted-profile -r -d 'profile and sort' complete -c spack -n '__fish_spack_using_command ' -l lines -r -f -a lines -complete -c spack -n '__fish_spack_using_command ' -l lines -r -d 'lines of profile output or \'all\' (default: 20)' +complete -c spack -n '__fish_spack_using_command ' -l lines -r -d 'lines of profile output or '"'"'all'"'"' (default: 20)' complete -c spack -n '__fish_spack_using_command ' -s v -l verbose -f -a verbose complete -c spack -n '__fish_spack_using_command ' -s v -l verbose -d 'print additional output during builds' complete -c spack -n '__fish_spack_using_command ' -l stacktrace -f -a stacktrace @@ -667,7 +667,7 @@ complete -c spack -n '__fish_spack_using_command build-env' -s h -l help -d 'sho complete -c spack -n '__fish_spack_using_command build-env' -l clean -f -a dirty complete -c spack -n '__fish_spack_using_command build-env' -l clean -d 'unset harmful variables in the build environment (default)' complete -c spack -n '__fish_spack_using_command build-env' -l dirty -f -a dirty -complete -c spack -n '__fish_spack_using_command build-env' -l dirty -d 'preserve user environment in spack\'s build environment (danger!)' +complete -c spack -n '__fish_spack_using_command build-env' -l dirty -d 'preserve user environment in spack'"'"'s build environment (danger!)' complete -c spack -n '__fish_spack_using_command build-env' -s U -l fresh -f -a concretizer_reuse complete -c spack -n '__fish_spack_using_command build-env' -s U -l fresh -d 'do not reuse installed deps; build newest configuration' complete -c spack -n '__fish_spack_using_command build-env' -l reuse -f -a concretizer_reuse @@ -892,7 +892,7 @@ complete -c spack -n '__fish_spack_using_command cd' -s r -l spack-root -d 'spac complete -c spack -n '__fish_spack_using_command cd' -s i -l install-dir -f -a install_dir complete -c spack -n '__fish_spack_using_command cd' -s i -l install-dir -d 'install prefix for spec (spec need not be installed)' complete -c spack -n '__fish_spack_using_command cd' -s p -l package-dir -f -a package_dir -complete -c spack -n '__fish_spack_using_command cd' -s p -l package-dir -d 'directory enclosing a spec\'s package.py file' +complete -c spack -n '__fish_spack_using_command cd' -s p -l package-dir -d 'directory enclosing a spec'"'"'s package.py file' complete -c spack -n '__fish_spack_using_command cd' -s P -l packages -f -a packages complete -c spack -n '__fish_spack_using_command cd' -s P -l packages -d 'top-level packages directory for Spack' complete -c spack -n '__fish_spack_using_command cd' -s s -l stage-dir -f -a stage_dir @@ -927,9 +927,9 @@ complete -c spack -n '__fish_spack_using_command_pos_remainder 1 checksum' -f -a complete -c spack -n '__fish_spack_using_command checksum' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command checksum' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command checksum' -l keep-stage -f -a keep_stage -complete -c spack -n '__fish_spack_using_command checksum' -l keep-stage -d 'don\'t clean up staging area when command completes' +complete -c spack -n '__fish_spack_using_command checksum' -l keep-stage -d 'don'"'"'t clean up staging area when command completes' complete -c spack -n '__fish_spack_using_command checksum' -l batch -s b -f -a batch -complete -c spack -n '__fish_spack_using_command checksum' -l batch -s b -d 'don\'t ask which versions to checksum' +complete -c spack -n '__fish_spack_using_command checksum' -l batch -s b -d 'don'"'"'t ask which versions to checksum' complete -c spack -n '__fish_spack_using_command checksum' -l latest -s l -f -a latest complete -c spack -n '__fish_spack_using_command checksum' -l latest -s l -d 'checksum the latest available version' complete -c spack -n '__fish_spack_using_command checksum' -l preferred -s p -f -a preferred @@ -961,7 +961,7 @@ complete -c spack -n '__fish_spack_using_command ci generate' -l copy-to -r -d ' complete -c spack -n '__fish_spack_using_command ci generate' -l optimize -f -a optimize complete -c spack -n '__fish_spack_using_command ci generate' -l optimize -d '(DEPRECATED) optimize the gitlab yaml file for size' complete -c spack -n '__fish_spack_using_command ci generate' -l dependencies -f -a dependencies -complete -c spack -n '__fish_spack_using_command ci generate' -l dependencies -d '(DEPRECATED) disable DAG scheduling (use \'plain\' dependencies)' +complete -c spack -n '__fish_spack_using_command ci generate' -l dependencies -d '(DEPRECATED) disable DAG scheduling (use '"'"'plain'"'"' dependencies)' complete -c spack -n '__fish_spack_using_command ci generate' -l buildcache-destination -r -f -a buildcache_destination complete -c spack -n '__fish_spack_using_command ci generate' -l buildcache-destination -r -d 'override the mirror configured in the environment' complete -c spack -n '__fish_spack_using_command ci generate' -l prune-dag -f -a prune_dag @@ -1037,7 +1037,7 @@ set -g __fish_spack_optspecs_spack_commands h/help update-completion a/aliases f complete -c spack -n '__fish_spack_using_command commands' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command commands' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command commands' -l update-completion -f -a update_completion -complete -c spack -n '__fish_spack_using_command commands' -l update-completion -d 'regenerate spack\'s tab completion scripts' +complete -c spack -n '__fish_spack_using_command commands' -l update-completion -d 'regenerate spack'"'"'s tab completion scripts' complete -c spack -n '__fish_spack_using_command commands' -s a -l aliases -f -a aliases complete -c spack -n '__fish_spack_using_command commands' -s a -l aliases -d 'include command aliases' complete -c spack -n '__fish_spack_using_command commands' -l format -r -f -a 'subcommands rst names bash fish' @@ -1137,7 +1137,7 @@ complete -c spack -n '__fish_spack_using_command concretize' -s f -l force -d 'r complete -c spack -n '__fish_spack_using_command concretize' -l test -r -f -a 'root all' complete -c spack -n '__fish_spack_using_command concretize' -l test -r -d 'concretize with test dependencies of only root packages or all packages' complete -c spack -n '__fish_spack_using_command concretize' -s q -l quiet -f -a quiet -complete -c spack -n '__fish_spack_using_command concretize' -s q -l quiet -d 'don\'t print concretized specs' +complete -c spack -n '__fish_spack_using_command concretize' -s q -l quiet -d 'don'"'"'t print concretized specs' complete -c spack -n '__fish_spack_using_command concretize' -s U -l fresh -f -a concretizer_reuse complete -c spack -n '__fish_spack_using_command concretize' -s U -l fresh -d 'do not reuse installed deps; build newest configuration' complete -c spack -n '__fish_spack_using_command concretize' -l reuse -f -a concretizer_reuse @@ -1158,7 +1158,7 @@ complete -c spack -n '__fish_spack_using_command concretise' -s f -l force -d 'r complete -c spack -n '__fish_spack_using_command concretise' -l test -r -f -a 'root all' complete -c spack -n '__fish_spack_using_command concretise' -l test -r -d 'concretize with test dependencies of only root packages or all packages' complete -c spack -n '__fish_spack_using_command concretise' -s q -l quiet -f -a quiet -complete -c spack -n '__fish_spack_using_command concretise' -s q -l quiet -d 'don\'t print concretized specs' +complete -c spack -n '__fish_spack_using_command concretise' -s q -l quiet -d 'don'"'"'t print concretized specs' complete -c spack -n '__fish_spack_using_command concretise' -s U -l fresh -f -a concretizer_reuse complete -c spack -n '__fish_spack_using_command concretise' -s U -l fresh -d 'do not reuse installed deps; build newest configuration' complete -c spack -n '__fish_spack_using_command concretise' -l reuse -f -a concretizer_reuse @@ -1288,7 +1288,7 @@ set -g __fish_spack_optspecs_spack_create h/help keep-stage n/name= t/template= complete -c spack -n '__fish_spack_using_command create' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command create' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command create' -l keep-stage -f -a keep_stage -complete -c spack -n '__fish_spack_using_command create' -l keep-stage -d 'don\'t clean up staging area when command completes' +complete -c spack -n '__fish_spack_using_command create' -l keep-stage -d 'don'"'"'t clean up staging area when command completes' complete -c spack -n '__fish_spack_using_command create' -s n -l name -r -f -a name complete -c spack -n '__fish_spack_using_command create' -s n -l name -r -d 'name of the package to create' complete -c spack -n '__fish_spack_using_command create' -s t -l template -r -f -a 'autoreconf autotools bazel bundle cargo cmake generic go intel lua makefile maven meson octave perlbuild perlmake python qmake r racket ruby scons sip waf' @@ -1302,11 +1302,11 @@ complete -c spack -n '__fish_spack_using_command create' -s f -l force -d 'overw complete -c spack -n '__fish_spack_using_command create' -l skip-editor -f -a skip_editor complete -c spack -n '__fish_spack_using_command create' -l skip-editor -d 'skip the edit session for the package (e.g., automation)' complete -c spack -n '__fish_spack_using_command create' -s b -l batch -f -a batch -complete -c spack -n '__fish_spack_using_command create' -s b -l batch -d 'don\'t ask which versions to checksum' +complete -c spack -n '__fish_spack_using_command create' -s b -l batch -d 'don'"'"'t ask which versions to checksum' # spack debug set -g __fish_spack_optspecs_spack_debug h/help -complete -c spack -n '__fish_spack_using_command_pos 0 debug' -f -a create-db-tarball -d 'create a tarball of Spack\'s installation metadata' +complete -c spack -n '__fish_spack_using_command_pos 0 debug' -f -a create-db-tarball -d 'create a tarball of Spack'"'"'s installation metadata' complete -c spack -n '__fish_spack_using_command_pos 0 debug' -f -a report -d 'print information useful for bug reports' complete -c spack -n '__fish_spack_using_command debug' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command debug' -s h -l help -d 'show this help message and exit' @@ -1373,7 +1373,7 @@ complete -c spack -n '__fish_spack_using_command deprecate' -s i -l install-depr complete -c spack -n '__fish_spack_using_command deprecate' -s I -l no-install-deprecator -f -a install complete -c spack -n '__fish_spack_using_command deprecate' -s I -l no-install-deprecator -d 'deprecator spec must already be installed (default)' complete -c spack -n '__fish_spack_using_command deprecate' -s l -l link-type -r -f -a 'soft hard' -complete -c spack -n '__fish_spack_using_command deprecate' -s l -l link-type -r -d (deprecated) +complete -c spack -n '__fish_spack_using_command deprecate' -s l -l link-type -r -d '(deprecated)' # spack dev-build set -g __fish_spack_optspecs_spack_dev_build h/help j/jobs= n/no-checksum d/source-path= i/ignore-dependencies keep-prefix skip-patch q/quiet drop-in= test= b/before= u/until= clean dirty U/fresh reuse fresh-roots deprecated @@ -1405,7 +1405,7 @@ complete -c spack -n '__fish_spack_using_command dev-build' -s u -l until -r -d complete -c spack -n '__fish_spack_using_command dev-build' -l clean -f -a dirty complete -c spack -n '__fish_spack_using_command dev-build' -l clean -d 'unset harmful variables in the build environment (default)' complete -c spack -n '__fish_spack_using_command dev-build' -l dirty -f -a dirty -complete -c spack -n '__fish_spack_using_command dev-build' -l dirty -d 'preserve user environment in spack\'s build environment (danger!)' +complete -c spack -n '__fish_spack_using_command dev-build' -l dirty -d 'preserve user environment in spack'"'"'s build environment (danger!)' complete -c spack -n '__fish_spack_using_command dev-build' -s U -l fresh -f -a concretizer_reuse complete -c spack -n '__fish_spack_using_command dev-build' -s U -l fresh -d 'do not reuse installed deps; build newest configuration' complete -c spack -n '__fish_spack_using_command dev-build' -l reuse -f -a concretizer_reuse @@ -1483,7 +1483,7 @@ complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a list -d 'list complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a ls -d 'list managed environments' complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a status -d 'print whether there is an active environment' complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a st -d 'print whether there is an active environment' -complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a loads -d 'list modules for an installed environment \'(see spack module loads)\'' +complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a loads -d 'list modules for an installed environment '"'"'(see spack module loads)'"'"'' complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a view -d 'manage a view associated with the environment' complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a update -d 'update environments to the latest format' complete -c spack -n '__fish_spack_using_command_pos 0 env' -f -a revert -d 'restore environments to their state before update' @@ -1515,9 +1515,9 @@ complete -c spack -n '__fish_spack_using_command env activate' -s p -l prompt -d complete -c spack -n '__fish_spack_using_command env activate' -l temp -f -a temp complete -c spack -n '__fish_spack_using_command env activate' -l temp -d 'create and activate an environment in a temporary directory' complete -c spack -n '__fish_spack_using_command env activate' -l create -f -a create -complete -c spack -n '__fish_spack_using_command env activate' -l create -d 'create and activate the environment if it doesn\'t exist' +complete -c spack -n '__fish_spack_using_command env activate' -l create -d 'create and activate the environment if it doesn'"'"'t exist' complete -c spack -n '__fish_spack_using_command env activate' -l envfile -r -f -a envfile -complete -c spack -n '__fish_spack_using_command env activate' -l envfile -r -d 'either a lockfile (must end with \'.json\' or \'.lock\') or a manifest file' +complete -c spack -n '__fish_spack_using_command env activate' -l envfile -r -d 'either a lockfile (must end with '"'"'.json'"'"' or '"'"'.lock'"'"') or a manifest file' complete -c spack -n '__fish_spack_using_command env activate' -l keep-relative -f -a keep_relative complete -c spack -n '__fish_spack_using_command env activate' -l keep-relative -d 'copy relative develop paths verbatim into the new environment when initializing from envfile' complete -c spack -n '__fish_spack_using_command env activate' -s d -l dir -f -a dir @@ -1699,7 +1699,7 @@ set -g __fish_spack_optspecs_spack_external_find h/help not-buildable exclude= p complete -c spack -n '__fish_spack_using_command external find' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command external find' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command external find' -l not-buildable -f -a not_buildable -complete -c spack -n '__fish_spack_using_command external find' -l not-buildable -d 'packages with detected externals won\'t be built with Spack' +complete -c spack -n '__fish_spack_using_command external find' -l not-buildable -d 'packages with detected externals won'"'"'t be built with Spack' complete -c spack -n '__fish_spack_using_command external find' -l exclude -r -f -a exclude complete -c spack -n '__fish_spack_using_command external find' -l exclude -r -d 'packages to exclude from search' complete -c spack -n '__fish_spack_using_command external find' -s p -l path -r -f -a path @@ -1729,7 +1729,7 @@ complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l ignore-default-dir -f -a ignore_default_dir complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l ignore-default-dir -d 'ignore the default directory of manifest files' complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l dry-run -f -a dry_run -complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l dry-run -d 'don\'t modify DB with files that are read' +complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l dry-run -d 'don'"'"'t modify DB with files that are read' complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l fail-on-error -f -a fail_on_error complete -c spack -n '__fish_spack_using_command external read-cray-manifest' -l fail-on-error -d 'if a manifest file cannot be parsed, fail and report the full stack trace' @@ -1761,7 +1761,7 @@ complete -c spack -n '__fish_spack_using_command find' -s h -l help -d 'show thi complete -c spack -n '__fish_spack_using_command find' -l format -r -f -a format complete -c spack -n '__fish_spack_using_command find' -l format -r -d 'output specs with the specified format string' complete -c spack -n '__fish_spack_using_command find' -s H -l hashes -f -a format -complete -c spack -n '__fish_spack_using_command find' -s H -l hashes -d 'same as \'--format {/hash}\'; use with xargs or $()' +complete -c spack -n '__fish_spack_using_command find' -s H -l hashes -d 'same as '"'"'--format {/hash}'"'"'; use with xargs or $()' complete -c spack -n '__fish_spack_using_command find' -l json -f -a json complete -c spack -n '__fish_spack_using_command find' -l json -d 'output specs as machine-readable json records' complete -c spack -n '__fish_spack_using_command find' -s I -l install-status -f -a install_status @@ -1783,7 +1783,7 @@ complete -c spack -n '__fish_spack_using_command find' -s t -l tag -r -d 'filter complete -c spack -n '__fish_spack_using_command find' -s N -l namespaces -f -a namespaces complete -c spack -n '__fish_spack_using_command find' -s N -l namespaces -d 'show fully qualified package names' complete -c spack -n '__fish_spack_using_command find' -s r -l only-roots -f -a only_roots -complete -c spack -n '__fish_spack_using_command find' -s r -l only-roots -d 'don\'t show full list of installed specs in an environment' +complete -c spack -n '__fish_spack_using_command find' -s r -l only-roots -d 'don'"'"'t show full list of installed specs in an environment' complete -c spack -n '__fish_spack_using_command find' -s c -l show-concretized -f -a show_concretized complete -c spack -n '__fish_spack_using_command find' -s c -l show-concretized -d 'show concretized specs in an environment' complete -c spack -n '__fish_spack_using_command find' -s f -l show-flags -f -a show_flags @@ -1809,7 +1809,7 @@ complete -c spack -n '__fish_spack_using_command find' -l deprecated -d 'show de complete -c spack -n '__fish_spack_using_command find' -l only-deprecated -f -a only_deprecated complete -c spack -n '__fish_spack_using_command find' -l only-deprecated -d 'show only deprecated packages' complete -c spack -n '__fish_spack_using_command find' -l install-tree -r -f -a install_tree -complete -c spack -n '__fish_spack_using_command find' -l install-tree -r -d 'Install trees to query: \'all\' (default), \'local\', \'upstream\', upstream name or path' +complete -c spack -n '__fish_spack_using_command find' -l install-tree -r -d 'Install trees to query: '"'"'all'"'"' (default), '"'"'local'"'"', '"'"'upstream'"'"', upstream name or path' complete -c spack -n '__fish_spack_using_command find' -l start-date -r -f -a start_date complete -c spack -n '__fish_spack_using_command find' -l start-date -r -d 'earliest date of installation [YYYY-MM-DD]' complete -c spack -n '__fish_spack_using_command find' -l end-date -r -f -a end_date @@ -1935,7 +1935,7 @@ complete -c spack -n '__fish_spack_using_command graph' -s a -l ascii -d 'draw g complete -c spack -n '__fish_spack_using_command graph' -s d -l dot -f -a dot complete -c spack -n '__fish_spack_using_command graph' -s d -l dot -d 'generate graph in dot format and print to stdout' complete -c spack -n '__fish_spack_using_command graph' -s s -l static -f -a static -complete -c spack -n '__fish_spack_using_command graph' -s s -l static -d 'graph static (possible) deps, don\'t concretize (implies --dot)' +complete -c spack -n '__fish_spack_using_command graph' -s s -l static -d 'graph static (possible) deps, don'"'"'t concretize (implies --dot)' complete -c spack -n '__fish_spack_using_command graph' -s c -l color -f -a color complete -c spack -n '__fish_spack_using_command graph' -s c -l color -d 'use different colors for different dependency types' complete -c spack -n '__fish_spack_using_command graph' -s i -l installed -f -a installed @@ -1979,7 +1979,7 @@ complete -c spack -n '__fish_spack_using_command info' -l tests -d 'output relev complete -c spack -n '__fish_spack_using_command info' -l virtuals -f -a virtuals complete -c spack -n '__fish_spack_using_command info' -l virtuals -d 'output virtual packages' complete -c spack -n '__fish_spack_using_command info' -l variants-by-name -f -a variants_by_name -complete -c spack -n '__fish_spack_using_command info' -l variants-by-name -d 'list variants in strict name order; don\'t group by condition' +complete -c spack -n '__fish_spack_using_command info' -l variants-by-name -d 'list variants in strict name order; don'"'"'t group by condition' # spack install set -g __fish_spack_optspecs_spack_install h/help only= u/until= j/jobs= overwrite fail-fast keep-prefix keep-stage dont-restage use-cache no-cache cache-only use-buildcache= include-build-deps no-check-signature show-log-on-error source n/no-checksum v/verbose fake only-concrete add no-add f/file= clean dirty test= log-format= log-file= help-cdash cdash-upload-url= cdash-build= cdash-site= cdash-track= cdash-buildstamp= y/yes-to-all U/fresh reuse fresh-roots deprecated @@ -1997,11 +1997,11 @@ complete -c spack -n '__fish_spack_using_command install' -l overwrite -d 'reins complete -c spack -n '__fish_spack_using_command install' -l fail-fast -f -a fail_fast complete -c spack -n '__fish_spack_using_command install' -l fail-fast -d 'stop all builds if any build fails (default is best effort)' complete -c spack -n '__fish_spack_using_command install' -l keep-prefix -f -a keep_prefix -complete -c spack -n '__fish_spack_using_command install' -l keep-prefix -d 'don\'t remove the install prefix if installation fails' +complete -c spack -n '__fish_spack_using_command install' -l keep-prefix -d 'don'"'"'t remove the install prefix if installation fails' complete -c spack -n '__fish_spack_using_command install' -l keep-stage -f -a keep_stage -complete -c spack -n '__fish_spack_using_command install' -l keep-stage -d 'don\'t remove the build stage if installation succeeds' +complete -c spack -n '__fish_spack_using_command install' -l keep-stage -d 'don'"'"'t remove the build stage if installation succeeds' complete -c spack -n '__fish_spack_using_command install' -l dont-restage -f -a dont_restage -complete -c spack -n '__fish_spack_using_command install' -l dont-restage -d 'if a partial install is detected, don\'t delete prior state' +complete -c spack -n '__fish_spack_using_command install' -l dont-restage -d 'if a partial install is detected, don'"'"'t delete prior state' complete -c spack -n '__fish_spack_using_command install' -l use-cache -f -a use_cache complete -c spack -n '__fish_spack_using_command install' -l use-cache -d 'check for pre-built Spack packages in mirrors (default)' complete -c spack -n '__fish_spack_using_command install' -l no-cache -f -a use_cache @@ -2009,7 +2009,7 @@ complete -c spack -n '__fish_spack_using_command install' -l no-cache -d 'do not complete -c spack -n '__fish_spack_using_command install' -l cache-only -f -a cache_only complete -c spack -n '__fish_spack_using_command install' -l cache-only -d 'only install package from binary mirrors' complete -c spack -n '__fish_spack_using_command install' -l use-buildcache -r -f -a use_buildcache -complete -c spack -n '__fish_spack_using_command install' -l use-buildcache -r -d 'select the mode of buildcache for the \'package\' and \'dependencies\'' +complete -c spack -n '__fish_spack_using_command install' -l use-buildcache -r -d 'select the mode of buildcache for the '"'"'package'"'"' and '"'"'dependencies'"'"'' complete -c spack -n '__fish_spack_using_command install' -l include-build-deps -f -a include_build_deps complete -c spack -n '__fish_spack_using_command install' -l include-build-deps -d 'include build deps when installing from cache, useful for CI pipeline troubleshooting' complete -c spack -n '__fish_spack_using_command install' -l no-check-signature -f -a unsigned @@ -2035,7 +2035,7 @@ complete -c spack -n '__fish_spack_using_command install' -s f -l file -r -d 're complete -c spack -n '__fish_spack_using_command install' -l clean -f -a dirty complete -c spack -n '__fish_spack_using_command install' -l clean -d 'unset harmful variables in the build environment (default)' complete -c spack -n '__fish_spack_using_command install' -l dirty -f -a dirty -complete -c spack -n '__fish_spack_using_command install' -l dirty -d 'preserve user environment in spack\'s build environment (danger!)' +complete -c spack -n '__fish_spack_using_command install' -l dirty -d 'preserve user environment in spack'"'"'s build environment (danger!)' complete -c spack -n '__fish_spack_using_command install' -l test -r -f -a 'root all' complete -c spack -n '__fish_spack_using_command install' -l test -r -d 'run tests on only root packages or all packages' complete -c spack -n '__fish_spack_using_command install' -l log-format -r -f -a 'junit cdash' @@ -2137,7 +2137,7 @@ complete -c spack -n '__fish_spack_using_command location' -s r -l spack-root -d complete -c spack -n '__fish_spack_using_command location' -s i -l install-dir -f -a install_dir complete -c spack -n '__fish_spack_using_command location' -s i -l install-dir -d 'install prefix for spec (spec need not be installed)' complete -c spack -n '__fish_spack_using_command location' -s p -l package-dir -f -a package_dir -complete -c spack -n '__fish_spack_using_command location' -s p -l package-dir -d 'directory enclosing a spec\'s package.py file' +complete -c spack -n '__fish_spack_using_command location' -s p -l package-dir -d 'directory enclosing a spec'"'"'s package.py file' complete -c spack -n '__fish_spack_using_command location' -s P -l packages -f -a packages complete -c spack -n '__fish_spack_using_command location' -s P -l packages -d 'top-level packages directory for Spack' complete -c spack -n '__fish_spack_using_command location' -s s -l stage-dir -f -a stage_dir @@ -2244,11 +2244,11 @@ complete -c spack -n '__fish_spack_using_command mirror create' -l exclude-file complete -c spack -n '__fish_spack_using_command mirror create' -l exclude-specs -r -f -a exclude_specs complete -c spack -n '__fish_spack_using_command mirror create' -l exclude-specs -r -d 'specs which Spack should not try to add to a mirror (specified on command line)' complete -c spack -n '__fish_spack_using_command mirror create' -l skip-unstable-versions -f -a skip_unstable_versions -complete -c spack -n '__fish_spack_using_command mirror create' -l skip-unstable-versions -d 'don\'t cache versions unless they identify a stable (unchanging) source code' +complete -c spack -n '__fish_spack_using_command mirror create' -l skip-unstable-versions -d 'don'"'"'t cache versions unless they identify a stable (unchanging) source code' complete -c spack -n '__fish_spack_using_command mirror create' -s D -l dependencies -f -a dependencies complete -c spack -n '__fish_spack_using_command mirror create' -s D -l dependencies -d 'also fetch all dependencies' complete -c spack -n '__fish_spack_using_command mirror create' -s n -l versions-per-spec -r -f -a versions_per_spec -complete -c spack -n '__fish_spack_using_command mirror create' -s n -l versions-per-spec -r -d 'the number of versions to fetch for each spec, choose \'all\' to retrieve all versions of each package' +complete -c spack -n '__fish_spack_using_command mirror create' -s n -l versions-per-spec -r -d 'the number of versions to fetch for each spec, choose '"'"'all'"'"' to retrieve all versions of each package' complete -c spack -n '__fish_spack_using_command mirror create' -l private -f -a private complete -c spack -n '__fish_spack_using_command mirror create' -l private -d 'for a private mirror, include non-redistributable packages' complete -c spack -n '__fish_spack_using_command mirror create' -s U -l fresh -f -a concretizer_reuse @@ -2353,7 +2353,7 @@ complete -c spack -n '__fish_spack_using_command mirror set' -l fetch -d 'modify complete -c spack -n '__fish_spack_using_command mirror set' -l type -r -f -a 'binary source' complete -c spack -n '__fish_spack_using_command mirror set' -l type -r -d 'specify the mirror type: for both binary and source use `--type binary --type source`' complete -c spack -n '__fish_spack_using_command mirror set' -l url -r -f -a url -complete -c spack -n '__fish_spack_using_command mirror set' -l url -r -d 'url of mirror directory from \'spack mirror create\'' +complete -c spack -n '__fish_spack_using_command mirror set' -l url -r -d 'url of mirror directory from '"'"'spack mirror create'"'"'' complete -c spack -n '__fish_spack_using_command mirror set' -l autopush -f -a autopush complete -c spack -n '__fish_spack_using_command mirror set' -l autopush -d 'set mirror to push automatically after installation' complete -c spack -n '__fish_spack_using_command mirror set' -l no-autopush -f -a autopush @@ -2580,7 +2580,7 @@ complete -c spack -n '__fish_spack_using_command_pos 1 pkg changed' -f -a '(__fi complete -c spack -n '__fish_spack_using_command pkg changed' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command pkg changed' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command pkg changed' -s t -l type -r -f -a type -complete -c spack -n '__fish_spack_using_command pkg changed' -s t -l type -r -d 'types of changes to show (A: added, R: removed, C: changed); default is \'C\'' +complete -c spack -n '__fish_spack_using_command pkg changed' -s t -l type -r -d 'types of changes to show (A: added, R: removed, C: changed); default is '"'"'C'"'"'' # spack pkg removed set -g __fish_spack_optspecs_spack_pkg_removed h/help @@ -2672,9 +2672,9 @@ complete -c spack -n '__fish_spack_using_command rm' -s f -l force -d 'remove co set -g __fish_spack_optspecs_spack_repo h/help complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a create -d 'create a new package repository' complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a list -d 'show registered repositories and their namespaces' -complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a add -d 'add a package source to Spack\'s configuration' -complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a remove -d 'remove a repository from Spack\'s configuration' -complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a rm -d 'remove a repository from Spack\'s configuration' +complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a add -d 'add a package source to Spack'"'"'s configuration' +complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a remove -d 'remove a repository from Spack'"'"'s configuration' +complete -c spack -n '__fish_spack_using_command_pos 0 repo' -f -a rm -d 'remove a repository from Spack'"'"'s configuration' complete -c spack -n '__fish_spack_using_command repo' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command repo' -s h -l help -d 'show this help message and exit' @@ -2907,7 +2907,7 @@ complete -c spack -n '__fish_spack_using_command test run' -l help-cdash -d 'sho complete -c spack -n '__fish_spack_using_command test run' -l clean -f -a dirty complete -c spack -n '__fish_spack_using_command test run' -l clean -d 'unset harmful variables in the build environment (default)' complete -c spack -n '__fish_spack_using_command test run' -l dirty -f -a dirty -complete -c spack -n '__fish_spack_using_command test run' -l dirty -d 'preserve user environment in spack\'s build environment (danger!)' +complete -c spack -n '__fish_spack_using_command test run' -l dirty -d 'preserve user environment in spack'"'"'s build environment (danger!)' # spack test list set -g __fish_spack_optspecs_spack_test_list h/help a/all @@ -2955,7 +2955,7 @@ complete -c spack -n '__fish_spack_using_command test-env' -s h -l help -d 'show complete -c spack -n '__fish_spack_using_command test-env' -l clean -f -a dirty complete -c spack -n '__fish_spack_using_command test-env' -l clean -d 'unset harmful variables in the build environment (default)' complete -c spack -n '__fish_spack_using_command test-env' -l dirty -f -a dirty -complete -c spack -n '__fish_spack_using_command test-env' -l dirty -d 'preserve user environment in spack\'s build environment (danger!)' +complete -c spack -n '__fish_spack_using_command test-env' -l dirty -d 'preserve user environment in spack'"'"'s build environment (danger!)' complete -c spack -n '__fish_spack_using_command test-env' -s U -l fresh -f -a concretizer_reuse complete -c spack -n '__fish_spack_using_command test-env' -s U -l fresh -d 'do not reuse installed deps; build newest configuration' complete -c spack -n '__fish_spack_using_command test-env' -l reuse -f -a concretizer_reuse From 4042afaa99426d8ed35643e531b69a8012fbd3f2 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Fri, 6 Sep 2024 08:26:46 -0400 Subject: [PATCH 021/687] Bootstrap GnuPG and `file` on Windows (#41810) Spack can now bootstrap two new dependencies on Windows: GnuPG, and file. These dependencies are modeled as a separate package, and they install a cross-compiled binary. Details on how they binaries are built are in https://github.com/spack/windows-bootstrap-resources --- .github/workflows/bootstrap.yml | 41 ++++++- lib/spack/llnl/util/filesystem.py | 74 ------------- lib/spack/spack/binary_distribution.py | 3 +- lib/spack/spack/bootstrap/__init__.py | 2 + lib/spack/spack/bootstrap/core.py | 23 +++- lib/spack/spack/bootstrap/status.py | 2 +- lib/spack/spack/package.py | 1 + lib/spack/spack/relocate.py | 6 +- lib/spack/spack/util/filesystem.py | 102 ++++++++++++++++++ .../gitlab/cloud_pipelines/.gitlab-ci.yml | 2 +- .../cloud_pipelines/configs/win64/ci.yaml | 2 +- share/spack/qa/bootstrap-file.py | 4 + .../builtin/packages/win-file/package.py | 35 ++++++ .../repos/builtin/packages/win-gpg/package.py | 36 +++++++ 14 files changed, 243 insertions(+), 90 deletions(-) create mode 100644 lib/spack/spack/util/filesystem.py create mode 100644 share/spack/qa/bootstrap-file.py create mode 100644 var/spack/repos/builtin/packages/win-file/package.py create mode 100644 var/spack/repos/builtin/packages/win-gpg/package.py diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 8e220b12bfdb0c..613dc2ba508393 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -112,10 +112,10 @@ jobs: runs-on: ${{ matrix.runner }} strategy: matrix: - runner: ['macos-13', 'macos-14', "ubuntu-latest"] + runner: ['macos-13', 'macos-14', "ubuntu-latest", "windows-latest"] steps: - name: Setup macOS - if: ${{ matrix.runner != 'ubuntu-latest' }} + if: ${{ matrix.runner != 'ubuntu-latest' && matrix.runner != 'windows-latest'}} run: | brew install tree # Remove GnuPG since we want to bootstrap it @@ -124,6 +124,11 @@ jobs: if: ${{ matrix.runner == 'ubuntu-latest' }} run: | sudo rm -rf $(which gpg) $(which gpg2) $(which patchelf) + - name: Setup Windows + if: ${{ matrix.runner == 'windows-latest' }} + run: | + Remove-Item -Path (Get-Command gpg).Path + Remove-Item -Path (Get-Command file).Path - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 with: @@ -137,11 +142,20 @@ jobs: 3.11 3.12 - name: Set bootstrap sources + env: + SETUP_SCRIPT_EXT: ${{ matrix.runner == 'windows-latest' && 'ps1' || 'sh' }} + SETUP_SCRIPT_SOURCE: ${{ matrix.runner == 'windows-latest' && './' || 'source ' }} run: | - source share/spack/setup-env.sh + ${{ env.SETUP_SCRIPT_SOURCE }}share/spack/setup-env.${{ env.SETUP_SCRIPT_EXT }} spack bootstrap disable github-actions-v0.4 + - name: Disable from source bootstrap + if: ${{ matrix.runner != 'windows-latest' }} + run: | + source share/spack/setup-env.sh spack bootstrap disable spack-install - name: Bootstrap clingo + # No binary clingo on Windows yet + if: ${{ matrix.runner != 'windows-latest' }} run: | set -e for ver in '3.8' '3.9' '3.10' '3.11' '3.12' ; do @@ -164,7 +178,24 @@ jobs: fi done - name: Bootstrap GnuPG + env: + SETUP_SCRIPT_EXT: ${{ matrix.runner == 'windows-latest' && 'ps1' || 'sh' }} + SETUP_SCRIPT_SOURCE: ${{ matrix.runner == 'windows-latest' && './' || 'source ' }} + USER_SCOPE_PARENT_DIR: ${{ matrix.runner == 'windows-latest' && '$env:userprofile' || '$HOME' }} + VALIDATE_LAST_EXIT: ${{ matrix.runner == 'windows-latest' && './share/spack/qa/validate_last_exit.ps1' || '' }} run: | - source share/spack/setup-env.sh + ${{ env.SETUP_SCRIPT_SOURCE }}share/spack/setup-env.${{ env.SETUP_SCRIPT_EXT }} spack -d gpg list - tree ~/.spack/bootstrap/store/ + ${{ env.VALIDATE_LAST_EXIT }} + tree ${{ env.USER_SCOPE_PARENT_DIR }}/.spack/bootstrap/store/ + - name: Bootstrap File + env: + SETUP_SCRIPT_EXT: ${{ matrix.runner == 'windows-latest' && 'ps1' || 'sh' }} + SETUP_SCRIPT_SOURCE: ${{ matrix.runner == 'windows-latest' && './' || 'source ' }} + USER_SCOPE_PARENT_DIR: ${{ matrix.runner == 'windows-latest' && '$env:userprofile' || '$HOME' }} + VALIDATE_LAST_EXIT: ${{ matrix.runner == 'windows-latest' && './share/spack/qa/validate_last_exit.ps1' || '' }} + run: | + ${{ env.SETUP_SCRIPT_SOURCE }}share/spack/setup-env.${{ env.SETUP_SCRIPT_EXT }} + spack -d python share/spack/qa/bootstrap-file.py + ${{ env.VALIDATE_LAST_EXIT }} + tree ${{ env.USER_SCOPE_PARENT_DIR }}/.spack/bootstrap/store/ diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 308c6154e1a789..54ace7d42fa4cf 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -27,8 +27,6 @@ from llnl.util.lang import dedupe, memoized from llnl.util.symlink import islink, readlink, resolve_link_target_relative_to_the_link, symlink -from spack.util.executable import Executable, which - from ..path import path_to_os_path, system_path_filter if sys.platform != "win32": @@ -53,7 +51,6 @@ "find_all_headers", "find_libraries", "find_system_libraries", - "fix_darwin_install_name", "force_remove", "force_symlink", "getuid", @@ -248,42 +245,6 @@ def path_contains_subdirectory(path, root): return norm_path.startswith(norm_root) -@memoized -def file_command(*args): - """Creates entry point to `file` system command with provided arguments""" - file_cmd = which("file", required=True) - for arg in args: - file_cmd.add_default_arg(arg) - return file_cmd - - -@memoized -def _get_mime_type(): - """Generate method to call `file` system command to aquire mime type - for a specified path - """ - if sys.platform == "win32": - # -h option (no-dereference) does not exist in Windows - return file_command("-b", "--mime-type") - else: - return file_command("-b", "-h", "--mime-type") - - -def mime_type(filename): - """Returns the mime type and subtype of a file. - - Args: - filename: file to be analyzed - - Returns: - Tuple containing the MIME type and subtype - """ - output = _get_mime_type()(filename, output=str, error=str).strip() - tty.debug("==> " + output) - type, _, subtype = output.partition("/") - return type, subtype - - #: This generates the library filenames that may appear on any OS. library_extensions = ["a", "la", "so", "tbd", "dylib"] @@ -1679,41 +1640,6 @@ def safe_remove(*files_or_dirs): raise -@system_path_filter -def fix_darwin_install_name(path): - """Fix install name of dynamic libraries on Darwin to have full path. - - There are two parts of this task: - - 1. Use ``install_name('-id', ...)`` to change install name of a single lib - 2. Use ``install_name('-change', ...)`` to change the cross linking between - libs. The function assumes that all libraries are in one folder and - currently won't follow subfolders. - - Parameters: - path (str): directory in which .dylib files are located - """ - libs = glob.glob(join_path(path, "*.dylib")) - for lib in libs: - # fix install name first: - install_name_tool = Executable("install_name_tool") - install_name_tool("-id", lib, lib) - otool = Executable("otool") - long_deps = otool("-L", lib, output=str).split("\n") - deps = [dep.partition(" ")[0][1::] for dep in long_deps[2:-1]] - # fix all dependencies: - for dep in deps: - for loc in libs: - # We really want to check for either - # dep == os.path.basename(loc) or - # dep == join_path(builddir, os.path.basename(loc)), - # but we don't know builddir (nor how symbolic links look - # in builddir). We thus only compare the basenames. - if os.path.basename(dep) == os.path.basename(loc): - install_name_tool("-change", dep, loc, lib) - break - - def find_first(root: str, files: Union[Iterable[str], str], bfs_depth: int = 2) -> Optional[str]: """Find the first file matching a pattern. diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 8d3c3cfb7a0b37..15189f9d438f62 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -54,6 +54,7 @@ import spack.util.archive import spack.util.crypto import spack.util.file_cache as file_cache +import spack.util.filesystem as ssys import spack.util.gpg import spack.util.parallel import spack.util.path @@ -687,7 +688,7 @@ def get_buildfile_manifest(spec): # Non-symlinks. for rel_path in visitor.files: abs_path = os.path.join(root, rel_path) - m_type, m_subtype = fsys.mime_type(abs_path) + m_type, m_subtype = ssys.mime_type(abs_path) if relocate.needs_binary_relocation(m_type, m_subtype): # Why is this branch not part of needs_binary_relocation? :( diff --git a/lib/spack/spack/bootstrap/__init__.py b/lib/spack/spack/bootstrap/__init__.py index 85935cd0e021b2..d710caee68cc2f 100644 --- a/lib/spack/spack/bootstrap/__init__.py +++ b/lib/spack/spack/bootstrap/__init__.py @@ -9,6 +9,7 @@ all_core_root_specs, ensure_clingo_importable_or_raise, ensure_core_dependencies, + ensure_file_in_path_or_raise, ensure_gpg_in_path_or_raise, ensure_patchelf_in_path_or_raise, ) @@ -19,6 +20,7 @@ "is_bootstrapping", "ensure_bootstrap_configuration", "ensure_core_dependencies", + "ensure_file_in_path_or_raise", "ensure_gpg_in_path_or_raise", "ensure_clingo_importable_or_raise", "ensure_patchelf_in_path_or_raise", diff --git a/lib/spack/spack/bootstrap/core.py b/lib/spack/spack/bootstrap/core.py index 62b6b86570c3a8..02909cbdf7bd8a 100644 --- a/lib/spack/spack/bootstrap/core.py +++ b/lib/spack/spack/bootstrap/core.py @@ -472,7 +472,8 @@ def ensure_clingo_importable_or_raise() -> None: def gnupg_root_spec() -> str: """Return the root spec used to bootstrap GnuPG""" - return _root_spec("gnupg@2.3:") + root_spec_name = "win-gpg" if IS_WINDOWS else "gnupg" + return _root_spec(f"{root_spec_name}@2.3:") def ensure_gpg_in_path_or_raise() -> None: @@ -482,6 +483,19 @@ def ensure_gpg_in_path_or_raise() -> None: ) +def file_root_spec() -> str: + """Return the root spec used to bootstrap file""" + root_spec_name = "win-file" if IS_WINDOWS else "file" + return _root_spec(root_spec_name) + + +def ensure_file_in_path_or_raise() -> None: + """Ensure file is in the PATH or raise""" + return ensure_executables_in_path_or_raise( + executables=["file"], abstract_spec=file_root_spec() + ) + + def patchelf_root_spec() -> str: """Return the root spec used to bootstrap patchelf""" # 0.13.1 is the last version not to require C++17. @@ -565,14 +579,15 @@ def ensure_core_dependencies() -> None: """Ensure the presence of all the core dependencies.""" if sys.platform.lower() == "linux": ensure_patchelf_in_path_or_raise() - if not IS_WINDOWS: - ensure_gpg_in_path_or_raise() + elif sys.platform == "win32": + ensure_file_in_path_or_raise() + ensure_gpg_in_path_or_raise() ensure_clingo_importable_or_raise() def all_core_root_specs() -> List[str]: """Return a list of all the core root specs that may be used to bootstrap Spack""" - return [clingo_root_spec(), gnupg_root_spec(), patchelf_root_spec()] + return [clingo_root_spec(), gnupg_root_spec(), patchelf_root_spec(), file_root_spec()] def bootstrapping_sources(scope: Optional[str] = None): diff --git a/lib/spack/spack/bootstrap/status.py b/lib/spack/spack/bootstrap/status.py index 582927af6ead95..6d3270b42c97ab 100644 --- a/lib/spack/spack/bootstrap/status.py +++ b/lib/spack/spack/bootstrap/status.py @@ -88,7 +88,7 @@ def _core_requirements() -> List[RequiredResponseType]: def _buildcache_requirements() -> List[RequiredResponseType]: _buildcache_exes = { - "file": _missing("file", "required to analyze files for buildcaches"), + "file": _missing("file", "required to analyze files for buildcaches", system_only=False), ("gpg2", "gpg"): _missing("gpg2", "required to sign/verify buildcaches", False), } if platform.system().lower() == "darwin": diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index d0b7beda1d6d49..99135b48343289 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -104,6 +104,7 @@ from spack.spec import InvalidSpecDetected, Spec from spack.util.cpus import determine_number_of_jobs from spack.util.executable import * +from spack.util.filesystem import file_command, fix_darwin_install_name, mime_type from spack.variant import ( any_combination_of, auto_or_any_combination_of, diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py index 357dd92f8499bd..364e72f7c3ca50 100644 --- a/lib/spack/spack/relocate.py +++ b/lib/spack/spack/relocate.py @@ -12,7 +12,6 @@ import macholib.mach_o import macholib.MachO -import llnl.util.filesystem as fs import llnl.util.lang import llnl.util.tty as tty from llnl.util.lang import memoized @@ -25,6 +24,7 @@ import spack.store import spack.util.elf as elf import spack.util.executable as executable +import spack.util.filesystem as ssys import spack.util.path from .relocate_text import BinaryFilePrefixReplacer, TextFilePrefixReplacer @@ -664,7 +664,7 @@ def is_binary(filename): Returns: True or False """ - m_type, _ = fs.mime_type(filename) + m_type, _ = ssys.mime_type(filename) msg = "[{0}] -> ".format(filename) if m_type == "application": @@ -692,7 +692,7 @@ def fixup_macos_rpath(root, filename): True if fixups were applied, else False """ abspath = os.path.join(root, filename) - if fs.mime_type(abspath) != ("application", "x-mach-binary"): + if ssys.mime_type(abspath) != ("application", "x-mach-binary"): return False # Get Mach-O header commands diff --git a/lib/spack/spack/util/filesystem.py b/lib/spack/spack/util/filesystem.py new file mode 100644 index 00000000000000..b296438fe89e82 --- /dev/null +++ b/lib/spack/spack/util/filesystem.py @@ -0,0 +1,102 @@ +# Copyright 2013-2024 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) + +""" +Utilities for interacting with files, +like those in llnl.util.filesystem, but which require logic from spack.util +""" + +import glob +import os +import sys + +from llnl.util import tty +from llnl.util.filesystem import join_path +from llnl.util.lang import memoized + +from spack.util.executable import Executable, which + + +def _ensure_file_on_win(): + """Ensures the file command is available on Windows + If not, it is bootstrapped. + No-op on all other platforms""" + if sys.platform != "win32": + return + import spack.bootstrap + + with spack.bootstrap.ensure_bootstrap_configuration(): + spack.bootstrap.ensure_file_in_path_or_raise() + + +@memoized +def file_command(*args): + """Creates entry point to `file` system command with provided arguments""" + _ensure_file_on_win() + file_cmd = which("file", required=True) + for arg in args: + file_cmd.add_default_arg(arg) + return file_cmd + + +@memoized +def _get_mime_type(): + """Generate method to call `file` system command to aquire mime type + for a specified path + """ + if sys.platform == "win32": + # -h option (no-dereference) does not exist in Windows + return file_command("-b", "--mime-type") + else: + return file_command("-b", "-h", "--mime-type") + + +def mime_type(filename): + """Returns the mime type and subtype of a file. + + Args: + filename: file to be analyzed + + Returns: + Tuple containing the MIME type and subtype + """ + output = _get_mime_type()(filename, output=str, error=str).strip() + tty.debug("==> " + output) + type, _, subtype = output.partition("/") + return type, subtype + + +def fix_darwin_install_name(path): + """Fix install name of dynamic libraries on Darwin to have full path. + + There are two parts of this task: + + 1. Use ``install_name('-id', ...)`` to change install name of a single lib + 2. Use ``install_name('-change', ...)`` to change the cross linking between + libs. The function assumes that all libraries are in one folder and + currently won't follow subfolders. + + Parameters: + path (str): directory in which .dylib files are located + """ + libs = glob.glob(join_path(path, "*.dylib")) + for lib in libs: + # fix install name first: + install_name_tool = Executable("install_name_tool") + install_name_tool("-id", lib, lib) + otool = Executable("otool") + long_deps = otool("-L", lib, output=str).split("\n") + deps = [dep.partition(" ")[0][1::] for dep in long_deps[2:-1]] + # fix all dependencies: + for dep in deps: + for loc in libs: + # We really want to check for either + # dep == os.path.basename(loc) or + # dep == join_path(builddir, os.path.basename(loc)), + # but we don't know builddir (nor how symbolic links look + # in builddir). We thus only compare the basenames. + if os.path.basename(dep) == os.path.basename(loc): + install_name_tool("-change", dep, loc, lib) + break diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index eceb9f3964ebca..7dcce7eb275365 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -218,7 +218,7 @@ default: - $ErrorActionPreference=$ErrorActionOld tags: ["spack", "public", "medium", "x86_64-win"] - image: "ghcr.io/johnwparent/windows-server21h2:sha-c749cf3" + image: "ghcr.io/johnwparent/windows-server21h2:sha-1c12b61" .generate-deprecated: extends: [ ".base-job" ] diff --git a/share/spack/gitlab/cloud_pipelines/configs/win64/ci.yaml b/share/spack/gitlab/cloud_pipelines/configs/win64/ci.yaml index 834c640fc36218..2d8aedf6d44455 100644 --- a/share/spack/gitlab/cloud_pipelines/configs/win64/ci.yaml +++ b/share/spack/gitlab/cloud_pipelines/configs/win64/ci.yaml @@ -15,4 +15,4 @@ ci: - spack.ps1 config add "config:install_tree:projections:${SPACK_JOB_SPEC_PKG_NAME}:'morepadding/{hash}'" - mkdir ${SPACK_ARTIFACTS_ROOT}/user_data - spack.ps1 --backtrace ci rebuild | Tee-Object -FilePath "${env:SPACK_ARTIFACTS_ROOT}/user_data/pipeline_out.txt" 2>&1 | Tee-Object -FilePath "${env:SPACK_ARTIFACTS_ROOT}/user_data/pipeline_err.txt" - image: "ghcr.io/johnwparent/windows-server21h2:sha-c749cf3" + image: "ghcr.io/johnwparent/windows-server21h2:sha-1c12b61" diff --git a/share/spack/qa/bootstrap-file.py b/share/spack/qa/bootstrap-file.py new file mode 100644 index 00000000000000..720bd99bbce5a0 --- /dev/null +++ b/share/spack/qa/bootstrap-file.py @@ -0,0 +1,4 @@ +from spack.util.filesystem import file_command + +if __name__ == "__main__": + file_command() diff --git a/var/spack/repos/builtin/packages/win-file/package.py b/var/spack/repos/builtin/packages/win-file/package.py new file mode 100644 index 00000000000000..2196be842d5f85 --- /dev/null +++ b/var/spack/repos/builtin/packages/win-file/package.py @@ -0,0 +1,35 @@ +# Copyright 2013-2024 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) +import os +import re +import shutil + +from spack.package import * + + +class WinFile(Package): + """File "file type guesser" system utility cross compiled for x86_64 Windows + systems via the Mingw-w64 cross compiler and a custom Spack repository + """ + + homepage = "https://spack.github.io/windows-bootstrap-resources" + url = ( + "https://spack.github.io/windows-bootstrap-resources/resources/file/5.45/file_5.45.tar.gz" + ) + + executables = ["^file$"] + + version("5.45", sha256="11b8f3abf647c711bc50ef8451c8d6e955f11c4afd8b0a98f2ac65e9b6e10d5e") + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)("--version", output=str, error=str) + match = re.search(r"file-(\S+)", output) + return match.group(1) if match else None + + def install(self, spec, prefix): + mkdirp(prefix) + for subdir in os.listdir(self.stage.source_path): + shutil.move(subdir, prefix) diff --git a/var/spack/repos/builtin/packages/win-gpg/package.py b/var/spack/repos/builtin/packages/win-gpg/package.py new file mode 100644 index 00000000000000..f2fef7ff6dddf7 --- /dev/null +++ b/var/spack/repos/builtin/packages/win-gpg/package.py @@ -0,0 +1,36 @@ +# Copyright 2013-2024 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) +import os +import re +import shutil + +from spack.package import * + + +class WinGpg(Package): + """GnuPG is a complete and free implementation of the OpenPGP + standard as defined by RFC4880 (also known as PGP). + + This utility was cross compiled for x86_64 Windows + systems via the Mingw-w64 cross compiler and a custom Spack repository + """ + + homepage = "https://spack.github.io/windows-bootstrap-resources/" + url = "https://spack.github.io/windows-bootstrap-resources/resources/gpg/2.4.5/gpg4win_2.4.5.tar.gz" + + executables = ["^gpg$"] + + version("2.4.5", sha256="249ab87bd06abea3140054089bad44d9a5d1531413590576da609142db2673ec") + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)("--version", output=str, error=str) + match = re.search(r"gpg (\S+)", output) + return match.group(1) if match else None + + def install(self, spec, prefix): + mkdirp(prefix) + for subdir in os.listdir(self.stage.source_path): + shutil.move(subdir, prefix) From fa5f4f1cabdcb105bfe81f98ddd5a1556de1d931 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:11:03 +0200 Subject: [PATCH 022/687] pthreadpool: add the PIC flag (#46216) --- var/spack/repos/builtin/packages/pthreadpool/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/pthreadpool/package.py b/var/spack/repos/builtin/packages/pthreadpool/package.py index 2754fef9b7c6b7..5ccb439496af0a 100644 --- a/var/spack/repos/builtin/packages/pthreadpool/package.py +++ b/var/spack/repos/builtin/packages/pthreadpool/package.py @@ -67,4 +67,5 @@ def cmake_args(self): self.define("PTHREADPOOL_BUILD_BENCHMARKS", False), self.define("PTHREADPOOL_LIBRARY_TYPE", "static"), self.define("PTHREADPOOL_ALLOW_DEPRECATED_API", True), + self.define("CMAKE_POSITION_INDEPENDENT_CODE", True), ] From 2b9a621d19e348b3984ac4a1c7befe8e75a005ed Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:37:20 +0200 Subject: [PATCH 023/687] sleef: add the PIC flag (#46217) --- var/spack/repos/builtin/packages/sleef/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/sleef/package.py b/var/spack/repos/builtin/packages/sleef/package.py index 5518519896d231..c7cd997c8bd441 100644 --- a/var/spack/repos/builtin/packages/sleef/package.py +++ b/var/spack/repos/builtin/packages/sleef/package.py @@ -70,7 +70,10 @@ def sleef_define(self, cmake_var, value): return self.define(cmake_var, value) def cmake_args(self): - args = [self.sleef_define("BUILD_TESTS", self.run_tests)] + args = [ + self.sleef_define("BUILD_TESTS", self.run_tests), + self.define("CMAKE_POSITION_INDEPENDENT_CODE", True), + ] # https://github.com/shibatch/sleef/issues/474 if self.spec.satisfies("@:3.5.1_2024-02-08 platform=darwin"): From 78a4d3e7d2bb5720dcd9d1ac1c375ceae8dcd12f Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Fri, 6 Sep 2024 10:37:33 -0700 Subject: [PATCH 024/687] Mixed-source cflags (#41049) Allow flags from different sources (compilers, `require:`, command-line specs, and `depends_on`) to be merged together, and enforce a consistent order among them. The order is based on the sources, e.g. flags on specs from the command line always come last. Some flag order consistency issues are fixed: 1. Flags from `compilers.yaml` and the command line were always intra- and inter-source order consistent. 2. Flags from dependents and packages.yaml (introduced via `require:`) were not: for `-a -b` from one source and `-c` from another, the final result might rearrange `-a -b`, and would also be inconsistent in terms of whether `-c` came before or after. (1) is/was handled by going back to the original source, i.e., flags are retrieved directly from the command line spec rather than the solver. (2) is addressed by: * Keeping track of grouped flags in the solver * Keeping track of flag sources in the solver on a per-flag basis The latter info is used in this PR to enforce DAG ordering on flags applied from multiple dependents to the same package, e.g., for this graph: ``` a /|\ b | c \|/ d ``` If `a`, `b`, and `c` impose flags on `d`, the combined flags on `d` will contain the flags of `a`, `b`, and `c` -- in that order. Conflicting flags are allowed (e.g. -O2 and -O3). `Spec.satisifes()` has been updated such that X satisfies Y as long as X has *at least* all of the flags that Y has. This is also true in the solver constraints. `.satisfies` does not account for how order can change behavior (so `-O2 -O3` can satisfy `-O3 -O2`); it is expected that this can be addressed later (e.g. by prohibiting flag conflicts). `Spec.constrain` and `.intersects` have been updated to be consistent with this new definition of `.satisfies`. --- lib/spack/spack/solver/asp.py | 319 +++++++++++++++++------ lib/spack/spack/solver/concretize.lp | 60 ++--- lib/spack/spack/solver/core.py | 14 ++ lib/spack/spack/solver/display.lp | 1 + lib/spack/spack/spec.py | 94 ++++--- lib/spack/spack/test/concretize.py | 15 +- lib/spack/spack/test/flag_mixing.py | 333 +++++++++++++++++++++++++ lib/spack/spack/test/spec_semantics.py | 70 +++++- 8 files changed, 732 insertions(+), 174 deletions(-) create mode 100644 lib/spack/spack/test/flag_mixing.py diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index b8d9eea037cb40..2d053721b1a71b 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -1022,6 +1022,102 @@ def __iter__(self): ConditionSpecCache = Dict[str, Dict[ConditionSpecKey, ConditionIdFunctionPair]] +class ConstraintOrigin(enum.Enum): + """Generates identifiers that can be pased into the solver attached + to constraints, and then later retrieved to determine the origin of + those constraints when ``SpecBuilder`` creates Specs from the solve + result. + """ + + DEPENDS_ON = 1 + REQUIRE = 2 + + @staticmethod + def _SUFFIXES() -> Dict["ConstraintOrigin", str]: + return {ConstraintOrigin.DEPENDS_ON: "_dep", ConstraintOrigin.REQUIRE: "_req"} + + @staticmethod + def append_type_suffix(pkg_id: str, kind: "ConstraintOrigin") -> str: + """Given a package identifier and a constraint kind, generate a string ID.""" + suffix = ConstraintOrigin._SUFFIXES()[kind] + return f"{pkg_id}{suffix}" + + @staticmethod + def strip_type_suffix(source: str) -> Tuple[int, Optional[str]]: + """Take a combined package/type ID generated by + ``append_type_suffix``, and extract the package ID and + an associated weight. + """ + if not source: + return -1, None + for kind, suffix in ConstraintOrigin._SUFFIXES().items(): + if source.endswith(suffix): + return kind.value, source[: -len(suffix)] + return -1, source + + +class SourceContext: + """Tracks context in which a Spec's clause-set is generated (i.e. + with ``SpackSolverSetup.spec_clauses``). + + Facts generated for the spec may include this context. + """ + + def __init__(self): + # This can be "literal" for constraints that come from a user + # spec (e.g. from the command line); it can be the output of + # `ConstraintOrigin.append_type_suffix`; the default is "none" + # (which means it isn't important to keep track of the source + # in that case). + self.source = "none" + + +class ConditionIdContext(SourceContext): + """Derived from a ``ConditionContext``: for clause-sets generated by + imposed/required specs, stores an associated transform. + + This is primarily used for tracking whether we are generating clauses + in the context of a required spec, or for an imposed spec. + + Is not a subclass of ``ConditionContext`` because it exists in a + lower-level context with less information. + """ + + def __init__(self): + super().__init__() + self.transform = None + + +class ConditionContext(SourceContext): + """Tracks context in which a condition (i.e. ``SpackSolverSetup.condition``) + is generated (e.g. for a `depends_on`). + + This may modify the required/imposed specs generated as relevant + for the context. + """ + + def __init__(self): + super().__init__() + # transformation applied to facts from the required spec. Defaults + # to leave facts as they are. + self.transform_required = None + # transformation applied to facts from the imposed spec. Defaults + # to removing "node" and "virtual_node" facts. + self.transform_imposed = None + + def requirement_context(self) -> ConditionIdContext: + ctxt = ConditionIdContext() + ctxt.source = self.source + ctxt.transform = self.transform_required + return ctxt + + def impose_context(self) -> ConditionIdContext: + ctxt = ConditionIdContext() + ctxt.source = self.source + ctxt.transform = self.transform_imposed + return ctxt + + class SpackSolverSetup: """Class to set up and run a Spack concretization solve.""" @@ -1197,8 +1293,9 @@ def compiler_facts(self): if compiler.compiler_obj is not None: c = compiler.compiler_obj for flag_type, flags in c.flags.items(): + flag_group = " ".join(flags) for flag in flags: - self.gen.fact(fn.compiler_flag(compiler_id, flag_type, flag)) + self.gen.fact(fn.compiler_flag(compiler_id, flag_type, flag, flag_group)) if compiler.available: self.gen.fact(fn.compiler_available(compiler_id)) @@ -1375,7 +1472,7 @@ def _get_condition_id( named_cond: spack.spec.Spec, cache: ConditionSpecCache, body: bool, - transform: Optional[TransformFunction] = None, + context: ConditionIdContext, ) -> int: """Get the id for one half of a condition (either a trigger or an imposed constraint). @@ -1389,15 +1486,15 @@ def _get_condition_id( """ pkg_cache = cache[named_cond.name] - named_cond_key = (str(named_cond), transform) + named_cond_key = (str(named_cond), context.transform) result = pkg_cache.get(named_cond_key) if result: return result[0] cond_id = next(self._id_counter) - requirements = self.spec_clauses(named_cond, body=body) - if transform: - requirements = transform(named_cond, requirements) + requirements = self.spec_clauses(named_cond, body=body, context=context) + if context.transform: + requirements = context.transform(named_cond, requirements) pkg_cache[named_cond_key] = (cond_id, requirements) return cond_id @@ -1408,8 +1505,7 @@ def condition( imposed_spec: Optional[spack.spec.Spec] = None, name: Optional[str] = None, msg: Optional[str] = None, - transform_required: Optional[TransformFunction] = None, - transform_imposed: Optional[TransformFunction] = remove_node, + context: Optional[ConditionContext] = None, ): """Generate facts for a dependency or virtual provider condition. @@ -1418,10 +1514,8 @@ def condition( imposed_spec: the constraints that are imposed when this condition is triggered name: name for `required_spec` (required if required_spec is anonymous, ignored if not) msg: description of the condition - transform_required: transformation applied to facts from the required spec. Defaults - to leave facts as they are. - transform_imposed: transformation applied to facts from the imposed spec. Defaults - to removing "node" and "virtual_node" facts. + context: if provided, indicates how to modify the clause-sets for the required/imposed + specs based on the type of constraint they are generated for (e.g. `depends_on`) Returns: int: id of the condition created by this function """ @@ -1429,14 +1523,19 @@ def condition( if not name: raise ValueError(f"Must provide a name for anonymous condition: '{required_spec}'") + if not context: + context = ConditionContext() + context.transform_imposed = remove_node + with spec_with_name(required_spec, name): # Check if we can emit the requirements before updating the condition ID counter. # In this way, if a condition can't be emitted but the exception is handled in the # caller, we won't emit partial facts. condition_id = next(self._id_counter) + requirement_context = context.requirement_context() trigger_id = self._get_condition_id( - required_spec, cache=self._trigger_cache, body=True, transform=transform_required + required_spec, cache=self._trigger_cache, body=True, context=requirement_context ) self.gen.fact(fn.pkg_fact(required_spec.name, fn.condition(condition_id))) self.gen.fact(fn.condition_reason(condition_id, msg)) @@ -1446,8 +1545,9 @@ def condition( if not imposed_spec: return condition_id + impose_context = context.impose_context() effect_id = self._get_condition_id( - imposed_spec, cache=self._effect_cache, body=False, transform=transform_imposed + imposed_spec, cache=self._effect_cache, body=False, context=impose_context ) self.gen.fact( fn.pkg_fact(required_spec.name, fn.condition_effect(condition_id, effect_id)) @@ -1455,8 +1555,8 @@ def condition( return condition_id - def impose(self, condition_id, imposed_spec, node=True, name=None, body=False): - imposed_constraints = self.spec_clauses(imposed_spec, body=body, required_from=name) + def impose(self, condition_id, imposed_spec, node=True, body=False): + imposed_constraints = self.spec_clauses(imposed_spec, body=body) for pred in imposed_constraints: # imposed "node"-like conditions are no-ops if not node and pred.args[0] in ("node", "virtual_node"): @@ -1528,14 +1628,14 @@ def dependency_holds(input_spec, requirements): if t & depflag ] - self.condition( - cond, - dep.spec, - name=pkg.name, - msg=msg, - transform_required=track_dependencies, - transform_imposed=dependency_holds, + context = ConditionContext() + context.source = ConstraintOrigin.append_type_suffix( + pkg.name, ConstraintOrigin.DEPENDS_ON ) + context.transform_required = track_dependencies + context.transform_imposed = dependency_holds + + self.condition(cond, dep.spec, name=pkg.name, msg=msg, context=context) self.gen.newline() @@ -1613,17 +1713,21 @@ def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]): when_spec = spack.spec.Spec(pkg_name) try: - # With virtual we want to emit "node" and "virtual_node" in imposed specs - transform: Optional[TransformFunction] = remove_node - if virtual: - transform = None + context = ConditionContext() + context.source = ConstraintOrigin.append_type_suffix( + pkg_name, ConstraintOrigin.REQUIRE + ) + if not virtual: + context.transform_imposed = remove_node + # else: for virtuals we want to emit "node" and + # "virtual_node" in imposed specs member_id = self.condition( required_spec=when_spec, imposed_spec=spec, name=pkg_name, - transform_imposed=transform, msg=f"{input_spec} is a requirement for package {pkg_name}", + context=context, ) except Exception as e: # Do not raise if the rule comes from the 'all' subsection, since usability @@ -1722,7 +1826,9 @@ def external_imposition(input_spec, requirements): ] try: - self.condition(spec, spec, msg=msg, transform_imposed=external_imposition) + context = ConditionContext() + context.transform_imposed = external_imposition + self.condition(spec, spec, msg=msg, context=context) except (spack.error.SpecError, RuntimeError) as e: warnings.warn(f"while setting up external spec {spec}: {e}") continue @@ -1797,6 +1903,7 @@ def spec_clauses( expand_hashes: bool = False, concrete_build_deps=False, required_from: Optional[str] = None, + context: Optional[SourceContext] = None, ) -> List[AspFunction]: """Wrap a call to `_spec_clauses()` into a try/except block with better error handling. @@ -1812,6 +1919,7 @@ def spec_clauses( transitive=transitive, expand_hashes=expand_hashes, concrete_build_deps=concrete_build_deps, + context=context, ) except RuntimeError as exc: msg = str(exc) @@ -1828,6 +1936,7 @@ def _spec_clauses( transitive: bool = True, expand_hashes: bool = False, concrete_build_deps: bool = False, + context: Optional[SourceContext] = None, ) -> List[AspFunction]: """Return a list of clauses for a spec mandates are true. @@ -1839,6 +1948,8 @@ def _spec_clauses( expand_hashes: if True, descend into hashes of concrete specs (default False) concrete_build_deps: if False, do not include pure build deps of concrete specs (as they have no effect on runtime constraints) + context: tracks what constraint this clause set is generated for (e.g. a + `depends_on` constraint in a package.py file) Normally, if called with ``transitive=True``, ``spec_clauses()`` just generates hashes for the dependency requirements of concrete specs. If ``expand_hashes`` @@ -1925,13 +2036,19 @@ def _spec_clauses( self.compiler_version_constraints.add(spec.compiler) # compiler flags + source = context.source if context else "none" for flag_type, flags in spec.compiler_flags.items(): + flag_group = " ".join(flags) for flag in flags: - clauses.append(f.node_flag(spec.name, flag_type, flag)) + clauses.append( + f.node_flag(spec.name, fn.node_flag(flag_type, flag, flag_group, source)) + ) if not spec.concrete and flag.propagate is True: clauses.append( f.propagate( - spec.name, fn.node_flag(flag_type, flag), fn.edge_types("link", "run") + spec.name, + fn.node_flag(flag_type, flag, flag_group, source), + fn.edge_types("link", "run"), ) ) @@ -2013,6 +2130,7 @@ def _spec_clauses( body=body, expand_hashes=expand_hashes, concrete_build_deps=concrete_build_deps, + context=context, ) ) @@ -2648,7 +2766,9 @@ def literal_specs(self, specs): effect_id, requirements = cache[imposed_spec_key] else: effect_id = next(self._id_counter) - requirements = self.spec_clauses(spec) + context = SourceContext() + context.source = "literal" + requirements = self.spec_clauses(spec, context=context) root_name = spec.name for clause in requirements: clause_name = clause.args[0] @@ -3405,11 +3525,10 @@ def node_compiler_version(self, node, compiler, version): self._specs[node].compiler = spack.spec.CompilerSpec(compiler) self._specs[node].compiler.versions = vn.VersionList([vn.Version(version)]) - def node_flag(self, node, flag_type, flag): - self._specs[node].compiler_flags.add_flag(flag_type, flag, False) - - def node_flag_source(self, node, flag_type, source): - self._flag_sources[(node, flag_type)].add(source) + def node_flag(self, node, node_flag): + self._specs[node].compiler_flags.add_flag( + node_flag.flag_type, node_flag.flag, False, node_flag.flag_group, node_flag.source + ) def external_spec_selected(self, node, idx): """This means that the external spec and index idx has been selected for this package.""" @@ -3450,15 +3569,23 @@ def virtual_on_edge(self, parent_node, provider_node, virtual): dependencies[0].update_virtuals((virtual,)) def reorder_flags(self): - """Order compiler flags on specs in predefined order. - - We order flags so that any node's flags will take priority over - those of its dependents. That is, the deepest node in the DAG's - flags will appear last on the compile line, in the order they - were specified. + """For each spec, determine the order of compiler flags applied to it. The solver determines which flags are on nodes; this routine - imposes order afterwards. + imposes order afterwards. The order is: + + 1. Flags applied in compiler definitions should come first + 2. Flags applied by dependents are ordered topologically (with a + dependency on `traverse` to resolve the partial order into a + stable total order) + 3. Flags from requirements are then applied (requirements always + come from the package and never a parent) + 4. Command-line flags should come last + + Additionally, for each source (requirements, compiler, command line, and + dependents), flags from that source should retain their order and grouping: + e.g. for `y cflags="-z -a"` "-z" and "-a" should never have any intervening + flags inserted, and should always appear in that order. """ # reverse compilers so we get highest priority compilers that share a spec compilers = dict( @@ -3473,40 +3600,78 @@ def reorder_flags(self): flagmap_from_compiler = compilers[spec.compiler].flags for flag_type in spec.compiler_flags.valid_compiler_flags(): - from_compiler = flagmap_from_compiler.get(flag_type, []) - from_sources = [] - - # order is determined by the DAG. A spec's flags come after any of its ancestors - # on the compile line node = SpecBuilder.make_node(pkg=spec.name) - source_key = (node, flag_type) - if source_key in self._flag_sources: - order = [ - SpecBuilder.make_node(pkg=s.name) - for s in spec.traverse(order="post", direction="parents") - ] - sorted_sources = sorted( - self._flag_sources[source_key], key=lambda s: order.index(s) + + ordered_flags = [] + + # 1. Put compiler flags first + from_compiler = tuple(flagmap_from_compiler.get(flag_type, [])) + extend_flag_list(ordered_flags, from_compiler) + + # 2. Add all sources (the compiler is one of them, so skip any + # flag group that matches it exactly) + flag_groups = set() + for flag in self._specs[node].compiler_flags.get(flag_type, []): + flag_groups.add( + spack.spec.CompilerFlag( + flag.flag_group, + propagate=flag.propagate, + flag_group=flag.flag_group, + source=flag.source, + ) ) - # add flags from each source, lowest to highest precedence - for node in sorted_sources: - all_src_flags = list() - per_pkg_sources = [self._specs[node]] - if node.pkg in cmd_specs: - per_pkg_sources.append(cmd_specs[node.pkg]) - for source in per_pkg_sources: - all_src_flags.extend(source.compiler_flags.get(flag_type, [])) - extend_flag_list(from_sources, all_src_flags) - - # compiler flags from compilers config are lowest precedence - ordered_compiler_flags = list(llnl.util.lang.dedupe(from_compiler + from_sources)) - compiler_flags = spec.compiler_flags.get(flag_type, []) + # For flags that are applied by dependents, put flags from parents + # before children; we depend on the stability of traverse() to + # achieve a stable flag order for flags introduced in this manner. + topo_order = list(s.name for s in spec.traverse(order="post", direction="parents")) + lex_order = list(sorted(flag_groups)) + + def _order_index(flag_group): + source = flag_group.source + # Note: if 'require: ^dependency cflags=...' is ever possible, + # this will topologically sort for require as well + type_index, pkg_source = ConstraintOrigin.strip_type_suffix(source) + if pkg_source in topo_order: + major_index = topo_order.index(pkg_source) + # If for x->y, x has multiple depends_on declarations that + # are activated, and each adds cflags to y, we fall back on + # alphabetical ordering to maintain a total order + minor_index = lex_order.index(flag_group) + else: + major_index = len(topo_order) + lex_order.index(flag_group) + minor_index = 0 + return (type_index, major_index, minor_index) - msg = f"{set(compiler_flags)} does not equal {set(ordered_compiler_flags)}" - assert set(compiler_flags) == set(ordered_compiler_flags), msg + prioritized_groups = sorted(flag_groups, key=lambda x: _order_index(x)) - spec.compiler_flags.update({flag_type: ordered_compiler_flags}) + for grp in prioritized_groups: + grp_flags = tuple( + x for (x, y) in spack.compiler.tokenize_flags(grp.flag_group) + ) + if grp_flags == from_compiler: + continue + as_compiler_flags = list( + spack.spec.CompilerFlag( + x, + propagate=grp.propagate, + flag_group=grp.flag_group, + source=grp.source, + ) + for x in grp_flags + ) + extend_flag_list(ordered_flags, as_compiler_flags) + + # 3. Now put cmd-line flags last + if node.pkg in cmd_specs: + cmd_flags = cmd_specs[node.pkg].compiler_flags.get(flag_type, []) + extend_flag_list(ordered_flags, cmd_flags) + + compiler_flags = spec.compiler_flags.get(flag_type, []) + msg = "%s does not equal %s" % (set(compiler_flags), set(ordered_flags)) + assert set(compiler_flags) == set(ordered_flags), msg + + spec.compiler_flags.update({flag_type: ordered_flags}) def deprecated(self, node: NodeArgument, version: str) -> None: tty.warn(f'using "{node.pkg}@{version}" which is a deprecated version') @@ -3570,10 +3735,9 @@ def build_specs(self, function_tuples): continue # if we've already gotten a concrete spec for this pkg, - # do not bother calling actions on it except for node_flag_source, - # since node_flag_source is tracking information not in the spec itself + # do not bother calling actions on it spec = self._specs.get(args[0]) - if spec and spec.concrete and name != "node_flag_source": + if spec and spec.concrete: continue action(*args) @@ -3633,7 +3797,8 @@ def _develop_specs_from_env(spec, env): assert spec.variants["dev_path"].value == path, error_msg else: spec.variants.setdefault("dev_path", spack.variant.SingleValuedVariant("dev_path", path)) - spec.constrain(dev_info["spec"]) + + assert spec.satisfies(dev_info["spec"]) def _is_reusable(spec: spack.spec.Spec, packages, local: bool) -> bool: diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 342620238feaf1..dab05adaa3a430 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -43,7 +43,7 @@ internal_error("Only nodes can have node_compiler_version"). :- attr("variant_value", PackageNode, _, _), not attr("node", PackageNode), internal_error("variant_value true for a non-node"). -:- attr("node_flag", PackageNode, _, _), not attr("node", PackageNode), +:- attr("node_flag", PackageNode, _), not attr("node", PackageNode), internal_error("node_flag assigned for non-node"). :- attr("external_spec_selected", PackageNode, _), not attr("node", PackageNode), internal_error("external_spec_selected for non-node"). @@ -51,10 +51,6 @@ internal_error("non-node depends on something"). :- attr("depends_on", _, ChildNode, _), not attr("node", ChildNode), internal_error("something depends_on a non-node"). -:- attr("node_flag_source", Node, _, _), not attr("node", Node), - internal_error("node_flag_source assigned for a non-node"). -:- attr("node_flag_source", _, _, SourceNode), not attr("node", SourceNode), - internal_error("node_flag_source assigned with a non-node source"). :- attr("virtual_node", VirtualNode), not provider(_, VirtualNode), internal_error("virtual node with no provider"). :- provider(_, VirtualNode), not attr("virtual_node", VirtualNode), @@ -152,7 +148,6 @@ unification_set(SetID, VirtualNode) % TODO: literals, at the moment, can only influence the "root" unification set. This needs to be extended later. % Node attributes that have multiple node arguments (usually, only the first argument is a node) -multiple_nodes_attribute("node_flag_source"). multiple_nodes_attribute("depends_on"). multiple_nodes_attribute("virtual_on_edge"). multiple_nodes_attribute("provider_set"). @@ -390,7 +385,6 @@ trigger_condition_holds(ID, RequestorNode) :- attr(Name, node(X, A1), A2, A3) : condition_requirement(ID, Name, A1, A2, A3), condition_nodes(ID, PackageNode, node(X, A1)), not multiple_nodes_attribute(Name); attr(Name, node(X, A1), A2, A3, A4) : condition_requirement(ID, Name, A1, A2, A3, A4), condition_nodes(ID, PackageNode, node(X, A1)); % Special cases - attr("node_flag_source", node(X, A1), A2, node(Y, A3)) : condition_requirement(ID, "node_flag_source", A1, A2, A3), condition_nodes(ID, PackageNode, node(X, A1)), condition_nodes(ID, PackageNode, node(Y, A3)); not cannot_hold(ID, PackageNode). condition_holds(ConditionID, node(X, Package)) @@ -438,13 +432,6 @@ attr(Name, node(X, A1), A2) :- impose(ID, PackageNode), imposed_constrai attr(Name, node(X, A1), A2, A3) :- impose(ID, PackageNode), imposed_constraint(ID, Name, A1, A2, A3), imposed_nodes(ID, PackageNode, node(X, A1)), not multiple_nodes_attribute(Name). attr(Name, node(X, A1), A2, A3, A4) :- impose(ID, PackageNode), imposed_constraint(ID, Name, A1, A2, A3, A4), imposed_nodes(ID, PackageNode, node(X, A1)). -% For node flag sources we need to look at the condition_set of the source, since it is the dependent -% of the package on which I want to impose the constraint -attr("node_flag_source", node(X, A1), A2, node(Y, A3)) - :- impose(ID, node(X, A1)), - imposed_constraint(ID, "node_flag_source", A1, A2, A3), - condition_set(node(Y, A3), node(X, A1)). - % Provider set is relevant only for literals, since it's the only place where `^[virtuals=foo] bar` % might appear in the HEAD of a rule attr("provider_set", node(min_dupe_id, Provider), node(min_dupe_id, Virtual)) @@ -485,8 +472,8 @@ virtual_condition_holds(node(Y, A2), Virtual) % we cannot have additional flag values when we are working with concrete specs :- attr("node", node(ID, Package)), attr("hash", node(ID, Package), Hash), - attr("node_flag", node(ID, Package), FlagType, Flag), - not imposed_constraint(Hash, "node_flag", Package, FlagType, Flag), + attr("node_flag", node(ID, Package), node_flag(FlagType, Flag, _, _)), + not imposed_constraint(Hash, "node_flag", Package, node_flag(FlagType, Flag, _, _)), internal_error("imposed hash without imposing all flag values"). #defined condition/2. @@ -787,22 +774,15 @@ required_provider(Provider, Virtual) :- provider(node(Y, Package), node(X, Virtual)), required_provider(Provider, Virtual), Package != Provider. -% TODO: the following two choice rules allow the solver to add compiler +% TODO: the following choice rule allows the solver to add compiler % flags if their only source is from a requirement. This is overly-specific % and should use a more-generic approach like in https://github.com/spack/spack/pull/37180 -{ attr("node_flag", node(ID, Package), FlagType, FlagValue) } :- +{ attr("node_flag", node(ID, Package), NodeFlag) } :- requirement_group_member(ConditionID, Package, RequirementID), activate_requirement(node(ID, Package), RequirementID), pkg_fact(Package, condition_effect(ConditionID, EffectID)), - imposed_constraint(EffectID, "node_flag_set", Package, FlagType, FlagValue). - -{ attr("node_flag_source", node(NodeID1, Package1), FlagType, node(NodeID2, Package2)) } :- - requirement_group_member(ConditionID, Package1, RequirementID), - activate_requirement(node(NodeID1, Package1), RequirementID), - pkg_fact(Package1, condition_effect(ConditionID, EffectID)), - imposed_constraint(EffectID, "node_flag_source", Package1, FlagType, Package2), - imposed_nodes(EffectID, node(NodeID2, Package2), node(NodeID1, Package1)). + imposed_constraint(EffectID, "node_flag_set", Package, NodeFlag). requirement_weight(node(ID, Package), Group, W) :- W = #min { @@ -1048,23 +1028,22 @@ variant_is_propagated(PackageNode, Variant) :- % 1. The same flag type is not set on this node % 2. This node has the same compiler as the propagation source -propagated_flag(node(PackageID, Package), node_flag(FlagType, Flag), SourceNode) :- - propagate(node(PackageID, Package), node_flag(FlagType, Flag), _), - not attr("node_flag_set", node(PackageID, Package), FlagType, _), +propagated_flag(node(PackageID, Package), node_flag(FlagType, Flag, FlagGroup, Source), SourceNode) :- + propagate(node(PackageID, Package), node_flag(FlagType, Flag, FlagGroup, Source), _), + not attr("node_flag_set", node(PackageID, Package), node_flag(FlagType, _, _, "literal")), % Same compiler as propagation source node_compiler(node(PackageID, Package), CompilerID), node_compiler(SourceNode, CompilerID), - attr("propagate", SourceNode, node_flag(FlagType, Flag), _), + attr("propagate", SourceNode, node_flag(FlagType, Flag, FlagGroup, Source), _), node(PackageID, Package) != SourceNode, not runtime(Package). -attr("node_flag", PackageNode, FlagType, Flag) :- propagated_flag(PackageNode, node_flag(FlagType, Flag), _). -attr("node_flag_source", PackageNode, FlagType, SourceNode) :- propagated_flag(PackageNode, node_flag(FlagType, _), SourceNode). +attr("node_flag", PackageNode, NodeFlag) :- propagated_flag(PackageNode, NodeFlag, _). % Cannot propagate the same flag from two distinct sources error(100, "{0} and {1} cannot both propagate compiler flags '{2}' to {3}", Source1, Source2, Package, FlagType) :- - propagated_flag(node(ID, Package), node_flag(FlagType, _), node(_, Source1)), - propagated_flag(node(ID, Package), node_flag(FlagType, _), node(_, Source2)), + propagated_flag(node(ID, Package), node_flag(FlagType, _, _, _), node(_, Source1)), + propagated_flag(node(ID, Package), node_flag(FlagType, _, _, _), node(_, Source2)), Source1 < Source2. %---- @@ -1351,23 +1330,18 @@ error(100, "Compiler {1}@{2} requested for {0} cannot be found. Set install_miss % Compiler flags %----------------------------------------------------------------------------- -% remember where flags came from -attr("node_flag_source", PackageNode, FlagType, PackageNode) :- attr("node_flag_set", PackageNode, FlagType, _). -attr("node_flag_source", PackageNode, FlagType, PackageNode) :- attr("node_flag", PackageNode, FlagType, _), attr("hash", PackageNode, _). - % compiler flags from compilers.yaml are put on nodes if compiler matches -attr("node_flag", PackageNode, FlagType, Flag) - :- compiler_flag(CompilerID, FlagType, Flag), +attr("node_flag", PackageNode, node_flag(FlagType, Flag, FlagGroup, CompilerID)) + :- compiler_flag(CompilerID, FlagType, Flag, FlagGroup), node_compiler(PackageNode, CompilerID), flag_type(FlagType), compiler_id(CompilerID), compiler_name(CompilerID, CompilerName), compiler_version(CompilerID, Version). -% Flag set to something -attr("node_flag", PackageNode, FlagType, Flag) :- attr("node_flag_set", PackageNode, FlagType, Flag). +attr("node_flag", PackageNode, NodeFlag) :- attr("node_flag_set", PackageNode, NodeFlag). -#defined compiler_flag/3. +#defined compiler_flag/4. %----------------------------------------------------------------------------- diff --git a/lib/spack/spack/solver/core.py b/lib/spack/spack/solver/core.py index 896631290c5ce2..2530981a21dda6 100644 --- a/lib/spack/spack/solver/core.py +++ b/lib/spack/spack/solver/core.py @@ -230,6 +230,13 @@ class NodeArgument(NamedTuple): pkg: str +class NodeFlag(NamedTuple): + flag_type: str + flag: str + flag_group: str + source: str + + def intermediate_repr(sym): """Returns an intermediate representation of clingo models for Spack's spec builder. @@ -248,6 +255,13 @@ def intermediate_repr(sym): return NodeArgument( id=intermediate_repr(sym.arguments[0]), pkg=intermediate_repr(sym.arguments[1]) ) + elif sym.name == "node_flag": + return NodeFlag( + flag_type=intermediate_repr(sym.arguments[0]), + flag=intermediate_repr(sym.arguments[1]), + flag_group=intermediate_repr(sym.arguments[2]), + source=intermediate_repr(sym.arguments[3]), + ) except RuntimeError: # This happens when using clingo w/ CFFI and trying to access ".name" for symbols # that are not functions diff --git a/lib/spack/spack/solver/display.lp b/lib/spack/spack/solver/display.lp index 358a1628aadd73..fb3b2c41dfce2c 100644 --- a/lib/spack/spack/solver/display.lp +++ b/lib/spack/spack/solver/display.lp @@ -13,6 +13,7 @@ #show attr/2. #show attr/3. #show attr/4. +#show attr/5. % names of optimization criteria #show opt_criterion/2. diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 700f3a74de4e13..0c869febb175d9 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -781,17 +781,49 @@ class CompilerFlag(str): propagate (bool): if ``True`` the flag value will be passed to the package's dependencies. If ``False`` it will not + flag_group (str): if this flag was introduced along + with several flags via a single source, then + this will store all such flags + source (str): identifies the type of constraint that + introduced this flag (e.g. if a package has + ``depends_on(... cflags=-g)``, then the ``source`` + for "-g" would indicate ``depends_on``. """ def __new__(cls, value, **kwargs): obj = str.__new__(cls, value) obj.propagate = kwargs.pop("propagate", False) + obj.flag_group = kwargs.pop("flag_group", value) + obj.source = kwargs.pop("source", None) return obj _valid_compiler_flags = ["cflags", "cxxflags", "fflags", "ldflags", "ldlibs", "cppflags"] +def _shared_subset_pair_iterate(container1, container2): + """ + [0, a, c, d, f] + [a, d, e, f] + + yields [(a, a), (d, d), (f, f)] + + no repeated elements + """ + a_idx, b_idx = 0, 0 + max_a, max_b = len(container1), len(container2) + while a_idx < max_a and b_idx < max_b: + if container1[a_idx] == container2[b_idx]: + yield (container1[a_idx], container2[b_idx]) + a_idx += 1 + b_idx += 1 + else: + while container1[a_idx] < container2[b_idx]: + a_idx += 1 + while container1[a_idx] > container2[b_idx]: + b_idx += 1 + + class FlagMap(lang.HashableMap): __slots__ = ("spec",) @@ -800,23 +832,9 @@ def __init__(self, spec): self.spec = spec def satisfies(self, other): - return all(f in self and self[f] == other[f] for f in other) + return all(f in self and set(self[f]) >= set(other[f]) for f in other) def intersects(self, other): - common_types = set(self) & set(other) - for flag_type in common_types: - if not self[flag_type] or not other[flag_type]: - # At least one of the two is empty - continue - - if self[flag_type] != other[flag_type]: - return False - - if not all( - f1.propagate == f2.propagate for f1, f2 in zip(self[flag_type], other[flag_type]) - ): - # At least one propagation flag didn't match - return False return True def constrain(self, other): @@ -824,28 +842,28 @@ def constrain(self, other): Return whether the spec changed. """ - if other.spec and other.spec._concrete: - for k in self: - if k not in other: - raise UnsatisfiableCompilerFlagSpecError(self[k], "") - changed = False - for k in other: - if k in self and not set(self[k]) <= set(other[k]): - raise UnsatisfiableCompilerFlagSpecError( - " ".join(f for f in self[k]), " ".join(f for f in other[k]) - ) - elif k not in self: - self[k] = other[k] + for flag_type in other: + if flag_type not in self: + self[flag_type] = other[flag_type] changed = True + else: + extra_other = set(other[flag_type]) - set(self[flag_type]) + if extra_other: + self[flag_type] = list(self[flag_type]) + list( + x for x in other[flag_type] if x in extra_other + ) + changed = True + + # Next, if any flags in other propagate, we force them to propagate in our case + shared = list(sorted(set(other[flag_type]) - extra_other)) + for x, y in _shared_subset_pair_iterate(shared, sorted(self[flag_type])): + if x.propagate: + y.propagate = True + + # TODO: what happens if flag groups with a partial (but not complete) + # intersection specify different behaviors for flag propagation? - # Check that the propagation values match - if self[k] == other[k]: - for i in range(len(other[k])): - if self[k][i].propagate != other[k][i].propagate: - raise UnsatisfiableCompilerFlagSpecError( - self[k][i].propagate, other[k][i].propagate - ) return changed @staticmethod @@ -858,7 +876,7 @@ def copy(self): clone[name] = compiler_flag return clone - def add_flag(self, flag_type, value, propagation): + def add_flag(self, flag_type, value, propagation, flag_group=None, source=None): """Stores the flag's value in CompilerFlag and adds it to the FlagMap @@ -869,7 +887,8 @@ def add_flag(self, flag_type, value, propagation): propagation (bool): if ``True`` the flag value will be passed to the packages' dependencies. If``False`` it will not be passed """ - flag = CompilerFlag(value, propagate=propagation) + flag_group = flag_group or value + flag = CompilerFlag(value, propagate=propagation, flag_group=flag_group, source=source) if flag_type not in self: self[flag_type] = [flag] @@ -1665,8 +1684,9 @@ def _add_flag(self, name, value, propagate): elif name in valid_flags: assert self.compiler_flags is not None flags_and_propagation = spack.compiler.tokenize_flags(value, propagate) + flag_group = " ".join(x for (x, y) in flags_and_propagation) for flag, propagation in flags_and_propagation: - self.compiler_flags.add_flag(name, flag, propagation) + self.compiler_flags.add_flag(name, flag, propagation, flag_group) else: # FIXME: # All other flags represent variants. 'foo=true' and 'foo=false' diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index bbddf7ff41b157..786528f30fd538 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -401,14 +401,6 @@ def test_spec_flags_maintain_order(self, mutable_config, gcc11_with_flags): s.compiler_flags[x] == ["-O0", "-g"] for x in ("cflags", "cxxflags", "fflags") ) - @pytest.mark.xfail(reason="Broken, needs to be fixed") - def test_compiler_flags_from_compiler_and_dependent(self): - client = Spec("cmake-client %clang@12.2.0 platform=test os=fe target=fe cflags==-g") - client.concretize() - cmake = client["cmake"] - for spec in [client, cmake]: - assert spec.compiler_flags["cflags"] == ["-O3", "-g"] - def test_compiler_flags_differ_identical_compilers(self, mutable_config, clang12_with_flags): mutable_config.set("compilers", [clang12_with_flags]) # Correct arch to use test compiler that has flags @@ -442,6 +434,13 @@ def test_compiler_flags_differ_identical_compilers(self, mutable_config, clang12 ["hypre cflags='-g'", "^openblas cflags='-O3'"], ["^openblas cflags='-g'"], ), + # Setting propagation on parent and dependency -> the + # dependency propagation flags override + ( + "hypre cflags=='-g' ^openblas cflags=='-O3'", + ["hypre cflags='-g'", "^openblas cflags='-O3'"], + ["^openblas cflags='-g'"], + ), # Propagation doesn't go across build dependencies ( "cmake-client cflags=='-O2 -g'", diff --git a/lib/spack/spack/test/flag_mixing.py b/lib/spack/spack/test/flag_mixing.py new file mode 100644 index 00000000000000..f1c2cf7defbce0 --- /dev/null +++ b/lib/spack/spack/test/flag_mixing.py @@ -0,0 +1,333 @@ +# Copyright 2013-2024 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) +import pytest + +import spack.build_systems.generic +import spack.config +import spack.environment as ev +import spack.error +import spack.package_base +import spack.repo +import spack.util.spack_yaml as syaml +import spack.version +from spack.spec import Spec +from spack.test.conftest import create_test_repo + +""" +These tests include the following package DAGs: + +Firstly, w, x, y where w and x apply cflags to y. + +w +|\ +x | +|/ +y + +Secondly, v, y which where v does not apply cflags to y - this is for testing +mixing with compiler flag propagation in the absence of compiler flags applied +by dependents. + +v +| +y + +Finally, a diamond dag to check that the topological order is resolved into +a total order: + +t +|\ +u x +|/ +y +""" + +_pkgx = ( + "x", + """\ +class X(Package): + version("1.1") + version("1.0") + + variant("activatemultiflag", default=False) + depends_on('y cflags="-d1"', when="~activatemultiflag") + depends_on('y cflags="-d1 -d2"', when="+activatemultiflag") +""", +) + + +_pkgy = ( + "y", + """\ +class Y(Package): + version("2.1") + version("2.0") +""", +) + + +_pkgw = ( + "w", + """\ +class W(Package): + version("3.1") + version("3.0") + + variant("moveflaglater", default=False) + + depends_on('x +activatemultiflag') + depends_on('y cflags="-d0"', when="~moveflaglater") + depends_on('y cflags="-d3"', when="+moveflaglater") +""", +) + + +_pkgv = ( + "v", + """\ +class V(Package): + version("4.1") + version("4.0") + + depends_on("y") +""", +) + + +_pkgt = ( + "t", + """\ +class T(Package): + version("5.0") + + depends_on("u") + depends_on("x+activatemultiflag") + depends_on("y cflags='-c1 -c2'") +""", +) + + +_pkgu = ( + "u", + """\ +class U(Package): + version("6.0") + + depends_on("y cflags='-e1 -e2'") +""", +) + + +@pytest.fixture +def _create_test_repo(tmpdir, mutable_config): + yield create_test_repo(tmpdir, [_pkgt, _pkgu, _pkgv, _pkgw, _pkgx, _pkgy]) + + +@pytest.fixture +def test_repo(_create_test_repo, monkeypatch, mock_stage): + with spack.repo.use_repositories(_create_test_repo) as mock_repo_path: + yield mock_repo_path + + +def update_concretize_scope(conf_str, section): + conf = syaml.load_config(conf_str) + spack.config.set(section, conf[section], scope="concretize") + + +def test_mix_spec_and_requirements(concretize_scope, test_repo): + conf_str = """\ +packages: + y: + require: cflags="-c" +""" + update_concretize_scope(conf_str, "packages") + + s1 = Spec('y cflags="-a"').concretized() + assert s1.satisfies('cflags="-a -c"') + + +def test_mix_spec_and_dependent(concretize_scope, test_repo): + s1 = Spec('x ^y cflags="-a"').concretized() + assert s1["y"].satisfies('cflags="-a -d1"') + + +def _compiler_cfg_one_entry_with_cflags(cflags): + return f"""\ +compilers:: +- compiler: + spec: gcc@12.100.100 + paths: + cc: /usr/bin/fake-gcc + cxx: /usr/bin/fake-g++ + f77: null + fc: null + flags: + cflags: {cflags} + operating_system: debian6 + modules: [] +""" + + +def test_mix_spec_and_compiler_cfg(concretize_scope, test_repo): + conf_str = _compiler_cfg_one_entry_with_cflags("-Wall") + update_concretize_scope(conf_str, "compilers") + + s1 = Spec('y %gcc@12.100.100 cflags="-O2"').concretized() + assert s1.satisfies('cflags="-Wall -O2"') + + +@pytest.mark.parametrize( + "cmd_flags,req_flags,cmp_flags,dflags,expected_order", + [ + ("-a -b", "-c", None, False, "-c -a -b"), + ("-x7 -x4", "-x5 -x6", None, False, "-x5 -x6 -x7 -x4"), + ("-x7 -x4", "-x5 -x6", "-x3 -x8", False, "-x3 -x8 -x5 -x6 -x7 -x4"), + ("-x7 -x4", "-x5 -x6", "-x3 -x8", True, "-x3 -x8 -d1 -d2 -x5 -x6 -x7 -x4"), + ("-x7 -x4", None, "-x3 -x8", False, "-x3 -x8 -x7 -x4"), + ("-x7 -x4", None, "-x3 -x8", True, "-x3 -x8 -d1 -d2 -x7 -x4"), + # The remaining test cover cases of intersection + ("-a -b", "-a -c", None, False, "-c -a -b"), + ("-a -b", None, "-a -c", False, "-c -a -b"), + ("-a -b", "-a -c", "-a -d", False, "-d -c -a -b"), + ("-a -d2 -d1", "-d2 -c", "-d1 -b", True, "-b -c -a -d2 -d1"), + ("-a", "-d0 -d2 -c", "-d1 -b", True, "-b -d1 -d0 -d2 -c -a"), + ], +) +def test_flag_order_and_grouping( + concretize_scope, test_repo, cmd_flags, req_flags, cmp_flags, dflags, expected_order +): + """Check consistent flag ordering and grouping on a package "y" + with flags introduced from a variety of sources. + + The ordering rules are explained in ``asp.SpecBuilder.reorder_flags``. + """ + if req_flags: + conf_str = f"""\ +packages: + y: + require: cflags="{req_flags}" +""" + update_concretize_scope(conf_str, "packages") + + if cmp_flags: + conf_str = _compiler_cfg_one_entry_with_cflags(cmp_flags) + update_concretize_scope(conf_str, "compilers") + + compiler_spec = "" + if cmp_flags: + compiler_spec = "%gcc@12.100.100" + + if dflags: + spec_str = f"x+activatemultiflag {compiler_spec} ^y" + expected_dflags = "-d1 -d2" + else: + spec_str = f"y {compiler_spec}" + expected_dflags = None + + if cmd_flags: + spec_str += f' cflags="{cmd_flags}"' + + root_spec = Spec(spec_str).concretized() + spec = root_spec["y"] + satisfy_flags = " ".join(x for x in [cmd_flags, req_flags, cmp_flags, expected_dflags] if x) + assert spec.satisfies(f'cflags="{satisfy_flags}"') + assert spec.compiler_flags["cflags"] == expected_order.split() + + +def test_two_dependents_flag_mixing(concretize_scope, test_repo): + root_spec1 = Spec("w~moveflaglater").concretized() + spec1 = root_spec1["y"] + assert spec1.compiler_flags["cflags"] == "-d0 -d1 -d2".split() + + root_spec2 = Spec("w+moveflaglater").concretized() + spec2 = root_spec2["y"] + assert spec2.compiler_flags["cflags"] == "-d3 -d1 -d2".split() + + +def test_propagate_and_compiler_cfg(concretize_scope, test_repo): + conf_str = _compiler_cfg_one_entry_with_cflags("-f2") + update_concretize_scope(conf_str, "compilers") + + root_spec = Spec("v %gcc@12.100.100 cflags=='-f1'").concretized() + assert root_spec["y"].satisfies("cflags='-f1 -f2'") + + +# Note: setting flags on a dependency overrides propagation, which +# is tested in test/concretize.py:test_compiler_flag_propagation + + +def test_propagate_and_pkg_dep(concretize_scope, test_repo): + root_spec1 = Spec("x ~activatemultiflag cflags=='-f1'").concretized() + assert root_spec1["y"].satisfies("cflags='-f1 -d1'") + + +def test_propagate_and_require(concretize_scope, test_repo): + conf_str = """\ +packages: + y: + require: cflags="-f2" +""" + update_concretize_scope(conf_str, "packages") + + root_spec1 = Spec("v cflags=='-f1'").concretized() + assert root_spec1["y"].satisfies("cflags='-f1 -f2'") + + # Next, check that a requirement does not "undo" a request for + # propagation from the command-line spec + conf_str = """\ +packages: + v: + require: cflags="-f1" +""" + update_concretize_scope(conf_str, "packages") + + root_spec2 = Spec("v cflags=='-f1'").concretized() + assert root_spec2["y"].satisfies("cflags='-f1'") + + # Note: requirements cannot enforce propagation: any attempt to do + # so will generate a concretization error; this likely relates to + # the note about #37180 in concretize.lp + + +def test_dev_mix_flags(tmp_path, concretize_scope, mutable_mock_env_path, test_repo): + src_dir = tmp_path / "x-src" + + env_content = f"""\ +spack: + specs: + - y %gcc@12.100.100 cflags=='-fsanitize=address' + develop: + y: + spec: y cflags=='-fsanitize=address' + path: {src_dir} +""" + + conf_str = _compiler_cfg_one_entry_with_cflags("-f1") + update_concretize_scope(conf_str, "compilers") + + manifest_file = tmp_path / ev.manifest_name + manifest_file.write_text(env_content) + e = ev.create("test", manifest_file) + with e: + e.concretize() + e.write() + + (result,) = list(j for i, j in e.concretized_specs() if j.name == "y") + + assert result["y"].satisfies("cflags='-fsanitize=address -f1'") + + +def test_diamond_dep_flag_mixing(concretize_scope, test_repo): + """A diamond where each dependent applies flags to the bottom + dependency. The goal is to ensure that the flag ordering is + (a) topological and (b) repeatable for elements not subject to + this partial ordering (i.e. the flags for the left and right + nodes of the diamond always appear in the same order). + `Spec.traverse` is responsible for handling both of these needs. + """ + root_spec1 = Spec("t").concretized() + spec1 = root_spec1["y"] + assert spec1.satisfies('cflags="-c1 -c2 -d1 -d2 -e1 -e2"') + assert spec1.compiler_flags["cflags"] == "-c1 -c2 -e1 -e2 -d1 -d2".split() diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index e11e663338e8e3..cd0f930acd8263 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -245,6 +245,65 @@ def test_abstract_specs_can_constrain_each_other(self, lhs, rhs, expected): assert c1 == c2 assert c1 == expected + @pytest.mark.parametrize( + "lhs,rhs,expected_lhs,expected_rhs,propagated_lhs,propagated_rhs", + [ + ( + 'mpich cppflags="-O3"', + 'mpich cppflags="-O2"', + 'mpich cppflags="-O3 -O2"', + 'mpich cppflags="-O2 -O3"', + [], + [], + ), + ( + 'mpich cflags="-O3 -g"', + 'mpich cflags=="-O3"', + 'mpich cflags="-O3 -g"', + 'mpich cflags=="-O3 -g"', + [("cflags", "-O3")], + [("cflags", "-O3")], + ), + ], + ) + def test_constrain_compiler_flags( + self, lhs, rhs, expected_lhs, expected_rhs, propagated_lhs, propagated_rhs + ): + """Constraining is asymmetric for compiler flags. Also note that + Spec equality does not account for flag propagation, so the checks + here are manual. + """ + lhs, rhs, expected_lhs, expected_rhs = ( + Spec(lhs), + Spec(rhs), + Spec(expected_lhs), + Spec(expected_rhs), + ) + + assert lhs.intersects(rhs) + assert rhs.intersects(lhs) + + c1, c2 = lhs.copy(), rhs.copy() + c1.constrain(rhs) + c2.constrain(lhs) + + assert c1 == expected_lhs + assert c2 == expected_rhs + for x in [c1, c2]: + assert x.satisfies(lhs) + assert x.satisfies(rhs) + + def _propagated_flags(_spec): + result = set() + for flagtype in _spec.compiler_flags: + for flag in _spec.compiler_flags[flagtype]: + if flag.propagate: + result.add((flagtype, flag)) + return result + + assert set(propagated_lhs) <= _propagated_flags(c1) + assert set(propagated_rhs) <= _propagated_flags(c2) + def test_constrain_specs_by_hash(self, default_mock_concretization, database): """Test that Specs specified only by their hashes can constrain eachother.""" mpich_dag_hash = "/" + database.query_one("mpich").dag_hash() @@ -311,14 +370,11 @@ def test_concrete_specs_which_satisfies_abstract(self, lhs, rhs, default_mock_co ("mpich~~foo", "mpich++foo"), ("mpich++foo", "mpich~~foo"), ("mpich foo==True", "mpich foo==False"), - ('mpich cppflags="-O3"', 'mpich cppflags="-O2"'), - ('mpich cppflags="-O3"', 'mpich cppflags=="-O3"'), ("libelf@0:2.0", "libelf@2.1:3"), ("libelf@0:2.5%gcc@4.8:4.9", "libelf@2.1:3%gcc@4.5:4.7"), ("libelf+debug", "libelf~debug"), ("libelf+debug~foo", "libelf+debug+foo"), ("libelf debug=True", "libelf debug=False"), - ('libelf cppflags="-O3"', 'libelf cppflags="-O2"'), ("libelf platform=test target=be os=be", "libelf target=fe os=fe"), ("namespace=builtin.mock", "namespace=builtin"), ], @@ -347,10 +403,6 @@ def test_constraining_abstract_specs_with_empty_intersection(self, lhs, rhs): ("mpich", "mpich++foo"), ("mpich", "mpich~~foo"), ("mpich", "mpich foo==1"), - # Flags semantics is currently different from other variant - ("mpich", 'mpich cflags="-O3"'), - ("mpich cflags=-O3", 'mpich cflags="-O3 -Ofast"'), - ("mpich cflags=-O2", 'mpich cflags="-O3"'), ("multivalue-variant foo=bar", "multivalue-variant +foo"), ("multivalue-variant foo=bar", "multivalue-variant ~foo"), ("multivalue-variant fee=bar", "multivalue-variant fee=baz"), @@ -1451,8 +1503,8 @@ def test_abstract_contains_semantic(lhs, rhs, expected, mock_packages): (CompilerSpec, "gcc@5", "gcc@5-tag", (True, False, True)), # Flags (flags are a map, so for convenience we initialize a full Spec) # Note: the semantic is that of sv variants, not mv variants - (Spec, "cppflags=-foo", "cppflags=-bar", (False, False, False)), - (Spec, "cppflags='-bar -foo'", "cppflags=-bar", (False, False, False)), + (Spec, "cppflags=-foo", "cppflags=-bar", (True, False, False)), + (Spec, "cppflags='-bar -foo'", "cppflags=-bar", (True, True, False)), (Spec, "cppflags=-foo", "cppflags=-foo", (True, True, True)), (Spec, "cppflags=-foo", "cflags=-foo", (True, False, False)), # Versions From 2f488b93294b2951d0db838d3bf1616521ff87a7 Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Fri, 6 Sep 2024 13:43:23 -0400 Subject: [PATCH 025/687] Use an HTTP git url for libpressio-opt (#46249) superceds #46128 Co-authored-by: Robert Underwood --- var/spack/repos/builtin/packages/libpressio-opt/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/libpressio-opt/package.py b/var/spack/repos/builtin/packages/libpressio-opt/package.py index 22ca887960430f..37c291e92ee821 100644 --- a/var/spack/repos/builtin/packages/libpressio-opt/package.py +++ b/var/spack/repos/builtin/packages/libpressio-opt/package.py @@ -10,7 +10,7 @@ class LibpressioOpt(CMakePackage): """Metacompressor which preforms optimization of compressor settings for LibPressio""" homepage = "https://github.com/robertu94/libpressio_opt" - git = "git@github.com:robertu94/libpressio_opt" + git = "https://github.com/robertu94/libpressio_opt.git" url = "https://github.com/robertu94/libpressio_opt/archive/refs/tags/0.11.0.tar.gz" maintainers("robertu94") From 8058cd34e42b2d34b5201ce9cabbee8508e917c5 Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Fri, 6 Sep 2024 13:56:46 -0400 Subject: [PATCH 026/687] Require a newer version of cudnn for cupy (#46248) cupy 12 needs a newer version of cudnn as documented here. Supercedes #46128 Co-authored-by: Robert Underwood From b51fd9f5a69aedb9e51a5b0dc0fd14b86da30cfd Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 6 Sep 2024 20:18:10 +0200 Subject: [PATCH 027/687] py-torchgeo: zipfile-deflate64 no longer required (#46233) --- var/spack/repos/builtin/packages/py-torchgeo/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-torchgeo/package.py b/var/spack/repos/builtin/packages/py-torchgeo/package.py index b5bf08f9c49e9f..8d307841591205 100644 --- a/var/spack/repos/builtin/packages/py-torchgeo/package.py +++ b/var/spack/repos/builtin/packages/py-torchgeo/package.py @@ -162,7 +162,7 @@ class PyTorchgeo(PythonPackage): depends_on("py-radiant-mlhub@0.2.1:0.4", when="@:0.4.0") depends_on("py-rarfile@4:", when="@0.5") depends_on("py-rarfile@3:", when="@:0.4") - depends_on("py-zipfile-deflate64@0.2:", when="@0.2.1:") + depends_on("py-zipfile-deflate64@0.2:", when="@0.2.1:0.5") with when("+docs"), default_args(type="run"): depends_on("py-ipywidgets@7:") From d9df520e85a325e9e488604aaad5b4bc3aae5888 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 6 Sep 2024 20:19:49 +0200 Subject: [PATCH 028/687] py-pandas: relax build dependencies (#46229) --- var/spack/repos/builtin/packages/py-pandas/package.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-pandas/package.py b/var/spack/repos/builtin/packages/py-pandas/package.py index ae9d8dc1bd1951..e1fdbc87f3351c 100644 --- a/var/spack/repos/builtin/packages/py-pandas/package.py +++ b/var/spack/repos/builtin/packages/py-pandas/package.py @@ -68,7 +68,7 @@ class PyPandas(PythonPackage): version("0.25.3", sha256="52da74df8a9c9a103af0a72c9d5fdc8e0183a90884278db7f386b5692a2220a4") version("0.25.2", sha256="ca91a19d1f0a280874a24dca44aadce42da7f3a7edb7e9ab7c7baad8febee2be") - depends_on("c", type="build") # generated + depends_on("c", type="build") variant("performance", default=True, description="Build recommended performance dependencies") variant("excel", when="@1.4:", default=False, description="Build with support for Excel") @@ -82,10 +82,10 @@ class PyPandas(PythonPackage): depends_on("python@:3.9", when="@1.1.3:1.3.2", type=("build", "run")) depends_on("python@:3.8", when="@0.25.2:1.1.2", type=("build", "run")) - depends_on("py-meson-python@0.13.1", when="@2.1:", type="build") - depends_on("meson@1.2.1", when="@2.1.1:", type="build") - depends_on("meson@1.0.1", when="@2.1.0", type="build") - depends_on("py-cython@3.0.5", when="@2.2:", type="build") + depends_on("py-meson-python@0.13.1:", when="@2.1:", type="build") + depends_on("meson@1.2.1:", when="@2.1.1:", type="build") + depends_on("meson@1.0.1:", when="@2.1.0", type="build") + depends_on("py-cython@3.0.5:", when="@2.2:", type="build") depends_on("py-cython@0.29.33:2", when="@2.0:2.1", type="build") depends_on("py-cython@0.29.32:2", when="@1.4.4:1", type="build") depends_on("py-cython@0.29.30:2", when="@1.4.3", type="build") From 983e7427f7111242bd4b5eb2058307bb04eef844 Mon Sep 17 00:00:00 2001 From: "Auriane R." <48684432+aurianer@users.noreply.github.com> Date: Fri, 6 Sep 2024 20:22:19 +0200 Subject: [PATCH 029/687] Replace `if ... in spec` with `spec.satisfies` in f* and g* packages (#46127) * Replace if ... in spec with spec.satisfies in f* and g* packages * gromacs: ^amdfftw -> ^[virtuals=fftw-api] amdfftw * flamemaster: add virtuals lapack for the amdlibflame dependency --------- Co-authored-by: Wouter Deconinck --- .../repos/builtin/packages/faiss/package.py | 16 +++--- .../packages/fasttransforms/package.py | 4 +- .../builtin/packages/fasttree/package.py | 4 +- .../repos/builtin/packages/fckit/package.py | 2 +- .../repos/builtin/packages/fenics/package.py | 2 +- .../repos/builtin/packages/ferret/package.py | 10 ++-- .../repos/builtin/packages/ffte/package.py | 4 +- .../repos/builtin/packages/fftw/package.py | 6 +-- .../repos/builtin/packages/fftx/package.py | 6 +-- .../repos/builtin/packages/fio/package.py | 2 +- .../repos/builtin/packages/fish/package.py | 2 +- .../builtin/packages/flamemaster/package.py | 2 +- .../repos/builtin/packages/flann/package.py | 2 +- .../builtin/packages/flatbuffers/package.py | 2 +- .../repos/builtin/packages/flecsi/package.py | 6 +-- .../repos/builtin/packages/fleur/package.py | 22 ++++---- .../repos/builtin/packages/fltk/package.py | 6 +-- .../builtin/packages/flux-core/package.py | 2 +- .../repos/builtin/packages/fmt/package.py | 4 +- .../builtin/packages/foam-extend/package.py | 14 ++--- .../repos/builtin/packages/form/package.py | 2 +- .../builtin/packages/formetis/package.py | 2 +- .../repos/builtin/packages/fpm/package.py | 4 +- .../repos/builtin/packages/freefem/package.py | 2 +- .../repos/builtin/packages/fsl/package.py | 2 +- .../repos/builtin/packages/fstrack/package.py | 4 +- .../builtin/packages/fujitsu-fftw/package.py | 8 +-- .../builtin/packages/fujitsu-ssl2/package.py | 20 +++---- .../repos/builtin/packages/funhpc/package.py | 2 +- .../repos/builtin/packages/fxt/package.py | 2 +- .../repos/builtin/packages/gapbs/package.py | 2 +- .../repos/builtin/packages/gasnet/package.py | 16 +++--- .../repos/builtin/packages/gate/package.py | 2 +- .../repos/builtin/packages/gcc/package.py | 18 +++---- .../repos/builtin/packages/gdal/package.py | 14 ++--- .../repos/builtin/packages/gdb/package.py | 4 +- .../builtin/packages/gdk-pixbuf/package.py | 2 +- .../repos/builtin/packages/gdl/package.py | 18 +++---- .../repos/builtin/packages/geant3/package.py | 2 +- .../repos/builtin/packages/geant4/package.py | 14 ++--- .../repos/builtin/packages/genesis/package.py | 4 +- .../repos/builtin/packages/genie/package.py | 12 ++--- .../builtin/packages/genomeworks/package.py | 2 +- .../builtin/packages/geopm-runtime/package.py | 4 +- .../builtin/packages/geopm-service/package.py | 2 +- .../repos/builtin/packages/geos/package.py | 2 +- .../repos/builtin/packages/gettext/package.py | 6 +-- .../repos/builtin/packages/gimp/package.py | 2 +- .../repos/builtin/packages/ginkgo/package.py | 10 ++-- .../builtin/packages/git-annex/package.py | 2 +- .../repos/builtin/packages/git/package.py | 22 ++++---- .../repos/builtin/packages/gl2ps/package.py | 2 +- .../repos/builtin/packages/glib/package.py | 12 ++--- .../builtin/packages/globalarrays/package.py | 2 +- .../repos/builtin/packages/glpk/package.py | 2 +- .../repos/builtin/packages/gmp/package.py | 2 +- .../repos/builtin/packages/gmt/package.py | 14 ++--- .../repos/builtin/packages/gnina/package.py | 2 +- .../repos/builtin/packages/gnuplot/package.py | 14 ++--- .../repos/builtin/packages/gnutls/package.py | 6 +-- .../builtin/packages/googletest/package.py | 2 +- .../builtin/packages/gosam-contrib/package.py | 4 +- .../repos/builtin/packages/gpi-2/package.py | 12 ++--- .../repos/builtin/packages/gptl/package.py | 8 +-- .../repos/builtin/packages/gptune/package.py | 14 ++--- .../builtin/packages/gpu-burn/package.py | 2 +- .../builtin/packages/graphviz/package.py | 4 +- .../repos/builtin/packages/grass/package.py | 52 +++++++++---------- .../repos/builtin/packages/grep/package.py | 2 +- .../builtin/packages/grib-api/package.py | 6 +-- .../repos/builtin/packages/grid/package.py | 6 +-- .../builtin/packages/gridlab-d/package.py | 2 +- .../repos/builtin/packages/groff/package.py | 2 +- .../repos/builtin/packages/gromacs/package.py | 48 ++++++++--------- .../repos/builtin/packages/gslib/package.py | 4 +- .../repos/builtin/packages/gtkplus/package.py | 2 +- .../repos/builtin/packages/guile/package.py | 4 +- .../repos/builtin/packages/gunrock/package.py | 2 +- .../repos/builtin/packages/gxsview/package.py | 2 +- 79 files changed, 280 insertions(+), 280 deletions(-) diff --git a/var/spack/repos/builtin/packages/faiss/package.py b/var/spack/repos/builtin/packages/faiss/package.py index a7e415a6df92eb..fc5336c3d184c0 100644 --- a/var/spack/repos/builtin/packages/faiss/package.py +++ b/var/spack/repos/builtin/packages/faiss/package.py @@ -79,7 +79,7 @@ class Faiss(AutotoolsPackage, CMakePackage, CudaPackage): patch("fixes-in-v1.7.2.patch", when="@1.7.2") def setup_run_environment(self, env): - if "+python" in self.spec: + if self.spec.satisfies("+python"): env.prepend_path("PYTHONPATH", python_platlib) if self.spec.satisfies("platform=darwin"): env.append_path( @@ -100,7 +100,7 @@ def cmake_args(self): self.define("FAISS_OPT_LEVEL", "generic"), ] - if "+cuda" in spec: + if spec.satisfies("+cuda"): key = "CMAKE_CUDA_ARCHITECTURES" args.append(self.define_from_variant(key, "cuda_arch")) # args.append(self.define_from_variant( @@ -109,7 +109,7 @@ def cmake_args(self): def install(self, pkg, spec, prefix): super().install(pkg, spec, prefix) - if "+python" in spec: + if spec.satisfies("+python"): class CustomPythonPipBuilder(spack.build_systems.python.PythonPipBuilder): def __init__(self, pkg, build_dirname): @@ -133,17 +133,17 @@ def configure_args(self): def build(self, pkg, spec, prefix): make() - if "+python" in self.spec: + if self.spec.satisfies("+python"): make("-C", "python") # CPU tests - if "+tests" in self.spec: + if self.spec.satisfies("+tests"): with working_dir("tests"): make("gtest") make("tests") # GPU tests - if "+tests+cuda" in self.spec: + if self.spec.satisfies("+tests+cuda"): with working_dir(os.path.join("gpu", "test")): make("gtest") make("build") # target added by the patch @@ -152,7 +152,7 @@ def build(self, pkg, spec, prefix): def install(self, pkg, spec, prefix): make("install") - if "+python" in self.spec: + if self.spec.satisfies("+python"): with working_dir("python"): args = std_pip_args + ["--prefix=" + prefix, "."] pip(*args) @@ -174,7 +174,7 @@ def _prefix_and_install(file): _prefix_and_install("TestCpu") # GPU tests - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): with working_dir(os.path.join("gpu", "test")): _prefix_and_install("TestGpuIndexFlat") _prefix_and_install("TestGpuIndexBinaryFlat") diff --git a/var/spack/repos/builtin/packages/fasttransforms/package.py b/var/spack/repos/builtin/packages/fasttransforms/package.py index 63e90ee45cc790..585caec673db46 100644 --- a/var/spack/repos/builtin/packages/fasttransforms/package.py +++ b/var/spack/repos/builtin/packages/fasttransforms/package.py @@ -32,9 +32,9 @@ class Fasttransforms(MakefilePackage): def build(self, spec, prefix): makeargs = ["CC=cc"] - if "openblas" in spec: + if spec.satisfies("openblas"): makeargs += ["FT_BLAS=openblas"] - if "quadmath" in spec: + if spec.satisfies("quadmath"): makeargs += ["FT_QUADMATH=1"] make("assembly", *makeargs) make("lib", *makeargs) diff --git a/var/spack/repos/builtin/packages/fasttree/package.py b/var/spack/repos/builtin/packages/fasttree/package.py index 8a766c29770fbd..3d26bbd290573e 100644 --- a/var/spack/repos/builtin/packages/fasttree/package.py +++ b/var/spack/repos/builtin/packages/fasttree/package.py @@ -34,7 +34,7 @@ class Fasttree(Package): def install(self, spec, prefix): cc = Executable(spack_cc) - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): cc( "-O3", self.compiler.openmp_flag, @@ -63,5 +63,5 @@ def install(self, spec, prefix): @run_after("install") def create_fasttree_mp_symlink(self): with working_dir(prefix.bin): - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): symlink("FastTree", "FastTreeMP") diff --git a/var/spack/repos/builtin/packages/fckit/package.py b/var/spack/repos/builtin/packages/fckit/package.py index ddea92b5064d73..89b1e3105e95b6 100644 --- a/var/spack/repos/builtin/packages/fckit/package.py +++ b/var/spack/repos/builtin/packages/fckit/package.py @@ -68,7 +68,7 @@ def cmake_args(self): "-DFYPP_NO_LINE_NUMBERING=ON", ] - if "~shared" in self.spec: + if self.spec.satisfies("~shared"): args.append("-DBUILD_SHARED_LIBS=OFF") if "finalize_ddts=auto" not in self.spec: diff --git a/var/spack/repos/builtin/packages/fenics/package.py b/var/spack/repos/builtin/packages/fenics/package.py index 0cd60596fbf656..ec9d77b5c4ad1a 100644 --- a/var/spack/repos/builtin/packages/fenics/package.py +++ b/var/spack/repos/builtin/packages/fenics/package.py @@ -192,7 +192,7 @@ def setup_run_environment(self, env): # build python interface of dolfin @run_after("install") def install_python_interface(self): - if "+python" in self.spec: + if self.spec.satisfies("+python"): with working_dir("python"): args = std_pip_args + ["--prefix=" + self.prefix, "."] pip(*args) diff --git a/var/spack/repos/builtin/packages/ferret/package.py b/var/spack/repos/builtin/packages/ferret/package.py index dea3a7fbb634f0..9e9a317b476fa9 100644 --- a/var/spack/repos/builtin/packages/ferret/package.py +++ b/var/spack/repos/builtin/packages/ferret/package.py @@ -80,7 +80,7 @@ def patch(self): work_dir = "FERRET" if "@:7.2" in spec else "." with working_dir(work_dir, create=False): - if "@7.3:" in spec: + if spec.satisfies("@7.3:"): copy("site_specific.mk.in", "site_specific.mk") copy( "external_functions/ef_utility/site_specific.mk.in", @@ -111,7 +111,7 @@ def patch(self): r"^(NETCDF4?_(LIB)?DIR).+", "\\1 = %s" % netcdff_prefix, "site_specific.mk" ) - if "@:7.3" in spec: + if spec.satisfies("@:7.3"): # Don't force using the static version of libz filter_file( r"\$\(LIBZ_DIR\)/lib64/libz.a", "-lz", "platform_specific.mk.x86_64-linux" @@ -137,7 +137,7 @@ def patch(self): # Don't force using the static version of libgfortran filter_file(r"-static-libgfortran", "", "platform_specific.mk.x86_64-linux") - if "@:7.4" in spec: + if spec.satisfies("@:7.4"): compilers_spec_file = "platform_specific.mk.x86_64-linux" else: compilers_spec_file = "site_specific.mk" @@ -182,7 +182,7 @@ def install(self, spec, prefix): make(parallel=False) make("install") - if "+datasets" in self.spec: + if self.spec.satisfies("+datasets"): mkdir(self.prefix.fer_dsets) install_tree("fer_dsets", self.prefix.fer_dsets) @@ -199,7 +199,7 @@ def setup_run_environment(self, env): fer_descr = ["."] fer_grids = ["."] - if "+datasets" in self.spec: + if self.spec.satisfies("+datasets"): env.set("FER_DSETS", self.prefix.fer_dsets) fer_data.append(self.prefix.fer_dsets.data) diff --git a/var/spack/repos/builtin/packages/ffte/package.py b/var/spack/repos/builtin/packages/ffte/package.py index e9b479be0ef6b2..af0a89e94b3e0e 100644 --- a/var/spack/repos/builtin/packages/ffte/package.py +++ b/var/spack/repos/builtin/packages/ffte/package.py @@ -87,7 +87,7 @@ def edit(self, spec, prefix): def install(self, spec, prefix): self.edit(spec, prefix) - if "+mpi" in spec: + if spec.satisfies("+mpi"): env["CC"] = spec["mpi"].mpicc env["F77"] = spec["mpi"].mpif77 env["FC"] = spec["mpi"].mpifc @@ -103,5 +103,5 @@ def install(self, spec, prefix): make() mkdirp(prefix.lib) install("libffte.a", prefix.lib) - if "+mpi" in spec: + if spec.satisfies("+mpi"): install("mpi/libfftempi.a", prefix.lib) diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 3c20fac5663334..bcf54524008ac3 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -79,7 +79,7 @@ def patch(self): os.rename("fftw/config.h", "fftw/config.h.SPACK_RENAMED") def autoreconf(self, spec, prefix): - if "+pfft_patches" in spec: + if spec.satisfies("+pfft_patches"): autoreconf = which("autoreconf") autoreconf("-ifv") @@ -114,13 +114,13 @@ def configure(self, spec, prefix): options.append("--enable-type-prefix") # Variants that affect every precision - if "+openmp" in spec: + if spec.satisfies("+openmp"): options.append("--enable-openmp") if spec.satisfies("@:2"): # TODO: libtool strips CFLAGS, so 2.x libxfftw_threads # isn't linked to the openmp library. Patch Makefile? options.insert(0, "CFLAGS=" + self.compiler.openmp_flag) - if "+mpi" in spec: + if spec.satisfies("+mpi"): options.append("--enable-mpi") # Specific SIMD support. diff --git a/var/spack/repos/builtin/packages/fftx/package.py b/var/spack/repos/builtin/packages/fftx/package.py index b131288a471ae9..96ed533315bf18 100644 --- a/var/spack/repos/builtin/packages/fftx/package.py +++ b/var/spack/repos/builtin/packages/fftx/package.py @@ -43,9 +43,9 @@ def create_lib_source_code(self): # What config should be built -- driven by spec spec = self.spec backend = "CPU" - if "+cuda" in spec: + if spec.satisfies("+cuda"): backend = "CUDA" - if "+rocm" in spec: + if spec.satisfies("+rocm"): backend = "HIP" self.build_config = "-D_codegen=%s" % backend @@ -58,7 +58,7 @@ def cmake_args(self): spec = self.spec args = ["-DSPIRAL_HOME:STRING={0}".format(spec["spiral-software"].prefix)] args.append("-DCMAKE_INSTALL_PREFIX:PATH={0}".format(self.prefix)) - if "+rocm" in spec: + if spec.satisfies("+rocm"): args.append("-DCMAKE_CXX_COMPILER={0}".format(self.spec["hip"].hipcc)) args.append(self.build_config) diff --git a/var/spack/repos/builtin/packages/fio/package.py b/var/spack/repos/builtin/packages/fio/package.py index d9875f4039fd34..c2fb6c30b997fa 100644 --- a/var/spack/repos/builtin/packages/fio/package.py +++ b/var/spack/repos/builtin/packages/fio/package.py @@ -58,6 +58,6 @@ def configure_args(self): @run_after("build") def build_docs(self): - if "+doc" in self.spec: + if self.spec.satisfies("+doc"): make("-C", "doc", "html") make("-C", "doc", "man") diff --git a/var/spack/repos/builtin/packages/fish/package.py b/var/spack/repos/builtin/packages/fish/package.py index e01b7f0307c998..b4359aabaf6aec 100644 --- a/var/spack/repos/builtin/packages/fish/package.py +++ b/var/spack/repos/builtin/packages/fish/package.py @@ -80,7 +80,7 @@ def cmake_args(self): "-DPCRE2_INCLUDE_DIR=" + self.spec["pcre2"].headers.directories[0], ] - if "+docs" in self.spec: + if self.spec.satisfies("+docs"): args.append("-DBUILD_DOCS=ON") else: args.append("-DBUILD_DOCS=OFF") diff --git a/var/spack/repos/builtin/packages/flamemaster/package.py b/var/spack/repos/builtin/packages/flamemaster/package.py index d49eacef5912d2..f6dbf090d4c3b0 100644 --- a/var/spack/repos/builtin/packages/flamemaster/package.py +++ b/var/spack/repos/builtin/packages/flamemaster/package.py @@ -242,7 +242,7 @@ def cmake_args(self): args.append("-DEIGEN_INTEGRATION:BOOL=%s" % ("ON" if "+eigen" in spec else "OFF")) args.append("-DINSTALL_EIGEN:BOOL=%s" % ("ON" if "+eigen" in spec else "OFF")) - if "^amdlibflame" in spec: + if spec.satisfies("[virtuals=lapack] ^amdlibflame"): args.append("-DBLA_VENDOR=FLAME") args.append("-DFLAMEMASTER_INSTALL_PREFIX:PATH={0}".format(spec.prefix)) diff --git a/var/spack/repos/builtin/packages/flann/package.py b/var/spack/repos/builtin/packages/flann/package.py index e6a8239dd5afa9..60521f83b99d70 100644 --- a/var/spack/repos/builtin/packages/flann/package.py +++ b/var/spack/repos/builtin/packages/flann/package.py @@ -94,7 +94,7 @@ def patch(self): "src/python/CMakeLists.txt", ) # Fix the install location so that spack activate works - if "+python" in self.spec: + if self.spec.satisfies("+python"): filter_file("share/flann/python", python_platlib, "src/python/CMakeLists.txt") # Hack. Don't install setup.py filter_file("install( FILES", "# install( FILES", "src/python/CMakeLists.txt", string=True) diff --git a/var/spack/repos/builtin/packages/flatbuffers/package.py b/var/spack/repos/builtin/packages/flatbuffers/package.py index 7d1ca90e2f0c2f..38cac7d8e9835c 100644 --- a/var/spack/repos/builtin/packages/flatbuffers/package.py +++ b/var/spack/repos/builtin/packages/flatbuffers/package.py @@ -56,7 +56,7 @@ class Flatbuffers(CMakePackage): @run_after("install") def python_install(self): - if "+python" in self.spec: + if self.spec.satisfies("+python"): pydir = join_path(self.stage.source_path, "python") with working_dir(pydir): args = std_pip_args + ["--prefix=" + self.prefix, "."] diff --git a/var/spack/repos/builtin/packages/flecsi/package.py b/var/spack/repos/builtin/packages/flecsi/package.py index c18adb82331e7e..517f57b0a7f996 100644 --- a/var/spack/repos/builtin/packages/flecsi/package.py +++ b/var/spack/repos/builtin/packages/flecsi/package.py @@ -131,13 +131,13 @@ def cmake_args(self): self.define_from_variant("ENABLE_DOCUMENTATION", "doc"), ] - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): options.append(self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)) options.append(self.define("CMAKE_C_COMPILER", self.spec["hip"].hipcc)) - if "backend=legion" in self.spec: + if self.spec.satisfies("backend=legion"): # CMake pulled in via find_package(Legion) won't work without this options.append(self.define("HIP_PATH", "{0}/hip".format(spec["hip"].prefix))) - elif "+kokkos" in self.spec: + elif self.spec.satisfies("+kokkos"): options.append(self.define("CMAKE_CXX_COMPILER", self.spec["kokkos"].kokkos_cxx)) else: # kept for supporing version prior to 2.2 diff --git a/var/spack/repos/builtin/packages/fleur/package.py b/var/spack/repos/builtin/packages/fleur/package.py index cd665cc14b8558..dc2e6d7727761e 100644 --- a/var/spack/repos/builtin/packages/fleur/package.py +++ b/var/spack/repos/builtin/packages/fleur/package.py @@ -82,7 +82,7 @@ class Fleur(Package): def setup_build_environment(self, env): spec = self.spec - if "+mpi" in spec: + if spec.satisfies("+mpi"): env.set("CC", spec["mpi"].mpicc, force=True) env.set("FC", spec["mpi"].mpifc, force=True) env.set("CXX", spec["mpi"].mpicxx, force=True) @@ -112,43 +112,43 @@ def configure(self): options["-includedir"].append(spec["libxml2"].prefix.include) options["-includedir"].append(join_path(spec["libxml2"].prefix.include, "libxml2")) - if "fft=mkl" in spec: + if spec.satisfies("fft=mkl"): options["-link"].append(spec["intel-mkl"].libs.link_flags) options["-libdir"].append(spec["intel-mkl"].prefix.lib) options["-includedir"].append(spec["intel-mkl"].prefix.include) - if "fft=fftw" in spec: + if spec.satisfies("fft=fftw"): options["-link"].append(spec["fftw-api"].libs.link_flags) options["-libdir"].append(spec["fftw-api"].prefix.lib) options["-includedir"].append(spec["fftw-api"].prefix.include) - if "+scalapack" in spec: + if spec.satisfies("+scalapack"): options["-link"].append(spec["scalapack"].libs.link_flags) options["-libdir"].append(spec["scalapack"].prefix.lib) - if "+external_libxc" in spec: + if spec.satisfies("+external_libxc"): # Workaround: The fortran library is called libxcf90.a/so # but spec['wannier90'].libs.link_flags return -lxc options["-link"].append("-lxcf90") options["-libdir"].append(spec["libxc"].prefix.lib) options["-includedir"].append(spec["libxc"].prefix.include) - if "+hdf5" in spec: + if spec.satisfies("+hdf5"): options["-link"].append(spec["hdf5"].libs.link_flags) options["-libdir"].append(spec["hdf5"].prefix.lib) options["-includedir"].append(spec["hdf5"].prefix.include) - if "+magma" in spec: + if spec.satisfies("+magma"): options["-link"].append(spec["magma"].libs.link_flags) options["-libdir"].append(spec["magma"].prefix.lib) options["-includedir"].append(spec["magma"].prefix.include) - if "+wannier90" in spec: + if spec.satisfies("+wannier90"): # Workaround: The library is not called wannier90.a/so # for this reason spec['wannier90'].libs.link_flags fails! options["-link"].append("-lwannier") options["-libdir"].append(spec["wannier90"].prefix.lib) - if "+spfft" in spec: + if spec.satisfies("+spfft"): options["-link"].append(spec["spfft"].libs.link_flags) # Workaround: The library is installed in /lib64 not /lib options["-libdir"].append(spec["spfft"].prefix.lib + "64") # Workaround: The library needs spfft.mod in include/spfft path options["-includedir"].append(join_path(spec["spfft"].prefix.include, "spfft")) - if "+elpa" in spec: + if spec.satisfies("+elpa"): options["-link"].append(spec["elpa"].libs.link_flags) options["-libdir"].append(spec["elpa"].prefix.lib) # Workaround: The library needs elpa.mod in include/elpa_%VERS/modules @@ -172,7 +172,7 @@ def install(self, spec, prefix): with working_dir("build"): make() mkdirp(prefix.bin) - if "+mpi" in spec: + if spec.satisfies("+mpi"): install("fleur_MPI", prefix.bin) else: install("fleur", prefix.bin) diff --git a/var/spack/repos/builtin/packages/fltk/package.py b/var/spack/repos/builtin/packages/fltk/package.py index 50f2b68c57a0ce..2cb32fd091c1dc 100644 --- a/var/spack/repos/builtin/packages/fltk/package.py +++ b/var/spack/repos/builtin/packages/fltk/package.py @@ -61,16 +61,16 @@ def install(self, spec, prefix): "--enable-localzlib", ] - if "+shared" in spec: + if spec.satisfies("+shared"): options.append("--enable-shared") - if "+xft" in spec: + if spec.satisfies("+xft"): # https://www.fltk.org/articles.php?L374+I0+TFAQ+P1+Q options.append("--enable-xft") else: options.append("--disable-xft") - if "~gl" in spec: + if spec.satisfies("~gl"): options.append("--disable-gl") # FLTK needs to be built in-source diff --git a/var/spack/repos/builtin/packages/flux-core/package.py b/var/spack/repos/builtin/packages/flux-core/package.py index 177fa45c5bd9a1..52eddda9fc938a 100644 --- a/var/spack/repos/builtin/packages/flux-core/package.py +++ b/var/spack/repos/builtin/packages/flux-core/package.py @@ -211,7 +211,7 @@ def configure_args(self): args = ["--enable-pylint=no"] if "+docs" not in self.spec: args.append("--disable-docs") - if "+security" in self.spec: + if self.spec.satisfies("+security"): args.append("--with-flux-security") return args diff --git a/var/spack/repos/builtin/packages/fmt/package.py b/var/spack/repos/builtin/packages/fmt/package.py index f9aa83dcbec154..898b835f9ab63b 100644 --- a/var/spack/repos/builtin/packages/fmt/package.py +++ b/var/spack/repos/builtin/packages/fmt/package.py @@ -114,7 +114,7 @@ def cmake_args(self): if self.spec.satisfies("+shared"): args.append("-DBUILD_SHARED_LIBS=ON") - if "+pic" in spec: + if spec.satisfies("+pic"): args.extend( [ "-DCMAKE_C_FLAGS={0}".format(self.compiler.cc_pic_flag), @@ -128,7 +128,7 @@ def cmake_args(self): args.append("-DCMAKE_CXX_STANDARD_REQUIRED=ON") # When cxxstd is 98, must disable FMT_USE_CPP11 - if "cxxstd=98" in spec: + if spec.satisfies("cxxstd=98"): args.append("-DFMT_USE_CPP11=OFF") # Can't build docs without doxygen+python+virtualenv diff --git a/var/spack/repos/builtin/packages/foam-extend/package.py b/var/spack/repos/builtin/packages/foam-extend/package.py index 550a3ce69e7947..6a9d8a026f727c 100644 --- a/var/spack/repos/builtin/packages/foam-extend/package.py +++ b/var/spack/repos/builtin/packages/foam-extend/package.py @@ -298,7 +298,7 @@ def configure(self, spec, prefix): # Adjust configuration via prefs - sort second self.etc_prefs["001"].update(self.foam_arch.foam_dict()) - if "+scotch" in spec or "+ptscotch" in spec: + if spec.satisfies("+scotch") or spec.satisfies("+ptscotch"): pkg = spec["scotch"].prefix self.etc_prefs["scotch"] = { "SCOTCH_SYSTEM": 1, @@ -308,7 +308,7 @@ def configure(self, spec, prefix): "SCOTCH_INCLUDE_DIR": pkg.include, } - if "+metis" in spec: + if spec.satisfies("+metis"): pkg = spec["metis"].prefix self.etc_prefs["metis"] = { "METIS_SYSTEM": 1, @@ -318,7 +318,7 @@ def configure(self, spec, prefix): "METIS_INCLUDE_DIR": pkg.include, } - if "+parmetis" in spec: + if spec.satisfies("+parmetis"): pkg = spec["parmetis"].prefix self.etc_prefs["parametis"] = { "PARMETIS_SYSTEM": 1, @@ -328,7 +328,7 @@ def configure(self, spec, prefix): "PARMETIS_INCLUDE_DIR": pkg.include, } - if "+parmgridgen" in spec: + if spec.satisfies("+parmgridgen"): pkg = spec["parmgridgen"].prefix self.etc_prefs["parmgridgen"] = { "PARMGRIDGEN_SYSTEM": 1, @@ -338,7 +338,7 @@ def configure(self, spec, prefix): "PARMGRIDGEN_INCLUDE_DIR": pkg.include, } - if "+paraview" in self.spec: + if self.spec.satisfies("+paraview"): self.etc_prefs["paraview"] = { "PARAVIEW_SYSTEM": 1, "PARAVIEW_DIR": spec["paraview"].prefix, @@ -386,7 +386,7 @@ def install(self, spec, prefix): } # All top-level files, except spack build info and possibly Allwmake - if "+source" in spec: + if spec.satisfies("+source"): ignored = re.compile(r"^spack-.*") else: ignored = re.compile(r"^(Allclean|Allwmake|spack-).*") @@ -400,7 +400,7 @@ def install(self, spec, prefix): for d in ["etc", "bin", "wmake", "lib", join_path(appdir, "bin")]: install_tree(d, join_path(self.projectdir, d), symlinks=True) - if "+source" in spec: + if spec.satisfies("+source"): subitem = join_path(appdir, "Allwmake") install(subitem, join_path(self.projectdir, subitem)) diff --git a/var/spack/repos/builtin/packages/form/package.py b/var/spack/repos/builtin/packages/form/package.py index 3597348f920529..b3d36d6c007af5 100644 --- a/var/spack/repos/builtin/packages/form/package.py +++ b/var/spack/repos/builtin/packages/form/package.py @@ -40,7 +40,7 @@ class Form(AutotoolsPackage): def configure_args(self): args = [] args += self.with_or_without("gmp", "prefix") - if "+zlib" in self.spec: + if self.spec.satisfies("+zlib"): args.append("--with-zlib=%s" % self.spec["zlib-api"].prefix) else: args.append("--without-zlib") diff --git a/var/spack/repos/builtin/packages/formetis/package.py b/var/spack/repos/builtin/packages/formetis/package.py index db2401871a4f86..2866df52a104e3 100644 --- a/var/spack/repos/builtin/packages/formetis/package.py +++ b/var/spack/repos/builtin/packages/formetis/package.py @@ -67,7 +67,7 @@ def test_metis(self): self.define("CMAKE_Fortran_COMPILER", self.compiler.fc), self.define("METIS_ROOT", self.spec["metis"].prefix), ] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): cmake_args.append(self.define("ParMETIS_ROOT", self.spec["parmetis"].prefix)) cmake_args.append(self.cached_tests_work_dir) cmake = which(self.spec["cmake"].prefix.bin.cmake) diff --git a/var/spack/repos/builtin/packages/fpm/package.py b/var/spack/repos/builtin/packages/fpm/package.py index a8c410e31a0aa7..18f179d15b29cf 100644 --- a/var/spack/repos/builtin/packages/fpm/package.py +++ b/var/spack/repos/builtin/packages/fpm/package.py @@ -42,13 +42,13 @@ class Fpm(Package): depends_on("git@1.8.5:", type="build") def setup_build_environment(self, env): - if "@0.4.0" in self.spec: + if self.spec.satisfies("@0.4.0"): env.set("FPM_C_COMPILER", self.compiler.cc) env.set("FPM_CC", self.compiler.cc) fflags = "-O3" - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): fflags += " " + self.compiler.openmp_flag env.set("FFLAGS", fflags) diff --git a/var/spack/repos/builtin/packages/freefem/package.py b/var/spack/repos/builtin/packages/freefem/package.py index 1f3f36d5449523..37ca96d694023a 100644 --- a/var/spack/repos/builtin/packages/freefem/package.py +++ b/var/spack/repos/builtin/packages/freefem/package.py @@ -75,7 +75,7 @@ def configure_args(self): "CXXFLAGS=%s" % " ".join(spec.compiler_flags["cxxflags"]), ] - if "+petsc" in spec: + if spec.satisfies("+petsc"): options.append("--with-petsc=%s" % spec["petsc"].prefix.lib.petsc.conf.petscvariables) options.append("--with-slepc-ldflags=%s" % spec["slepc"].libs.ld_flags) options.append("--with-slepc-include=%s" % spec["slepc"].headers.include_flags) diff --git a/var/spack/repos/builtin/packages/fsl/package.py b/var/spack/repos/builtin/packages/fsl/package.py index cae1ff6ecd233f..690911373e8559 100644 --- a/var/spack/repos/builtin/packages/fsl/package.py +++ b/var/spack/repos/builtin/packages/fsl/package.py @@ -111,7 +111,7 @@ def patch(self): vtk_settings.filter(r"(^VTKDIR_LIB)\s*=.*", r"\1 = {0}".format(vtk_lib_dir)) vtk_settings.filter(r"(^VTKSUFFIX)\s*=.*", r"\1 = -{0}".format(vtk_suffix)) - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): cuda_arch = self.spec.variants["cuda_arch"].value cuda_gencode = " ".join(self.cuda_flags(cuda_arch)) cuda_installation = self.spec["cuda"].prefix diff --git a/var/spack/repos/builtin/packages/fstrack/package.py b/var/spack/repos/builtin/packages/fstrack/package.py index 30c32470e089c3..a6bd204c3e51a7 100644 --- a/var/spack/repos/builtin/packages/fstrack/package.py +++ b/var/spack/repos/builtin/packages/fstrack/package.py @@ -43,7 +43,7 @@ def setup_build_environment(self, env): env.set("F90FLAGS_DEBUG", "-g -x f95-cpp-input") env.set("LDFLAGS", "-lm") - if "+flow" in self.spec: + if self.spec.satisfies("+flow"): env.set("GMTHOME", self.spec["gmt"].prefix) env.set("NETCDFDIR", self.spec["netcdf-c"].prefix) @@ -55,7 +55,7 @@ def build(self, spec, prefix): make() with working_dir("fstrack"): - if "+flow" in spec: + if spec.satisfies("+flow"): make("really_all") else: make() diff --git a/var/spack/repos/builtin/packages/fujitsu-fftw/package.py b/var/spack/repos/builtin/packages/fujitsu-fftw/package.py index f4f3619d2e6243..c647b94445e4e7 100644 --- a/var/spack/repos/builtin/packages/fujitsu-fftw/package.py +++ b/var/spack/repos/builtin/packages/fujitsu-fftw/package.py @@ -78,23 +78,23 @@ def configure(self, spec, prefix): "ac_cv_prog_f77_v=-###", ] - if "+shared" in spec: + if spec.satisfies("+shared"): options.append("--enable-shared") else: options.append("--disable-shared") - if "+openmp" in spec: + if spec.satisfies("+openmp"): options.append("--enable-openmp") options.append("OPENMP_CFLAGS=-Kopenmp") else: options.append("--disable-openmp") - if "+threads" in spec: + if spec.satisfies("+threads"): options.append("--enable-threads") else: options.append("--disable-threads") - if "+mpi" in spec: + if spec.satisfies("+mpi"): options.append("--enable-mpi") else: options.append("--disable-mpi") diff --git a/var/spack/repos/builtin/packages/fujitsu-ssl2/package.py b/var/spack/repos/builtin/packages/fujitsu-ssl2/package.py index 76682cc862d930..a12b8ca0e9b2e0 100644 --- a/var/spack/repos/builtin/packages/fujitsu-ssl2/package.py +++ b/var/spack/repos/builtin/packages/fujitsu-ssl2/package.py @@ -35,25 +35,25 @@ def blas_libs(self): spec = self.spec libslist = [] if spec.target == "a64fx": # Build with SVE support - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libfjlapackexsve.so") else: libslist.append("libfjlapacksve.so") else: - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libfjlapackex.so") else: libslist.append("libfjlapack.so") - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.extend(["libfjomphk.so", "libfjomp.so"]) if spec.target == "a64fx": # Build with SVE support - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libssl2mtexsve.a") libslist.append("libssl2mtsve.a") else: - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libssl2mtex.a") libslist.append("libssl2mt.a") @@ -81,7 +81,7 @@ def scalapack_libs(self): libslist = [] if spec.target == "a64fx": # Build with SVE support libslist.append("libfjscalapacksve.so") - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libfjlapackexsve.so") else: libslist.append("libfjlapacksve.so") @@ -89,7 +89,7 @@ def scalapack_libs(self): else: libslist.append("libfjscalapack.so") - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libfjlapackex.so") else: libslist.append("libfjlapack.so") @@ -97,15 +97,15 @@ def scalapack_libs(self): libslist.extend(["libmpi_usempi_ignore_tkr.so", "libmpi_mpifh.so"]) - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.extend(["libfjomphk.so", "libfjomp.so"]) if spec.target == "a64fx": # Build with SVE support - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libssl2mtexsve.a") libslist.append("libssl2mtsve.a") else: - if "+parallel" in spec: # parallel + if spec.satisfies("+parallel"): # parallel libslist.append("libssl2mtex.a") libslist.append("libssl2mt.a") diff --git a/var/spack/repos/builtin/packages/funhpc/package.py b/var/spack/repos/builtin/packages/funhpc/package.py index a11977116ce58b..776da697d84903 100644 --- a/var/spack/repos/builtin/packages/funhpc/package.py +++ b/var/spack/repos/builtin/packages/funhpc/package.py @@ -31,7 +31,7 @@ class Funhpc(CMakePackage): def cmake_args(self): spec = self.spec options = ["-DGTEST_ROOT=%s" % spec["googletest"].prefix] - if "+pic" in spec: + if spec.satisfies("+pic"): options += ["-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true"] return options diff --git a/var/spack/repos/builtin/packages/fxt/package.py b/var/spack/repos/builtin/packages/fxt/package.py index c80edd1c4dea11..f4e6a5846ba04a 100644 --- a/var/spack/repos/builtin/packages/fxt/package.py +++ b/var/spack/repos/builtin/packages/fxt/package.py @@ -48,7 +48,7 @@ class Fxt(AutotoolsPackage): def patch(self): # Increase the value of FXT_MAX_PARAMS (to allow longer task names) - if "+moreparams" in self.spec: + if self.spec.satisfies("+moreparams"): filter_file("#define FXT_MAX_PARAMS.*", "#define FXT_MAX_PARAMS 16", "tools/fxt.h") def autoreconf(self, spec, prefix): diff --git a/var/spack/repos/builtin/packages/gapbs/package.py b/var/spack/repos/builtin/packages/gapbs/package.py index 19dfa2bfa4cfcd..8fbde6cda968d4 100644 --- a/var/spack/repos/builtin/packages/gapbs/package.py +++ b/var/spack/repos/builtin/packages/gapbs/package.py @@ -32,7 +32,7 @@ class Gapbs(MakefilePackage): def build(self, spec, prefix): cxx_flags = ["-O3", self.compiler.cxx11_flag] - if "-serial" in spec: + if spec.satisfies("-serial"): cxx_flags.append(self.compiler.openmp_flag) make("CXX_FLAGS=" + " ".join(cxx_flags)) diff --git a/var/spack/repos/builtin/packages/gasnet/package.py b/var/spack/repos/builtin/packages/gasnet/package.py index 6267730ef128b1..a6100797123cce 100644 --- a/var/spack/repos/builtin/packages/gasnet/package.py +++ b/var/spack/repos/builtin/packages/gasnet/package.py @@ -163,22 +163,22 @@ def install(self, spec, prefix): if "conduits=none" not in spec: options = ["--prefix=%s" % prefix] - if "+debug" in spec: + if spec.satisfies("+debug"): options.append("--enable-debug") - if "+cuda" in spec: + if spec.satisfies("+cuda"): options.append("--enable-kind-cuda-uva") options.append("--with-cuda-home=" + spec["cuda"].prefix) - if "+rocm" in spec: + if spec.satisfies("+rocm"): options.append("--enable-kind-hip") options.append("--with-hip-home=" + spec["hip"].prefix) - if "+level_zero" in spec: + if spec.satisfies("+level_zero"): options.append("--enable-kind-ze") options.append("--with-ze-home=" + spec["oneapi-level-zero"].prefix) - if "conduits=mpi" in spec: + if spec.satisfies("conduits=mpi"): options.append("--enable-mpi-compat") else: options.append("--disable-mpi-compat") @@ -204,7 +204,7 @@ def install(self, spec, prefix): @run_after("install") @on_package_attributes(run_tests=True) def check_install(self): - if "conduits=smp" in self.spec: + if self.spec.satisfies("conduits=smp"): make("-C", "smp-conduit", "run-tests") self.test_testtools() @@ -219,7 +219,7 @@ def _setup_test_env(self): def test_testtools(self): """run testtools and check output""" - if "conduits=none" in self.spec: + if self.spec.satisfies("conduits=none"): raise SkipTest("Test requires conduit libraries") testtools_path = join_path(self.prefix.tests, "testtools") @@ -232,7 +232,7 @@ def test_testtools(self): def test_testgasnet(self): """run testgasnet and check output""" - if "conduits=none" in self.spec: + if self.spec.satisfies("conduits=none"): raise SkipTest("Test requires conduit libraries") self._setup_test_env() diff --git a/var/spack/repos/builtin/packages/gate/package.py b/var/spack/repos/builtin/packages/gate/package.py index 89fdeb74e793b8..72060b61277807 100644 --- a/var/spack/repos/builtin/packages/gate/package.py +++ b/var/spack/repos/builtin/packages/gate/package.py @@ -55,7 +55,7 @@ class Gate(CMakePackage): def cmake_args(self): args = [] - if "+rtk" in self.spec: + if self.spec.satisfies("+rtk"): args.extend(["-DGATE_USE_ITK=ON", "-DGATE_USE_RTK=ON"]) else: args.extend(["-DGATE_USE_ITK=OFF", "-DGATE_USE_RTK=OFF"]) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index ba0379bf37e3f9..eca0fdb71443f2 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -593,7 +593,7 @@ def cc(self): if self.spec.external: return self.spec.extra_attributes["compilers"].get("c", None) result = None - if "languages=c" in self.spec: + if self.spec.satisfies("languages=c"): result = str(self.spec.prefix.bin.gcc) return result @@ -604,7 +604,7 @@ def cxx(self): if self.spec.external: return self.spec.extra_attributes["compilers"].get("cxx", None) result = None - if "languages=c++" in self.spec: + if self.spec.satisfies("languages=c++"): result = os.path.join(self.spec.prefix.bin, "g++") return result @@ -615,7 +615,7 @@ def fortran(self): if self.spec.external: return self.spec.extra_attributes["compilers"].get("fortran", None) result = None - if "languages=fortran" in self.spec: + if self.spec.satisfies("languages=fortran"): result = str(self.spec.prefix.bin.gfortran) return result @@ -711,7 +711,7 @@ def build_optimization_config(self): if "+bootstrap %gcc" in self.spec and self.spec.target.family != "aarch64": flags += " " + self.get_common_target_flags(self.spec) - if "+bootstrap" in self.spec: + if self.spec.satisfies("+bootstrap"): variables = ["BOOT_CFLAGS", "CFLAGS_FOR_TARGET", "CXXFLAGS_FOR_TARGET"] else: variables = ["CFLAGS", "CXXFLAGS"] @@ -752,12 +752,12 @@ def configure_args(self): if self.version >= Version("6"): options.append("--with-system-zlib") - if "zstd" in spec: + if spec.satisfies("^zstd"): options.append("--with-zstd-include={0}".format(spec["zstd"].headers.directories[0])) options.append("--with-zstd-lib={0}".format(spec["zstd"].libs.directories[0])) # Enabling language "jit" requires --enable-host-shared. - if "languages=jit" in spec: + if spec.satisfies("languages=jit"): options.append("--enable-host-shared") # Binutils @@ -832,7 +832,7 @@ def configure_args(self): options.append("--with-boot-ldflags=" + boot_ldflags) options.append("--with-build-config=spack") - if "languages=d" in spec: + if spec.satisfies("languages=d"): # Phobos is the standard library for the D Programming Language. The documentation says # that on some targets, 'libphobos' is not enabled by default, but compiles and works # if '--enable-libphobos' is used. Specifics are documented for affected targets. @@ -919,13 +919,13 @@ def nvptx_install(self): @property def build_targets(self): - if "+profiled" in self.spec: + if self.spec.satisfies("+profiled"): return ["profiledbootstrap"] return [] @property def install_targets(self): - if "+strip" in self.spec: + if self.spec.satisfies("+strip"): return ["install-strip"] return ["install"] diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index 386ea879544964..5b4eb19fb38a99 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -506,7 +506,7 @@ def determine_version(cls, exe): return Executable(exe)("--version", output=str, error=str).rstrip() def setup_run_environment(self, env): - if "+java" in self.spec: + if self.spec.satisfies("+java"): class_paths = find(self.prefix, "*.jar") classpath = os.pathsep.join(class_paths) env.prepend_path("CLASSPATH", classpath) @@ -523,7 +523,7 @@ def setup_run_environment(self, env): env.prepend_path("LD_LIBRARY_PATH", ":".join(libs)) def patch(self): - if "+java platform=darwin" in self.spec: + if self.spec.satisfies("+java platform=darwin"): filter_file("linux", "darwin", "swig/java/java.opt", string=True) filter_file("-lazy-ljvm", "-ljvm", "configure", string=True) @@ -751,7 +751,7 @@ def configure_args(self): self.with_or_without("perl"), self.with_or_without("php"), ] - if "+iconv" in self.spec: + if self.spec.satisfies("+iconv"): if self.spec["iconv"].name == "libiconv": args.append(f"--with-libiconv-prefix={self.spec['iconv'].prefix}") else: @@ -787,7 +787,7 @@ def configure_args(self): else: args.append(self.with_or_without("dwgdirect", variant="teigha", package="teigha")) - if "+hdf4" in self.spec: + if self.spec.satisfies("+hdf4"): hdf4 = self.spec["hdf"] if "+external-xdr" in hdf4 and hdf4["rpc"].name == "libtirpc": args.append("LIBS=" + hdf4["rpc"].libs.link_flags) @@ -800,19 +800,19 @@ def configure_args(self): def build(self, pkg, spec, prefix): # https://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix make() - if "+java" in spec: + if spec.satisfies("+java"): with working_dir("swig/java"): make() def check(self): # no top-level test target - if "+java" in self.spec: + if self.spec.satisfies("+java"): with working_dir("swig/java"): make("test") def install(self, pkg, spec, prefix): make("install") - if "+java" in spec: + if spec.satisfies("+java"): with working_dir("swig/java"): make("install") install("*.jar", prefix) diff --git a/var/spack/repos/builtin/packages/gdb/package.py b/var/spack/repos/builtin/packages/gdb/package.py index 6367736ba96307..c54a0f25c3a6f1 100644 --- a/var/spack/repos/builtin/packages/gdb/package.py +++ b/var/spack/repos/builtin/packages/gdb/package.py @@ -117,7 +117,7 @@ def configure_args(self): if self.spec.version >= Version("11.1"): args.append("--with-gmp={}".format(self.spec["gmp"].prefix)) - if "+python" in self.spec: + if self.spec.satisfies("+python"): args.append("--with-python={}".format(self.spec["python"].command)) args.append("LDFLAGS={}".format(self.spec["python"].libs.ld_flags)) @@ -125,7 +125,7 @@ def configure_args(self): @run_after("install") def gdbinit(self): - if "+python" in self.spec: + if self.spec.satisfies("+python"): tool = self.spec["python"].command.path + "-gdb.py" if os.path.exists(tool): mkdir(self.prefix.etc) diff --git a/var/spack/repos/builtin/packages/gdk-pixbuf/package.py b/var/spack/repos/builtin/packages/gdk-pixbuf/package.py index 1dfe19f152164e..c86333395895ff 100644 --- a/var/spack/repos/builtin/packages/gdk-pixbuf/package.py +++ b/var/spack/repos/builtin/packages/gdk-pixbuf/package.py @@ -100,7 +100,7 @@ def install(self, spec, prefix): meson_args += ["-Dtests={0}".format(self.run_tests)] # Based on suggestion by luigi-calori and the fixup shown by lee218llnl: # https://github.com/spack/spack/pull/27254#issuecomment-974464174 - if "+x11" in spec: + if spec.satisfies("+x11"): if self.version >= Version("2.42"): raise InstallError("+x11 is not valid for {0}".format(self.version)) meson_args += ["-Dx11=true"] diff --git a/var/spack/repos/builtin/packages/gdl/package.py b/var/spack/repos/builtin/packages/gdl/package.py index fb95e6f63e0d92..79804fce3c0d3e 100644 --- a/var/spack/repos/builtin/packages/gdl/package.py +++ b/var/spack/repos/builtin/packages/gdl/package.py @@ -87,42 +87,42 @@ def cmake_args(self): # only version 6 of ImageMagick is supported (version 7 is packaged) args += ["-DMAGICK=OFF"] - if "+graphicsmagick" in self.spec: + if self.spec.satisfies("+graphicsmagick"): args += ["-DGRAPHICSMAGICK=ON"] else: args += ["-DGRAPHICSMAGICK=OFF"] - if "+hdf4" in self.spec: + if self.spec.satisfies("+hdf4"): args += ["-DHDF=ON"] else: args += ["-DHDF=OFF"] - if "+hdf5" in self.spec: + if self.spec.satisfies("+hdf5"): args += ["-DHDF5=ON"] else: args += ["-DHDF5=OFF"] - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): args += ["-DOPENMP=ON"] else: args += ["-DOPENMP=OFF"] - if "+proj" in self.spec: + if self.spec.satisfies("+proj"): args += ["-DLIBPROJ4=ON", "-DLIBPROJ4DIR={0}".format(self.spec["proj"].prefix)] else: args += ["-DLIBPROJ4=OFF"] - if "+python" in self.spec: + if self.spec.satisfies("+python"): args += ["-DPYTHON_MODULE=ON"] else: args += ["-DPYTHON_MODULE=OFF"] - if "+wx" in self.spec: + if self.spec.satisfies("+wx"): args += ["-DWXWIDGETS=ON"] else: args += ["-DWXWIDGETS=OFF"] - if "+x11" in self.spec: + if self.spec.satisfies("+x11"): args += ["-DX11=ON"] else: args += ["-DX11=OFF"] @@ -131,7 +131,7 @@ def cmake_args(self): @run_after("install") def post_install(self): - if "+python" in self.spec: + if self.spec.satisfies("+python"): # gdl installs the python module into prefix/lib/site-python # move it to the standard location src = os.path.join(self.spec.prefix.lib, "site-python") diff --git a/var/spack/repos/builtin/packages/geant3/package.py b/var/spack/repos/builtin/packages/geant3/package.py index 966f9fd58692e7..5f0ede0e58db9a 100644 --- a/var/spack/repos/builtin/packages/geant3/package.py +++ b/var/spack/repos/builtin/packages/geant3/package.py @@ -43,5 +43,5 @@ def cmake_args(self): return args def setup_build_environment(self, env): - if "platform=darwin" in self.spec: + if self.spec.satisfies("platform=darwin"): env.unset("MACOSX_DEPLOYMENT_TARGET") diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py index 2de7ab7b861665..3a65b8c40c6b05 100644 --- a/var/spack/repos/builtin/packages/geant4/package.py +++ b/var/spack/repos/builtin/packages/geant4/package.py @@ -282,7 +282,7 @@ def cmake_args(self): options.append(self.define_from_variant("GEANT4_BUILD_MULTITHREADED", "threads")) options.append(self.define_from_variant("GEANT4_USE_TBB", "tbb")) - if "+threads" in spec: + if spec.satisfies("+threads"): # Locked at global-dynamic to allow use cases that load the # geant4 libs at application runtime options.append(self.define("GEANT4_BUILD_TLS_MODEL", "global-dynamic")) @@ -297,22 +297,22 @@ def cmake_args(self): options.append(self.define("GEANT4_INSTALL_DATADIR", self.datadir)) # Vecgeom - if "+vecgeom" in spec: + if spec.satisfies("+vecgeom"): options.append(self.define("GEANT4_USE_USOLIDS", True)) options.append(self.define("USolids_DIR", spec["vecgeom"].prefix.lib.CMake.USolids)) # Visualization options if "platform=darwin" not in spec: - if "+x11 +opengl" in spec: + if spec.satisfies("+x11 +opengl"): options.append(self.define("GEANT4_USE_OPENGL_X11", True)) - if "+motif +opengl" in spec: + if spec.satisfies("+motif +opengl"): options.append(self.define("GEANT4_USE_XM", True)) - if "+x11" in spec: + if spec.satisfies("+x11"): options.append(self.define("GEANT4_USE_RAYTRACER_X11", True)) - if "+qt" in spec: + if spec.satisfies("+qt"): options.append(self.define("GEANT4_USE_QT", True)) - if "^[virtuals=qmake] qt-base" in spec: + if spec.satisfies("^[virtuals=qmake] qt-base"): options.append(self.define("GEANT4_USE_QT_QT6", True)) options.append(self.define("QT_QMAKE_EXECUTABLE", spec["qmake"].prefix.bin.qmake)) diff --git a/var/spack/repos/builtin/packages/genesis/package.py b/var/spack/repos/builtin/packages/genesis/package.py index d12d5c900663bc..61ccc3dfe37644 100644 --- a/var/spack/repos/builtin/packages/genesis/package.py +++ b/var/spack/repos/builtin/packages/genesis/package.py @@ -84,7 +84,7 @@ def configure_args(self): options.extend(self.enable_or_disable("openmp")) options.extend(self.enable_or_disable("single")) options.extend(self.enable_or_disable("hmdisk")) - if "+cuda" in spec: + if spec.satisfies("+cuda"): options.append("--enable-gpu") options.append("--with-cuda=%s" % spec["cuda"].prefix) else: @@ -99,7 +99,7 @@ def setup_build_environment(self, env): env.set("CC", self.spec["mpi"].mpicc, force=True) env.set("CXX", self.spec["mpi"].mpicxx, force=True) env.set("LAPACK_LIBS", self.spec["lapack"].libs.ld_flags) - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): cuda_arch = self.spec.variants["cuda_arch"].value cuda_gencode = " ".join(self.cuda_flags(cuda_arch)) env.set("NVCCFLAGS", cuda_gencode) diff --git a/var/spack/repos/builtin/packages/genie/package.py b/var/spack/repos/builtin/packages/genie/package.py index a962862707ee0a..451e52393de3c8 100644 --- a/var/spack/repos/builtin/packages/genie/package.py +++ b/var/spack/repos/builtin/packages/genie/package.py @@ -132,17 +132,17 @@ def _configure_args(self, spec, prefix): "--with-lhapdf6-inc=" + spec["lhapdf"].prefix.include, "--with-lhapdf6-lib=" + spec["lhapdf"].prefix.lib, ] - if "+vleextension" in self.spec: + if self.spec.satisfies("+vleextension"): args += ["--enable-vle-extension"] - if "+t2k" in self.spec: + if self.spec.satisfies("+t2k"): args += ["--enable-t2k"] - if "+fnal" in self.spec: + if self.spec.satisfies("+fnal"): args += ["--enable-fnal"] - if "+atmo" in self.spec: + if self.spec.satisfies("+atmo"): args += ["--enable-atmo"] - if "+nucleondecay" in self.spec: + if self.spec.satisfies("+nucleondecay"): args += ["--enable-nucleon-decay"] - if "+masterclass" in self.spec: + if self.spec.satisfies("+masterclass"): args += ["--enable-masterclass"] return args diff --git a/var/spack/repos/builtin/packages/genomeworks/package.py b/var/spack/repos/builtin/packages/genomeworks/package.py index 5c8263440d64df..4128923dbc1021 100644 --- a/var/spack/repos/builtin/packages/genomeworks/package.py +++ b/var/spack/repos/builtin/packages/genomeworks/package.py @@ -59,7 +59,7 @@ class Genomeworks(CMakePackage, CudaPackage): def cmake_args(self): args = [] spec = self.spec - if "+cuda" in spec: + if spec.satisfies("+cuda"): args.append("-DWITH_CUDA=ON") args.append("-Dgw_cuda_gen_all_arch=ON") args.append("-DTHRUST_IGNORE_CUB_VERSION_CHECK=ON") diff --git a/var/spack/repos/builtin/packages/geopm-runtime/package.py b/var/spack/repos/builtin/packages/geopm-runtime/package.py index 974daed7d04737..bae53f8f407e98 100644 --- a/var/spack/repos/builtin/packages/geopm-runtime/package.py +++ b/var/spack/repos/builtin/packages/geopm-runtime/package.py @@ -113,7 +113,7 @@ def configure_directory(self): @property def install_targets(self): target = ["install"] - if "+checkprogs" in self.spec: + if self.spec.satisfies("+checkprogs"): target += ["checkprogs"] return target @@ -161,7 +161,7 @@ def setup_run_environment(self, env): lib_dir = self.prefix.lib env.prepend_path("LD_LIBRARY_PATH", lib_dir) - if "+checkprogs" in self.spec: + if self.spec.satisfies("+checkprogs"): env.set("GEOPM_SOURCE", self.stage.source_path) env.prepend_path("PYTHONPATH", self.stage.source_path) env.set("GEOPM_INSTALL", self.prefix) diff --git a/var/spack/repos/builtin/packages/geopm-service/package.py b/var/spack/repos/builtin/packages/geopm-service/package.py index 54aa00e6b14494..557f6371825fe4 100644 --- a/var/spack/repos/builtin/packages/geopm-service/package.py +++ b/var/spack/repos/builtin/packages/geopm-service/package.py @@ -141,7 +141,7 @@ def configure_args(self): args += self.enable_or_disable("levelzero") args += self.enable_or_disable("nvml") - if "+nvml" in self.spec: + if self.spec.satisfies("+nvml"): args += [ "--with-nvml=" + join_path( diff --git a/var/spack/repos/builtin/packages/geos/package.py b/var/spack/repos/builtin/packages/geos/package.py index d84f45d3c2798d..42b95f00950c74 100644 --- a/var/spack/repos/builtin/packages/geos/package.py +++ b/var/spack/repos/builtin/packages/geos/package.py @@ -89,7 +89,7 @@ def cmake_args(self): args = [] # https://github.com/libgeos/geos/issues/460 - if "%intel" in self.spec: + if self.spec.satisfies("%intel"): args.append(self.define("BUILD_ASTYLE", False)) args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) diff --git a/var/spack/repos/builtin/packages/gettext/package.py b/var/spack/repos/builtin/packages/gettext/package.py index c6c8da89a89586..04a0ad7b39fe69 100644 --- a/var/spack/repos/builtin/packages/gettext/package.py +++ b/var/spack/repos/builtin/packages/gettext/package.py @@ -125,12 +125,12 @@ def configure_args(self): else: config_args.append("--without-libiconv-prefix") - if "+curses" in spec: + if spec.satisfies("+curses"): config_args.append("--with-ncurses-prefix={0}".format(spec["ncurses"].prefix)) else: config_args.append("--disable-curses") - if "+libxml2" in spec: + if spec.satisfies("+libxml2"): config_args.append("--with-libxml2-prefix={0}".format(spec["libxml2"].prefix)) else: config_args.append("--with-included-libxml") @@ -141,7 +141,7 @@ def configure_args(self): if "+xz" not in spec: config_args.append("--without-xz") - if "+libunistring" in spec: + if spec.satisfies("+libunistring"): config_args.append( "--with-libunistring-prefix={0}".format(spec["libunistring"].prefix) ) diff --git a/var/spack/repos/builtin/packages/gimp/package.py b/var/spack/repos/builtin/packages/gimp/package.py index d3c01af6697efb..a9f1189890c62f 100644 --- a/var/spack/repos/builtin/packages/gimp/package.py +++ b/var/spack/repos/builtin/packages/gimp/package.py @@ -100,7 +100,7 @@ def configure_args(self): "GIO_USE_TLS=gnutls", "GIO_EXTRA_MODULES={0}/lib/gio/modules".format(self.spec["glib-networking"].prefix), ] - if "+libxpm" in self.spec: + if self.spec.satisfies("+libxpm"): args.append("--with-libxpm={0}".format(self.spec["libxpm"].prefix)) return args diff --git a/var/spack/repos/builtin/packages/ginkgo/package.py b/var/spack/repos/builtin/packages/ginkgo/package.py index b4638d9666f1b4..dd5dc4b557db94 100644 --- a/var/spack/repos/builtin/packages/ginkgo/package.py +++ b/var/spack/repos/builtin/packages/ginkgo/package.py @@ -129,7 +129,7 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage): def setup_build_environment(self, env): spec = self.spec - if "+sycl" in spec: + if spec.satisfies("+sycl"): env.set("MKLROOT", join_path(spec["intel-oneapi-mkl"].prefix, "mkl", "latest")) env.set("DPL_ROOT", join_path(spec["intel-oneapi-dpl"].prefix, "dpl", "latest")) # The `IntelSYCLConfig.cmake` is broken with spack. By default, it @@ -189,13 +189,13 @@ def cmake_args(self): if self.run_tests: args.append("-DGINKGO_USE_EXTERNAL_GTEST=ON") - if "+cuda" in spec: + if spec.satisfies("+cuda"): archs = spec.variants["cuda_arch"].value if archs != "none": arch_str = ";".join(archs) args.append("-DGINKGO_CUDA_ARCHITECTURES={0}".format(arch_str)) - if "+rocm" in spec: + if spec.satisfies("+rocm"): args.append("-DHIP_PATH={0}".format(spec["hip"].prefix)) args.append("-DHIP_CLANG_PATH={0}/bin".format(spec["llvm-amdgpu"].prefix)) args.append("-DHIP_CLANG_INCLUDE_PATH={0}/include".format(spec["llvm-amdgpu"].prefix)) @@ -213,7 +213,7 @@ def cmake_args(self): self.define("CMAKE_MODULE_PATH", self.spec["hip"].prefix.lib.cmake.hip) ) - if "+sycl" in self.spec: + if self.spec.satisfies("+sycl"): sycl_compatible_compilers = ["icpx"] if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): raise InstallError("ginkgo +sycl requires icpx compiler.") @@ -243,7 +243,7 @@ def _build_and_run_test(self, script): ] # Fix: For HIP tests, add the ARCH compilation flags when not present - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): src_path = join_path(src_dir, "CMakeLists.txt") cmakelists = open(src_path, "rt") data = cmakelists.read() diff --git a/var/spack/repos/builtin/packages/git-annex/package.py b/var/spack/repos/builtin/packages/git-annex/package.py index 62df61d23e0fb0..2cecdfce1bfb31 100644 --- a/var/spack/repos/builtin/packages/git-annex/package.py +++ b/var/spack/repos/builtin/packages/git-annex/package.py @@ -124,7 +124,7 @@ def determine_version(cls, exe): def install(self, spec, prefix): install_tree(".", prefix.bin) - if "~standalone" in spec: + if spec.satisfies("~standalone"): # use git provided by spack instead of the one in the package git_files = ["git", "git-receive-pack", "git-shell", "git-upload-pack"] for i in git_files: diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py index bc4803a6b20be5..02c6aa7cd3c376 100644 --- a/var/spack/repos/builtin/packages/git/package.py +++ b/var/spack/repos/builtin/packages/git/package.py @@ -185,7 +185,7 @@ def setup_build_environment(self, env): # In that case the node in the DAG gets truncated and git DOES NOT # have a gettext dependency. spec = self.spec - if "+nls" in spec: + if spec.satisfies("+nls"): if "intl" in spec["gettext"].libs.names: extlib_bits = [] if not is_system_path(spec["gettext"].prefix): @@ -200,7 +200,7 @@ def setup_build_environment(self, env): # For build step: env.append_flags("EXTLIBS", curlconfig("--static-libs", output=str).strip()) - if "~perl" in self.spec: + if self.spec.satisfies("~perl"): env.append_flags("NO_PERL", "1") def configure_args(self): @@ -216,14 +216,14 @@ def configure_args(self): if self.spec["iconv"].name == "libiconv": configure_args.append(f"--with-iconv={self.spec['iconv'].prefix}") - if "+perl" in self.spec: + if self.spec.satisfies("+perl"): configure_args.append("--with-perl={0}".format(spec["perl"].command.path)) - if "^pcre" in self.spec: + if self.spec.satisfies("^pcre"): configure_args.append("--with-libpcre={0}".format(spec["pcre"].prefix)) - if "^pcre2" in self.spec: + if self.spec.satisfies("^pcre2"): configure_args.append("--with-libpcre2={0}".format(spec["pcre2"].prefix)) - if "+tcltk" in self.spec: + if self.spec.satisfies("+tcltk"): configure_args.append("--with-tcltk={0}".format(self.spec["tk"].prefix.bin.wish)) else: configure_args.append("--without-tcltk") @@ -241,7 +241,7 @@ def check(self): def build(self, spec, prefix): args = [] - if "~nls" in self.spec: + if self.spec.satisfies("~nls"): args.append("NO_GETTEXT=1") make(*args) @@ -251,7 +251,7 @@ def build(self, spec, prefix): def install(self, spec, prefix): args = ["install"] - if "~nls" in self.spec: + if self.spec.satisfies("~nls"): args.append("NO_GETTEXT=1") make(*args) @@ -267,7 +267,7 @@ def install_completions(self): @run_after("install") def install_manpages(self): - if "~man" in self.spec: + if self.spec.satisfies("~man"): return prefix = self.prefix @@ -279,7 +279,7 @@ def install_manpages(self): @run_after("install") def install_subtree(self): - if "+subtree" in self.spec: + if self.spec.satisfies("+subtree"): with working_dir("contrib/subtree"): make_args = ["V=1", "prefix={}".format(self.prefix.bin)] make(" ".join(make_args)) @@ -292,7 +292,7 @@ def setup_run_environment(self, env): # Libs from perl-alien-svn and apr-util are required in # LD_LIBRARY_PATH # TODO: extend to other platforms - if "+svn platform=linux" in self.spec: + if self.spec.satisfies("+svn platform=linux"): perl_svn = self.spec["perl-alien-svn"] env.prepend_path( "LD_LIBRARY_PATH", diff --git a/var/spack/repos/builtin/packages/gl2ps/package.py b/var/spack/repos/builtin/packages/gl2ps/package.py index af24489a976a9e..6826fd4fb00721 100644 --- a/var/spack/repos/builtin/packages/gl2ps/package.py +++ b/var/spack/repos/builtin/packages/gl2ps/package.py @@ -63,7 +63,7 @@ def cmake_args(self): if spec.satisfies("platform=windows"): options.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) - if "~doc" in spec: + if spec.satisfies("~doc"): # Make sure we don't look. options.append(self.define("CMAKE_DISABLE_FIND_PACKAGE_LATEX", True)) diff --git a/var/spack/repos/builtin/packages/glib/package.py b/var/spack/repos/builtin/packages/glib/package.py index 43367172b48c9d..efdcfa90c13407 100644 --- a/var/spack/repos/builtin/packages/glib/package.py +++ b/var/spack/repos/builtin/packages/glib/package.py @@ -292,20 +292,20 @@ class MesonBuilder(BaseBuilder, spack.build_systems.meson.MesonBuilder): def meson_args(self): args = [] if self.spec.satisfies("@2.63.5:"): - if "+libmount" in self.spec: + if self.spec.satisfies("+libmount"): args.append("-Dlibmount=enabled") else: args.append("-Dlibmount=disabled") else: - if "+libmount" in self.spec: + if self.spec.satisfies("+libmount"): args.append("-Dlibmount=true") else: args.append("-Dlibmount=false") - if "tracing=dtrace" in self.spec: + if self.spec.satisfies("tracing=dtrace"): args.append("-Ddtrace=true") else: args.append("-Ddtrace=false") - if "tracing=systemtap" in self.spec: + if self.spec.satisfies("tracing=systemtap"): args.append("-Dsystemtap=true") else: args.append("-Dsystemtap=false") @@ -333,7 +333,7 @@ def meson_args(self): class AutotoolsBuilder(BaseBuilder, spack.build_systems.autotools.AutotoolsBuilder): def configure_args(self): args = [] - if "+libmount" in self.spec: + if self.spec.satisfies("+libmount"): args.append("--enable-libmount") else: args.append("--disable-libmount") @@ -352,7 +352,7 @@ def configure_args(self): else: args.append("--disable-" + value) else: - if "tracing=dtrace" in self.spec or "tracing=systemtap" in self.spec: + if self.spec.satisfies("tracing=dtrace") or self.spec.satisfies("tracing=systemtap"): args.append("--enable-tracing") else: args.append("--disable-tracing") diff --git a/var/spack/repos/builtin/packages/globalarrays/package.py b/var/spack/repos/builtin/packages/globalarrays/package.py index 82ad9080f602a1..bf7844924c70f8 100644 --- a/var/spack/repos/builtin/packages/globalarrays/package.py +++ b/var/spack/repos/builtin/packages/globalarrays/package.py @@ -75,7 +75,7 @@ def configure_args(self): "--with-lapack={0}".format(lapack_libs), ] - if "+scalapack" in self.spec: + if self.spec.satisfies("+scalapack"): scalapack_libs = self.spec["scalapack"].libs.ld_flags args.append("--with-scalapack={0}".format(scalapack_libs)) diff --git a/var/spack/repos/builtin/packages/glpk/package.py b/var/spack/repos/builtin/packages/glpk/package.py index 0c93cdcd7ecd44..ea7a1047932236 100644 --- a/var/spack/repos/builtin/packages/glpk/package.py +++ b/var/spack/repos/builtin/packages/glpk/package.py @@ -33,7 +33,7 @@ class Glpk(AutotoolsPackage, GNUMirrorPackage): def configure_args(self): options = [] - if "+gmp" in self.spec: + if self.spec.satisfies("+gmp"): options.append("--with-gmp") return options diff --git a/var/spack/repos/builtin/packages/gmp/package.py b/var/spack/repos/builtin/packages/gmp/package.py index dd87a3d2175366..df7a05e381ca54 100644 --- a/var/spack/repos/builtin/packages/gmp/package.py +++ b/var/spack/repos/builtin/packages/gmp/package.py @@ -65,6 +65,6 @@ def flag_handler(self, name, flags): def configure_args(self): args = self.enable_or_disable("cxx") args += self.enable_or_disable("libs") - if "libs=static" in self.spec: + if self.spec.satisfies("libs=static"): args.append("--with-pic") return args diff --git a/var/spack/repos/builtin/packages/gmt/package.py b/var/spack/repos/builtin/packages/gmt/package.py index 6d207642eee753..be2b4ec5c74a8f 100644 --- a/var/spack/repos/builtin/packages/gmt/package.py +++ b/var/spack/repos/builtin/packages/gmt/package.py @@ -130,16 +130,16 @@ def cmake_args(self): self.define("DCW_PATH", "dcw"), ] - if "+ghostscript" in spec: + if spec.satisfies("+ghostscript"): args.append(self.define("GS", spec["ghostscript"].prefix.bin.gs)) - if "+geos" in spec: + if spec.satisfies("+geos"): args.append(self.define("GEOS_CONFIG", spec["geos"].prefix.bin.join("geos-config"))) - if "+pcre" in spec: + if spec.satisfies("+pcre"): args.append(self.define("PCRE2_CONFIG", spec["pcre2"].prefix.bin.join("pcre2-config"))) - if "+fftw" in spec: + if spec.satisfies("+fftw"): args.extend( [ self.define("FFTW3_INCLUDE_DIR", spec["fftw"].headers.directories[0]), @@ -147,7 +147,7 @@ def cmake_args(self): ] ) - if "+glib" in spec: + if spec.satisfies("+glib"): args.extend( [ self.define("GLIB_INCLUDE_DIR", spec["glib"].headers.directories[0]), @@ -155,7 +155,7 @@ def cmake_args(self): ] ) - if "graphicsmagick" in spec: + if spec.satisfies("graphicsmagick"): args.extend( [ self.define("GM", spec["graphicsmagick"].prefix.bin.gm), @@ -163,7 +163,7 @@ def cmake_args(self): ] ) - if "+ffmpeg" in spec: + if spec.satisfies("+ffmpeg"): args.append(self.define("FFMPEG", spec["ffmpeg"].prefix.bin.ffmpeg)) return args diff --git a/var/spack/repos/builtin/packages/gnina/package.py b/var/spack/repos/builtin/packages/gnina/package.py index 38d91e32c85718..f9d1dded275bf7 100644 --- a/var/spack/repos/builtin/packages/gnina/package.py +++ b/var/spack/repos/builtin/packages/gnina/package.py @@ -74,7 +74,7 @@ class Gnina(CMakePackage, CudaPackage): def cmake_args(self): args = ["-DBLAS=Open"] # Use OpenBLAS instead of Atlas' BLAS - if "+gninavis" in self.spec: + if self.spec.satisfies("+gninavis"): args.append(f"-DRDKIT_INCLUDE_DIR={self.spec['rdkit'].prefix.include.rdkit}") return args diff --git a/var/spack/repos/builtin/packages/gnuplot/package.py b/var/spack/repos/builtin/packages/gnuplot/package.py index 0f69b3c654e9a3..fc5f19f1ecc63c 100644 --- a/var/spack/repos/builtin/packages/gnuplot/package.py +++ b/var/spack/repos/builtin/packages/gnuplot/package.py @@ -91,12 +91,12 @@ def configure_args(self): options += self.with_or_without("readline", "prefix") - if "+pbm" in spec: + if spec.satisfies("+pbm"): options.append("--with-bitmap-terminals") else: options.append("--without-bitmap-terminals") - if "+X" in spec: + if spec.satisfies("+X"): # It seems there's an open bug for wxWidgets support # See : http://sourceforge.net/p/gnuplot/bugs/1694/ os.environ["TERMLIBS"] = "-lX11" @@ -104,7 +104,7 @@ def configure_args(self): else: options.append("--without-x") - if "+qt" in spec: + if spec.satisfies("+qt"): options.append("--with-qt=qt5") # QT needs C++11 compiler: os.environ["CXXFLAGS"] = "{0}".format(self.compiler.cxx11_flag) @@ -134,22 +134,22 @@ def configure_args(self): else: options.append("--with-qt=no") - if "+wx" in spec: + if spec.satisfies("+wx"): options.append("--with-wx=%s" % spec["wxwidgets"].prefix) else: options.append("--disable-wxwidgets") - if "+gd" in spec: + if spec.satisfies("+gd"): options.append("--with-gd=%s" % spec["libgd"].prefix) else: options.append("--without-gd") - if "+cairo" in spec: + if spec.satisfies("+cairo"): options.append("--with-cairo") else: options.append("--without-cairo") - if "+libcerf" in spec: + if spec.satisfies("+libcerf"): options.append("--with-libcerf") else: options.append("--without-libcerf") diff --git a/var/spack/repos/builtin/packages/gnutls/package.py b/var/spack/repos/builtin/packages/gnutls/package.py index 71db94256c71d2..f405a8ecf04997 100644 --- a/var/spack/repos/builtin/packages/gnutls/package.py +++ b/var/spack/repos/builtin/packages/gnutls/package.py @@ -66,7 +66,7 @@ def url_for_version(self, version): def setup_build_environment(self, env): spec = self.spec - if "+guile" in spec: + if spec.satisfies("+guile"): env.set("GUILE", spec["guile"].prefix.bin.guile) def configure_args(self): @@ -79,12 +79,12 @@ def configure_args(self): args.append("--with-included-unistring") args.append("--without-p11-kit") # p11-kit@0.23.1: ... - if "+zlib" in spec: + if spec.satisfies("+zlib"): args.append("--with-zlib") else: args.append("--without-zlib") - if "+guile" in spec: + if spec.satisfies("+guile"): args.append("--enable-guile") else: args.append("--disable-guile") diff --git a/var/spack/repos/builtin/packages/googletest/package.py b/var/spack/repos/builtin/packages/googletest/package.py index 47b6b6d2d1f945..d471cbe2f6c12d 100644 --- a/var/spack/repos/builtin/packages/googletest/package.py +++ b/var/spack/repos/builtin/packages/googletest/package.py @@ -66,7 +66,7 @@ def install(self, spec, prefix): install_tree(join_path(self.stage.source_path, "include"), prefix.include) mkdirp(prefix.lib) - if "+shared" in spec: + if spec.satisfies("+shared"): install("libgtest.{0}".format(dso_suffix), prefix.lib) install("libgtest_main.{0}".format(dso_suffix), prefix.lib) else: diff --git a/var/spack/repos/builtin/packages/gosam-contrib/package.py b/var/spack/repos/builtin/packages/gosam-contrib/package.py index fe6accd3816318..9c49e53458f9c4 100644 --- a/var/spack/repos/builtin/packages/gosam-contrib/package.py +++ b/var/spack/repos/builtin/packages/gosam-contrib/package.py @@ -39,14 +39,14 @@ def patch(self): def flag_handler(self, name, flags): if name in ["cflags", "cxxflags", "cppflags"]: - if "+pic" in self.spec: + if self.spec.satisfies("+pic"): flags.append(self.compiler.cc_pic_flag) if name == "fflags": if "gfortran" in self.compiler.fc: flags.append("-std=legacy") - if "+pic" in self.spec: + if self.spec.satisfies("+pic"): flags.append(self.compiler.fc_pic_flag) return (None, flags, None) diff --git a/var/spack/repos/builtin/packages/gpi-2/package.py b/var/spack/repos/builtin/packages/gpi-2/package.py index b4bb3fbe0389dd..70ca28ff4340ca 100644 --- a/var/spack/repos/builtin/packages/gpi-2/package.py +++ b/var/spack/repos/builtin/packages/gpi-2/package.py @@ -105,17 +105,17 @@ def old_install(self, spec, prefix): self.set_specific_cflags(spec) config_args = ["-p {0}".format(prefix)] - if "fabrics=ethernet" in spec: + if spec.satisfies("fabrics=ethernet"): config_args += ["--with-ethernet"] - elif "fabrics=infiniband" in spec: + elif spec.satisfies("fabrics=infiniband"): config_args += ["--with-infiniband={0}".format(spec["rdma-core"].prefix)] - if "schedulers=loadleveler" in spec: + if spec.satisfies("schedulers=loadleveler"): config_args += ["--with-ll"] - if "+fortran" in spec: + if spec.satisfies("+fortran"): config_args += ["--with-fortran=true"] else: config_args += ["--with-fortran=false"] - if "+mpi" in spec: + if spec.satisfies("+mpi"): config_args += ["--with-mpi={0}".format(spec["mpi"].prefix)] with working_dir(self.build_directory): @@ -147,7 +147,7 @@ def configure_args(self): config_args.extend(self.with_or_without("fortran")) # Mpi - if "+mpi" in spec: + if spec.satisfies("+mpi"): config_args += ["--with-mpi={0}".format(spec["mpi"].prefix)] # Fabrics if "fabrics=none" not in spec: diff --git a/var/spack/repos/builtin/packages/gptl/package.py b/var/spack/repos/builtin/packages/gptl/package.py index 6fc1f2a6d24344..70395d99bc55a6 100644 --- a/var/spack/repos/builtin/packages/gptl/package.py +++ b/var/spack/repos/builtin/packages/gptl/package.py @@ -35,7 +35,7 @@ class Gptl(AutotoolsPackage): def configure_args(self): args = [] - if "+pmpi" in self.spec: + if self.spec.satisfies("+pmpi"): args.append("--enable-pmpi") args.append("CC=" + self.spec["mpi"].mpicc) args.append("CXX=" + self.spec["mpi"].mpicxx) @@ -43,13 +43,13 @@ def configure_args(self): args.append("F90=" + self.spec["mpi"].mpifc) args.append("F77=" + self.spec["mpi"].mpif77) - if "+papi" in self.spec: + if self.spec.satisfies("+papi"): args.append("--enable-papi") - if "+nestedomp" in self.spec: + if self.spec.satisfies("+nestedomp"): args.append("--enable-nestedomp") - if "+disable-unwind" in self.spec: + if self.spec.satisfies("+disable-unwind"): args.append("--disable-libunwind") return args diff --git a/var/spack/repos/builtin/packages/gptune/package.py b/var/spack/repos/builtin/packages/gptune/package.py index 672cd3ab814bf9..dcb17ccb481426 100644 --- a/var/spack/repos/builtin/packages/gptune/package.py +++ b/var/spack/repos/builtin/packages/gptune/package.py @@ -112,7 +112,7 @@ def test(self): comp_version = str(self.compiler.version).replace(".", ",") test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) - if "+superlu" in spec: + if spec.satisfies("+superlu"): superludriver = join_path(spec["superlu-dist"].prefix.lib, "EXAMPLE/pddrive_spawn") op = ["-r", superludriver, "."] # copy superlu-dist executables to the correct place @@ -127,7 +127,7 @@ def test(self): self.run_test("mkdir", options=["-p", "EXAMPLE"], work_dir=wd + "/superlu_dist/build") self.run_test("cp", options=op, work_dir=wd + "/superlu_dist/build/EXAMPLE") - if "+hypre" in spec: + if spec.satisfies("+hypre"): hypredriver = join_path(spec["hypre"].prefix.bin, "ij") op = ["-r", hypredriver, "."] # copy superlu-dist executables to the correct place @@ -221,14 +221,14 @@ def test(self): self.run_test("cp", options=op, work_dir=wd) apps = ["Scalapack-PDGEQRF_RCI"] - if "+mpispawn" in spec: + if spec.satisfies("+mpispawn"): apps = apps + ["GPTune-Demo", "Scalapack-PDGEQRF"] - if "+superlu" in spec: + if spec.satisfies("+superlu"): apps = apps + ["SuperLU_DIST_RCI"] - if "+mpispawn" in spec: + if spec.satisfies("+mpispawn"): apps = apps + ["SuperLU_DIST"] - if "+hypre" in spec: - if "+mpispawn" in spec: + if spec.satisfies("+hypre"): + if spec.satisfies("+mpispawn"): apps = apps + ["Hypre"] for app in apps: diff --git a/var/spack/repos/builtin/packages/gpu-burn/package.py b/var/spack/repos/builtin/packages/gpu-burn/package.py index c53ff6707ef0e9..8cc872ed6867ed 100644 --- a/var/spack/repos/builtin/packages/gpu-burn/package.py +++ b/var/spack/repos/builtin/packages/gpu-burn/package.py @@ -30,7 +30,7 @@ class GpuBurn(MakefilePackage, CudaPackage): def edit(self, spec, prefix): # update cuda architecture if necessary - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): cuda_arch = self.spec.variants["cuda_arch"].value archflag = " ".join(CudaPackage.cuda_flags(cuda_arch)) with open("Makefile", "w") as fh: diff --git a/var/spack/repos/builtin/packages/graphviz/package.py b/var/spack/repos/builtin/packages/graphviz/package.py index 573c8abef5f0d2..ca3552c3fd2906 100644 --- a/var/spack/repos/builtin/packages/graphviz/package.py +++ b/var/spack/repos/builtin/packages/graphviz/package.py @@ -164,7 +164,7 @@ def setup_build_environment(self, env): # Set MACOSX_DEPLOYMENT_TARGET to 10.x due to old configure super().setup_build_environment(env) - if "+quartz" in self.spec: + if self.spec.satisfies("+quartz"): env.set("OBJC", self.compiler.cc) @when("%clang platform=darwin") @@ -209,7 +209,7 @@ def configure_args(self): args.append("--with-{0}includedir={1}".format(var, spec[var].prefix.include)) args.append("--with-{0}libdir={1}".format(var, spec[var].prefix.lib)) - if "+zlib" in spec: + if spec.satisfies("+zlib"): args.append("--with-zlibincludedir={}".format(spec["zlib-api"].prefix.include)) args.append("--with-zliblibdir={}".format(spec["zlib-api"].prefix.lib)) diff --git a/var/spack/repos/builtin/packages/grass/package.py b/var/spack/repos/builtin/packages/grass/package.py index aa1414ea190263..d66a88b32937cc 100644 --- a/var/spack/repos/builtin/packages/grass/package.py +++ b/var/spack/repos/builtin/packages/grass/package.py @@ -117,132 +117,132 @@ def configure_args(self): "--with-proj-share={0}".format(spec["proj"].prefix.share.proj), ] - if "+cxx" in spec: + if spec.satisfies("+cxx"): args.append("--with-cxx") else: args.append("--without-cxx") - if "+tiff" in spec: + if spec.satisfies("+tiff"): args.append("--with-tiff") else: args.append("--without-tiff") - if "+png" in spec: + if spec.satisfies("+png"): args.append("--with-png") else: args.append("--without-png") - if "+postgres" in spec: + if spec.satisfies("+postgres"): args.append("--with-postgres") else: args.append("--without-postgres") - if "+mysql" in spec: + if spec.satisfies("+mysql"): args.append("--with-mysql") else: args.append("--without-mysql") - if "+sqlite" in spec: + if spec.satisfies("+sqlite"): args.append("--with-sqlite") else: args.append("--without-sqlite") - if "+opengl" in spec: + if spec.satisfies("+opengl"): args.append("--with-opengl") else: args.append("--without-opengl") - if "+odbc" in spec: + if spec.satisfies("+odbc"): args.append("--with-odbc") else: args.append("--without-odbc") - if "+fftw" in spec: + if spec.satisfies("+fftw"): args.append("--with-fftw") else: args.append("--without-fftw") - if "+blas" in spec: + if spec.satisfies("+blas"): args.append("--with-blas") else: args.append("--without-blas") - if "+lapack" in spec: + if spec.satisfies("+lapack"): args.append("--with-lapack") else: args.append("--without-lapack") - if "+cairo" in spec: + if spec.satisfies("+cairo"): args.append("--with-cairo") else: args.append("--without-cairo") - if "+freetype" in spec: + if spec.satisfies("+freetype"): args.append("--with-freetype") else: args.append("--without-freetype") - if "+readline" in spec: + if spec.satisfies("+readline"): args.append("--with-readline") else: args.append("--without-readline") - if "+regex" in spec: + if spec.satisfies("+regex"): args.append("--with-regex") else: args.append("--without-regex") - if "+pthread" in spec: + if spec.satisfies("+pthread"): args.append("--with-pthread") else: args.append("--without-pthread") - if "+openmp" in spec: + if spec.satisfies("+openmp"): args.append("--with-openmp") else: args.append("--without-openmp") - if "+opencl" in spec: + if spec.satisfies("+opencl"): args.append("--with-opencl") else: args.append("--without-opencl") - if "+bzlib" in spec: + if spec.satisfies("+bzlib"): args.append("--with-bzlib") else: args.append("--without-bzlib") - if "+zstd" in spec: + if spec.satisfies("+zstd"): args.append("--with-zstd") else: args.append("--without-zstd") - if "+gdal" in spec: + if spec.satisfies("+gdal"): args.append("--with-gdal={0}/gdal-config".format(spec["gdal"].prefix.bin)) else: args.append("--without-gdal") - if "+liblas" in spec: + if spec.satisfies("+liblas"): args.append("--with-liblas={0}/liblas-config".format(spec["liblas"].prefix.bin)) else: args.append("--without-liblas") - if "+wxwidgets" in spec: + if spec.satisfies("+wxwidgets"): args.append("--with-wxwidgets={0}/wx-config".format(spec["wxwidgets"].prefix.bin)) else: args.append("--without-wxwidgets") - if "+netcdf" in spec: + if spec.satisfies("+netcdf"): args.append("--with-netcdf={0}/bin/nc-config".format(spec["netcdf-c"].prefix)) else: args.append("--without-netcdf") - if "+geos" in spec: + if spec.satisfies("+geos"): args.append("--with-geos={0}/bin/geos-config".format(spec["geos"].prefix)) else: args.append("--without-geos") - if "+x" in spec: + if spec.satisfies("+x"): args.append("--with-x") else: args.append("--without-x") diff --git a/var/spack/repos/builtin/packages/grep/package.py b/var/spack/repos/builtin/packages/grep/package.py index caeeb0bec89d29..1ff968569f99f8 100644 --- a/var/spack/repos/builtin/packages/grep/package.py +++ b/var/spack/repos/builtin/packages/grep/package.py @@ -32,7 +32,7 @@ class Grep(AutotoolsPackage): def configure_args(self): args = [] - if "+pcre" in self.spec: + if self.spec.satisfies("+pcre"): args.append("--enable-perl-regexp") else: args.append("--disable-perl-regexp") diff --git a/var/spack/repos/builtin/packages/grib-api/package.py b/var/spack/repos/builtin/packages/grib-api/package.py index 70d3d2517d73c7..2f207025a95856 100644 --- a/var/spack/repos/builtin/packages/grib-api/package.py +++ b/var/spack/repos/builtin/packages/grib-api/package.py @@ -105,7 +105,7 @@ def cmake_args(self): for var, opt in var_opt_list ] - if "+netcdf" in self.spec: + if self.spec.satisfies("+netcdf"): args.extend( [ "-DENABLE_NETCDF=ON", @@ -128,12 +128,12 @@ def cmake_args(self): if self.spec.variants["jp2k"].value == "openjpeg": args.append("-DOPENJPEG_PATH=" + self.spec["openjpeg"].prefix) - if "+png" in self.spec: + if self.spec.satisfies("+png"): args.extend(["-DENABLE_PNG=ON", "-DZLIB_ROOT=" + self.spec["zlib-api"].prefix]) else: args.append("-DENABLE_PNG=OFF") - if "+aec" in self.spec: + if self.spec.satisfies("+aec"): args.extend( [ "-DENABLE_AEC=ON", diff --git a/var/spack/repos/builtin/packages/grid/package.py b/var/spack/repos/builtin/packages/grid/package.py index ad782b35726701..9d1b6b3fe0f9c1 100644 --- a/var/spack/repos/builtin/packages/grid/package.py +++ b/var/spack/repos/builtin/packages/grid/package.py @@ -77,12 +77,12 @@ def configure_args(self): args = ["--with-gmp", "--with-mpfr"] if spec.satisfies("^intel-mkl"): - if "+fftw" in spec or "+lapack" in spec: + if spec.satisfies("+fftw") or spec.satisfies("+lapack"): args.append("--enable-mkl") else: - if "+fftw" in spec: + if spec.satisfies("+fftw"): args.append("--with-fftw={0}".format(self.spec["fftw-api"].prefix)) - if "+lapack" in spec: + if spec.satisfies("+lapack"): args.append("--enable-lapack={0}".format(self.spec["lapack"].prefix)) # lapack is searched only as `-llapack`, so anything else # wouldn't be found, causing an error. diff --git a/var/spack/repos/builtin/packages/gridlab-d/package.py b/var/spack/repos/builtin/packages/gridlab-d/package.py index 6f18648920d19e..882b065fb53734 100644 --- a/var/spack/repos/builtin/packages/gridlab-d/package.py +++ b/var/spack/repos/builtin/packages/gridlab-d/package.py @@ -42,7 +42,7 @@ class GridlabD(AutotoolsPackage): def configure_args(self): args = [] - if "+helics" in self.spec: + if self.spec.satisfies("+helics"): # Taken from # https://github.com/GMLC-TDC/HELICS-Tutorial/tree/master/setup args.append("--with-helics=" + self.spec["helics"].prefix) diff --git a/var/spack/repos/builtin/packages/groff/package.py b/var/spack/repos/builtin/packages/groff/package.py index 47a216b5190475..8e96bc06ada787 100644 --- a/var/spack/repos/builtin/packages/groff/package.py +++ b/var/spack/repos/builtin/packages/groff/package.py @@ -82,7 +82,7 @@ def determine_version(cls, exe): def configure_args(self): args = ["--disable-silent-rules"] args.extend(self.with_or_without("x")) - if "@1.22.4:" in self.spec: + if self.spec.satisfies("@1.22.4:"): args.extend(self.with_or_without("uchardet")) if self.spec["iconv"].name == "libiconv": args.append(f"--with-libiconv-prefix={self.spec['iconv'].prefix}") diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py index 9b149aa2ce82b0..0d8942d66f1218 100644 --- a/var/spack/repos/builtin/packages/gromacs/package.py +++ b/var/spack/repos/builtin/packages/gromacs/package.py @@ -384,14 +384,14 @@ def patch(self): string=True, ) - if "+plumed" in self.spec: + if self.spec.satisfies("+plumed"): self.spec["plumed"].package.apply_patch(self) if self.spec.satisfies("%nvhpc"): # Disable obsolete workaround filter_file("ifdef __PGI", "if 0", "src/gromacs/fileio/xdrf.h") - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): # Upstream supports building of last two major versions of Gromacs. # Older versions of Gromacs need to be patched to build with more recent # versions of CUDA library. @@ -486,7 +486,7 @@ def cmake_args(self): # In other words, the mapping between package variants and the # GMX CMake variables is often non-trivial. - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): options.append("-DGMX_MPI:BOOL=ON") if self.pkg.version < Version("2020"): # Ensures gmxapi builds properly @@ -542,39 +542,39 @@ def cmake_args(self): else: options.append("-DGMX_GPLUSPLUS_PATH=%s/g++" % self.spec["gcc"].prefix.bin) - if "+double" in self.spec: + if self.spec.satisfies("+double"): options.append("-DGMX_DOUBLE:BOOL=ON") - if "+nosuffix" in self.spec: + if self.spec.satisfies("+nosuffix"): options.append("-DGMX_DEFAULT_SUFFIX:BOOL=OFF") - if "~shared" in self.spec: + if self.spec.satisfies("~shared"): options.append("-DBUILD_SHARED_LIBS:BOOL=OFF") options.append("-DGMXAPI:BOOL=OFF") - if "+hwloc" in self.spec: + if self.spec.satisfies("+hwloc"): options.append("-DGMX_HWLOC:BOOL=ON") else: options.append("-DGMX_HWLOC:BOOL=OFF") if self.pkg.version >= Version("2021"): - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): options.append("-DGMX_GPU:STRING=CUDA") - elif "+opencl" in self.spec: + elif self.spec.satisfies("+opencl"): options.append("-DGMX_GPU:STRING=OpenCL") - elif "+sycl" in self.spec: + elif self.spec.satisfies("+sycl"): options.append("-DGMX_GPU:STRING=SYCL") else: options.append("-DGMX_GPU:STRING=OFF") else: - if "+cuda" in self.spec or "+opencl" in self.spec: + if self.spec.satisfies("+cuda") or self.spec.satisfies("+opencl"): options.append("-DGMX_GPU:BOOL=ON") - if "+opencl" in self.spec: + if self.spec.satisfies("+opencl"): options.append("-DGMX_USE_OPENCL=ON") else: options.append("-DGMX_GPU:BOOL=OFF") - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): options.append("-DCUDA_TOOLKIT_ROOT_DIR:STRING=" + self.spec["cuda"].prefix) if not self.spec.satisfies("cuda_arch=none"): cuda_arch = self.spec.variants["cuda_arch"].value @@ -588,28 +588,28 @@ def cmake_args(self): if self.spec["blas"].libs: options.append("-DGMX_BLAS_USER={0}".format(self.spec["blas"].libs.joined(";"))) - if "+cp2k" in self.spec: + if self.spec.satisfies("+cp2k"): options.append("-DGMX_CP2K:BOOL=ON") options.append("-DCP2K_DIR:STRING={0}".format(self.spec["cp2k"].prefix)) - if "+cufftmp" in self.spec: + if self.spec.satisfies("+cufftmp"): options.append("-DGMX_USE_CUFFTMP=ON") options.append( f'-DcuFFTMp_ROOT={self.spec["nvhpc"].prefix}/Linux_{self.spec.target.family}' + f'/{self.spec["nvhpc"].version}/math_libs' ) - if "+heffte" in self.spec: + if self.spec.satisfies("+heffte"): options.append("-DGMX_USE_HEFFTE=on") options.append(f'-DHeffte_ROOT={self.spec["heffte"].prefix}') - if "+intel-data-center-gpu-max" in self.spec: + if self.spec.satisfies("+intel-data-center-gpu-max"): options.append("-DGMX_GPU_NB_CLUSTER_SIZE=8") options.append("-DGMX_GPU_NB_NUM_CLUSTER_PER_CELL_X=1") - if "~nblib" in self.spec: + if self.spec.satisfies("~nblib"): options.append("-DGMX_INSTALL_NBLIB_API=OFF") - if "~gmxapi" in self.spec: + if self.spec.satisfies("~gmxapi"): options.append("-DGMXAPI=OFF") # Activate SIMD based on properties of the target @@ -685,7 +685,7 @@ def cmake_args(self): ) ) - if "+cycle_subcounters" in self.spec: + if self.spec.satisfies("+cycle_subcounters"): options.append("-DGMX_CYCLE_SUBCOUNTERS:BOOL=ON") else: options.append("-DGMX_CYCLE_SUBCOUNTERS:BOOL=OFF") @@ -719,7 +719,7 @@ def cmake_args(self): else: # we rely on the fftw-api@3 options.append("-DGMX_FFT_LIBRARY=fftw3") - if "^amdfftw" in self.spec: + if self.spec.satisfies("^[virtuals=fftw-api] amdfftw"): options.append("-DGMX_FFT_LIBRARY=fftw3") options.append( "-DFFTWF_INCLUDE_DIRS={0}".format(self.spec["amdfftw"].headers.directories[0]) @@ -727,14 +727,14 @@ def cmake_args(self): options.append( "-DFFTWF_LIBRARIES={0}".format(self.spec["amdfftw"].libs.joined(";")) ) - elif "^armpl-gcc" in self.spec: + elif self.spec.satisfies("^armpl-gcc"): options.append( "-DFFTWF_INCLUDE_DIR={0}".format(self.spec["armpl-gcc"].headers.directories[0]) ) options.append( "-DFFTWF_LIBRARY={0}".format(self.spec["armpl-gcc"].libs.joined(";")) ) - elif "^acfl" in self.spec: + elif self.spec.satisfies("^acfl"): options.append( "-DFFTWF_INCLUDE_DIR={0}".format(self.spec["acfl"].headers.directories[0]) ) @@ -742,7 +742,7 @@ def cmake_args(self): # Ensure that the GROMACS log files report how the code was patched # during the build, so that any problems are easier to diagnose. - if "+plumed" in self.spec: + if self.spec.satisfies("+plumed"): options.append("-DGMX_VERSION_STRING_OF_FORK=PLUMED-spack") else: options.append("-DGMX_VERSION_STRING_OF_FORK=spack") diff --git a/var/spack/repos/builtin/packages/gslib/package.py b/var/spack/repos/builtin/packages/gslib/package.py index 65d9e9fdbbf9f1..45e3f4e1135d2f 100644 --- a/var/spack/repos/builtin/packages/gslib/package.py +++ b/var/spack/repos/builtin/packages/gslib/package.py @@ -50,7 +50,7 @@ def install(self, spec, prefix): if "+mpiio" not in spec: filter_file(r"MPIIO.*?=.*1", "MPIIO = 0", makefile) - if "+mpi" in spec: + if spec.satisfies("+mpi"): cc = spec["mpi"].mpicc else: filter_file(r"MPI.*?=.*1", "MPI = 0", makefile) @@ -58,7 +58,7 @@ def install(self, spec, prefix): make_cmd = "CC=" + cc - if "+blas" in spec: + if spec.satisfies("+blas"): filter_file(r"BLAS.*?=.*0", "BLAS = 1", makefile) blas = spec["blas"].libs ld_flags = blas.ld_flags diff --git a/var/spack/repos/builtin/packages/gtkplus/package.py b/var/spack/repos/builtin/packages/gtkplus/package.py index 4c7bd0fdd1b105..dfbc40710f328c 100644 --- a/var/spack/repos/builtin/packages/gtkplus/package.py +++ b/var/spack/repos/builtin/packages/gtkplus/package.py @@ -124,7 +124,7 @@ def configure_args(self): "GTKDOC_MKPDF={0}".format(true), "GTKDOC_REBASE={0}".format(true), ] - if "~cups" in self.spec: + if self.spec.satisfies("~cups"): args.append("--disable-cups") return args diff --git a/var/spack/repos/builtin/packages/guile/package.py b/var/spack/repos/builtin/packages/guile/package.py index 24b73341fbac6e..32c3e4527354eb 100644 --- a/var/spack/repos/builtin/packages/guile/package.py +++ b/var/spack/repos/builtin/packages/guile/package.py @@ -70,12 +70,12 @@ def configure_args(self): "--with-libintl-prefix={0}".format(spec["gettext"].prefix), ] - if "threads=none" in spec: + if spec.satisfies("threads=none"): config_args.append("--without-threads") else: config_args.append("--with-threads") - if "+readline" in spec: + if spec.satisfies("+readline"): config_args.append("--with-libreadline-prefix={0}".format(spec["readline"].prefix)) else: config_args.append("--without-libreadline-prefix") diff --git a/var/spack/repos/builtin/packages/gunrock/package.py b/var/spack/repos/builtin/packages/gunrock/package.py index 5cdfa5f3a247f2..bcb9189aac12a8 100644 --- a/var/spack/repos/builtin/packages/gunrock/package.py +++ b/var/spack/repos/builtin/packages/gunrock/package.py @@ -163,5 +163,5 @@ def install(self, spec, prefix): with working_dir(self.build_directory): install_tree("lib", prefix.lib) # bin dir is created only if tests/examples are built - if "+tests" in spec: + if spec.satisfies("+tests"): install_tree("bin", prefix.bin) diff --git a/var/spack/repos/builtin/packages/gxsview/package.py b/var/spack/repos/builtin/packages/gxsview/package.py index a0418477527625..0d94df2f6eed1c 100644 --- a/var/spack/repos/builtin/packages/gxsview/package.py +++ b/var/spack/repos/builtin/packages/gxsview/package.py @@ -66,7 +66,7 @@ def qmake_args(self): ) # Below to avoid undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' if self.spec.satisfies("%gcc@8.0:8.9") or self.spec.satisfies("%fj"): - if "^vtk@9:" in self.spec: + if self.spec.satisfies("^vtk@9:"): fic = "vtk9.pri" else: fic = "vtk8.pri" From 76df9de26ae0e30f1f231750c8e527ecceea4c6f Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:53:21 -0400 Subject: [PATCH 030/687] Update ExaCA backend handling and add version 2.0 (#46243) * Add exaca 2.0 * Add kokkos/cuda/hip backend support for exaca --- .../repos/builtin/packages/exaca/package.py | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/exaca/package.py b/var/spack/repos/builtin/packages/exaca/package.py index ce79d0ad6bd46e..3ca8bcb7a013d1 100644 --- a/var/spack/repos/builtin/packages/exaca/package.py +++ b/var/spack/repos/builtin/packages/exaca/package.py @@ -7,12 +7,12 @@ from spack.pkg.builtin.kokkos import Kokkos -class Exaca(CMakePackage): +class Exaca(CMakePackage, CudaPackage, ROCmPackage): """ExaCA: an exascale cellular automata application for alloy solidification modeling""" homepage = "https://github.com/LLNL/ExaCA" git = "https://github.com/LLNL/ExaCA.git" - url = "https://github.com/LLNL/ExaCA/archive/1.2.0.tar.gz" + url = "https://github.com/LLNL/ExaCA/archive/2.0.0.tar.gz" maintainers("streeve", "MattRolchigo") @@ -21,6 +21,8 @@ class Exaca(CMakePackage): license("MIT") version("master", branch="master") + version("2.0.0", sha256="a33cc65a6e79bed37a644f5bfc9dd5fe356239f78c5b82830c6354acc43e016b") + version("1.3.0", sha256="637215d3c64e8007b55d68bea6003b51671029d9045af847534e0e59c4271a94") version("1.2.0", sha256="5038d63de96c6142ddea956998e1f4ebffbc4a5723caa4da0e73eb185e6623e4") version("1.1.0", sha256="10106fb1836964a19bc5bab3f374baa24188ba786c768e554442ab896b31ff24") version("1.0.0", sha256="48556233360a5e15e1fc20849e57dd60739c1991c7dfc7e6b2956af06688b96a") @@ -40,13 +42,38 @@ class Exaca(CMakePackage): depends_on("googletest@1.10:", type="test", when="@1.1:+testing") depends_on("kokkos@3.0:", when="@:1.1") depends_on("kokkos@3.2:", when="@1.2:") + depends_on("kokkos@4.0:", when="@1.3:") depends_on("mpi") depends_on("nlohmann-json", when="@1.2:") + for _backend in _kokkos_backends: + # Handled separately below + if _backend != "cuda" and _backend != "rocm": + _backend_dep = "+{0}".format(_backend) + depends_on("kokkos {0}".format(_backend_dep), when=_backend_dep) + + for arch in CudaPackage.cuda_arch_values: + cuda_dep = "+cuda cuda_arch={0}".format(arch) + depends_on("kokkos {0}".format(cuda_dep), when=cuda_dep) + for arch in ROCmPackage.amdgpu_targets: + rocm_dep = "+rocm amdgpu_target={0}".format(arch) + depends_on("kokkos {0}".format(rocm_dep), when=rocm_dep) + def cmake_args(self): options = [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] if self.spec.satisfies("@1.1:"): options += [self.define_from_variant("ExaCA_ENABLE_TESTING", "testing")] + # Only release with optional json + if self.spec.satisfies("@1.2"): + options += [self.define("ExaCA_ENABLE_JSON", "ON")] + # Use the json dependency, not an internal download + if self.spec.satisfies("@2.0:"): + options += [self.define("ExaCA_REQUIRE_EXTERNAL_JSON", "ON")] + + # Use hipcc if compiling for rocm. Modifying this instead of CMAKE_CXX_COMPILER + # keeps the spack wrapper + if self.spec.satisfies("+rocm"): + env["SPACK_CXX"] = self.spec["hip"].hipcc return options From e4f8cff286a7e39660dd2431811221877ff3bc55 Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Fri, 6 Sep 2024 15:15:03 -0400 Subject: [PATCH 031/687] Updated version of sz3 (#46246) Supercedes #46128 Co-authored-by: Robert Underwood --- var/spack/repos/builtin/packages/sz3/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/sz3/package.py b/var/spack/repos/builtin/packages/sz3/package.py index 5722cced398384..b82a28e0894b5c 100644 --- a/var/spack/repos/builtin/packages/sz3/package.py +++ b/var/spack/repos/builtin/packages/sz3/package.py @@ -16,6 +16,7 @@ class Sz3(CMakePackage): tags = ["e4s"] version("master") + version("3.2.0", commit="b3dab4018425803a55d8073dc55dade7fa46b7b4") version("3.1.8", commit="e308ebf8528c233286874b920c72c0a6c0218fb2") version("3.1.7", commit="c49fd17f2d908835c41000c1286c510046c0480e") version("3.1.5.4", commit="4c6ddf628f27d36b28d1bbda02174359cd05573d") From 19352af10bab6424178f6eb45f6807a67a35a810 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 6 Sep 2024 21:17:41 +0200 Subject: [PATCH 032/687] GEOS: add v3.13.0 (#46261) --- var/spack/repos/builtin/packages/geos/package.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/geos/package.py b/var/spack/repos/builtin/packages/geos/package.py index 42b95f00950c74..1359fdb8bce82c 100644 --- a/var/spack/repos/builtin/packages/geos/package.py +++ b/var/spack/repos/builtin/packages/geos/package.py @@ -22,6 +22,7 @@ class Geos(CMakePackage): license("LGPL-2.1-or-later") maintainers("adamjstewart") + version("3.13.0", sha256="47ec83ff334d672b9e4426695f15da6e6368244214971fabf386ff8ef6df39e4") version("3.12.2", sha256="34c7770bf0090ee88488af98767d08e779f124fa33437e0aabec8abd4609fec6") version("3.12.1", sha256="d6ea7e492224b51193e8244fe3ec17c4d44d0777f3c32ca4fb171140549a0d03") version("3.12.0", sha256="d96db96011259178a35555a0f6d6e75a739e52a495a6b2aa5efb3d75390fbc39") @@ -66,10 +67,11 @@ class Geos(CMakePackage): version("3.3.4", sha256="cd5400aa5f3fe32246dfed5d238c5017e1808162c865c016480b3e6c07271904") version("3.3.3", sha256="dfcf4bd70ab212a5b7bad21d01b84748f101a545092b56dafdc3882ef3bddec9") - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated + depends_on("c", type="build") + depends_on("cxx", type="build") generator("ninja") + depends_on("cmake@3.15:", when="@3.13:", type="build") depends_on("cmake@3.13:", when="@3.10:", type="build") depends_on("cmake@3.8:", type="build") From afc9615abf413cbccf2633932d55ee0b314c223a Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:21:41 -0700 Subject: [PATCH 033/687] libfabric: Add versions v1.22.0 and v1.21.1 (#46188) * Add libfabric v1.22.0 and v1.21.1 * Fix whitespace --- var/spack/repos/builtin/packages/libfabric/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/libfabric/package.py b/var/spack/repos/builtin/packages/libfabric/package.py index 49dbacde6744a3..9f9d3e0cb2eb6d 100644 --- a/var/spack/repos/builtin/packages/libfabric/package.py +++ b/var/spack/repos/builtin/packages/libfabric/package.py @@ -24,6 +24,8 @@ class Libfabric(AutotoolsPackage, CudaPackage): license("GPL-2.0-or-later") version("main", branch="main") + version("1.22.0", sha256="485e6cafa66c9e4f6aa688d2c9526e274c47fda3a783cf1dd8f7c69a07e2d5fe") + version("1.21.1", sha256="54befa6697352f3179c79c4a79225ae71694f29eefad5d0d5a14b5444ff986dd") version("1.21.0", sha256="0c1b7b830d9147f661e5d7f359250b85b5a9885c330464cd3b5e5d35b86551c7") version("1.20.2", sha256="75b89252a0b8b3eae8e60f7098af1598445a99a99e8fc1ff458e2fd5d4ef8cde") version("1.20.1", sha256="fd88d65c3139865d42a6eded24e121aadabd6373239cef42b76f28630d6eed76") From a3fa54812f926a78b4411f6d39cef92e9d1b2eb6 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 6 Sep 2024 23:14:36 +0200 Subject: [PATCH 034/687] Remove deprecated config options (#44061) These options have been deprecated in v0.21, and slated for removal in v0.23 --- lib/spack/spack/audit.py | 34 ------------------------------ lib/spack/spack/schema/packages.py | 28 ------------------------ lib/spack/spack/test/cmd/env.py | 3 --- 3 files changed, 65 deletions(-) diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 9ff3e8dd29713d..28b7727e5ec2f8 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -257,40 +257,6 @@ def _search_duplicate_specs_in_externals(error_cls): return errors -@config_packages -def _deprecated_preferences(error_cls): - """Search package preferences deprecated in v0.21 (and slated for removal in v0.23)""" - # TODO (v0.23): remove this audit as the attributes will not be allowed in config - errors = [] - packages_yaml = spack.config.CONFIG.get_config("packages") - - def make_error(attribute_name, config_data, summary): - s = io.StringIO() - s.write("Occurring in the following file:\n") - dict_view = syaml.syaml_dict((k, v) for k, v in config_data.items() if k == attribute_name) - syaml.dump_config(dict_view, stream=s, blame=True) - return error_cls(summary=summary, details=[s.getvalue()]) - - if "all" in packages_yaml and "version" in packages_yaml["all"]: - summary = "Using the deprecated 'version' attribute under 'packages:all'" - errors.append(make_error("version", packages_yaml["all"], summary)) - - for package_name in packages_yaml: - if package_name == "all": - continue - - package_conf = packages_yaml[package_name] - for attribute in ("compiler", "providers", "target"): - if attribute not in package_conf: - continue - summary = ( - f"Using the deprecated '{attribute}' attribute " f"under 'packages:{package_name}'" - ) - errors.append(make_error(attribute, package_conf, summary)) - - return errors - - @config_packages def _avoid_mismatched_variants(error_cls): """Warns if variant preferences have mismatched types or names.""" diff --git a/lib/spack/spack/schema/packages.py b/lib/spack/spack/schema/packages.py index 9e8b7f21c0a587..2193a6254167a0 100644 --- a/lib/spack/spack/schema/packages.py +++ b/lib/spack/spack/schema/packages.py @@ -109,7 +109,6 @@ "require": requirements, "prefer": prefer_and_conflict, "conflict": prefer_and_conflict, - "version": {}, # Here only to warn users on ignored properties "target": { "type": "array", "default": [], @@ -140,16 +139,6 @@ }, "variants": variants, }, - "deprecatedProperties": [ - { - "names": ["version"], - "message": "setting version preferences in the 'all' section of " - "packages.yaml is deprecated and will be removed in v0.23" - "\n\n\tThese preferences will be ignored by Spack. You can " - "set them only in package-specific sections of the same file.\n", - "error": False, - } - ], } }, "patternProperties": { @@ -167,14 +156,11 @@ # version strings "items": {"anyOf": [{"type": "string"}, {"type": "number"}]}, }, - "target": {}, # Here only to warn users on ignored properties - "compiler": {}, # Here only to warn users on ignored properties "buildable": {"type": "boolean", "default": True}, "permissions": permissions, # If 'get_full_repo' is promoted to a Package-level # attribute, it could be useful to set it here "package_attributes": package_attributes, - "providers": {}, # Here only to warn users on ignored properties "variants": variants, "externals": { "type": "array", @@ -206,20 +192,6 @@ }, }, }, - "deprecatedProperties": [ - { - "names": ["target", "compiler", "providers"], - "message": "setting '{name}:' preferences in " - "a package-specific section of packages.yaml is deprecated, and will be " - "removed in v0.23.\n\n\tThis preferences will be ignored by Spack, and " - "can be set only in the 'all' section of the same file. " - "You can run:\n\n\t\t$ spack audit configs\n\n\tto get better " - "diagnostics, including files:lines where the deprecated " - "attributes are used.\n\n\tUse requirements to enforce conditions" - f" on specific packages: {REQUIREMENT_URL}\n", - "error": False, - } - ], } }, } diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index ee725770cb88dc..e841b1c84555e6 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -4204,9 +4204,6 @@ def test_env_include_mixed_views(tmp_path, mutable_mock_env_path, mutable_config {''.join(includes)} specs: - mpileaks - packages: - mpileaks: - compiler: [gcc] """ ) From 3bdaaaf47c09df53410a636076a993c3a7621819 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Fri, 6 Sep 2024 17:19:12 -0400 Subject: [PATCH 035/687] New package: py-monai (#46140) * New package: py-monai * Fixed linked issues with py-monai * [py-monai] removed extra line * [py-monai] - New version 1.3.2 - ran black - update copyright * [py-monai] added license * [py-monai] - moved build only dependencies - specified newer python requirements for newer versions --------- Co-authored-by: vehrc --- .../builtin/packages/py-monai/package.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-monai/package.py diff --git a/var/spack/repos/builtin/packages/py-monai/package.py b/var/spack/repos/builtin/packages/py-monai/package.py new file mode 100644 index 00000000000000..78f8771c75e388 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-monai/package.py @@ -0,0 +1,29 @@ +# Copyright 2013-2024 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 PyMonai(PythonPackage): + """AI Toolkit for Healthcare Imaging""" + + homepage = "https://monai.io/" + url = "https://github.com/Project-MONAI/MONAI/archive/refs/tags/0.8.1.tar.gz" + + license("Apache-2.0", checked_by="qwertos") + + version("1.3.2", sha256="e370e1fcd78854fb22c2414fa7419c15ff5afce67b923ce666d0f12979015136") + version("0.8.1", sha256="e1227e6406cc47c23f6846f617350879ceba353915b948d917bf4308b17ea861") + version("0.8.0", sha256="a63df7d5a680d9641c223ea090ff843a7d6f20bdb62095bd44f3b0480a4706ed") + + depends_on("python@3.6:", type=("build", "run")) + depends_on("python@3.8:", when="@1.2:", type=("build", "run")) + depends_on("py-ninja", type="build") + depends_on("py-wheel", type="build") + depends_on("py-setuptools", type="build") + depends_on("py-torch@1.6:", type=("build", "run")) + depends_on("py-torch@1.9:", when="@1.3.2:", type=("build", "run")) + depends_on("py-numpy@1.17:", type=("build", "run")) + depends_on("py-numpy@1.20:", when="@1.3.2:", type=("build", "run")) From 7a313295acf947a88dfb5be698b82776dfea6983 Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Fri, 6 Sep 2024 17:35:55 -0400 Subject: [PATCH 036/687] Sz3 fix (#46263) * Updated version of sz3 Supercedes #46128 * Add Robertu94 to maintainers fo r SZ3 --------- Co-authored-by: Robert Underwood --- var/spack/repos/builtin/packages/sz3/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/sz3/package.py b/var/spack/repos/builtin/packages/sz3/package.py index b82a28e0894b5c..9a1e3a0d0fbb22 100644 --- a/var/spack/repos/builtin/packages/sz3/package.py +++ b/var/spack/repos/builtin/packages/sz3/package.py @@ -12,7 +12,7 @@ class Sz3(CMakePackage): homepage = "https://github.com/szcompressor/SZ3" git = "https://github.com/szcompressor/SZ3" - maintainers("disheng222") + maintainers("disheng222", "robertu94") tags = ["e4s"] version("master") From 7086d6f1ac9838ddc05b906e80e71cfbba7125ae Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:48:45 -0700 Subject: [PATCH 037/687] use updated container with cmake@3.30.2 (#46262) --- share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml | 2 +- share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index 7dcce7eb275365..e50d06919862df 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -422,7 +422,7 @@ e4s-rocm-external-build: e4s-oneapi-generate: extends: [ ".e4s-oneapi", ".generate-x86_64"] - image: ecpe4s/ubuntu22.04-runner-amd64-oneapi-2024.2:2024.06.21 + image: ecpe4s/ubuntu22.04-runner-amd64-oneapi-2024.2:2024.09.06 e4s-oneapi-build: extends: [ ".e4s-oneapi", ".build" ] diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml index 2509938d6ea6c8..112afaaff46db6 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-oneapi/spack.yaml @@ -242,7 +242,7 @@ spack: ci: pipeline-gen: - build-job: - image: ecpe4s/ubuntu22.04-runner-amd64-oneapi-2024.2:2024.06.21 + image: ecpe4s/ubuntu22.04-runner-amd64-oneapi-2024.2:2024.09.06 cdash: build-group: E4S OneAPI From 6f08db463149efdea126abf8fdc770f684b4199d Mon Sep 17 00:00:00 2001 From: Dan Lipsa Date: Fri, 6 Sep 2024 20:54:09 -0400 Subject: [PATCH 038/687] Set module variables for all packages before running setup_dependent_package (#44327) When a package is running `setup_dependent_package` on a parent, ensure that module variables like `spack_cc` are available. This was often true prior to this commit, but externals were an exception. --------- Co-authored-by: John Parent --- lib/spack/spack/build_environment.py | 7 ++++++- lib/spack/spack/test/build_environment.py | 24 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index e807bf6fd02234..e95a90421737af 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -1003,7 +1003,6 @@ def set_all_package_py_globals(self): """Set the globals in modules of package.py files.""" for dspec, flag in chain(self.external, self.nonexternal): pkg = dspec.package - if self.should_set_package_py_globals & flag: if self.context == Context.BUILD and self.needs_build_context & flag: set_package_py_globals(pkg, context=Context.BUILD) @@ -1011,6 +1010,12 @@ def set_all_package_py_globals(self): # This includes runtime dependencies, also runtime deps of direct build deps. set_package_py_globals(pkg, context=Context.RUN) + # Looping over the set of packages a second time + # ensures all globals are loaded into the module space prior to + # any package setup. This guarantees package setup methods have + # access to expected module level definitions such as "spack_cc" + for dspec, flag in chain(self.external, self.nonexternal): + pkg = dspec.package for spec in dspec.dependents(): # Note: some specs have dependents that are unreachable from the root, so avoid # setting globals for those. diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 3ae41acc9cecee..02f0a27f46fd98 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -513,6 +513,30 @@ def test_setting_dtags_based_on_config(config_setting, expected_flag, config, mo assert dtags_to_add.value == expected_flag +def test_module_globals_available_at_setup_dependent_time( + monkeypatch, mutable_config, mock_packages, working_env +): + """Spack built package externaltest depends on an external package + externaltool. Externaltool's setup_dependent_package needs to be able to + access globals on the dependent""" + + def setup_dependent_package(module, dependent_spec): + # Make sure set_package_py_globals was already called on + # dependents + # ninja is always set by the setup context and is not None + dependent_module = dependent_spec.package.module + assert hasattr(dependent_module, "ninja") + assert dependent_module.ninja is not None + dependent_spec.package.test_attr = True + + externaltool = spack.spec.Spec("externaltest").concretized() + monkeypatch.setattr( + externaltool["externaltool"].package, "setup_dependent_package", setup_dependent_package + ) + spack.build_environment.setup_package(externaltool.package, False) + assert externaltool.package.test_attr + + def test_build_jobs_sequential_is_sequential(): assert ( determine_number_of_jobs( From 7d6b643b5887ee34868e033deded5caee1dcb9d9 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Fri, 6 Sep 2024 20:54:36 -0400 Subject: [PATCH 039/687] [py-torch-fidelity] New package (#46257) * [py-torch-fidelity] New package * [py-torch-fidelity] add patch to fix missing requirements.txt --- .../packages/py-torch-fidelity/package.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-torch-fidelity/package.py diff --git a/var/spack/repos/builtin/packages/py-torch-fidelity/package.py b/var/spack/repos/builtin/packages/py-torch-fidelity/package.py new file mode 100644 index 00000000000000..df20602e79c3f8 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-torch-fidelity/package.py @@ -0,0 +1,33 @@ +# Copyright 2013-2024 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) + +import os + +from spack.package import * + + +class PyTorchFidelity(PythonPackage): + """High-fidelity performance metrics for generative models in PyTorch""" + + homepage = "https://www.github.com/toshas/torch-fidelity" + pypi = "torch_fidelity/torch_fidelity-0.3.0.tar.gz" + + license("Apache-2.0", checked_by="qwertos") + + version("0.3.0", sha256="3d3e33db98919759cc4f3f24cb27e1e74bdc7c905d90a780630e4e1c18492b66") + + depends_on("py-setuptools", type="build") + depends_on("py-numpy", type=("build", "run")) + depends_on("pil", type=("build", "run")) + depends_on("py-scipy", type=("build", "run")) + depends_on("py-torch", type=("build", "run")) + depends_on("py-torchvision", type=("build", "run")) + depends_on("py-tqdm", type=("build", "run")) + + def patch(self): + os.rename( + join_path(self.stage.source_path, "torch_fidelity.egg-info", "requires.txt"), + join_path(self.stage.source_path, "requirements.txt"), + ) From ddc8790896d48ae608c621525f61ca51c4be4237 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Fri, 6 Sep 2024 20:54:51 -0400 Subject: [PATCH 040/687] [py-lpips] new package (#46256) --- .../builtin/packages/py-lpips/package.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-lpips/package.py diff --git a/var/spack/repos/builtin/packages/py-lpips/package.py b/var/spack/repos/builtin/packages/py-lpips/package.py new file mode 100644 index 00000000000000..84472f699fc5c1 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-lpips/package.py @@ -0,0 +1,24 @@ +# Copyright 2013-2024 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 PyLpips(PythonPackage): + """LPIPS Similarity metric""" + + homepage = "https://github.com/richzhang/PerceptualSimilarity" + pypi = "lpips/lpips-0.1.4.tar.gz" + + license("BSD-2-Clause", checked_by="qwertos") + + version("0.1.4", sha256="3846331df6c69688aec3d300a5eeef6c529435bc8460bd58201c3d62e56188fa") + + depends_on("py-setuptools", type="build") + depends_on("py-torch@0.4:", type=("build", "run")) + depends_on("py-torchvision@0.2.1:", type=("build", "run")) + depends_on("py-numpy@1.14.3:", type=("build", "run")) + depends_on("py-scipy@1.0.1:", type=("build", "run")) + depends_on("py-tqdm@4.28.1:", type=("build", "run")) From 541e40e2523bfa89e15b632bc3208e4c9a605191 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sat, 7 Sep 2024 04:28:15 -0400 Subject: [PATCH 041/687] py-httpcore: add v1.0.5 (#46123) * py-httpcore: Added new version * [py-httpcore] - added version 0.18.0 - restructured dependencies as everything has a when and type/when ordering was all over the place * [py-httpcore] ordered dependencies in the order listed in v1.0.5 pyproject.toml --------- Co-authored-by: Alex C Leute --- .../builtin/packages/py-httpcore/package.py | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-httpcore/package.py b/var/spack/repos/builtin/packages/py-httpcore/package.py index 8a72e47aa05c06..45fbf4b22bb95e 100644 --- a/var/spack/repos/builtin/packages/py-httpcore/package.py +++ b/var/spack/repos/builtin/packages/py-httpcore/package.py @@ -15,15 +15,24 @@ class PyHttpcore(PythonPackage): license("BSD-3-Clause") + version("1.0.5", sha256="34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61") + version("0.18.0", sha256="13b5e5cd1dca1a6636a6aaea212b19f4f85cd88c366a2b82304181b769aab3c9") version("0.16.3", sha256="c5d6f04e2fc530f39e0c077e6a30caa53f1451096120f1f38b954afd0b17c0cb") version("0.14.7", sha256="7503ec1c0f559066e7e39bc4003fd2ce023d01cf51793e3c173b864eb456ead1") version("0.11.0", sha256="35ffc735d746b83f8fc6d36f82600e56117b9e8adc65d0c0423264b6ebfef7bf") - depends_on("py-setuptools", type="build") - depends_on("py-h11@0.13:0.14", when="@0.16.3", type=("build", "run")) - depends_on("py-h11@0.11:0.12", type=("build", "run"), when="@0.14.7") - depends_on("py-h11@0.8:0.9", type=("build", "run"), when="@0.11.0") - depends_on("py-sniffio@1", type=("build", "run")) - depends_on("py-anyio@3:4", when="@0.16.3", type=("build", "run")) - depends_on("py-anyio@3", type=("build", "run"), when="@0.14.7") - depends_on("py-certifi", type=("build", "run"), when="@0.14.7:") + depends_on("py-setuptools", when="@:1.16.3", type="build") + depends_on("py-hatchling", when="@0.18:", type="build") + depends_on("py-hatch-fancy-pypi-readme", when="@0.18:", type="build") + + with default_args(type=("build", "run")): + depends_on("py-certifi", when="@0.14.7:") + + depends_on("py-h11@0.8:0.9", when="@0.11.0") + depends_on("py-h11@0.11:0.12", when="@0.14.7") + depends_on("py-h11@0.13:0.14", when="@0.16.3:") + + depends_on("py-sniffio@1", when="@0") + + depends_on("py-anyio@3", when="@0.14.7") + depends_on("py-anyio@3:4", when="@0.16.3:0.18") From 5f9c6299d14becb686a69c57f28ec8b1be7e5653 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sat, 7 Sep 2024 06:29:45 -0400 Subject: [PATCH 042/687] [py-langsmith] added version 0.1.81 (#46259) --- var/spack/repos/builtin/packages/py-langsmith/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-langsmith/package.py b/var/spack/repos/builtin/packages/py-langsmith/package.py index c2f759c9a007de..4c08c78aba0310 100644 --- a/var/spack/repos/builtin/packages/py-langsmith/package.py +++ b/var/spack/repos/builtin/packages/py-langsmith/package.py @@ -13,6 +13,7 @@ class PyLangsmith(PythonPackage): license("MIT") + version("0.1.81", sha256="585ef3a2251380bd2843a664c9a28da4a7d28432e3ee8bcebf291ffb8e1f0af0") version( "0.1.1", sha256="09df0c2ca9085105f97a4e4f281b083e312c99d162f3fe2b2d5eefd5c3692e60", @@ -24,5 +25,7 @@ class PyLangsmith(PythonPackage): depends_on("python@3.8.1:3", type=("build", "run")) depends_on("py-poetry-core", type="build") - depends_on("py-pydantic@1", type=("build", "run")) + depends_on("py-pydantic@1", type=("build", "run"), when="@:0.1.1") + depends_on("py-pydantic@1:2", type=("build", "run"), when="@0.1.81:") depends_on("py-requests@2", type=("build", "run")) + depends_on("py-orjson@3.9.14:3", type=("build", "run"), when="@0.1.81:") From 32727087f10c9dfc276bec577821deb4bc543a2a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Sat, 7 Sep 2024 07:54:43 -0600 Subject: [PATCH 043/687] Add patch vfile_cassert.patch for ecflow@5.11.4 (#46095) --- var/spack/repos/builtin/packages/ecflow/package.py | 1 + .../repos/builtin/packages/ecflow/vfile_cassert.patch | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 var/spack/repos/builtin/packages/ecflow/vfile_cassert.patch diff --git a/var/spack/repos/builtin/packages/ecflow/package.py b/var/spack/repos/builtin/packages/ecflow/package.py index 7616e64e8db11c..22762230ca1cb9 100644 --- a/var/spack/repos/builtin/packages/ecflow/package.py +++ b/var/spack/repos/builtin/packages/ecflow/package.py @@ -76,6 +76,7 @@ class Ecflow(CMakePackage): # https://github.com/JCSDA/spack-stack/issues/1001 # https://github.com/JCSDA/spack-stack/issues/1009 patch("ctsapi_cassert.patch", when="@5.11.4") + patch("vfile_cassert.patch", when="@5.11.4") @when("@:4.13.0") def patch(self): diff --git a/var/spack/repos/builtin/packages/ecflow/vfile_cassert.patch b/var/spack/repos/builtin/packages/ecflow/vfile_cassert.patch new file mode 100644 index 00000000000000..871ae9d9d51851 --- /dev/null +++ b/var/spack/repos/builtin/packages/ecflow/vfile_cassert.patch @@ -0,0 +1,10 @@ +--- a/Viewer/ecflowUI/src/VFile.cpp 2024-08-28 12:20:27.000000000 +0000 ++++ b/Viewer/ecflowUI/src/VFile.cpp 2024-08-28 12:20:51.000000000 +0000 +@@ -9,6 +9,7 @@ + + #include "VFile.hpp" + ++#include + #include + #include + #include From cb47c5f0acad02a67839b67ad0db73f73cf1722e Mon Sep 17 00:00:00 2001 From: Pierre Augier Date: Mon, 9 Sep 2024 03:03:09 +0200 Subject: [PATCH 044/687] Add package py-transonic (#46234) --- .../builtin/packages/py-transonic/package.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-transonic/package.py diff --git a/var/spack/repos/builtin/packages/py-transonic/package.py b/var/spack/repos/builtin/packages/py-transonic/package.py new file mode 100644 index 00000000000000..01772b1c568f85 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-transonic/package.py @@ -0,0 +1,28 @@ +# Copyright 2013-2024 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 PyTransonic(PythonPackage): + """Make your Python code fly at transonic speeds!""" + + pypi = "transonic/transonic-0.7.2.tar.gz" + + maintainers("paugier") + + license("BSD-3-Clause", checked_by="paugier") + + version("0.7.2", sha256="d0c39c13b535df4f121a8a378efc42e3d3bf4e49536d131e6d26e9fe7d5a5bf4") + version("0.7.1", sha256="dcc59f1936d09129c800629cd4e6812571a74afe40dadd8193940b545e6ef03e") + + depends_on("python@3.9:", type=("build", "run")) + depends_on("py-pdm-backend", type="build") + + with default_args(type="run"): + depends_on("py-numpy") + depends_on("py-beniget@0.4") + depends_on("py-gast@0.5") + depends_on("py-autopep8") From 6af92f59ec8fac9a7208624ebc55d840a4ab61db Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 8 Sep 2024 23:45:15 -0500 Subject: [PATCH 045/687] xrootd: add v5.7.1 (#46270) --- var/spack/repos/builtin/packages/xrootd/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/xrootd/package.py b/var/spack/repos/builtin/packages/xrootd/package.py index c89f263430ad08..73482d79201275 100644 --- a/var/spack/repos/builtin/packages/xrootd/package.py +++ b/var/spack/repos/builtin/packages/xrootd/package.py @@ -23,6 +23,7 @@ class Xrootd(CMakePackage): license("LGPL-3.0-only") + version("5.7.1", sha256="c28c9dc0a2f5d0134e803981be8b1e8b1c9a6ec13b49f5fa3040889b439f4041") version("5.7.0", sha256="214599bba98bc69875b82ac74f2d4b9ac8a554a1024119d8a9802b3d8b9986f8") version("5.6.9", sha256="44196167fbcf030d113e3749dfdecab934c43ec15e38e77481e29aac191ca3a8") version("5.6.8", sha256="19268fd9f0307d936da3598a5eb8471328e059c58f60d91d1ce7305ca0d57528") From fec2f30d5adaf5c4e44ff4899692bd160a9a24e9 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 8 Sep 2024 22:46:12 -0600 Subject: [PATCH 046/687] lammps: add 20240829 and 20230802.4 releases (#46131) --- .../repos/builtin/packages/lammps/package.py | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py index 69163fb93c8345..4f9a7f32e2eda5 100644 --- a/var/spack/repos/builtin/packages/lammps/package.py +++ b/var/spack/repos/builtin/packages/lammps/package.py @@ -29,21 +29,43 @@ class Lammps(CMakePackage, CudaPackage, ROCmPackage, PythonExtension): # marked deprecated=True # * patch releases older than a stable release should be marked deprecated=True version("develop", branch="develop") - version("20240627", sha256="2174a99d266279823a8c57629ee1c21ec357816aefd85f964d9f859fe9222aa5") - version("20240417", sha256="158b288725c251fd8b30dbcf61749e0d6a042807da92af865a7d3c413efdd8ea") version( - "20240207.1", sha256="3ba62c2a1ed463fceedf313a1c3ea2997994aa102379a8d35b525ea424f56776" + "20240829", + sha256="6112e0cc352c3140a4874c7f74db3c0c8e30134024164509ecf3772b305fde2e", + preferred=True, + ) + version( + "20240627", + sha256="2174a99d266279823a8c57629ee1c21ec357816aefd85f964d9f859fe9222aa5", + deprecated=True, + ) + version( + "20240417", + sha256="158b288725c251fd8b30dbcf61749e0d6a042807da92af865a7d3c413efdd8ea", + deprecated=True, + ) + version( + "20240207.1", + sha256="3ba62c2a1ed463fceedf313a1c3ea2997994aa102379a8d35b525ea424f56776", + deprecated=True, ) version( "20240207", sha256="d518f32de4eb2681f2543be63926411e72072dd7d67c1670c090b5baabed98ac", deprecated=True, ) - version("20231121", sha256="704d8a990874a425bcdfe0245faf13d712231ba23f014a3ebc27bc14398856f1") + version( + "20231121", + sha256="704d8a990874a425bcdfe0245faf13d712231ba23f014a3ebc27bc14398856f1", + deprecated=True, + ) + version( + "20230802.4", sha256="6eed007cc24cda80b5dd43372b2ad4268b3982bb612669742c8c336b79137b5b" + ) version( "20230802.3", sha256="6666e28cb90d3ff01cbbda6c81bdb85cf436bbb41604a87f2ab2fa559caa8510", - preferred=True, + deprecated=True, ) version( "20230802.2", @@ -372,7 +394,7 @@ class Lammps(CMakePackage, CudaPackage, ROCmPackage, PythonExtension): depends_on("cxx", type="build") # mdi, scafacos, ml-quip, qmmm require C, but not available in Spack - for c_pkg in ("adios", "atc", "awpmd", "ml-pod", "electrode", "kim", "h5md", "tools"): + for c_pkg in ("adios", "atc", "awpmd", "ml-pod", "electrode", "kim", "h5md", "tools", "rheo"): depends_on("c", type="build", when=f"+{c_pkg}") # scafacos, ml-quip require Fortran, but not available in Spack @@ -380,6 +402,8 @@ class Lammps(CMakePackage, CudaPackage, ROCmPackage, PythonExtension): depends_on("fortran", type="build", when=f"+{fc_pkg}") stable_versions = { + "20240829", + "20230802.4", "20230802.3", "20230802.2", "20230802.1", @@ -495,6 +519,7 @@ def url_for_version(self, version): "reaction": {"when": "@20210702:"}, "reax": {"when": "@:20181212"}, "reaxff": {"when": "@20210702:"}, + "rheo": {"when": "@20240829:"}, "replica": {}, "rigid": {"default": True}, "shock": {}, @@ -569,6 +594,7 @@ def url_for_version(self, version): variant("jpeg", default=False, description="Build with jpeg support") variant("png", default=False, description="Build with png support") variant("ffmpeg", default=False, description="Build with ffmpeg support") + variant("curl", default=False, description="Build with curl support", when="@20240829:") variant("openmp", default=True, description="Build with OpenMP") variant("opencl", default=False, description="Build with OpenCL") variant( @@ -658,6 +684,7 @@ def url_for_version(self, version): depends_on("jpeg", when="+jpeg") depends_on("kim-api", when="+kim") depends_on("curl", when="@20190329:+kim") + depends_on("curl", when="+curl") depends_on("libpng", when="+png") depends_on("ffmpeg", when="+ffmpeg") depends_on("kokkos+deprecated_code+shared@3.0.00", when="@20200303+kokkos") @@ -688,6 +715,7 @@ def url_for_version(self, version): depends_on("hipcub", when="~kokkos +rocm") depends_on("llvm-amdgpu ", when="+rocm", type="build") depends_on("rocm-openmp-extras", when="+rocm +openmp", type="build") + depends_on("gsl@2.6:", when="+rheo") # propagate CUDA and ROCm architecture when +kokkos for arch in CudaPackage.cuda_arch_values: @@ -756,6 +784,12 @@ def url_for_version(self, version): sha256="3dedd807f63a21c543d1036439099f05c6031fd98e7cb1ea7825822fc074106e", when="@20220623.3:20230208 +kokkos +rocm +kspace", ) + # Fixed in https://github.com/lammps/lammps/pull/4305 + patch( + "https://github.com/lammps/lammps/commit/49bdc3e26449634f150602a66d0dab34d09dbc0e.patch?full_index=1", + sha256="b8d1f08a82329e493e040de2bde9d2291af173a0fe6c7deb24750cc22823c421", + when="@20240829 %cce", + ) # Older LAMMPS does not compile with Kokkos 4.x conflicts( @@ -873,6 +907,7 @@ def cmake_args(self): args.append(self.define_from_variant("WITH_JPEG", "jpeg")) args.append(self.define_from_variant("WITH_PNG", "png")) args.append(self.define_from_variant("WITH_FFMPEG", "ffmpeg")) + args.append(self.define_from_variant("WITH_CURL", "curl")) for pkg, params in self.supported_packages.items(): if "when" not in params or spec.satisfies(params["when"]): From c4f3348af127f2579d717d4ac6eb4eb4e8e01a2e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 8 Sep 2024 23:47:45 -0500 Subject: [PATCH 047/687] (py-)onnx: add v1.16.2; onnx: enable testing (#46274) --- var/spack/repos/builtin/packages/onnx/package.py | 12 ++++++++---- var/spack/repos/builtin/packages/py-onnx/package.py | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/onnx/package.py b/var/spack/repos/builtin/packages/onnx/package.py index 3cc781463ee7e1..ec9602c14befbe 100644 --- a/var/spack/repos/builtin/packages/onnx/package.py +++ b/var/spack/repos/builtin/packages/onnx/package.py @@ -17,9 +17,10 @@ class Onnx(CMakePackage): url = "https://github.com/onnx/onnx/archive/refs/tags/v1.9.0.tar.gz" git = "https://github.com/onnx/onnx.git" - license("Apache-2.0") + license("Apache-2.0", checked_by="wdconinc") version("master", branch="master") + version("1.16.2", sha256="84fc1c3d6133417f8a13af6643ed50983c91dacde5ffba16cc8bb39b22c2acbb") version("1.16.1", sha256="0e6aa2c0a59bb2d90858ad0040ea1807117cc2f05b97702170f18e6cd6b66fb3") version("1.16.0", sha256="0ce153e26ce2c00afca01c331a447d86fbf21b166b640551fe04258b4acfc6a4") version("1.15.0", sha256="c757132e018dd0dd171499ef74fca88b74c5430a20781ec53da19eb7f937ef68") @@ -61,7 +62,7 @@ class Onnx(CMakePackage): "1.1.0_2018-04-19", commit="7e1bed51cc508a25b22130de459830b5d5063c41" ) # py-torch@0.4.0 - depends_on("cxx", type="build") # generated + depends_on("cxx", type="build") generator("ninja") depends_on("cmake@3.1:", type="build") @@ -73,6 +74,9 @@ def patch(self): filter_file("CMAKE_CXX_STANDARD 11", "CMAKE_CXX_STANDARD 14", "CMakeLists.txt") def cmake_args(self): - # Try to get ONNX to use the same version of python as the spec is using - args = ["-DPY_VERSION={0}".format(self.spec["python"].version.up_to(2))] + args = [ + # Try to get ONNX to use the same version of python as the spec is using + self.define("PY_VERSION", self.spec["python"].version.up_to(2)), + self.define("ONNX_BUILD_TESTS", self.run_tests), + ] return args diff --git a/var/spack/repos/builtin/packages/py-onnx/package.py b/var/spack/repos/builtin/packages/py-onnx/package.py index 63f3869b94a305..c80bee5736078e 100644 --- a/var/spack/repos/builtin/packages/py-onnx/package.py +++ b/var/spack/repos/builtin/packages/py-onnx/package.py @@ -19,8 +19,9 @@ class PyOnnx(PythonPackage): homepage = "https://github.com/onnx/onnx" pypi = "Onnx/onnx-1.6.0.tar.gz" - license("Apache-2.0") + license("Apache-2.0", checked_by="wdconinc") + version("1.16.2", sha256="b33a282b038813c4b69e73ea65c2909768e8dd6cc10619b70632335daf094646") version("1.16.1", sha256="8299193f0f2a3849bfc069641aa8e4f93696602da8d165632af8ee48ec7556b6") version("1.16.0", sha256="237c6987c6c59d9f44b6136f5819af79574f8d96a760a1fa843bede11f3822f7") version("1.15.0", sha256="b18461a7d38f286618ca2a6e78062a2a9c634ce498e631e708a8041b00094825") @@ -59,6 +60,8 @@ class PyOnnx(PythonPackage): depends_on("py-numpy", type=("build", "run")) depends_on("py-numpy@1.16.6:", type=("build", "run"), when="@1.8.1:1.13") depends_on("py-numpy@1.20:", type=("build", "run"), when="@1.16.0:") + depends_on("py-numpy@1.21:", type=("build", "run"), when="@1.16.2:") + depends_on("py-numpy@:1", type=("build", "run"), when="@:1.16") # Historical dependencies depends_on("py-six", type=("build", "run"), when="@:1.8.1") From ef11fcdf346f2375f50724a477358d18ff44c2d9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 8 Sep 2024 23:48:50 -0500 Subject: [PATCH 048/687] protobuf: patch @3.22:3.24.3 when ^abseil-cpp@20240116: (#46273) --- .../repos/builtin/packages/protobuf/package.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/var/spack/repos/builtin/packages/protobuf/package.py b/var/spack/repos/builtin/packages/protobuf/package.py index 8ae36963a46300..247b4854e686f9 100644 --- a/var/spack/repos/builtin/packages/protobuf/package.py +++ b/var/spack/repos/builtin/packages/protobuf/package.py @@ -120,6 +120,22 @@ class Protobuf(CMakePackage): patch("msvc-abseil-target-namespace.patch", when="@3.22 %msvc") + # Misisng #include "absl/container/internal/layout.h" + # See https://github.com/protocolbuffers/protobuf/pull/14042 + patch( + "https://github.com/protocolbuffers/protobuf/commit/e052928c94f5a9a6a6cbdb82e09ab4ee92b7815f.patch?full_index=1", + when="@3.22:3.24.3 ^abseil-cpp@20240116:", + sha256="20e3cc99a9513b256e219653abe1bfc7d6b6a5413e269676e3d442830f99a1af", + ) + + # Missing #include "absl/strings/str_cat.h" + # See https://github.com/protocolbuffers/protobuf/pull/14054 + patch( + "https://github.com/protocolbuffers/protobuf/commit/38a24729ec94e6576a1425951c898ad0b91ad2d2.patch?full_index=1", + when="@3.22:3.24.3 ^abseil-cpp@20240116:", + sha256="c061356db31cdce29c8cdd98a3a8219ef048ebc2318d0dec26c1f2c5e5dae29b", + ) + def fetch_remote_versions(self, *args, **kwargs): """Ignore additional source artifacts uploaded with releases, only keep known versions From 74ba81368a17e47f82ffd574e53d65b4410b326b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 8 Sep 2024 23:49:35 -0500 Subject: [PATCH 049/687] py-vector: add v1.5.1 (#46271) --- var/spack/repos/builtin/packages/py-vector/package.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-vector/package.py b/var/spack/repos/builtin/packages/py-vector/package.py index de058582e471f0..fb9fe5aa95a045 100644 --- a/var/spack/repos/builtin/packages/py-vector/package.py +++ b/var/spack/repos/builtin/packages/py-vector/package.py @@ -16,8 +16,9 @@ class PyVector(PythonPackage): tags = ["hep"] - license("BSD-3-Clause") + license("BSD-3-Clause", checked_by="wdconinc") + version("1.5.1", sha256="41ec731fb67ea35af2075eb3a4d6c83ef93b580dade63010821cbc00f1b98961") version("1.5.0", sha256="77e48bd40b7e7d30a17bf79bb6ed0f2d6985d915fcb9bf0879836276a619a0a9") version("1.4.2", sha256="3805848eb9e53e9c60aa24dd5be88c842a6cd3d241e22984bfe12629b08536a9") version("1.4.1", sha256="15aef8911560db1ea3ffa9dbd5414d0ec575a504a2c3f23ea45170a18994466e") @@ -43,7 +44,7 @@ class PyVector(PythonPackage): depends_on("py-setuptools@42:", type="build") depends_on("py-setuptools-scm@3.4: +toml", type="build") depends_on("py-wheel", type="build") - depends_on("py-numpy@1.13.3:2.0", type=("build", "run")) + depends_on("py-numpy@1.13.3:", type=("build", "run")) depends_on("py-packaging@19.0:", type=("build", "run")) depends_on("py-importlib-metadata@0.22:", type=("build", "run"), when="@:1.0 ^python@:3.7") depends_on("py-typing-extensions", type=("build", "run"), when="@:1.0 ^python@:3.7") @@ -51,3 +52,6 @@ class PyVector(PythonPackage): with when("+awkward"): depends_on("py-awkward@1.2:", type=("build", "run")) depends_on("py-awkward@2:", type=("build", "run"), when="@1.5:") + + # Historical dependencies + depends_on("py-numpy@:2.0", type=("build", "run"), when="@:1.5.0") From c7139eb690131fa9b6d3bfb3f514b76b7a2b8e4d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 8 Sep 2024 23:50:30 -0500 Subject: [PATCH 050/687] wayland-protocols: add v1.37 (#46269) --- var/spack/repos/builtin/packages/wayland-protocols/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/wayland-protocols/package.py b/var/spack/repos/builtin/packages/wayland-protocols/package.py index 9f346187dade9c..20b113de243152 100644 --- a/var/spack/repos/builtin/packages/wayland-protocols/package.py +++ b/var/spack/repos/builtin/packages/wayland-protocols/package.py @@ -28,6 +28,7 @@ class WaylandProtocols(MesonPackage, AutotoolsPackage): license("MIT") + version("1.37", sha256="c3b215084eb4cf318415533554c2c2714e58ed75847d7c3a8e50923215ffbbf3") version("1.36", sha256="c839dd4325565fd59a93d6cde17335357328f66983c2e1fb03c33e92d6918b17") version("1.35", sha256="6e62dfa92ce82487d107b76064cfe2d7ca107c87c239ea9036a763d79c09105a") version("1.34", sha256="cd3cc9dedb838e6fc8f55bbeb688e8569ffac7df53bc59dbfac8acbb39267f05") From 47c771f03f9094da6f50e824fb0e12ac40f9a5c8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 8 Sep 2024 23:51:57 -0500 Subject: [PATCH 051/687] assimp: add v5.4.3, enable testing (#46267) --- .../repos/builtin/packages/assimp/package.py | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/assimp/package.py b/var/spack/repos/builtin/packages/assimp/package.py index 9fd69d85b4fb18..2e51f75e53e11e 100644 --- a/var/spack/repos/builtin/packages/assimp/package.py +++ b/var/spack/repos/builtin/packages/assimp/package.py @@ -16,9 +16,10 @@ class Assimp(CMakePackage): maintainers("wdconinc") - license("BSD-3-Clause") + license("BSD-3-Clause", checked_by="wdconinc") version("master", branch="master") + version("5.4.3", sha256="66dfbaee288f2bc43172440a55d0235dfc7bf885dda6435c038e8000e79582cb") version("5.4.2", sha256="7414861a7b038e407b510e8b8c9e58d5bf8ca76c9dfe07a01d20af388ec5086a") version("5.4.0", sha256="a90f77b0269addb2f381b00c09ad47710f2aab6b1d904f5e9a29953c30104d3f") version("5.3.1", sha256="a07666be71afe1ad4bc008c2336b7c688aca391271188eb9108d0c6db1be53f1") @@ -32,9 +33,6 @@ class Assimp(CMakePackage): version("5.0.1", sha256="11310ec1f2ad2cd46b95ba88faca8f7aaa1efe9aa12605c55e3de2b977b3dbfc") version("4.0.1", sha256="60080d8ab4daaab309f65b3cffd99f19eb1af8d05623fff469b9b652818e286e") - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated - patch( "https://patch-diff.githubusercontent.com/raw/assimp/assimp/pull/4203.patch?full_index=1", sha256="24135e88bcef205e118f7a3f99948851c78d3f3e16684104dc603439dd790d74", @@ -43,6 +41,9 @@ class Assimp(CMakePackage): variant("shared", default=True, description="Enables the build of shared libraries") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("cmake@3.10:", type="build", when="@5.1:") depends_on("cmake@3.22:", type="build", when="@5.4:") @@ -54,10 +55,10 @@ def patch(self): def cmake_args(self): args = [ - "-DASSIMP_HUNTER_ENABLED=OFF", - "-DASSIMP_BUILD_ZLIB=OFF", - "-DASSIMP_BUILD_MINIZIP=OFF", - "-DASSIMP_BUILD_TESTS=OFF", + self.define("ASSIMP_HUNTER_ENABLED", False), + self.define("ASSIMP_BUILD_ZLIB", False), + self.define("ASSIMP_BUILD_MINIZIP", False), + self.define("ASSIMP_BUILD_TESTS", self.run_tests), self.define_from_variant("BUILD_SHARED_LIBS", "shared"), ] return args @@ -67,3 +68,12 @@ def flag_handler(self, name, flags): if name == "cxxflags": flags.append(self.compiler.cxx11_flag) return (None, None, flags) + + def check(self): + unit = Executable(join_path(self.builder.build_directory, "bin", "unit")) + skipped_tests = [ + "AssimpAPITest_aiMatrix3x3.aiMatrix3FromToTest", + "AssimpAPITest_aiMatrix4x4.aiMatrix4FromToTest", + "AssimpAPITest_aiQuaternion.aiQuaternionFromNormalizedQuaternionTest", + ] + unit(f"--gtest_filter=-{':'.join(skipped_tests)}") From 216619bb531f966e6cb08607f4fdd2addbfbdde9 Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:42:16 +0530 Subject: [PATCH 052/687] namd: variant updates (#45825) * Add missing variant, already used in recipe (avxtiles) * Add memopt variant Co-authored-by: viveshar --- .../repos/builtin/packages/namd/package.py | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/namd/package.py b/var/spack/repos/builtin/packages/namd/package.py index 273835e07ef2d7..2e9fc20f7947e8 100644 --- a/var/spack/repos/builtin/packages/namd/package.py +++ b/var/spack/repos/builtin/packages/namd/package.py @@ -75,9 +75,24 @@ class Namd(MakefilePackage, CudaPackage, ROCmPackage): description="Enables Tcl and/or python interface", ) - variant("avxtiles", when="target=x86_64_v4:", default=False, description="Enable avxtiles") + variant( + "avxtiles", + when="target=x86_64_v4: @2.15:", + default=False, + description="Enable avxtiles supported with NAMD 2.15+", + ) variant("single_node_gpu", default=False, description="Single node GPU") + # Adding memopt variant to build memory-optimized mode that utilizes a compressed + # version of the molecular structure and also supports parallel I/O. + # Refer: https://www.ks.uiuc.edu/Research/namd/wiki/index.cgi?NamdMemoryReduction + variant( + "memopt", + when="@2.8:", + default=False, + description="Enable memory-optimized build supported with NAMD 2.8+", + ) + # init_tcl_pointers() declaration and implementation are inconsistent # "src/colvarproxy_namd.C", line 482: error: inherited member is not # allowed @@ -103,9 +118,13 @@ class Namd(MakefilePackage, CudaPackage, ROCmPackage): depends_on("tcl", when="interface=python") depends_on("python", when="interface=python") - conflicts("+avxtiles", when="@:2.14,3:", msg="AVXTiles algorithm requires NAMD 2.15") conflicts("+rocm", when="+cuda", msg="NAMD supports only one GPU backend at a time") conflicts("+single_node_gpu", when="~cuda~rocm") + conflicts( + "+memopt", + when="+single_node_gpu", + msg="memopt mode is not compatible with GPU-resident builds", + ) # https://www.ks.uiuc.edu/Research/namd/2.12/features.html # https://www.ks.uiuc.edu/Research/namd/2.13/features.html @@ -304,6 +323,9 @@ def edit(self, spec, prefix): if "+single_node_gpu" in spec: opts.extend(["--with-single-node-hip"]) + if spec.satisfies("+memopt"): + opts.append("--with-memopt") + config = Executable("./config") config(self.build_directory, *opts) From 1d9c8a90344237a9b0a8e87cbb1a0272df7a3f42 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Mon, 9 Sep 2024 00:19:31 -0500 Subject: [PATCH 053/687] xsdk: add amrex variant (#46190) and remove compiler conditionals [as amrex conflict with clang no longer exists since #22967] --- var/spack/repos/builtin/packages/xsdk/package.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/xsdk/package.py b/var/spack/repos/builtin/packages/xsdk/package.py index 14967eb6e64ac8..85bf27ae2b092b 100644 --- a/var/spack/repos/builtin/packages/xsdk/package.py +++ b/var/spack/repos/builtin/packages/xsdk/package.py @@ -90,6 +90,7 @@ class Xsdk(BundlePackage, CudaPackage, ROCmPackage): variant("sycl", default=False, sticky=True, description="Enable sycl variant of xsdk packages") variant("trilinos", default=True, sticky=True, description="Enable trilinos package build") variant("datatransferkit", default=True, description="Enable datatransferkit package build") + variant("amrex", default=True, description="Enable amrex package build") variant("omega-h", default=True, description="Enable omega-h package build") variant("strumpack", default=True, description="Enable strumpack package build") variant("dealii", default=True, description="Enable dealii package build") @@ -207,12 +208,8 @@ class Xsdk(BundlePackage, CudaPackage, ROCmPackage): xsdk_depends_on("magma@2.7.0", when="@0.8.0", cuda_var="?cuda", rocm_var="?rocm") xsdk_depends_on("amrex +sycl", when="@1.0.0: +sycl") - xsdk_depends_on("amrex@23.08+sundials", when="@1.0.0 %intel", cuda_var="cuda", rocm_var="rocm") - xsdk_depends_on("amrex@23.08+sundials", when="@1.0.0 %gcc", cuda_var="cuda", rocm_var="rocm") - xsdk_depends_on("amrex@23.08+sundials", when="@1.0.0 %cce", cuda_var="cuda", rocm_var="rocm") - xsdk_depends_on("amrex@22.09+sundials", when="@0.8.0 %intel", cuda_var="cuda", rocm_var="rocm") - xsdk_depends_on("amrex@22.09+sundials", when="@0.8.0 %gcc", cuda_var="cuda", rocm_var="rocm") - xsdk_depends_on("amrex@22.09+sundials", when="@0.8.0 %cce", cuda_var="cuda", rocm_var="rocm") + xsdk_depends_on("amrex@23.08+sundials", when="@1.0.0 +amrex", cuda_var="cuda", rocm_var="rocm") + xsdk_depends_on("amrex@22.09+sundials", when="@0.8.0 +amrex", cuda_var="cuda", rocm_var="rocm") xsdk_depends_on("slepc@3.20.0", when="@1.0.0", cuda_var="cuda", rocm_var="rocm") xsdk_depends_on("slepc@3.18.1", when="@0.8.0", cuda_var="cuda", rocm_var="rocm") From 4c6b3ccb409b838afc442e98a6a5552d81bda0fc Mon Sep 17 00:00:00 2001 From: Paul Ferrell <51765748+Paul-Ferrell@users.noreply.github.com> Date: Sun, 8 Sep 2024 23:26:20 -0600 Subject: [PATCH 054/687] charliecloud: fix libsquashfuse dependency type (#46189) Should have been a link depenedency, not a build dependency. --- var/spack/repos/builtin/packages/charliecloud/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/charliecloud/package.py b/var/spack/repos/builtin/packages/charliecloud/package.py index 2f4497ac18f295..3d2b4dabc3a941 100644 --- a/var/spack/repos/builtin/packages/charliecloud/package.py +++ b/var/spack/repos/builtin/packages/charliecloud/package.py @@ -150,9 +150,9 @@ class Charliecloud(AutotoolsPackage): with when("+squashfuse"): depends_on("libfuse@3:", type=("build", "run", "link"), when="@0.32:") depends_on("pkgconfig", type="build", when="@0.37:") - depends_on("squashfuse@0.1.105:0.2.0,0.4.0:", type="build", when="@0.36:") - depends_on("squashfuse@0.1.105:0.2.0,0.4.0", type="build", when="@0.35") - depends_on("squashfuse@0.1.105", type="build", when="@0.32:0.34") + depends_on("squashfuse@0.1.105:0.2.0,0.4.0:", type="link", when="@0.36:") + depends_on("squashfuse@0.1.105:0.2.0,0.4.0", type="link", when="@0.35") + depends_on("squashfuse@0.1.105", type="link", when="@0.32:0.34") def autoreconf(self, spec, prefix): which("bash")("autogen.sh") From 18218d732a403906f5a4da2a5a9aaf6e4696dd08 Mon Sep 17 00:00:00 2001 From: Eric Berquist <727571+berquist@users.noreply.github.com> Date: Mon, 9 Sep 2024 01:28:53 -0400 Subject: [PATCH 055/687] intel-pin: add up to v3.31 (#46185) --- .../builtin/packages/intel-pin/package.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/var/spack/repos/builtin/packages/intel-pin/package.py b/var/spack/repos/builtin/packages/intel-pin/package.py index c884312358427f..b1acaf43de84f2 100644 --- a/var/spack/repos/builtin/packages/intel-pin/package.py +++ b/var/spack/repos/builtin/packages/intel-pin/package.py @@ -18,6 +18,26 @@ class IntelPin(Package): license("MIT") + version( + "3.31", + sha256="82216144e3df768f0203b671ff48605314f13266903eb42dac01b91310eba956", + url="https://software.intel.com/sites/landingpage/pintool/downloads/pin-external-3.31-98869-gfa6f126a8-gcc-linux.tar.gz", + ) + version( + "3.30", + sha256="be4f1130445c3fc4d83b7afad85c421d418f60013c33e8ee457bc7c9c194de1b", + url="https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.30-98830-g1d7b601b3-gcc-linux.tar.gz", + ) + version( + "3.29", + sha256="45c2a68d4b2184117584a55db17b44c86f9476e9cb8109b2fae50a965b1ea64f", + url="https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.29-98790-g1a445fcd1-gcc-linux.tar.gz", + ) + version( + "3.28", + sha256="5a5a3337f3f16176b97edcd3366b561936e1068fba4ebcfed4b836d81d45847b", + url="https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.28-98749-g6643ecee5-gcc-linux.tar.gz", + ) version( "3.27", sha256="e7d44d25668632007d5a109e5033415e91db543b8ce9e665893a05e852b67707", From 66ee4caeab3dd155d62730a38968d5eae9f4934b Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Mon, 9 Sep 2024 00:32:14 -0500 Subject: [PATCH 056/687] nekrs: add v23.0, add new build system (#45992) --- .../repos/builtin/packages/nekrs/package.py | 74 +++++++++++++------ 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/var/spack/repos/builtin/packages/nekrs/package.py b/var/spack/repos/builtin/packages/nekrs/package.py index 1472bd26c46bcf..3376682772fee9 100644 --- a/var/spack/repos/builtin/packages/nekrs/package.py +++ b/var/spack/repos/builtin/packages/nekrs/package.py @@ -5,16 +5,19 @@ import os +import spack.build_systems.cmake +import spack.build_systems.generic from spack.package import * -class Nekrs(Package, CudaPackage, ROCmPackage): +class Nekrs(Package, CMakePackage, CudaPackage, ROCmPackage): """nekRS is an open-source Navier Stokes solver based on the spectral element method targeting classical processors and hardware accelerators like GPUs""" homepage = "https://github.com/Nek5000/nekRS" git = "https://github.com/Nek5000/nekRS.git" + url = "https://github.com/Nek5000/nekRS/archive/refs/tags/v23.0.tar.gz" tags = [ "cfd", @@ -32,6 +35,11 @@ class Nekrs(Package, CudaPackage, ROCmPackage): license("BSD-3-Clause") + build_system( + conditional("cmake", when="@23.0:"), conditional("generic", when="@=21.0"), default="cmake" + ) + + version("23.0", sha256="2cb4ded69551b9614036e1a9d5ac54c8535826eae8f8b6a00ddb89043b2c392a") version("21.0", tag="v21.0", commit="bcd890bf3f9fb4d91224c83aeda75c33570f1eaa") depends_on("c", type="build") # generated @@ -52,17 +60,35 @@ class Nekrs(Package, CudaPackage, ROCmPackage): depends_on("git") depends_on("cmake") - @run_before("install") - def fortran_check(self): - if not self.compiler.f77: - msg = "Cannot build NekRS without a Fortran 77 compiler." - raise RuntimeError(msg) + def patch(self): + with working_dir("scripts"): + # Make sure nekmpi wrapper uses srun when we know OpenMPI + # is not built with mpiexec + if self.spec.satisfies("^openmpi~legacylaunchers"): + filter_file(r"mpirun -np", "srun -n", "nrsmpi") + filter_file(r"mpirun -np", "srun -n", "nrspre") + filter_file(r"mpirun -np", "srun -n", "nrsbmpi") + + def setup_run_environment(self, env): + # The 'env' is included in the Spack generated module files. + spec = self.spec + env.set("OCCA_CXX", self.compiler.cxx) + + cxxflags = spec.compiler_flags["cxxflags"] + if cxxflags: + # Run-time compiler flags: + env.set("OCCA_CXXFLAGS", " ".join(cxxflags)) - # Following 4 methods are stolen from OCCA since we are using OCCA - # shipped with nekRS. + if "+cuda" in spec: + cuda_dir = spec["cuda"].prefix + # Run-time CUDA compiler: + env.set("OCCA_CUDA_COMPILER", join_path(cuda_dir, "bin", "nvcc")) + + +class SetupEnvironment: def _setup_runtime_flags(self, s_env): spec = self.spec - s_env.set("OCCA_CXX", self.compiler.cxx) + s_env.set("OCCA_CXX", self.pkg.compiler.cxx) cxxflags = spec.compiler_flags["cxxflags"] if cxxflags: @@ -111,26 +137,14 @@ def setup_build_environment(self, env): env.set("OCCA_VERBOSE", "1") self._setup_runtime_flags(env) - def setup_run_environment(self, env): - # The 'env' is included in the Spack generated module files. - self._setup_runtime_flags(env) - def setup_dependent_build_environment(self, env, dependent_spec): # Export OCCA_* variables for everyone using this package from within # Spack. self._setup_runtime_flags(env) - def install(self, spec, prefix): - script_dir = "scripts" - - with working_dir(script_dir): - # Make sure nekmpi wrapper uses srun when we know OpenMPI - # is not built with mpiexec - if "^openmpi~legacylaunchers" in spec: - filter_file(r"mpirun -np", "srun -n", "nrsmpi") - filter_file(r"mpirun -np", "srun -n", "nrspre") - filter_file(r"mpirun -np", "srun -n", "nrsbmpi") +class GenericBuilder(spack.build_systems.generic.GenericBuilder): + def install(self, pkg, spec, prefix): makenrs = Executable(os.path.join(os.getcwd(), "makenrs")) makenrs.add_default_env("NEKRS_INSTALL_DIR", prefix) @@ -140,3 +154,17 @@ def install(self, spec, prefix): makenrs.add_default_env("TRAVIS", "true") makenrs(output=str, error=str, fail_on_error=True) + + +class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): + def cmake_args(self): + cxxflags = self.spec.compiler_flags["cxxflags"] + args = [ + self.define("CMAKE_CXX_COMPILER", self.spec["mpi"].mpicxx), + self.define("NEKRS_COMPILER_FLAGS", cxxflags), + self.define("OCCA_CXXFLAGS", cxxflags), + self.define_from_variant("ENABLE_CUDA", "cuda"), + self.define_from_variant("ENABLE_OPENCL", "opencl"), + self.define_from_variant("ENABLE_HIP", "rocm"), + ] + return args From 9bdc97043e021245611d0e62a2c3609c1b388dcb Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 9 Sep 2024 08:42:09 +0200 Subject: [PATCH 057/687] PyTorch: unpin pybind11 dependency (#46266) --- var/spack/repos/builtin/packages/py-torch/package.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py index 830aa41e7052a4..9af10cb65a39d2 100644 --- a/var/spack/repos/builtin/packages/py-torch/package.py +++ b/var/spack/repos/builtin/packages/py-torch/package.py @@ -230,12 +230,12 @@ class PyTorch(PythonPackage, CudaPackage, ROCmPackage): depends_on("pthreadpool@2020-10-05", when="@1.8") depends_on("pthreadpool@2020-06-15", when="@1.6:1.7") with default_args(type=("build", "link", "run")): - depends_on("py-pybind11@2.12.0", when="@2.3:") - depends_on("py-pybind11@2.11.0", when="@2.1:2.2") - depends_on("py-pybind11@2.10.1", when="@2.0") - depends_on("py-pybind11@2.10.0", when="@1.13:1") - depends_on("py-pybind11@2.6.2", when="@1.8:1.12") - depends_on("py-pybind11@2.3.0", when="@:1.7") + depends_on("py-pybind11@2.12.0:", when="@2.3:") + depends_on("py-pybind11@2.11.0:", when="@2.1:2.2") + depends_on("py-pybind11@2.10.1:", when="@2.0") + depends_on("py-pybind11@2.10.0:", when="@1.13:1") + depends_on("py-pybind11@2.6.2:", when="@1.8:1.12") + depends_on("py-pybind11@2.3.0:", when="@:1.7") depends_on("sleef@3.6.0_2024-03-20", when="@2.4:") depends_on("sleef@3.5.1_2020-12-22", when="@1.8:2.3") depends_on("sleef@3.4.0_2019-07-30", when="@1.6:1.7") From 2502a3c2b647e71b1643eab0e11b4b8eeb1b1122 Mon Sep 17 00:00:00 2001 From: Jordan Galby <67924449+Jordan474@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:42:04 +0200 Subject: [PATCH 058/687] Fix regression in spec format string for indiviual variants (#46206) Fix a regression in {variants.X} and {variants.X.value} spec format strings. --- lib/spack/spack/spec.py | 7 +++++-- lib/spack/spack/test/spec_semantics.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 0c869febb175d9..e420eaada960ab 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -3914,9 +3914,12 @@ def format_attribute(match_object: Match) -> str: if part.startswith("_"): raise SpecFormatStringError("Attempted to format private attribute") else: - if part == "variants" and isinstance(current, VariantMap): + if isinstance(current, VariantMap): # subscript instead of getattr for variant names - current = current[part] + try: + current = current[part] + except KeyError: + raise SpecFormatStringError(f"Variant '{part}' does not exist") else: # aliases if part == "arch": diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index cd0f930acd8263..0f3b58e4862799 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -741,6 +741,13 @@ def test_spec_formatting(self, default_mock_concretization): ("{/hash}", "/", lambda s: "/" + s.dag_hash()), ] + variants_segments = [ + ("{variants.debug}", spec, "debug"), + ("{variants.foo}", spec, "foo"), + ("{^pkg-a.variants.bvv}", spec["pkg-a"], "bvv"), + ("{^pkg-a.variants.foo}", spec["pkg-a"], "foo"), + ] + other_segments = [ ("{spack_root}", spack.paths.spack_root), ("{spack_install}", spack.store.STORE.layout.root), @@ -768,6 +775,12 @@ def check_prop(check_spec, fmt_str, prop, getter): callpath, fmt_str = depify("callpath", named_str, sigil) assert spec.format(fmt_str) == getter(callpath) + for named_str, test_spec, variant_name in variants_segments: + assert test_spec.format(named_str) == str(test_spec.variants[variant_name]) + assert test_spec.format(named_str[:-1] + ".value}") == str( + test_spec.variants[variant_name].value + ) + for named_str, expected in other_segments: actual = spec.format(named_str) assert expected == actual @@ -827,6 +840,7 @@ def test_spec_formatting_sigil_mismatches(self, default_mock_concretization, fmt r"{dag_hash}", r"{foo}", r"{+variants.debug}", + r"{variants.this_variant_does_not_exist}", ], ) def test_spec_formatting_bad_formats(self, default_mock_concretization, fmt_str): From 3ff441c5b058dd8ba8185b2e26a1e938f3c749a1 Mon Sep 17 00:00:00 2001 From: Teague Sterling Date: Mon, 9 Sep 2024 02:08:34 -0700 Subject: [PATCH 059/687] perl-graphviz: add graphviz dependency (#46268) Signed-off-by: Teague Sterling --- var/spack/repos/builtin/packages/perl-graphviz/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/perl-graphviz/package.py b/var/spack/repos/builtin/packages/perl-graphviz/package.py index ae67fe9aa801ff..2b882c584c6f51 100644 --- a/var/spack/repos/builtin/packages/perl-graphviz/package.py +++ b/var/spack/repos/builtin/packages/perl-graphviz/package.py @@ -18,6 +18,7 @@ class PerlGraphviz(PerlPackage): version("2.26", sha256="9a5d2520b3262bf30475272dd764a445f8e7f931bef88be0e3d3bff445da7328") + depends_on("graphviz", type=("build", "run", "test")) depends_on("perl-file-which@1.09:", type=("build", "run", "test")) depends_on("perl-ipc-run@0.6:", type=("build", "run", "test")) depends_on("perl-libwww-perl", type=("build", "run", "test")) From 98e35f7232a2cd81f439e298f9a95b358a01f51e Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Mon, 9 Sep 2024 14:30:32 +0200 Subject: [PATCH 060/687] pika: Add conflict with fmt 11 and newer (#46280) --- var/spack/repos/builtin/packages/pika/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/pika/package.py b/var/spack/repos/builtin/packages/pika/package.py index 466212e1c69ccd..4916681eaf2385 100644 --- a/var/spack/repos/builtin/packages/pika/package.py +++ b/var/spack/repos/builtin/packages/pika/package.py @@ -126,6 +126,8 @@ class Pika(CMakePackage, CudaPackage, ROCmPackage): # https://github.com/pika-org/pika/issues/686 conflicts("^fmt@10:", when="@:0.15 +cuda") conflicts("^fmt@10:", when="@:0.15 +rocm") + # https://github.com/pika-org/pika/pull/1074 + conflicts("^fmt@11:", when="@:0.23") depends_on("spdlog@1.9.2:", when="@0.25:") depends_on("hwloc@1.11.5:") # https://github.com/pika-org/pika/issues/1223 From 67089b967e34408c019ecbcb85ea437370939c2b Mon Sep 17 00:00:00 2001 From: Pierre Augier Date: Mon, 9 Sep 2024 16:47:44 +0200 Subject: [PATCH 061/687] Add new package py-fluiddyn (#46235) --- .../builtin/packages/py-fluiddyn/package.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-fluiddyn/package.py diff --git a/var/spack/repos/builtin/packages/py-fluiddyn/package.py b/var/spack/repos/builtin/packages/py-fluiddyn/package.py new file mode 100644 index 00000000000000..af76b817057ca8 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluiddyn/package.py @@ -0,0 +1,42 @@ +# Copyright 2013-2024 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 PyFluiddyn(PythonPackage): + """Framework for studying fluid dynamics.""" + + pypi = "fluiddyn/fluiddyn-0.6.5.tar.gz" + + maintainers("paugier") + + license("CECILL-B", checked_by="paugier") + + version("0.6.5", sha256="ad0df4c05855bd2ae702731983d310bfbb13802874ce83e2da6454bb7100b5df") + version("0.6.4", sha256="576eb0fa50012552b3a68dd17e81ce4f08ddf1e276812b02316016bb1c3a1342") + version("0.6.3", sha256="3c4c57ac8e48c55498aeafaf8b26daecefc03e6ac6e2c03a591e0f7fec13bb69") + version("0.6.2", sha256="40f772cfdf111797ae1c6cf7b67272207f2bc7c4f599085634cc1d74eb748ee5") + version("0.6.1", sha256="af75ed3adfaaa0f0d82822619ced2f9e0611ad15351c9cdbc1d802d67249c3de") + version("0.6.0", sha256="47ad53b3723487d3711ec4ea16bca2d7c270b5c5c5a0255f7684558d7397850e") + + depends_on("python@3.9:", type=("build", "run")) + depends_on("py-pdm-backend", type="build") + + with default_args(type="run"): + depends_on("py-numpy") + depends_on("py-matplotlib") + depends_on("py-h5py") + depends_on("py-h5netcdf") + depends_on("py-distro") + depends_on("py-simpleeval@0.9.13:") + depends_on("py-psutil@5.2.1:") + depends_on("py-ipython") + depends_on("py-scipy") + + with default_args(type="test"): + depends_on("py-pytest") + depends_on("py-pytest-allclose") + depends_on("py-pytest-mock") From 9059756a110106371c461390306c03cda942a533 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 9 Sep 2024 17:26:30 +0200 Subject: [PATCH 062/687] reindex: do not assume fixed layout (#46170) `spack reindex` relies on projections from configuration to locate installed specs and prefixes. This is problematic because config can change over time, and we have reasons to do so when turning compilers into depedencies (removing `{compiler.name}-{compiler.version}` from projections) This commit makes reindex recursively search for .spack/ metadirs. --- lib/spack/docs/conf.py | 1 + lib/spack/spack/database.py | 214 +++++++++++++++++----------- lib/spack/spack/directory_layout.py | 122 ++++++++-------- lib/spack/spack/test/cmd/reindex.py | 20 ++- lib/spack/spack/test/database.py | 60 +++++++- lib/spack/spack/traverse.py | 9 +- 6 files changed, 274 insertions(+), 152 deletions(-) diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 9819d6f4d3039f..95b711db93f725 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -218,6 +218,7 @@ def setup(sphinx): ("py:class", "spack.spec.SpecfileReaderBase"), ("py:class", "spack.install_test.Pb"), ("py:class", "spack.filesystem_view.SimpleFilesystemView"), + ("py:class", "spack.traverse.EdgeAndDepth"), ] # The reST default role (used for this markup: `text`) to use for all documents. diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index 2b0c4f4c37ee15..404288ff83ae1b 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -207,7 +207,7 @@ class InstallRecord: def __init__( self, spec: "spack.spec.Spec", - path: str, + path: Optional[str], installed: bool, ref_count: int = 0, explicit: bool = False, @@ -845,7 +845,7 @@ def check(cond, msg): ): tty.warn(f"Spack database version changed from {version} to {_DB_VERSION}. Upgrading.") - self.reindex(spack.store.STORE.layout) + self.reindex() installs = dict( (k, v.to_dict(include_fields=self._record_fields)) for k, v in self._data.items() ) @@ -918,8 +918,6 @@ def reindex(self): if self.is_upstream: raise UpstreamDatabaseLockingError("Cannot reindex an upstream database") - error: Optional[CorruptDatabaseError] = None - # Special transaction to avoid recursive reindex calls and to # ignore errors if we need to rebuild a corrupt database. def _read_suppress_error(): @@ -927,99 +925,116 @@ def _read_suppress_error(): if os.path.isfile(self._index_path): self._read_from_file(self._index_path) except CorruptDatabaseError as e: - nonlocal error - error = e + tty.warn(f"Reindexing corrupt database, error was: {e}") self._data = {} self._installed_prefixes = set() - transaction = lk.WriteTransaction( - self.lock, acquire=_read_suppress_error, release=self._write - ) - - with transaction: - if error is not None: - tty.warn(f"Spack database was corrupt. Will rebuild. Error was: {error}") - - old_data = self._data - old_installed_prefixes = self._installed_prefixes + with lk.WriteTransaction(self.lock, acquire=_read_suppress_error, release=self._write): + old_installed_prefixes, self._installed_prefixes = self._installed_prefixes, set() + old_data, self._data = self._data, {} try: - self._construct_from_directory_layout(old_data) + self._reindex(old_data) except BaseException: # If anything explodes, restore old data, skip write. self._data = old_data self._installed_prefixes = old_installed_prefixes raise - def _construct_entry_from_directory_layout( - self, - old_data: Dict[str, InstallRecord], - spec: "spack.spec.Spec", - deprecator: Optional["spack.spec.Spec"] = None, - ): - # Try to recover explicit value from old DB, but - # default it to True if DB was corrupt. This is - # just to be conservative in case a command like - # "autoremove" is run by the user after a reindex. - tty.debug(f"Reconstructing from spec file: {spec}") - explicit = True - inst_time = os.stat(spec.prefix).st_ctime - if old_data is not None: - old_info = old_data.get(spec.dag_hash()) - if old_info is not None: - explicit = old_info.explicit - inst_time = old_info.installation_time - - self._add(spec, explicit=explicit, installation_time=inst_time) - if deprecator: - self._deprecate(spec, deprecator) - - def _construct_from_directory_layout(self, old_data: Dict[str, InstallRecord]): - # Read first the spec files in the prefixes. They should be considered authoritative with - # respect to DB reindexing, as entries in the DB may be corrupted in a way that still makes - # them readable. If we considered DB entries authoritative instead, we would perpetuate - # errors over a reindex. - assert self.layout is not None, "Cannot reindex a database without a known layout" - with self.layout.disable_upstream_check(): - # Initialize data in the reconstructed DB - self._data = {} - self._installed_prefixes = set() - - # Start inspecting the installed prefixes - processed_specs = set() - - for spec in self.layout.all_specs(): - self._construct_entry_from_directory_layout(old_data, spec) - processed_specs.add(spec) - - for spec, deprecator in self.layout.all_deprecated_specs(): - self._construct_entry_from_directory_layout(old_data, spec, deprecator) - processed_specs.add(spec) - - for entry in old_data.values(): - # We already took care of this spec using spec file from its prefix. - if entry.spec in processed_specs: - tty.debug( - f"Skipping reconstruction from old db: {entry.spec}" - " [already reconstructed from spec file]" - ) - continue + def _reindex(self, old_data: Dict[str, InstallRecord]): + # Specs on the file system are the source of truth for record.spec. The old database values + # if available are the source of truth for the rest of the record. + assert self.layout, "Database layout must be set to reindex" - # If we arrived here it very likely means that we have external specs that are not - # dependencies of other specs. This may be the case for externally installed - # compilers or externally installed applications. - tty.debug(f"Reconstructing from old db: {entry.spec}") - try: - self._add( - spec=entry.spec, - explicit=entry.explicit, - installation_time=entry.installation_time, - ) - processed_specs.add(entry.spec) - except Exception as e: - # Something went wrong, so the spec was not restored from old data - tty.debug(e) + specs_from_fs = self.layout.all_specs() + deprecated_for = self.layout.deprecated_for(specs_from_fs) + + known_specs: List[spack.spec.Spec] = [ + *specs_from_fs, + *(deprecated for _, deprecated in deprecated_for), + *(rec.spec for rec in old_data.values()), + ] + + upstream_hashes = { + dag_hash for upstream in self.upstream_dbs for dag_hash in upstream._data + } + upstream_hashes.difference_update(spec.dag_hash() for spec in known_specs) + + def create_node(edge: spack.spec.DependencySpec, is_upstream: bool): + if is_upstream: + return + + self._data[edge.spec.dag_hash()] = InstallRecord( + spec=edge.spec.copy(deps=False), + path=edge.spec.external_path if edge.spec.external else None, + installed=edge.spec.external, + ) - self._check_ref_counts() + # Store all nodes of known specs, excluding ones found in upstreams + tr.traverse_breadth_first_with_visitor( + known_specs, + tr.CoverNodesVisitor( + NoUpstreamVisitor(upstream_hashes, create_node), key=tr.by_dag_hash + ), + ) + + # Store the prefix and other information for specs were found on the file system + for s in specs_from_fs: + record = self._data[s.dag_hash()] + record.path = s.prefix + record.installed = True + record.explicit = True # conservative assumption + record.installation_time = os.stat(s.prefix).st_ctime + + # Deprecate specs + for new, old in deprecated_for: + self._data[old.dag_hash()].deprecated_for = new.dag_hash() + + # Copy data we have from the old database + for old_record in old_data.values(): + record = self._data[old_record.spec.dag_hash()] + record.explicit = old_record.explicit + record.installation_time = old_record.installation_time + record.origin = old_record.origin + record.deprecated_for = old_record.deprecated_for + + # Warn when the spec has been removed from the file system (i.e. it was not detected) + if not record.installed and old_record.installed: + tty.warn( + f"Spec {old_record.spec.short_spec} was marked installed in the database " + "but was not found on the file system. It is now marked as missing." + ) + + def create_edge(edge: spack.spec.DependencySpec, is_upstream: bool): + if not edge.parent: + return + parent_record = self._data[edge.parent.dag_hash()] + if is_upstream: + upstream, child_record = self.query_by_spec_hash(edge.spec.dag_hash()) + assert upstream and child_record, "Internal error: upstream spec not found" + else: + child_record = self._data[edge.spec.dag_hash()] + parent_record.spec._add_dependency( + child_record.spec, depflag=edge.depflag, virtuals=edge.virtuals + ) + + # Then store edges + tr.traverse_breadth_first_with_visitor( + known_specs, + tr.CoverEdgesVisitor( + NoUpstreamVisitor(upstream_hashes, create_edge), key=tr.by_dag_hash + ), + ) + + # Finally update the ref counts + for record in self._data.values(): + for dep in record.spec.dependencies(deptype=_TRACKED_DEPENDENCIES): + dep_record = self._data.get(dep.dag_hash()) + if dep_record: # dep might be upstream + dep_record.ref_count += 1 + if record.deprecated_for: + self._data[record.deprecated_for].ref_count += 1 + + self._check_ref_counts() def _check_ref_counts(self): """Ensure consistency of reference counts in the DB. @@ -1199,7 +1214,7 @@ def _add( for dep in spec.edges_to_dependencies(depflag=_TRACKED_DEPENDENCIES): dkey = dep.spec.dag_hash() upstream, record = self.query_by_spec_hash(dkey) - assert record, f"Missing dependency {dep.spec} in DB" + assert record, f"Missing dependency {dep.spec.short_spec} in DB" new_spec._add_dependency(record.spec, depflag=dep.depflag, virtuals=dep.virtuals) if not upstream: record.ref_count += 1 @@ -1711,6 +1726,33 @@ def update_explicit(self, spec, explicit): rec.explicit = explicit +class NoUpstreamVisitor: + """Gives edges to upstream specs, but does follow edges from upstream specs.""" + + def __init__( + self, + upstream_hashes: Set[str], + on_visit: Callable[["spack.spec.DependencySpec", bool], None], + ): + self.upstream_hashes = upstream_hashes + self.on_visit = on_visit + + def accept(self, item: tr.EdgeAndDepth) -> bool: + self.on_visit(item.edge, self.is_upstream(item)) + return True + + def is_upstream(self, item: tr.EdgeAndDepth) -> bool: + return item.edge.spec.dag_hash() in self.upstream_hashes + + def neighbors(self, item: tr.EdgeAndDepth): + # Prune edges from upstream nodes, only follow database tracked dependencies + return ( + [] + if self.is_upstream(item) + else item.edge.spec.edges_to_dependencies(depflag=_TRACKED_DEPENDENCIES) + ) + + class UpstreamDatabaseLockingError(SpackError): """Raised when an operation would need to lock an upstream database""" diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index b094012fa6dcaf..7b715d14d3e4dd 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -4,14 +4,12 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import errno -import glob import os -import posixpath import re import shutil import sys -from contextlib import contextmanager from pathlib import Path +from typing import List, Optional, Tuple import llnl.util.filesystem as fs from llnl.util.symlink import readlink @@ -33,6 +31,42 @@ def _check_concrete(spec): raise ValueError("Specs passed to a DirectoryLayout must be concrete!") +def _get_spec(prefix: str) -> Optional["spack.spec.Spec"]: + """Returns a spec if the prefix contains a spec file in the .spack subdir""" + for f in ("spec.json", "spec.yaml"): + try: + return spack.spec.Spec.from_specfile(os.path.join(prefix, ".spack", f)) + except Exception: + continue + return None + + +def specs_from_metadata_dirs(root: str) -> List["spack.spec.Spec"]: + stack = [root] + specs = [] + + while stack: + prefix = stack.pop() + + spec = _get_spec(prefix) + + if spec: + spec.prefix = prefix + specs.append(spec) + continue + + try: + scandir = os.scandir(prefix) + except OSError: + continue + + with scandir as entries: + for entry in entries: + if entry.is_dir(follow_symlinks=False): + stack.append(entry.path) + return specs + + class DirectoryLayout: """A directory layout is used to associate unique paths with specs. Different installations are going to want different layouts for their @@ -184,12 +218,6 @@ def deprecated_file_path(self, deprecated_spec, deprecator_spec=None): return yaml_path if os.path.exists(yaml_path) else json_path - @contextmanager - def disable_upstream_check(self): - self.check_upstream = False - yield - self.check_upstream = True - def metadata_path(self, spec): return os.path.join(spec.prefix, self.metadata_dir) @@ -244,53 +272,6 @@ def ensure_installed(self, spec): "Spec file in %s does not match hash!" % spec_file_path ) - def all_specs(self): - if not os.path.isdir(self.root): - return [] - - specs = [] - for _, path_scheme in self.projections.items(): - path_elems = ["*"] * len(path_scheme.split(posixpath.sep)) - # NOTE: Does not validate filename extension; should happen later - path_elems += [self.metadata_dir, "spec.json"] - pattern = os.path.join(self.root, *path_elems) - spec_files = glob.glob(pattern) - if not spec_files: # we're probably looking at legacy yaml... - path_elems += [self.metadata_dir, "spec.yaml"] - pattern = os.path.join(self.root, *path_elems) - spec_files = glob.glob(pattern) - specs.extend([self.read_spec(s) for s in spec_files]) - return specs - - def all_deprecated_specs(self): - if not os.path.isdir(self.root): - return [] - - deprecated_specs = set() - for _, path_scheme in self.projections.items(): - path_elems = ["*"] * len(path_scheme.split(posixpath.sep)) - # NOTE: Does not validate filename extension; should happen later - path_elems += [ - self.metadata_dir, - self.deprecated_dir, - "*_spec.*", - ] # + self.spec_file_name] - pattern = os.path.join(self.root, *path_elems) - spec_files = glob.glob(pattern) - get_depr_spec_file = lambda x: os.path.join( - os.path.dirname(os.path.dirname(x)), self.spec_file_name - ) - deprecated_specs |= set( - (self.read_spec(s), self.read_spec(get_depr_spec_file(s))) for s in spec_files - ) - return deprecated_specs - - def specs_by_hash(self): - by_hash = {} - for spec in self.all_specs(): - by_hash[spec.dag_hash()] = spec - return by_hash - def path_for_spec(self, spec): """Return absolute path from the root to a directory for the spec.""" _check_concrete(spec) @@ -356,6 +337,35 @@ def remove_install_directory(self, spec, deprecated=False): raise e path = os.path.dirname(path) + def all_specs(self) -> List["spack.spec.Spec"]: + """Returns a list of all specs detected in self.root, detected by `.spack` directories. + Their prefix is set to the directory containing the `.spack` directory. Note that these + specs may follow a different layout than the current layout if it was changed after + installation.""" + return specs_from_metadata_dirs(self.root) + + def deprecated_for( + self, specs: List["spack.spec.Spec"] + ) -> List[Tuple["spack.spec.Spec", "spack.spec.Spec"]]: + """Returns a list of tuples of specs (new, old) where new is deprecated for old""" + spec_with_deprecated = [] + for spec in specs: + try: + deprecated = os.scandir( + os.path.join(str(spec.prefix), self.metadata_dir, self.deprecated_dir) + ) + except OSError: + continue + + with deprecated as entries: + for entry in entries: + try: + deprecated_spec = spack.spec.Spec.from_specfile(entry.path) + spec_with_deprecated.append((spec, deprecated_spec)) + except Exception: + continue + return spec_with_deprecated + class DirectoryLayoutError(SpackError): """Superclass for directory layout errors.""" diff --git a/lib/spack/spack/test/cmd/reindex.py b/lib/spack/spack/test/cmd/reindex.py index 6e48a3c21c3ea5..abaaf4530c0ca7 100644 --- a/lib/spack/spack/test/cmd/reindex.py +++ b/lib/spack/spack/test/cmd/reindex.py @@ -55,12 +55,24 @@ def test_reindex_with_deprecated_packages( deprecate("-y", "libelf@0.8.12", "libelf@0.8.13") - all_installed = spack.store.STORE.db.query(installed=any) - non_deprecated = spack.store.STORE.db.query(installed=True) + db = spack.store.STORE.db + + all_installed = db.query(installed=any) + non_deprecated = db.query(installed=True) _clear_db(tmp_path) reindex() - assert spack.store.STORE.db.query(installed=any) == all_installed - assert spack.store.STORE.db.query(installed=True) == non_deprecated + assert db.query(installed=any) == all_installed + assert db.query(installed=True) == non_deprecated + + old_libelf = db.query_local_by_spec_hash( + db.query_local("libelf@0.8.12", installed=any)[0].dag_hash() + ) + new_libelf = db.query_local_by_spec_hash( + db.query_local("libelf@0.8.13", installed=True)[0].dag_hash() + ) + assert old_libelf.deprecated_for == new_libelf.spec.dag_hash() + assert new_libelf.deprecated_for is None + assert new_libelf.ref_count == 1 diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index d1d4917179af17..5e8e5abbc85954 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -7,6 +7,7 @@ import functools import json import os +import re import shutil import sys @@ -982,9 +983,12 @@ def test_reindex_removed_prefix_is_not_installed(mutable_database, mock_store, c # Reindex should pick up libelf as a dependency of libdwarf spack.store.STORE.reindex() - # Reindexing should warn about libelf not being found on the filesystem - err = capfd.readouterr()[1] - assert "this directory does not contain an installation of the spec" in err + # Reindexing should warn about libelf not found on the filesystem + assert re.search( + "libelf@0.8.13.+ was marked installed in the database " + "but was not found on the file system", + capfd.readouterr().err, + ) # And we should still have libelf in the database, but not installed. assert not mutable_database.query_one("libelf", installed=True) @@ -1124,3 +1128,53 @@ def test_database_errors_with_just_a_version_key(tmp_path): with pytest.raises(spack.database.InvalidDatabaseVersionError): spack.database.Database(root).query_local() + + +def test_reindex_with_upstreams(tmp_path, monkeypatch, mock_packages, config): + # Reindexing should not put install records of upstream entries into the local database. Here + # we install `mpileaks` locally with dependencies in the upstream. And we even install + # `mpileaks` with the same hash in the upstream. After reindexing, `mpileaks` should still be + # in the local db, and `callpath` should not. + mpileaks = spack.spec.Spec("mpileaks").concretized() + callpath = mpileaks.dependencies("callpath")[0] + + upstream_store = spack.store.create( + {"config": {"install_tree": {"root": str(tmp_path / "upstream")}}} + ) + monkeypatch.setattr(spack.store, "STORE", upstream_store) + callpath.package.do_install(fake=True) + + local_store = spack.store.create( + { + "config": {"install_tree": {"root": str(tmp_path / "local")}}, + "upstreams": {"my-upstream": {"install_tree": str(tmp_path / "upstream")}}, + } + ) + monkeypatch.setattr(spack.store, "STORE", local_store) + mpileaks.package.do_install(fake=True) + + # Sanity check that callpath is from upstream. + assert not local_store.db.query_local("callpath") + assert local_store.db.query("callpath") + + # Install mpileaks also upstream with the same hash to ensure that determining upstreamness + # checks local installs before upstream databases, even when the local database is being + # reindexed. + monkeypatch.setattr(spack.store, "STORE", upstream_store) + mpileaks.package.do_install(fake=True) + + # Delete the local database + shutil.rmtree(local_store.db.database_directory) + + # Create a new instance s.t. we don't have cached specs in memory + reindexed_local_store = spack.store.create( + { + "config": {"install_tree": {"root": str(tmp_path / "local")}}, + "upstreams": {"my-upstream": {"install_tree": str(tmp_path / "upstream")}}, + } + ) + reindexed_local_store.db.reindex() + + assert not reindexed_local_store.db.query_local("callpath") + assert reindexed_local_store.db.query("callpath") == [callpath] + assert reindexed_local_store.db.query_local("mpileaks") == [mpileaks] diff --git a/lib/spack/spack/traverse.py b/lib/spack/spack/traverse.py index 091ebfe193df58..f6c5589b2aeaf7 100644 --- a/lib/spack/spack/traverse.py +++ b/lib/spack/spack/traverse.py @@ -3,8 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from collections import defaultdict, namedtuple -from typing import Union +from collections import defaultdict +from typing import NamedTuple, Union import spack.deptypes as dt import spack.spec @@ -12,11 +12,14 @@ # Export only the high-level API. __all__ = ["traverse_edges", "traverse_nodes", "traverse_tree"] + #: Data class that stores a directed edge together with depth at #: which the target vertex was found. It is passed to ``accept`` #: and ``neighbors`` of visitors, so they can decide whether to #: follow the edge or not. -EdgeAndDepth = namedtuple("EdgeAndDepth", ["edge", "depth"]) +class EdgeAndDepth(NamedTuple): + edge: "spack.spec.DependencySpec" + depth: int def sort_edges(edges): From 0229240df45b4e7c3a74d4084bd9c72bd5bc98e5 Mon Sep 17 00:00:00 2001 From: Kevin Kuriakose Date: Mon, 9 Sep 2024 22:23:15 +0530 Subject: [PATCH 063/687] darshan-runtime: fix JOBID determination (#46148) --- .../repos/builtin/packages/darshan-runtime/package.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/darshan-runtime/package.py b/var/spack/repos/builtin/packages/darshan-runtime/package.py index 7c811e09aaa85e..e7f7e4255626fc 100644 --- a/var/spack/repos/builtin/packages/darshan-runtime/package.py +++ b/var/spack/repos/builtin/packages/darshan-runtime/package.py @@ -101,13 +101,13 @@ def configure_args(self): extra_args = [] job_id = "NONE" - if spec.satisfies("+slurm"): + if spec.satisfies("scheduler=slurm"): job_id = "SLURM_JOBID" - if spec.satisfies("+cobalt"): + elif spec.satisfies("scheduler=cobalt"): job_id = "COBALT_JOBID" - if spec.satisfies("+pbs"): + elif spec.satisfies("scheduler=pbs"): job_id = "PBS_JOBID" - if spec.satisfies("+sge"): + elif spec.satisfies("scheduler=sge"): job_id = "JOB_ID" if spec.satisfies("+hdf5"): From 2f789f01d3b38770fb51c01b9bf64024b8852d82 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 9 Sep 2024 19:37:26 +0200 Subject: [PATCH 064/687] =?UTF-8?q?Revert=20"Set=20module=20variables=20fo?= =?UTF-8?q?r=20all=20packages=20before=20running=20setup=5Fdependent=5F?= =?UTF-8?q?=E2=80=A6"=20(#46283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6f08db463149efdea126abf8fdc770f684b4199d. --- lib/spack/spack/build_environment.py | 7 +------ lib/spack/spack/test/build_environment.py | 24 ----------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index e95a90421737af..e807bf6fd02234 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -1003,6 +1003,7 @@ def set_all_package_py_globals(self): """Set the globals in modules of package.py files.""" for dspec, flag in chain(self.external, self.nonexternal): pkg = dspec.package + if self.should_set_package_py_globals & flag: if self.context == Context.BUILD and self.needs_build_context & flag: set_package_py_globals(pkg, context=Context.BUILD) @@ -1010,12 +1011,6 @@ def set_all_package_py_globals(self): # This includes runtime dependencies, also runtime deps of direct build deps. set_package_py_globals(pkg, context=Context.RUN) - # Looping over the set of packages a second time - # ensures all globals are loaded into the module space prior to - # any package setup. This guarantees package setup methods have - # access to expected module level definitions such as "spack_cc" - for dspec, flag in chain(self.external, self.nonexternal): - pkg = dspec.package for spec in dspec.dependents(): # Note: some specs have dependents that are unreachable from the root, so avoid # setting globals for those. diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 02f0a27f46fd98..3ae41acc9cecee 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -513,30 +513,6 @@ def test_setting_dtags_based_on_config(config_setting, expected_flag, config, mo assert dtags_to_add.value == expected_flag -def test_module_globals_available_at_setup_dependent_time( - monkeypatch, mutable_config, mock_packages, working_env -): - """Spack built package externaltest depends on an external package - externaltool. Externaltool's setup_dependent_package needs to be able to - access globals on the dependent""" - - def setup_dependent_package(module, dependent_spec): - # Make sure set_package_py_globals was already called on - # dependents - # ninja is always set by the setup context and is not None - dependent_module = dependent_spec.package.module - assert hasattr(dependent_module, "ninja") - assert dependent_module.ninja is not None - dependent_spec.package.test_attr = True - - externaltool = spack.spec.Spec("externaltest").concretized() - monkeypatch.setattr( - externaltool["externaltool"].package, "setup_dependent_package", setup_dependent_package - ) - spack.build_environment.setup_package(externaltool.package, False) - assert externaltool.package.test_attr - - def test_build_jobs_sequential_is_sequential(): assert ( determine_number_of_jobs( From d5e08abe46be44277e8bcfa0c2a54a48bc41503c Mon Sep 17 00:00:00 2001 From: Pranav Sivaraman Date: Mon, 9 Sep 2024 15:19:54 -0400 Subject: [PATCH 065/687] py-poxy: add new package (#46214) * py-poxy: add new package * py-poxy: depends on misk >= 0.8.1 --- .../repos/builtin/packages/py-poxy/package.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-poxy/package.py diff --git a/var/spack/repos/builtin/packages/py-poxy/package.py b/var/spack/repos/builtin/packages/py-poxy/package.py new file mode 100644 index 00000000000000..9a4dcf5d56443d --- /dev/null +++ b/var/spack/repos/builtin/packages/py-poxy/package.py @@ -0,0 +1,35 @@ +# Copyright 2013-2024 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 PyPoxy(PythonPackage): + """Documentation generator for C++""" + + homepage = "https://github.com/marzer/poxy" + pypi = "poxy/poxy-0.18.0.tar.gz" + + license("MIT", checked_by="pranav-sivaraman") + + version("0.18.0", sha256="f5da8ff04ec08859bfd1c8ec6ef61b70e3af630915a4cce6a3e377eec3bcd3d4") + + depends_on("py-setuptools", type="build") + + with default_args(type=("build", "run")): + depends_on("python@3.7:") + depends_on("py-misk@0.8.1:") + depends_on("py-beautifulsoup4") + depends_on("py-jinja2") + depends_on("py-pygments") + depends_on("py-html5lib") + depends_on("py-lxml") + depends_on("py-tomli") + depends_on("py-schema") + depends_on("py-requests") + depends_on("py-trieregex") + depends_on("py-colorama") + + conflicts("py-schema@=0.7.5") From 98fb9c23f9149b0748c1d7af782ca94afa1a29c2 Mon Sep 17 00:00:00 2001 From: David Collins Date: Mon, 9 Sep 2024 14:33:13 -0600 Subject: [PATCH 066/687] numactl: Add versions 2.0.16-2.0.18 (#46150) * Add numactl 2.0.16-2.0.18 * Create link-with-latomic-if-needed-v2.0.16.patch Add a link to libatomic, if needed, for numactl v2.0.16. * Add some missing patches to v2.0.16 * Create numactl-2.0.18-syscall-NR-ppc64.patch In short, we need numactl to set __NR_set_mempolicy_home_node on ppc64, if it's not already defined. * Apply a necessary patch for v2.0.18 on PPC64 * Add libatomic patch for v2.0.16 --- .../link-with-latomic-if-needed-v2.0.16.patch | 11 +++++++++++ .../numactl/numactl-2.0.18-syscall-NR-ppc64.patch | 14 ++++++++++++++ .../repos/builtin/packages/numactl/package.py | 7 ++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/numactl/link-with-latomic-if-needed-v2.0.16.patch create mode 100644 var/spack/repos/builtin/packages/numactl/numactl-2.0.18-syscall-NR-ppc64.patch diff --git a/var/spack/repos/builtin/packages/numactl/link-with-latomic-if-needed-v2.0.16.patch b/var/spack/repos/builtin/packages/numactl/link-with-latomic-if-needed-v2.0.16.patch new file mode 100644 index 00000000000000..995a42858cdf0b --- /dev/null +++ b/var/spack/repos/builtin/packages/numactl/link-with-latomic-if-needed-v2.0.16.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -24,6 +24,8 @@ AM_CONDITIONAL([HAVE_TREE_VECTORIZE], [test x"${tree_vectorize}" = x"true"]) + + AC_CONFIG_FILES([Makefile]) + ++AC_SEARCH_LIBS([__atomic_fetch_and_1], [atomic]) ++ + # GCC tries to be "helpful" and only issue a warning for unrecognized + # attributes. So we compile the test with Werror, so that if the + # attribute is not recognized the compilation fails diff --git a/var/spack/repos/builtin/packages/numactl/numactl-2.0.18-syscall-NR-ppc64.patch b/var/spack/repos/builtin/packages/numactl/numactl-2.0.18-syscall-NR-ppc64.patch new file mode 100644 index 00000000000000..b296e49e39067b --- /dev/null +++ b/var/spack/repos/builtin/packages/numactl/numactl-2.0.18-syscall-NR-ppc64.patch @@ -0,0 +1,14 @@ +diff --git a/syscall.c b/syscall.c +index 63b3e53..5b354c4 100644 +--- a/syscall.c ++++ b/syscall.c +@@ -141,7 +141,7 @@ + + #if !defined(__NR_set_mempolicy_home_node) + +-#if defined(__x86_64__) || defined(__aarch64__) ++#if defined(__x86_64__) || defined(__aarch64__) || defined(__PPC64__) + #define __NR_set_mempolicy_home_node 450 + #else + #error "Add syscalls for your architecture or update kernel headers" + diff --git a/var/spack/repos/builtin/packages/numactl/package.py b/var/spack/repos/builtin/packages/numactl/package.py index 0abd8d7c5a9434..cde391471cdafb 100644 --- a/var/spack/repos/builtin/packages/numactl/package.py +++ b/var/spack/repos/builtin/packages/numactl/package.py @@ -16,6 +16,9 @@ class Numactl(AutotoolsPackage): license("LGPL-2.1-only") + version("2.0.18", sha256="8cd6c13f3096e9c2293c1d732f56e2aa37a7ada1a98deed3fac7bd6da1aaaaf6") + version("2.0.17", sha256="af22829cda8b5bdee3d280e61291697bbd3f9bd372afdf119c9348b88369d40b") + version("2.0.16", sha256="a35c3bdb3efab5c65927e0de5703227760b1101f5e27ab741d8f32b3d5f0a44c") version("2.0.14", sha256="1ee27abd07ff6ba140aaf9bc6379b37825e54496e01d6f7343330cf1a4487035") version("2.0.12", sha256="7c3e819c2bdeb883de68bafe88776a01356f7ef565e75ba866c4b49a087c6bdf") version("2.0.11", sha256="3e099a59b2c527bcdbddd34e1952ca87462d2cef4c93da9b0bc03f02903f7089") @@ -25,8 +28,10 @@ class Numactl(AutotoolsPackage): patch("numactl-2.0.11-sysmacros.patch", when="@2.0.11") # https://github.com/numactl/numactl/issues/94 patch("numactl-2.0.14-symver.patch", when="@2.0.14") - patch("fix-empty-block.patch", when="@2.0.10:2.0.14") + patch("fix-empty-block.patch", when="@2.0.10:2.0.16") patch("link-with-latomic-if-needed.patch", when="@2.0.14") + patch("link-with-latomic-if-needed-v2.0.16.patch", when="@2.0.16") + patch("numactl-2.0.18-syscall-NR-ppc64.patch", when="@2.0.18 target=ppc64le:") depends_on("autoconf", type="build") depends_on("automake", type="build") From 69b628a3f0f6e6f3f2a624287e7b3d6649669a89 Mon Sep 17 00:00:00 2001 From: Philipp Edelmann Date: Mon, 9 Sep 2024 15:40:25 -0600 Subject: [PATCH 067/687] makedepf90: new package (#45816) * makedepf90: new package * reorder versions and dependencies --- .../builtin/packages/makedepf90/package.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 var/spack/repos/builtin/packages/makedepf90/package.py diff --git a/var/spack/repos/builtin/packages/makedepf90/package.py b/var/spack/repos/builtin/packages/makedepf90/package.py new file mode 100644 index 00000000000000..79ad93eb9826c0 --- /dev/null +++ b/var/spack/repos/builtin/packages/makedepf90/package.py @@ -0,0 +1,24 @@ +# Copyright 2013-2024 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 Makedepf90(AutotoolsPackage): + """Makedepf90 is a program for automatic creation of Makefile-style dependency lists for + Fortran source code.""" + + homepage = "https://salsa.debian.org/science-team/makedepf90" + url = "https://deb.debian.org/debian/pool/main/m/makedepf90/makedepf90_3.0.1.orig.tar.xz" + + maintainers("tukss") + + license("GPL-2.0-only", checked_by="tukss") + + version("3.0.1", sha256="a11601ea14ad793f23fca9c7e7df694b6337f962ccc930d995d72e172edf29ee") + + depends_on("c", type="build") + depends_on("flex", type="build") + depends_on("bison", type="build") From dc853b2cf411a245d8611284a7cca84c57f96327 Mon Sep 17 00:00:00 2001 From: AcriusWinter <152348900+AcriusWinter@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:21:55 -0400 Subject: [PATCH 068/687] gptune: new test API (#45383) * gptune: new test API * gptune: cleanup; finish API changes; separate unrelated test parts * gptune: standalone test cleanup with timeout constraints * gptune: ensure stand-alone test bash failures terminate; enable in CI * gptune: add directory to terminate_bash_failures * gptune/stand-alone tests: use satisifes for checking variants --------- Co-authored-by: Tamara Dahlgren --- .../gitlab/cloud_pipelines/configs/ci.yaml | 1 - .../repos/builtin/packages/gptune/package.py | 199 ++++++++++++------ 2 files changed, 132 insertions(+), 68 deletions(-) diff --git a/share/spack/gitlab/cloud_pipelines/configs/ci.yaml b/share/spack/gitlab/cloud_pipelines/configs/ci.yaml index 5f34beb2c58fee..722d7ef6cd24ce 100644 --- a/share/spack/gitlab/cloud_pipelines/configs/ci.yaml +++ b/share/spack/gitlab/cloud_pipelines/configs/ci.yaml @@ -2,7 +2,6 @@ ci: target: gitlab broken-tests-packages: - - gptune - superlu-dist # srun -n 4 hangs - papyrus diff --git a/var/spack/repos/builtin/packages/gptune/package.py b/var/spack/repos/builtin/packages/gptune/package.py index dcb17ccb481426..5eb7976777ec76 100644 --- a/var/spack/repos/builtin/packages/gptune/package.py +++ b/var/spack/repos/builtin/packages/gptune/package.py @@ -2,11 +2,19 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - +import os from spack.package import * +def terminate_bash_failures(dir): + """Ensure bash scripts within the directory fail as soon as a command + within fails.""" + for f in os.listdir(dir): + if f.endswith(".sh"): + filter_file(r"#!/bin/bash", r"#!/bin/bash" + "\nset -e", join_path(dir, f)) + + class Gptune(CMakePackage): """GPTune is an autotuning framework that relies on multitask and transfer learnings to help solve the underlying black-box optimization problem using @@ -93,7 +101,6 @@ def cmake_args(self): return args examples_src_dir = "examples" - src_dir = "GPTune" nodes = 1 cores = 4 @@ -101,45 +108,14 @@ def cmake_args(self): def cache_test_sources(self): """Copy the example source files after the package is installed to an install test subdirectory for use during `spack test run`.""" - self.cache_extra_test_sources([self.examples_src_dir]) - - def setup_run_environment(self, env): - env.set("GPTUNE_INSTALL_PATH", python_platlib) + cache_extra_test_sources(self, [self.examples_src_dir]) - def test(self): - spec = self.spec + # Create the environment setup script comp_name = self.compiler.name comp_version = str(self.compiler.version).replace(".", ",") - test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) - - if spec.satisfies("+superlu"): - superludriver = join_path(spec["superlu-dist"].prefix.lib, "EXAMPLE/pddrive_spawn") - op = ["-r", superludriver, "."] - # copy superlu-dist executables to the correct place - wd = join_path(test_dir, "SuperLU_DIST") - self.run_test("rm", options=["-rf", "superlu_dist"], work_dir=wd) - self.run_test( - "git", - options=["clone", "https://github.com/xiaoyeli/superlu_dist.git"], - work_dir=wd, - ) - self.run_test("mkdir", options=["-p", "build"], work_dir=wd + "/superlu_dist") - self.run_test("mkdir", options=["-p", "EXAMPLE"], work_dir=wd + "/superlu_dist/build") - self.run_test("cp", options=op, work_dir=wd + "/superlu_dist/build/EXAMPLE") - - if spec.satisfies("+hypre"): - hypredriver = join_path(spec["hypre"].prefix.bin, "ij") - op = ["-r", hypredriver, "."] - # copy superlu-dist executables to the correct place - wd = join_path(test_dir, "Hypre") - self.run_test("rm", options=["-rf", "hypre"], work_dir=wd) - self.run_test( - "git", options=["clone", "https://github.com/hypre-space/hypre.git"], work_dir=wd - ) - self.run_test("cp", options=op, work_dir=wd + "/hypre/src/test/") - - wd = self.test_suite.current_test_cache_dir - with open("{0}/run_env.sh".format(wd), "w") as envfile: + spec = self.spec + script_path = f"{install_test_root(self)}/run_env.sh" + with open(script_path, "w") as envfile: envfile.write('if [[ $NERSC_HOST = "cori" ]]; then\n') envfile.write(" export machine=cori\n") envfile.write('elif [[ $(uname -s) = "Darwin" ]]; then\n') @@ -154,13 +130,15 @@ def test(self): envfile.write(" export machine=unknownlinux\n") envfile.write("fi\n") envfile.write("export GPTUNEROOT=$PWD\n") - envfile.write("export MPIRUN={0}\n".format(which(spec["mpi"].prefix.bin + "/mpirun"))) - envfile.write("export PYTHONPATH={0}:$PYTHONPATH\n".format(python_platlib + "/gptune")) + mpirun = spec["mpi"].prefix.bin.mpirun + envfile.write(f"export MPIRUN={mpirun}\n") + gptune_path = join_path(python_platlib, "gptune") + envfile.write(f"export PYTHONPATH={gptune_path}:$PYTHONPATH\n") envfile.write("export proc=$(spack arch)\n") - envfile.write("export mpi={0}\n".format(spec["mpi"].name)) - envfile.write("export compiler={0}\n".format(comp_name)) - envfile.write("export nodes={0} \n".format(self.nodes)) - envfile.write("export cores={0} \n".format(self.cores)) + envfile.write(f"export mpi={spec['mpi'].name}\n") + envfile.write(f"export compiler={comp_name}\n") + envfile.write(f"export nodes={self.nodes} \n") + envfile.write(f"export cores={self.cores} \n") envfile.write("export ModuleEnv=$machine-$proc-$mpi-$compiler \n") envfile.write( 'software_json=$(echo ",\\"software_configuration\\":' @@ -214,28 +192,115 @@ def test(self): + '{\\"nodes\\":$nodes,\\"cores\\":$cores}}}") \n' ) - # copy the environment configuration files to non-cache directories - op = ["run_env.sh", python_platlib + "/gptune/."] - self.run_test("cp", options=op, work_dir=wd) - op = ["run_env.sh", self.install_test_root + "/."] - self.run_test("cp", options=op, work_dir=wd) - - apps = ["Scalapack-PDGEQRF_RCI"] - if spec.satisfies("+mpispawn"): - apps = apps + ["GPTune-Demo", "Scalapack-PDGEQRF"] - if spec.satisfies("+superlu"): - apps = apps + ["SuperLU_DIST_RCI"] - if spec.satisfies("+mpispawn"): - apps = apps + ["SuperLU_DIST"] - if spec.satisfies("+hypre"): - if spec.satisfies("+mpispawn"): - apps = apps + ["Hypre"] + # copy the environment configuration to the python install directory + cp = which("cp") + cp(script_path, join_path(python_platlib, "gptune")) - for app in apps: - wd = join_path(test_dir, app) - self.run_test( - "bash", - options=["run_examples.sh"], - work_dir=wd, - purpose="gptune smoke test for {0}".format(app), + def setup_run_environment(self, env): + env.set("GPTUNE_INSTALL_PATH", python_platlib) + + bash = which("bash") + cp = which("cp") + git = which("git") + rm = which("rm") + + def test_hypre(self): + """set up and run hypre example""" + spec = self.spec + if spec.satisfies("~hypre") or spec.satisfies("~mpispawn"): + raise SkipTest("Package must be installed with +hypre+mpispawn") + + # https://github.com/spack/spack/pull/45383#discussion_r1737987370 + if not self.spec["hypre"].satisfies("@2.19.0"): + raise SkipTest("Package test only works for hypre@2.19.0") + + test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) + + # copy hypre executables to the correct place + wd = join_path(test_dir, "Hypre") + with working_dir(wd): + self.rm("-rf", "hypre") + self.git( + "clone", + "--depth", + "1", + "--branch", + f"v{self.spec['hypre'].version.string}", + "https://github.com/hypre-space/hypre.git", ) + + hypre_test_dir = join_path(wd, "hypre", "src", "test") + mkdirp(hypre_test_dir) + self.cp("-r", self.spec["hypre"].prefix.bin.ij, hypre_test_dir) + + # now run the test example + with working_dir(join_path(test_dir, "Hypre")): + terminate_bash_failures(".") + self.bash("run_examples.sh") + + def test_superlu(self): + """set up and run superlu tests""" + if self.spec.satisfies("~superlu"): + raise SkipTest("Package must be installed with +superlu") + + # https://github.com/spack/spack/pull/45383#discussion_r1737987370 + if self.spec["superlu-dist"].version < Version("7.1"): + raise SkipTest("Package must be installed with superlu-dist@:7.1") + + test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) + + # copy only works for-dist executables to the correct place + wd = join_path(test_dir, "SuperLU_DIST") + with working_dir(wd): + self.rm("-rf", "superlu_dist") + version = self.spec["superlu-dist"].version.string + tag = f"v{version}" if version.replace(".", "").isdigit() else version + # TODO: Replace this IF/when superlu-dist renames its "master" + # branch's version from "develop" to "master". + tag = "master" if tag == "develop" else tag + self.git( + "clone", + "--depth", + "1", + "--branch", + tag, + "https://github.com/xiaoyeli/superlu_dist.git", + ) + + superludriver = self.spec["superlu-dist"].prefix.lib.EXAMPLE.pddrive_spawn + example_dir = join_path(wd, "superlu_dist", "build", "EXAMPLE") + mkdirp(example_dir) + self.cp("-r", superludriver, example_dir) + + apps = ["SuperLU_DIST", "SuperLU_DIST_RCI"] + for app in apps: + with test_part(self, f"test_superlu_{app}", purpose=f"run {app} example"): + if app == "SuperLU_DIST" and self.spec.satisfies("~mpispawn"): + raise SkipTest("Package must be installed with +superlu+mpispawn") + with working_dir(join_path(test_dir, app)): + terminate_bash_failures(".") + self.bash("run_examples.sh") + + def test_demo(self): + """Run the demo test""" + if self.spec.satisfies("~mpispawn"): + raise SkipTest("Package must be installed with +mpispawn") + + test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) + + with working_dir(join_path(test_dir, "GPTune-Demo")): + terminate_bash_failures(".") + self.bash("run_examples.sh") + + def test_scalapack(self): + """Run scalapack tests""" + test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) + + apps = ["Scalapack-PDGEQRF", "Scalapack-PDGEQRF_RCI"] + for app in apps: + with test_part(self, f"test_scalapack_{app}", purpose=f"run {app} example"): + if app == "Scalapack-PDGEQRF" and self.spec.satisfies("~mpispawn"): + raise SkipTest("Package must be installed with +superlu+mpispawn") + with working_dir(join_path(test_dir, app)): + terminate_bash_failures(".") + self.bash("run_examples.sh") From 975f4fbf8449acc471b3e49c492f4b860cb81899 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 10 Sep 2024 07:56:51 +0200 Subject: [PATCH 069/687] cmake: remove last occurrences of std_cmake_args globals (#46288) --- var/spack/repos/builtin/packages/apcomp/package.py | 3 ++- var/spack/repos/builtin/packages/dray/package.py | 8 +++++++- var/spack/repos/builtin/packages/kicad/package.py | 3 +-- .../repos/builtin/packages/rocm-openmp-extras/package.py | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/apcomp/package.py b/var/spack/repos/builtin/packages/apcomp/package.py index 90c86f00968365..87e1a8c16f2bcb 100644 --- a/var/spack/repos/builtin/packages/apcomp/package.py +++ b/var/spack/repos/builtin/packages/apcomp/package.py @@ -9,6 +9,7 @@ import llnl.util.tty as tty +from spack.build_systems.cmake import CMakeBuilder from spack.package import * @@ -65,7 +66,7 @@ def install(self, spec, prefix): with working_dir("spack-build", create=True): host_cfg_fname = self.create_host_config(spec, prefix) print("Configuring APComp...") - cmake(*std_cmake_args, "-C", host_cfg_fname, "../src") + cmake(*CMakeBuilder.std_args(self), "-C", host_cfg_fname, "../src") print("Building APComp...") make() print("Installing APComp...") diff --git a/var/spack/repos/builtin/packages/dray/package.py b/var/spack/repos/builtin/packages/dray/package.py index 1751e931052ac0..9c0a38721de56f 100644 --- a/var/spack/repos/builtin/packages/dray/package.py +++ b/var/spack/repos/builtin/packages/dray/package.py @@ -8,6 +8,7 @@ import llnl.util.tty as tty +from spack.build_systems.cmake import CMakeBuilder from spack.package import * @@ -120,7 +121,12 @@ def install(self, spec, prefix): with working_dir("spack-build", create=True): host_cfg_fname = self.create_host_config(spec, prefix) print("Configuring Devil Ray...") - cmake(*std_cmake_args, "-C", host_cfg_fname, "../src") + cmake( + *CMakeBuilder.std_args(self, generator="Unix Makefiles"), + "-C", + host_cfg_fname, + "../src", + ) print("Building Devil Ray...") make() # run unit tests if requested diff --git a/var/spack/repos/builtin/packages/kicad/package.py b/var/spack/repos/builtin/packages/kicad/package.py index be431d8a0eafe7..04ce3b555fcd55 100644 --- a/var/spack/repos/builtin/packages/kicad/package.py +++ b/var/spack/repos/builtin/packages/kicad/package.py @@ -130,6 +130,5 @@ def install_libraries(self): for ver, lib, checksum in self.resource_list: if self.spec.version == Version(ver): with working_dir("kicad-{0}-{1}".format(lib, ver)): - args = std_cmake_args - cmake(*args) + cmake(*self.std_cmake_args) make("install") diff --git a/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py b/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py index 54402bdfc085f4..f6a9717462571c 100644 --- a/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py +++ b/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py @@ -6,6 +6,7 @@ import os import re +from spack.build_systems.cmake import CMakeBuilder from spack.package import * tools_url = "https://github.com/ROCm" @@ -643,6 +644,7 @@ def install(self, spec, prefix): build_order += ["pgmath", "flang", "flang-runtime"] # Override standard CMAKE_BUILD_TYPE + std_cmake_args = CMakeBuilder.std_args(self, generator="Unix Makefiles") for arg in std_cmake_args: found = re.search("CMAKE_BUILD_TYPE", arg) if found: From 78117877e002fcb8afec74044b21adffc7655cd3 Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Tue, 10 Sep 2024 08:16:47 +0200 Subject: [PATCH 070/687] boost: Refactor header-only install and add missing compiled libraries (#46281) --- .../repos/builtin/packages/boost/package.py | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index 1f2ff0f0ac9c5d..366a14509aa7fb 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -116,7 +116,9 @@ class Boost(Package): # support. The header-only library is installed when no variant is given. all_libs = [ "atomic", + "charconv", "chrono", + "cobalt", "container", "context", "contract", @@ -146,6 +148,7 @@ class Boost(Package): "thread", "timer", "type_erasure", + "url", "wave", ] @@ -497,7 +500,7 @@ def bjam_python_line(self, spec): spec["python"].libs[0], ) - def determine_bootstrap_options(self, spec, with_libs, without_libs, options): + def determine_bootstrap_options(self, spec, with_libs, options): boost_toolset_id = self.determine_toolset(spec) # Arm compiler bootstraps with 'gcc' (but builds as 'clang') @@ -506,9 +509,9 @@ def determine_bootstrap_options(self, spec, with_libs, without_libs, options): else: options.append("--with-toolset=%s" % boost_toolset_id) if with_libs: - options.append("--with-libraries=%s" % ",".join(with_libs)) + options.append("--with-libraries=%s" % ",".join(sorted(with_libs))) else: - options.append("--without-libraries=%s" % ",".join(without_libs)) + options.append("--with-libraries=headers") if spec.satisfies("+python"): options.append("--with-python=%s" % spec["python"].command.path) @@ -679,50 +682,39 @@ def install(self, spec, prefix): force_symlink("/usr/bin/libtool", join_path(newdir, "libtool")) env["PATH"] = newdir + ":" + env["PATH"] - with_libs = list() - without_libs = list() - for lib in Boost.all_libs: - if "+{0}".format(lib) in spec: - with_libs.append(lib) - else: - without_libs.append(lib) - - remove_if_in_list = lambda lib, libs: libs.remove(lib) if lib in libs else None + with_libs = {f"{lib}" for lib in Boost.all_libs if f"+{lib}" in spec} # Remove libraries that the release version does not support + if not spec.satisfies("@1.85.0:"): + with_libs.discard("charconv") + if not spec.satisfies("@1.84.0:"): + with_libs.discard("cobalt") + if not spec.satisfies("@1.81.0:"): + with_libs.discard("url") if not spec.satisfies("@1.75.0:"): - remove_if_in_list("json", with_libs) - remove_if_in_list("json", without_libs) + with_libs.discard("json") if spec.satisfies("@1.69.0:"): - remove_if_in_list("signals", with_libs) - remove_if_in_list("signals", without_libs) + with_libs.discard("signals") if not spec.satisfies("@1.54.0:"): - remove_if_in_list("log", with_libs) - remove_if_in_list("log", without_libs) + with_libs.discard("log") if not spec.satisfies("@1.53.0:"): - remove_if_in_list("atomic", with_libs) - remove_if_in_list("atomic", without_libs) + with_libs.discard("atomic") if not spec.satisfies("@1.48.0:"): - remove_if_in_list("locale", with_libs) - remove_if_in_list("locale", without_libs) + with_libs.discard("locale") if not spec.satisfies("@1.47.0:"): - remove_if_in_list("chrono", with_libs) - remove_if_in_list("chrono", without_libs) + with_libs.discard("chrono") if not spec.satisfies("@1.43.0:"): - remove_if_in_list("random", with_libs) - remove_if_in_list("random", without_libs) + with_libs.discard("random") if not spec.satisfies("@1.39.0:"): - remove_if_in_list("exception", with_libs) - remove_if_in_list("exception", without_libs) + with_libs.discard("exception") if spec.satisfies("+graph") and spec.satisfies("+mpi"): - with_libs.append("graph_parallel") - remove_if_in_list("graph_parallel", without_libs) + with_libs.add("graph_parallel") # to make Boost find the user-config.jam env["BOOST_BUILD_PATH"] = self.stage.source_path bootstrap_options = ["--prefix=%s" % prefix] - self.determine_bootstrap_options(spec, with_libs, without_libs, bootstrap_options) + self.determine_bootstrap_options(spec, with_libs, bootstrap_options) if self.spec.satisfies("platform=windows"): bootstrap = Executable("cmd.exe") From b220938d42b5410aaf4321146673ba0f64b0d546 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 9 Sep 2024 23:20:39 -0700 Subject: [PATCH 071/687] bugfix: `elfutils` has no bzip2 or xz variants (#46294) Signed-off-by: Todd Gamblin --- share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml index addccd7bd21a83..986ffa2f4648ac 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/gpu-tests/spack.yaml @@ -16,7 +16,7 @@ spack: boost: variants: +python +filesystem +iostreams +system elfutils: - variants: +bzip2 ~nls +xz + variants: ~nls hdf5: variants: +fortran +hl +shared libfabric: From 16dba7828864d683219c15df5028312601aea8b1 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 10 Sep 2024 09:02:37 +0200 Subject: [PATCH 072/687] spec.py: dedent format logic (#46279) --- lib/spack/spack/spec.py | 69 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index e420eaada960ab..3d5a1ce3203ad3 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -3911,46 +3911,43 @@ def format_attribute(match_object: Match) -> str: for idx, part in enumerate(parts): if not part: raise SpecFormatStringError("Format string attributes must be non-empty") - if part.startswith("_"): + elif part.startswith("_"): raise SpecFormatStringError("Attempted to format private attribute") + elif isinstance(current, VariantMap): + # subscript instead of getattr for variant names + try: + current = current[part] + except KeyError: + raise SpecFormatStringError(f"Variant '{part}' does not exist") else: - if isinstance(current, VariantMap): - # subscript instead of getattr for variant names - try: - current = current[part] - except KeyError: - raise SpecFormatStringError(f"Variant '{part}' does not exist") - else: - # aliases - if part == "arch": - part = "architecture" - elif part == "version": - # version (singular) requires a concrete versions list. Avoid - # pedantic errors by using versions (plural) when not concrete. - # These two are not entirely equivalent for pkg@=1.2.3: - # - version prints '1.2.3' - # - versions prints '=1.2.3' - if not current.versions.concrete: - part = "versions" - try: - current = getattr(current, part) - except AttributeError: - parent = ".".join(parts[:idx]) - m = "Attempted to format attribute %s." % attribute - m += "Spec %s has no attribute %s" % (parent, part) - raise SpecFormatStringError(m) - if isinstance(current, vn.VersionList): - if current == vn.any_version: - # don't print empty version lists - return "" - - if callable(current): - raise SpecFormatStringError("Attempted to format callable object") - - if current is None: - # not printing anything + # aliases + if part == "arch": + part = "architecture" + elif part == "version" and not current.versions.concrete: + # version (singular) requires a concrete versions list. Avoid + # pedantic errors by using versions (plural) when not concrete. + # These two are not entirely equivalent for pkg@=1.2.3: + # - version prints '1.2.3' + # - versions prints '=1.2.3' + part = "versions" + try: + current = getattr(current, part) + except AttributeError: + raise SpecFormatStringError( + f"Attempted to format attribute {attribute}. " + f"Spec {'.'.join(parts[:idx])} has no attribute {part}" + ) + if isinstance(current, vn.VersionList) and current == vn.any_version: + # don't print empty version lists return "" + if callable(current): + raise SpecFormatStringError("Attempted to format callable object") + + if current is None: + # not printing anything + return "" + # Set color codes for various attributes color = None if "architecture" in parts: From 0905edf592752742eb4ddab3a528d3aee8f92930 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 10 Sep 2024 09:04:09 +0200 Subject: [PATCH 073/687] r: do not create dir in setup_dependent_package (#46282) --- lib/spack/spack/build_systems/r.py | 24 ++++++++----------- var/spack/repos/builtin/packages/r/package.py | 5 ---- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lib/spack/spack/build_systems/r.py b/lib/spack/spack/build_systems/r.py index 9950d670486797..07bdb3d0ae0bbd 100644 --- a/lib/spack/spack/build_systems/r.py +++ b/lib/spack/spack/build_systems/r.py @@ -5,6 +5,7 @@ from typing import Optional, Tuple import llnl.util.lang as lang +from llnl.util.filesystem import mkdirp from spack.directives import extends @@ -36,6 +37,7 @@ def configure_vars(self): def install(self, pkg, spec, prefix): """Installs an R package.""" + mkdirp(pkg.module.r_lib_dir) config_args = self.configure_args() config_vars = self.configure_vars() @@ -43,12 +45,12 @@ def install(self, pkg, spec, prefix): args = ["--vanilla", "CMD", "INSTALL"] if config_args: - args.append("--configure-args={0}".format(" ".join(config_args))) + args.append(f"--configure-args={' '.join(config_args)}") if config_vars: - args.append("--configure-vars={0}".format(" ".join(config_vars))) + args.append(f"--configure-vars={' '.join(config_vars)}") - args.extend(["--library={0}".format(self.pkg.module.r_lib_dir), self.stage.source_path]) + args.extend([f"--library={pkg.module.r_lib_dir}", self.stage.source_path]) pkg.module.R(*args) @@ -79,27 +81,21 @@ class RPackage(Package): @lang.classproperty def homepage(cls): if cls.cran: - return "https://cloud.r-project.org/package=" + cls.cran + return f"https://cloud.r-project.org/package={cls.cran}" elif cls.bioc: - return "https://bioconductor.org/packages/" + cls.bioc + return f"https://bioconductor.org/packages/{cls.bioc}" @lang.classproperty def url(cls): if cls.cran: - return ( - "https://cloud.r-project.org/src/contrib/" - + cls.cran - + "_" - + str(list(cls.versions)[0]) - + ".tar.gz" - ) + return f"https://cloud.r-project.org/src/contrib/{cls.cran}_{str(list(cls.versions)[0])}.tar.gz" @lang.classproperty def list_url(cls): if cls.cran: - return "https://cloud.r-project.org/src/contrib/Archive/" + cls.cran + "/" + return f"https://cloud.r-project.org/src/contrib/Archive/{cls.cran}/" @property def git(self): if self.bioc: - return "https://git.bioconductor.org/packages/" + self.bioc + return f"https://git.bioconductor.org/packages/{self.bioc}" diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py index a2d0f01517b306..478d4c5d8bdd8b 100644 --- a/var/spack/repos/builtin/packages/r/package.py +++ b/var/spack/repos/builtin/packages/r/package.py @@ -297,8 +297,3 @@ def setup_dependent_package(self, module, dependent_spec): # Add variable for library directry module.r_lib_dir = join_path(dependent_spec.prefix, self.r_lib_dir) - - # Make the site packages directory for extensions, if it does not exist - # already. - if dependent_spec.package.is_extension: - mkdirp(module.r_lib_dir) From 6f5ba4443119cc9fb67e025adea32a92ba07d469 Mon Sep 17 00:00:00 2001 From: Teague Sterling Date: Tue, 10 Sep 2024 03:36:43 -0700 Subject: [PATCH 074/687] perl-bioperl: add v1.6.924, v1.7.8, deprecate v1.007002, refactor dependeicies, update url (#46213) * perl-bioperl: add v1.6.924 Signed-off-by: Teague Sterling * fix style Signed-off-by: Teague Sterling * perl-bioperl: add v1.6.924, v1.7.2, deprecate v1.007002, refactor dependencies Signed-off-by: Teague Sterling * perl-bioperl: add v1.7.8 Signed-off-by: Teague Sterling * perl-bioperl: update url Signed-off-by: Teague Sterling * perl-bioperl: cleanup version urls Signed-off-by: Teague Sterling * remove v1.7.2 --------- Signed-off-by: Teague Sterling --- .../builtin/packages/perl-bioperl/package.py | 136 +++++++++--------- 1 file changed, 65 insertions(+), 71 deletions(-) diff --git a/var/spack/repos/builtin/packages/perl-bioperl/package.py b/var/spack/repos/builtin/packages/perl-bioperl/package.py index 790446ad915c7e..1385bd5911ec0e 100644 --- a/var/spack/repos/builtin/packages/perl-bioperl/package.py +++ b/var/spack/repos/builtin/packages/perl-bioperl/package.py @@ -32,87 +32,81 @@ class PerlBioperl(PerlPackage): and contribute your own if possible.""" homepage = "https://metacpan.org/pod/BioPerl" - url = "https://cpan.metacpan.org/authors/id/C/CD/CDRAUG/BioPerl-1.7.6.tar.gz" + url = "https://cpan.metacpan.org/authors/id/C/CJ/CJFIELDS/BioPerl-1.7.8.tar.gz" license("Artistic-1.0") + version("1.7.8", sha256="c490a3be7715ea6e4305efd9710e5edab82dabc55fd786b6505b550a30d71738") version( "1.7.6", sha256="df2a3efc991b9b5d7cc9d038a1452c6dac910c9ad2a0e47e408dd692c111688d", - preferred=True, + url="https://cpan.metacpan.org/authors/id/C/CD/CDRAUG/BioPerl-1.7.6.tar.gz", ) + version("1.6.924", sha256="616a7546bb3c58504de27304a0f6cb904e18b6bbcdb6a4ec8454f2bd37bb76d0") + + # This is technically the same as 1.7.2, but with a more conventional version number. version( "1.007002", sha256="17aa3aaab2f381bbcaffdc370002eaf28f2c341b538068d6586b2276a76464a1", url="https://cpan.metacpan.org/authors/id/C/CJ/CJFIELDS/BioPerl-1.007002.tar.gz", + deprecated=True, ) - depends_on("fortran", type="build") # generated - - # According to cpandeps.grinnz.com Module-Build is both a build and run - # time dependency for BioPerl - depends_on("perl-module-build", type=("build", "run")) - depends_on("perl-uri", type=("build", "run")) - depends_on("perl-io-string", type=("build", "run")) - depends_on("perl-data-stag", type=("build", "run")) - depends_on("perl-test-most", type=("build", "run")) - depends_on("perl-error", when="@1.7.6:", type=("build", "run")) - depends_on("perl-graph", when="@1.7.6:", type=("build", "run")) - depends_on("perl-http-message", when="@1.7.6:", type=("build", "run")) - depends_on("perl-io-stringy", when="@1.7.6:", type=("build", "run")) - depends_on("perl-ipc-run", when="@1.7.6:", type=("build", "run")) - depends_on("perl-list-moreutils", when="@1.7.6:", type=("build", "run")) - depends_on("perl-set-scalar", when="@1.7.6:", type=("build", "run")) - depends_on("perl-test-requiresinternet", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-dom", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-dom-xpath", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-libxml", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-sax", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-sax-base", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-sax-writer", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-twig", when="@1.7.6:", type=("build", "run")) - depends_on("perl-xml-writer", when="@1.7.6:", type=("build", "run")) - depends_on("perl-yaml", when="@1.7.6:", type=("build", "run")) - depends_on("perl-libwww-perl", when="@1.7.6:", type=("build", "run")) - depends_on("perl-libxml-perl", when="@1.7.6:", type=("build", "run")) - - @when("@1.007002") - def configure(self, spec, prefix): - # Overriding default configure method in order to cater to interactive - # Build.pl - self.build_method = "Build.PL" - self.build_executable = Executable(join_path(self.stage.source_path, "Build")) - - # Config questions consist of: - # Do you want to run the Bio::DB::GFF or Bio::DB::SeqFeature::Store - # live database tests? y/n [n] - # - # Install [a]ll BioPerl scripts, [n]one, or choose groups - # [i]nteractively? [a] - # - # Do you want to run tests that require connection to servers across - # the internet (likely to cause some failures)? y/n [n] - # - # Eventually, someone can add capability for the other options, but - # the current answers are the most practical for a spack install. - - config_answers = ["n\n", "a\n", "n\n"] - config_answers_filename = "spack-config.in" - - with open(config_answers_filename, "w") as f: - f.writelines(config_answers) - - with open(config_answers_filename, "r") as f: - perl("Build.PL", "--install_base=%s" % self.prefix, input=f) - - # Need to also override the build and install methods to make sure that the - # Build script is run through perl and not use the shebang, as it might be - # too long. This is needed because this does not pick up the - # `@run_after(configure)` step defined in `PerlPackage`. - @when("@1.007002") - def build(self, spec, prefix): - perl("Build") - - @when("@1.007002") - def install(self, spec, prefix): - perl("Build", "install") + with default_args(type=("build", "run")): + depends_on("perl-data-stag") + depends_on("perl-error") + depends_on("perl-graph") + depends_on("perl-http-message") + depends_on("perl-io-string") + depends_on("perl-io-stringy") + depends_on("perl-ipc-run") + depends_on("perl-libwww-perl") + depends_on("perl-libxml-perl") + depends_on("perl-list-moreutils") + depends_on("perl-module-build") + depends_on("perl-set-scalar") + depends_on("perl-test-most") + depends_on("perl-test-requiresinternet") + depends_on("perl-uri") + depends_on("perl-xml-dom") + depends_on("perl-xml-dom-xpath") + depends_on("perl-xml-libxml") + depends_on("perl-xml-parser") + depends_on("perl-xml-sax") + depends_on("perl-xml-sax-base") + depends_on("perl-xml-sax-writer") + depends_on("perl-xml-simple") + depends_on("perl-xml-twig") + depends_on("perl-yaml") + + with when("@:1.7.0"): + depends_on("perl-clone") + depends_on("perl-db-file") + depends_on("perl-dbd-mysql") + depends_on("perl-dbd-pg") + depends_on("perl-dbd-sqlite") + depends_on("perl-dbi") + depends_on("perl-gd") + depends_on("perl-graphviz") + depends_on("perl-scalar-list-utils") + depends_on("perl-set-scalar") + depends_on("perl-svg") + + # TODO: + # variant("optionaldeps", default=False, description="Add optional dependencies") + # with when("@:1.7.0+optionaldeps"): + # depends_on("perl-sort-naturally") + # depends_on("perl-test-harness") + # depends_on("perl-text-parsewords") + # depends_on("perl-algorithm-munkres") + # depends_on("perl-array-compare") + # depends_on("perl-bio-phylo") + # depends_on("perl-convert-binary-c") + # depends_on("perl-html-entities") + # depends_on("perl-html-headparser") + # depends_on("perl-html-tableextract") + # depends_on("perl-svg-graph") + + def configure_args(self): + args = ["--accept=1"] + return args From 79d778f8cdb5f4f5eaaeb9a5d1215080698041e3 Mon Sep 17 00:00:00 2001 From: Robert Underwood Date: Tue, 10 Sep 2024 11:20:05 -0400 Subject: [PATCH 075/687] Add additional cuda-toolkit location variable used by py-torch (#46245) superceds #46128 Co-authored-by: Robert Underwood --- var/spack/repos/builtin/packages/py-torch/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py index 9af10cb65a39d2..2e1631fa027288 100644 --- a/var/spack/repos/builtin/packages/py-torch/package.py +++ b/var/spack/repos/builtin/packages/py-torch/package.py @@ -526,6 +526,7 @@ def enable_or_disable(variant, keyword="USE", var=None): enable_or_disable("cuda") if "+cuda" in self.spec: + env.set("CUDA_TOOLKIT_ROOT_DIR", self.spec["cuda"].prefix) # Linux/macOS env.set("CUDA_HOME", self.spec["cuda"].prefix) # Linux/macOS env.set("CUDA_PATH", self.spec["cuda"].prefix) # Windows self.torch_cuda_arch_list(env) From 0629c5df38fb78545a54e131a91567badd7c36bd Mon Sep 17 00:00:00 2001 From: Tony Weaver <55799947+aweaver1fandm@users.noreply.github.com> Date: Tue, 10 Sep 2024 11:37:05 -0400 Subject: [PATCH 076/687] py-your: Changed software pull location (#46201) * py-your: new package Spack package recipe for YOUR, Your Unified Reader. YOUR processes pulsar data in different formats. Output below from spack install py-your spack install py-your ==> Installing py-your-0.6.7-djfzsn2lutp24ik6wrk6tjx5f7hil76x [83/83] ==> No binary for py-your-0.6.7-djfzsn2lutp24ik6wrk6tjx5f7hil76x found: installing from source ==> Fetching https://github.com/thepetabyteproject/your/archive/refs/tags/0.6.7.tar.gz ==> No patches needed for py-your ==> py-your: Executing phase: 'install' ==> py-your: Successfully installed py-your-0.6.7-djfzsn2lutp24ik6wrk6tjx5f7hil76x Stage: 1.43s. Install: 0.99s. Post-install: 0.12s. Total: 3.12s * Removed setup_run_environment After some testing, both spack load and module load for the package will include the bin directory generated by py-your as well as the path to the version of python the package was built with, without the need for the setup_run_environment function. I removed that function (Although, like Tamara I thought it would be necessary based on other package setups I used as a basis for this package). Note: I also updated the required version of py-astropy from py-astropy@4.0: to @py-astropy@6.1.0: In my test builds, the install was picking up version py-astropy@4.0.1.post1 and numpy1.26. However when I tried to run some of the code I was getting errors about py-astropy making numpy calls that are now removed. The newer version of py-astropy corrects these. Ideally this would be handled in the py-astropy package to make sure numpy isn't too new * Changed software pull location The original package pulled a tagged release version from GitHub. That tagged version was created in 2022 and has not been updated since. It no longer runs because newer versions of numpy have removed deprecation warnings for several of their calls. The main branch for this repository has addressed these numpy issues as well as some other important fixes but no new release has been generated. Because of this and the apparent minimal development that now appears to be going on, it is probably best to always pull from the main branch * [@spackbot] updating style on behalf of aweaver1fandm * py-your: Changed software pull location 1. Restored original URL and version (0.6.7) as requested 2. Updated py-numpy dependency versions to be constrained based on the version of your. Because of numpy deprecations related to your version 0.6.7 need to ensure that the numpy version used is not 1.24 or greater because the depracations were removed starting with that version --- var/spack/repos/builtin/packages/py-your/package.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-your/package.py b/var/spack/repos/builtin/packages/py-your/package.py index a0e90fc7bde592..f226bff0b31f26 100644 --- a/var/spack/repos/builtin/packages/py-your/package.py +++ b/var/spack/repos/builtin/packages/py-your/package.py @@ -10,14 +10,14 @@ class PyYour(PythonPackage): """Python library to read and process pulsar data in several different formats""" homepage = "https://github.com/thepetabyteproject/your" - - # pypi tarball has requirements.txt missing url = "https://github.com/thepetabyteproject/your/archive/refs/tags/0.6.7.tar.gz" + git = "https://github.com/thepetabyteproject/your.git" maintainers("aweaver1fandm") license("GPL-3.0") + version("main", branch="main", preferred=True) version("0.6.7", sha256="f2124a630d413621cce067805feb6b9c21c5c8938f41188bd89684968478d814") depends_on("python@3.8:", type=("build", "run")) @@ -25,7 +25,9 @@ class PyYour(PythonPackage): depends_on("py-astropy@6.1.0:", type=("build", "run")) depends_on("py-matplotlib@3.2.1:", type=("build", "run")) - depends_on("py-numpy@1.18.4:", type=("build", "run")) + + depends_on("py-numpy@1.18.4:1.23.5", when="@0.6.7", type=("build", "run")) + depends_on("py-numpy@1.18.4:", when="@main", type=("build", "run")) depends_on("py-h5py@2.10:", type=("build", "run")) depends_on("py-scikit-image@0.14.2:", type=("build", "run")) depends_on("py-scipy@1.3:", type=("build", "run")) From e2e5e74b9915fc553362c452d17f2d7c8714f2dc Mon Sep 17 00:00:00 2001 From: Pranav Sivaraman Date: Tue, 10 Sep 2024 13:36:23 -0400 Subject: [PATCH 077/687] fast-float: new package (#46137) * fast-float: new package * fast-float: add test dependency * fast-float: fix doctest dependency type * fast-float: convert deps to tuple * fast-float: add v6.1.5 and v6.1.6 * fast-float: patch older versions to use find_package(doctest) --- .../builtin/packages/fast-float/package.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 var/spack/repos/builtin/packages/fast-float/package.py diff --git a/var/spack/repos/builtin/packages/fast-float/package.py b/var/spack/repos/builtin/packages/fast-float/package.py new file mode 100644 index 00000000000000..00872846e512da --- /dev/null +++ b/var/spack/repos/builtin/packages/fast-float/package.py @@ -0,0 +1,36 @@ +# Copyright 2013-2024 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 FastFloat(CMakePackage): + """Fast and exact implementation of the C++ from_chars functions for number + types.""" + + homepage = "https://github.com/fastfloat/fast_float" + url = "https://github.com/fastfloat/fast_float/archive/refs/tags/v6.1.4.tar.gz" + + license("Apache-2.0 OR BSL-1.0 OR MIT", checked_by="pranav-sivararamn") + + version("6.1.6", sha256="4458aae4b0eb55717968edda42987cabf5f7fc737aee8fede87a70035dba9ab0") + version("6.1.5", sha256="597126ff5edc3ee59d502c210ded229401a30dafecb96a513135e9719fcad55f") + version("6.1.4", sha256="12cb6d250824160ca16bcb9d51f0ca7693d0d10cb444f34f1093bc02acfce704") + + depends_on("cxx", type="build") + depends_on("cmake@3.9:", type="build") + + depends_on("doctest", type="test") + + patch( + "https://github.com/fastfloat/fast_float/commit/a7ed4e89c7444b5c8585453fc6d015c0efdf8654.patch?full_index=1", + sha256="25561aa7db452da458fb0ae3075ef8e63ccab174ca8f5a6c79fb15cb342b3683", + when="@:6.1.5", + ) + + def cmake_args(self): + args = [self.define("FASTFLOAT_TEST", self.run_tests), self.define("SYSTEM_DOCTEST", True)] + + return args From decefe02344d2a2708e159d39fd1c5a39bfbfd14 Mon Sep 17 00:00:00 2001 From: Teague Sterling Date: Tue, 10 Sep 2024 10:45:59 -0700 Subject: [PATCH 078/687] perl-bio-ensembl-io: new package (#44509) * Adding the perl-bio-db-bigfile package * Adding perl-bio-ensembl-io package * Update package.py * Update package.py * Update package.py * Update package.py * Updating dependent package handling Signed-off-by: Teague Sterling * Updating dependent package handling Signed-off-by: Teague Sterling * Reverting variants Signed-off-by: Teague Sterling * Rename package.py to package.py * Update package.py * Update package.py * Removing unneeded dependencies Signed-off-by: Teague Sterling * Update package.py * Update package.py * Update package.py * Update package.py * Update package.py * Updated from testing by @ebiarnie Signed-off-by: Teague Sterling * Updated from testing by @ebiarnie Signed-off-by: Teague Sterling * Fixing depends Signed-off-by: Teague Sterling * Fix styles Signed-off-by: Teague Sterling * Update package.py --------- Signed-off-by: Teague Sterling --- .../packages/perl-bio-ensembl-io/package.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 var/spack/repos/builtin/packages/perl-bio-ensembl-io/package.py diff --git a/var/spack/repos/builtin/packages/perl-bio-ensembl-io/package.py b/var/spack/repos/builtin/packages/perl-bio-ensembl-io/package.py new file mode 100644 index 00000000000000..5793e3bd51185b --- /dev/null +++ b/var/spack/repos/builtin/packages/perl-bio-ensembl-io/package.py @@ -0,0 +1,47 @@ +# Copyright 2013-2024 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 PerlBioEnsemblIo(Package): + """File parsing and writing code for Ensembl.""" + + homepage = "https://github.com/Ensembl/ensembl-io/" + url = "https://github.com/Ensembl/ensembl-io/archive/release/111.zip" + + maintainers("teaguesterling") + + license("APACHE-2.0", checked_by="teaguesterling") + + for vers, sha in [ + ("112", "ccbffe7c15318075463db46be348655a5914762e05ff47da2d72a4c99414d39a"), + ("111", "f81d4c1aea88aac7105aaa3fec548e39b79f129c7abc08b55be7d0345aa5482c"), + ("110", "83cf00ecdb6184be480fc3cbf0ffc322d3e9411e14602396fda8d153345d6c2e"), + ]: + version(vers, sha256=sha) + depends_on(f"perl-bio-ensembl@{vers}", when=f"@{vers}") + + extends("perl") + + variant("scripts", default=False, description="Install scripts") + + depends_on("perl-bio-bigfile") + depends_on("perl-bio-db-hts") + depends_on("perl-bio-ensembl") + depends_on("perl-bioperl@1.6.924") + depends_on("perl-compress-bzip2") + depends_on("perl-json") + depends_on("perl-try-tiny") + depends_on("perl-uri") + depends_on("vcftools") + + def install(self, spec, prefix): + install_tree("modules", prefix.lib.perl5) + mkdirp(prefix.share.ensembl) + for extra in ["scripts"]: + if spec.satisfies(f"+{extra}"): + extra = extra.replace("_", "-") + target = join_path(prefix.share.ensembl, extra) + install_tree(extra, target) From ffdfa498bf18974dc0fb7e5b280249cb43644438 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 10 Sep 2024 20:02:05 +0200 Subject: [PATCH 079/687] Deprecate `config:install_missing_compilers` (#46237) The option config:install_missing_compilers is currently buggy, and has been for a while. Remove it, since it won't be needed when compilers are treated as dependencies. Signed-off-by: Massimiliano Culpo --- etc/spack/defaults/config.yaml | 6 - lib/spack/docs/developer_guide.rst | 4 - lib/spack/docs/pipelines.rst | 6 +- lib/spack/spack/concretize.py | 26 ++--- lib/spack/spack/installer.py | 161 --------------------------- lib/spack/spack/schema/config.py | 10 +- lib/spack/spack/solver/asp.py | 6 +- lib/spack/spack/solver/concretize.lp | 2 +- lib/spack/spack/test/cmd/install.py | 65 +---------- lib/spack/spack/test/concretize.py | 20 ---- lib/spack/spack/test/installer.py | 104 ----------------- 11 files changed, 19 insertions(+), 391 deletions(-) diff --git a/etc/spack/defaults/config.yaml b/etc/spack/defaults/config.yaml index 686575f8fc01d5..b9c4aee64eee3c 100644 --- a/etc/spack/defaults/config.yaml +++ b/etc/spack/defaults/config.yaml @@ -115,12 +115,6 @@ config: suppress_gpg_warnings: false - # If set to true, Spack will attempt to build any compiler on the spec - # that is not already available. If set to False, Spack will only use - # compilers already configured in compilers.yaml - install_missing_compilers: false - - # If set to true, Spack will always check checksums after downloading # archives. If false, Spack skips the checksum step. checksum: true diff --git a/lib/spack/docs/developer_guide.rst b/lib/spack/docs/developer_guide.rst index 91550f795fd86c..134f0f540f63c8 100644 --- a/lib/spack/docs/developer_guide.rst +++ b/lib/spack/docs/developer_guide.rst @@ -181,10 +181,6 @@ Spec-related modules :mod:`spack.parser` Contains :class:`~spack.parser.SpecParser` and functions related to parsing specs. -:mod:`spack.concretize` - Contains :class:`~spack.concretize.Concretizer` implementation, - which allows site administrators to change Spack's :ref:`concretization-policies`. - :mod:`spack.version` Implements a simple :class:`~spack.version.Version` class with simple comparison semantics. Also implements :class:`~spack.version.VersionRange` diff --git a/lib/spack/docs/pipelines.rst b/lib/spack/docs/pipelines.rst index 0a72793a891d6b..bfcf1572d79e9a 100644 --- a/lib/spack/docs/pipelines.rst +++ b/lib/spack/docs/pipelines.rst @@ -663,11 +663,7 @@ build the package. When including a bootstrapping phase as in the example above, the result is that the bootstrapped compiler packages will be pushed to the binary mirror (and the -local artifacts mirror) before the actual release specs are built. In this case, -the jobs corresponding to subsequent release specs are configured to -``install_missing_compilers``, so that if spack is asked to install a package -with a compiler it doesn't know about, it can be quickly installed from the -binary mirror first. +local artifacts mirror) before the actual release specs are built. Since bootstrapping compilers is optional, those items can be left out of the environment/stack file, and in that case no bootstrapping will be done (only the diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index b8e61d53810780..9aed68f34d7bec 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -19,35 +19,23 @@ import spack.tengine import spack.util.path - -class Concretizer: - """(DEPRECATED) Only contains logic to enable/disable compiler existence checks.""" - - #: Controls whether we check that compiler versions actually exist - #: during concretization. Used for testing and for mirror creation - check_for_compiler_existence = None - - def __init__(self): - if Concretizer.check_for_compiler_existence is None: - Concretizer.check_for_compiler_existence = not spack.config.get( - "config:install_missing_compilers", False - ) +CHECK_COMPILER_EXISTENCE = True @contextmanager def disable_compiler_existence_check(): - saved = Concretizer.check_for_compiler_existence - Concretizer.check_for_compiler_existence = False + global CHECK_COMPILER_EXISTENCE + CHECK_COMPILER_EXISTENCE, saved = False, CHECK_COMPILER_EXISTENCE yield - Concretizer.check_for_compiler_existence = saved + CHECK_COMPILER_EXISTENCE = saved @contextmanager def enable_compiler_existence_check(): - saved = Concretizer.check_for_compiler_existence - Concretizer.check_for_compiler_existence = True + global CHECK_COMPILER_EXISTENCE + CHECK_COMPILER_EXISTENCE, saved = True, CHECK_COMPILER_EXISTENCE yield - Concretizer.check_for_compiler_existence = saved + CHECK_COMPILER_EXISTENCE = saved def find_spec(spec, condition, default=None): diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index b6ac7a73ecce07..1adc5b9ee31e3b 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -276,52 +276,6 @@ def _do_fake_install(pkg: "spack.package_base.PackageBase") -> None: dump_packages(pkg.spec, packages_dir) -def _packages_needed_to_bootstrap_compiler( - compiler: "spack.spec.CompilerSpec", architecture: "spack.spec.ArchSpec", pkgs: list -) -> List[Tuple["spack.package_base.PackageBase", bool]]: - """ - Return a list of packages required to bootstrap `pkg`s compiler - - Checks Spack's compiler configuration for a compiler that - matches the package spec. - - Args: - compiler: the compiler to bootstrap - architecture: the architecture for which to boostrap the compiler - pkgs: the packages that may need their compiler installed - - Return: - list of tuples of packages and a boolean, for concretized compiler-related - packages that need to be installed and bool values specify whether the - package is the bootstrap compiler (``True``) or one of its dependencies - (``False``). The list will be empty if there are no compilers. - """ - tty.debug(f"Bootstrapping {compiler} compiler") - compilers = spack.compilers.compilers_for_spec(compiler, arch_spec=architecture) - if compilers: - return [] - - dep = spack.compilers.pkg_spec_for_compiler(compiler) - - # Set the architecture for the compiler package in a way that allows the - # concretizer to back off if needed for the older bootstrapping compiler - dep.constrain(f"platform={str(architecture.platform)}") - dep.constrain(f"os={str(architecture.os)}") - dep.constrain(f"target={architecture.target.microarchitecture.family.name}:") - # concrete CompilerSpec has less info than concrete Spec - # concretize as Spec to add that information - dep.concretize() - # mark compiler as depended-on by the packages that use it - for pkg in pkgs: - dep._dependents.add( - spack.spec.DependencySpec(pkg.spec, dep, depflag=dt.BUILD, virtuals=()) - ) - packages = [(s.package, False) for s in dep.traverse(order="post", root=False)] - - packages.append((dep.package, True)) - return packages - - def _hms(seconds: int) -> str: """ Convert seconds to hours, minutes, seconds @@ -967,26 +921,6 @@ def __init__( if package_id(d) != self.pkg_id ) - # Handle bootstrapped compiler - # - # The bootstrapped compiler is not a dependency in the spec, but it is - # a dependency of the build task. Here we add it to self.dependencies - compiler_spec = self.pkg.spec.compiler - arch_spec = self.pkg.spec.architecture - strict = spack.concretize.Concretizer().check_for_compiler_existence - if ( - not spack.compilers.compilers_for_spec(compiler_spec, arch_spec=arch_spec) - and not strict - ): - # The compiler is in the queue, identify it as dependency - dep = spack.compilers.pkg_spec_for_compiler(compiler_spec) - dep.constrain(f"platform={str(arch_spec.platform)}") - dep.constrain(f"os={str(arch_spec.os)}") - dep.constrain(f"target={arch_spec.target.microarchitecture.family.name}:") - dep.concretize() - dep_id = package_id(dep) - self.dependencies.add(dep_id) - # List of uninstalled dependencies, which is used to establish # the priority of the build task. # @@ -1165,53 +1099,6 @@ def __str__(self) -> str: installed = f"installed ({len(self.installed)}) = {self.installed}" return f"{self.pid}: {requests}; {tasks}; {installed}; {failed}" - def _add_bootstrap_compilers( - self, - compiler: "spack.spec.CompilerSpec", - architecture: "spack.spec.ArchSpec", - pkgs: List["spack.package_base.PackageBase"], - request: BuildRequest, - all_deps, - ) -> None: - """ - Add bootstrap compilers and dependencies to the build queue. - - Args: - compiler: the compiler to boostrap - architecture: the architecture for which to bootstrap the compiler - pkgs: the package list with possible compiler dependencies - request: the associated install request - all_deps (defaultdict(set)): dictionary of all dependencies and - associated dependents - """ - packages = _packages_needed_to_bootstrap_compiler(compiler, architecture, pkgs) - for comp_pkg, is_compiler in packages: - pkgid = package_id(comp_pkg.spec) - if pkgid not in self.build_tasks: - self._add_init_task(comp_pkg, request, is_compiler, all_deps) - elif is_compiler: - # ensure it's queued as a compiler - self._modify_existing_task(pkgid, "compiler", True) - - def _modify_existing_task(self, pkgid: str, attr, value) -> None: - """ - Update a task in-place to modify its behavior. - - Currently used to update the ``compiler`` field on tasks - that were originally created as a dependency of a compiler, - but are compilers in their own right. - - For example, ``intel-oneapi-compilers-classic`` depends on - ``intel-oneapi-compilers``, which can cause the latter to be - queued first as a non-compiler, and only later as a compiler. - """ - for i, tup in enumerate(self.build_pq): - key, task = tup - if task.pkg_id == pkgid: - tty.debug(f"Modifying task for {pkgid} to treat it as a compiler", level=2) - setattr(task, attr, value) - self.build_pq[i] = (key, task) - def _add_init_task( self, pkg: "spack.package_base.PackageBase", @@ -1541,42 +1428,7 @@ def _add_tasks(self, request: BuildRequest, all_deps): tty.warn(f"Installation request refused: {str(err)}") return - install_compilers = spack.config.get("config:install_missing_compilers", False) - install_deps = request.install_args.get("install_deps") - # Bootstrap compilers first - if install_deps and install_compilers: - packages_per_compiler: Dict[ - "spack.spec.CompilerSpec", - Dict["spack.spec.ArchSpec", List["spack.package_base.PackageBase"]], - ] = {} - - for dep in request.traverse_dependencies(): - dep_pkg = dep.package - compiler = dep_pkg.spec.compiler - arch = dep_pkg.spec.architecture - if compiler not in packages_per_compiler: - packages_per_compiler[compiler] = {} - - if arch not in packages_per_compiler[compiler]: - packages_per_compiler[compiler][arch] = [] - - packages_per_compiler[compiler][arch].append(dep_pkg) - - compiler = request.pkg.spec.compiler - arch = request.pkg.spec.architecture - - if compiler not in packages_per_compiler: - packages_per_compiler[compiler] = {} - - if arch not in packages_per_compiler[compiler]: - packages_per_compiler[compiler][arch] = [] - - packages_per_compiler[compiler][arch].append(request.pkg) - - for compiler, archs in packages_per_compiler.items(): - for arch, packages in archs.items(): - self._add_bootstrap_compilers(compiler, arch, packages, request, all_deps) if install_deps: for dep in request.traverse_dependencies(): @@ -1608,10 +1460,6 @@ def _add_tasks(self, request: BuildRequest, all_deps): fail_fast = bool(request.install_args.get("fail_fast")) self.fail_fast = self.fail_fast or fail_fast - def _add_compiler_package_to_config(self, pkg: "spack.package_base.PackageBase") -> None: - compiler_search_prefix = getattr(pkg, "compiler_search_prefix", pkg.spec.prefix) - spack.compilers.find_compilers([compiler_search_prefix]) - def _install_task(self, task: BuildTask, install_status: InstallStatus) -> None: """ Perform the installation of the requested spec and/or dependency @@ -1639,8 +1487,6 @@ def _install_task(self, task: BuildTask, install_status: InstallStatus) -> None: if use_cache: if _install_from_cache(pkg, explicit, unsigned): self._update_installed(task) - if task.compiler: - self._add_compiler_package_to_config(pkg) return elif cache_only: raise InstallError("No binary found when cache-only was specified", pkg=pkg) @@ -1670,9 +1516,6 @@ def _install_task(self, task: BuildTask, install_status: InstallStatus) -> None: # the database, so that we don't need to re-read from file. spack.store.STORE.db.add(pkg.spec, explicit=explicit) - # If a compiler, ensure it is added to the configuration - if task.compiler: - self._add_compiler_package_to_config(pkg) except spack.build_environment.StopPhase as e: # A StopPhase exception means that do_install was asked to # stop early from clients, and is not an error at this point @@ -2073,10 +1916,6 @@ def install(self) -> None: path = spack.util.path.debug_padded_filter(pkg.prefix) _print_installed_pkg(path) - # It's an already installed compiler, add it to the config - if task.compiler: - self._add_compiler_package_to_config(pkg) - else: # At this point we've failed to get a write or a read # lock, which means another process has taken a write diff --git a/lib/spack/spack/schema/config.py b/lib/spack/spack/schema/config.py index 468af55fc6bb22..72590d8e82cfc2 100644 --- a/lib/spack/spack/schema/config.py +++ b/lib/spack/spack/schema/config.py @@ -75,7 +75,6 @@ "verify_ssl": {"type": "boolean"}, "ssl_certs": {"type": "string"}, "suppress_gpg_warnings": {"type": "boolean"}, - "install_missing_compilers": {"type": "boolean"}, "debug": {"type": "boolean"}, "checksum": {"type": "boolean"}, "deprecated": {"type": "boolean"}, @@ -102,7 +101,14 @@ "message": "Spack supports only clingo as a concretizer from v0.23. " "The config:concretizer config option is ignored.", "error": False, - } + }, + { + "names": ["install_missing_compilers"], + "message": "The config:install_missing_compilers option has been deprecated in " + "Spack v0.23, and is currently ignored. It will be removed from config in " + "Spack v0.25.", + "error": False, + }, ], } } diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 2d053721b1a71b..ba04e7cb339cc1 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -2731,10 +2731,6 @@ def define_runtime_constraints(self): continue current_libc = compiler.compiler_obj.default_libc - # If this is a compiler yet to be built (config:install_missing_compilers:true) - # infer libc from the Python process - if not current_libc and compiler.compiler_obj.cc is None: - current_libc = spack.util.libc.libc_from_current_python_process() if using_libc_compatibility() and current_libc: recorder("*").depends_on( @@ -3156,7 +3152,7 @@ def with_input_specs(self, input_specs: List["spack.spec.Spec"]) -> "CompilerPar Args: input_specs: specs to be concretized """ - strict = spack.concretize.Concretizer().check_for_compiler_existence + strict = spack.concretize.CHECK_COMPILER_EXISTENCE default_os = str(spack.platforms.host().default_os) default_target = str(archspec.cpu.host().family) for s in traverse.traverse_nodes(input_specs): diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index dab05adaa3a430..44e9e213be9ae3 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -1319,7 +1319,7 @@ node_compiler_weight(node(ID, Package), 100) not compiler_weight(CompilerID, _). % For the time being, be strict and reuse only if the compiler match one we have on the system -error(100, "Compiler {1}@{2} requested for {0} cannot be found. Set install_missing_compilers:true if intended.", Package, Compiler, Version) +error(100, "Compiler {1}@{2} requested for {0} cannot be found.", Package, Compiler, Version) :- attr("node_compiler_version", node(ID, Package), Compiler, Version), not node_compiler(node(ID, Package), _). diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 5f8119f01763d2..47dd194f879acd 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -19,7 +19,6 @@ import spack.cmd.common.arguments import spack.cmd.install -import spack.compilers as compilers import spack.config import spack.environment as ev import spack.hash_types as ht @@ -29,7 +28,7 @@ from spack.error import SpackError from spack.main import SpackCommand from spack.parser import SpecSyntaxError -from spack.spec import CompilerSpec, Spec +from spack.spec import Spec install = SpackCommand("install") env = SpackCommand("env") @@ -916,68 +915,6 @@ def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd): assert "foo: No such file or directory" in content -@pytest.mark.not_on_windows("ArchSpec gives test platform debian rather than windows") -def test_compiler_bootstrap( - install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch -): - monkeypatch.setattr(spack.concretize.Concretizer, "check_for_compiler_existence", False) - spack.config.set("config:install_missing_compilers", True) - assert CompilerSpec("gcc@=12.0") not in compilers.all_compiler_specs() - - # Test succeeds if it does not raise an error - install("pkg-a%gcc@=12.0") - - -@pytest.mark.not_on_windows("Binary mirrors not supported on windows") -def test_compiler_bootstrap_from_binary_mirror( - install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch, tmpdir -): - """ - Make sure installing compiler from buildcache registers compiler - """ - - # Create a temp mirror directory for buildcache usage - mirror_dir = tmpdir.join("mirror_dir") - mirror_url = "file://{0}".format(mirror_dir.strpath) - - # Install a compiler, because we want to put it in a buildcache - install("gcc@=10.2.0") - - # Put installed compiler in the buildcache - buildcache("push", "-u", "-f", mirror_dir.strpath, "gcc@10.2.0") - - # Now uninstall the compiler - uninstall("-y", "gcc@10.2.0") - - monkeypatch.setattr(spack.concretize.Concretizer, "check_for_compiler_existence", False) - spack.config.set("config:install_missing_compilers", True) - assert CompilerSpec("gcc@=10.2.0") not in compilers.all_compiler_specs() - - # Configure the mirror where we put that buildcache w/ the compiler - mirror("add", "test-mirror", mirror_url) - - # Now make sure that when the compiler is installed from binary mirror, - # it also gets configured as a compiler. Test succeeds if it does not - # raise an error - install("--no-check-signature", "--cache-only", "--only", "dependencies", "pkg-b%gcc@=10.2.0") - install("--no-cache", "--only", "package", "pkg-b%gcc@10.2.0") - - -@pytest.mark.not_on_windows("ArchSpec gives test platform debian rather than windows") -@pytest.mark.regression("16221") -def test_compiler_bootstrap_already_installed( - install_mockery, mock_packages, mock_fetch, mock_archive, mutable_config, monkeypatch -): - monkeypatch.setattr(spack.concretize.Concretizer, "check_for_compiler_existence", False) - spack.config.set("config:install_missing_compilers", True) - - assert CompilerSpec("gcc@=12.0") not in compilers.all_compiler_specs() - - # Test succeeds if it does not raise an error - install("gcc@=12.0") - install("pkg-a%gcc@=12.0") - - def test_install_fails_no_args(tmpdir): # ensure no spack.yaml in directory with tmpdir.as_cwd(): diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 786528f30fd538..4843861730bb21 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -2375,26 +2375,6 @@ def test_externals_with_platform_explicitly_set(self, tmp_path): s = Spec("mpich").concretized() assert s.external - @pytest.mark.regression("43875") - def test_concretize_missing_compiler(self, mutable_config, monkeypatch): - """Tests that Spack can concretize a spec with a missing compiler when the - option is active. - """ - - def _default_libc(self): - if self.cc is None: - return None - return Spec("glibc@=2.28") - - monkeypatch.setattr(spack.concretize.Concretizer, "check_for_compiler_existence", False) - monkeypatch.setattr(spack.compiler.Compiler, "default_libc", property(_default_libc)) - monkeypatch.setattr( - spack.util.libc, "libc_from_current_python_process", lambda: Spec("glibc@=2.28") - ) - mutable_config.set("config:install_missing_compilers", True) - s = Spec("pkg-a %gcc@=13.2.0").concretized() - assert s.satisfies("%gcc@13.2.0") - @pytest.mark.regression("43267") def test_spec_with_build_dep_from_json(self, tmp_path): """Tests that we can correctly concretize a spec, when we express its dependency as a diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 16d50221ea01cb..95084ba8ee6d06 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -12,8 +12,6 @@ import py import pytest -import archspec.cpu - import llnl.util.filesystem as fs import llnl.util.lock as ulk import llnl.util.tty as tty @@ -435,76 +433,6 @@ def test_fake_install(install_mockery): assert os.path.isdir(pkg.prefix.lib) -def test_packages_needed_to_bootstrap_compiler_none(install_mockery): - spec = spack.spec.Spec("trivial-install-test-package") - spec.concretize() - assert spec.concrete - - packages = inst._packages_needed_to_bootstrap_compiler( - spec.compiler, spec.architecture, [spec.package] - ) - assert not packages - - -@pytest.mark.xfail(reason="fails when assuming Spec.package can only be called on concrete specs") -def test_packages_needed_to_bootstrap_compiler_packages(install_mockery, monkeypatch): - spec = spack.spec.Spec("trivial-install-test-package") - spec.concretize() - - def _conc_spec(compiler): - return spack.spec.Spec("pkg-a").concretized() - - # Ensure we can get past functions that are precluding obtaining - # packages. - monkeypatch.setattr(spack.compilers, "compilers_for_spec", _none) - monkeypatch.setattr(spack.compilers, "pkg_spec_for_compiler", _conc_spec) - monkeypatch.setattr(spack.spec.Spec, "concretize", _noop) - - packages = inst._packages_needed_to_bootstrap_compiler( - spec.compiler, spec.architecture, [spec.package] - ) - assert packages - - -def test_update_tasks_for_compiler_packages_as_compiler(mock_packages, config, monkeypatch): - spec = spack.spec.Spec("trivial-install-test-package").concretized() - installer = inst.PackageInstaller([spec.package], {}) - - # Add a task to the queue - installer._add_init_task(spec.package, installer.build_requests[0], False, {}) - - # monkeypatch to make the list of compilers be what we test - def fake_package_list(compiler, architecture, pkgs): - return [(spec.package, True)] - - monkeypatch.setattr(inst, "_packages_needed_to_bootstrap_compiler", fake_package_list) - - installer._add_bootstrap_compilers("fake", "fake", "fake", None, {}) - - # Check that the only task is now a compiler task - assert len(installer.build_pq) == 1 - assert installer.build_pq[0][1].compiler - - -@pytest.mark.skipif( - str(archspec.cpu.host().family) != "x86_64", - reason="OneAPI compiler is not supported on other architectures", -) -def test_bootstrapping_compilers_with_different_names_from_spec( - install_mockery, mutable_config, mock_fetch, archspec_host_is_spack_test_host -): - """Tests that, when we bootstrap '%oneapi' we can translate it to the - 'intel-oneapi-compilers' package. - """ - with spack.config.override("config:install_missing_compilers", True): - with spack.concretize.disable_compiler_existence_check(): - spec = spack.spec.Spec("trivial-install-test-package%oneapi@=22.2.0").concretized() - spec.package.do_install() - assert ( - spack.spec.CompilerSpec("oneapi@=22.2.0") in spack.compilers.all_compiler_specs() - ) - - def test_dump_packages_deps_ok(install_mockery, tmpdir, mock_packages): """Test happy path for dump_packages with dependencies.""" @@ -696,26 +624,6 @@ def test_check_deps_status_upstream(install_mockery, monkeypatch): assert inst.package_id(dep) in installer.installed -def test_add_bootstrap_compilers(install_mockery, monkeypatch): - from collections import defaultdict - - def _pkgs(compiler, architecture, pkgs): - spec = spack.spec.Spec("mpi").concretized() - return [(spec.package, True)] - - installer = create_installer(["trivial-install-test-package"], {}) - request = installer.build_requests[0] - all_deps = defaultdict(set) - - monkeypatch.setattr(inst, "_packages_needed_to_bootstrap_compiler", _pkgs) - installer._add_bootstrap_compilers("fake", "fake", [request.pkg], request, all_deps) - - ids = list(installer.build_tasks) - assert len(ids) == 1 - task = installer.build_tasks[ids[0]] - assert task.compiler - - def test_prepare_for_install_on_installed(install_mockery, monkeypatch): """Test of _prepare_for_install's early return for installed task path.""" installer = create_installer(["dependent-install"], {}) @@ -729,18 +637,6 @@ def test_prepare_for_install_on_installed(install_mockery, monkeypatch): installer._prepare_for_install(task) -def test_installer_init_requests(install_mockery): - """Test of installer initial requests.""" - spec_name = "dependent-install" - with spack.config.override("config:install_missing_compilers", True): - installer = create_installer([spec_name], {}) - - # There is only one explicit request in this case - assert len(installer.build_requests) == 1 - request = installer.build_requests[0] - assert request.pkg.name == spec_name - - def test_install_task_use_cache(install_mockery, monkeypatch): installer = create_installer(["trivial-install-test-package"], {}) request = installer.build_requests[0] From f58ee3ea2be19318b21f9700c1bbebb579651b55 Mon Sep 17 00:00:00 2001 From: Taillefumier Mathieu <29380261+mtaillefumier@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:08:32 -0400 Subject: [PATCH 080/687] SIRIUS: add v7.6.1 (#46296) bug fix update for sirius --- var/spack/repos/builtin/packages/sirius/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/sirius/package.py b/var/spack/repos/builtin/packages/sirius/package.py index 5d33a42fba69b9..02f547a0821860 100644 --- a/var/spack/repos/builtin/packages/sirius/package.py +++ b/var/spack/repos/builtin/packages/sirius/package.py @@ -23,6 +23,7 @@ class Sirius(CMakePackage, CudaPackage, ROCmPackage): version("develop", branch="develop") version("master", branch="master") + version("7.6.1", sha256="16a114dc17e28697750585820e69718a96e6929f88406d266c75cf9a7cdbdaaa") version("7.6.0", sha256="e424206fecb35bb2082b5c87f0865a9536040e984b88b041e6f7d531f8a65b20") version("7.5.2", sha256="9ae01935578532c84f1d0d673dbbcdd490e26be22efa6c4acf7129f9dc1a0c60") version("7.5.1", sha256="aadfa7976e90a109aeb1677042454388a8d1a50d75834d59c86c8aef06bc12e4") From e1da0a731261452639890c07633485e4f6aeff0a Mon Sep 17 00:00:00 2001 From: afzpatel <122491982+afzpatel@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:13:21 -0400 Subject: [PATCH 081/687] Bump up the version for ROCm-6.2.0 (#45701) * initial update for rocm 6.2 * fix typo in rocprofiler-register * update rocm-device-libs * add patch to use clang 18 for roctracer-dev * add updates for rocm-opencl and rocm-validation-suite * add hipify-clang patch * update remaining packages to 6.2 * update hipblaslt mivisionx patches * update rocm-tensile to 6.2.0 * add hipsparselt changes for 6.2 * add rocm-openmp-extras patch * add build-time test for rocprofiler-register * update flang-legacy support for 6.2 * simplify version range * update boost dependency in rpp --------- Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> --- .../repos/builtin/packages/amdsmi/package.py | 1 + .../builtin/packages/aqlprofile/package.py | 14 ++ .../repos/builtin/packages/comgr/package.py | 2 + .../packages/composable-kernel/package.py | 6 +- .../builtin/packages/hip-tensor/package.py | 5 +- .../repos/builtin/packages/hip/package.py | 11 +- .../repos/builtin/packages/hipblas/package.py | 4 +- .../builtin/packages/hipblaslt/package.py | 5 +- .../repos/builtin/packages/hipcc/package.py | 1 + .../repos/builtin/packages/hipcub/package.py | 2 + .../repos/builtin/packages/hipfft/package.py | 2 + .../repos/builtin/packages/hipfort/package.py | 2 + ...se-source-permission-for-hipify-perl.patch | 12 ++ .../builtin/packages/hipify-clang/package.py | 6 +- .../repos/builtin/packages/hiprand/package.py | 2 + .../builtin/packages/hipsolver/package.py | 2 + .../builtin/packages/hipsparse/package.py | 2 + ...-hipsparse-include-dir-for-spack-6.2.patch | 77 +++++++++ .../builtin/packages/hipsparselt/package.py | 4 +- .../builtin/packages/hsa-rocr-dev/package.py | 3 + .../builtin/packages/hsakmt-roct/package.py | 1 + .../builtin/packages/llvm-amdgpu/package.py | 25 ++- .../builtin/packages/migraphx/package.py | 4 +- .../builtin/packages/miopen-hip/package.py | 46 +++++- .../builtin/packages/mivisionx/package.py | 10 +- .../repos/builtin/packages/rccl/package.py | 3 + .../repos/builtin/packages/rdc/package.py | 7 +- .../builtin/packages/rocalution/package.py | 2 + .../repos/builtin/packages/rocblas/package.py | 16 +- .../repos/builtin/packages/rocfft/package.py | 2 + .../packages/rocm-bandwidth-test/package.py | 3 + .../builtin/packages/rocm-cmake/package.py | 2 + .../builtin/packages/rocm-core/package.py | 1 + .../builtin/packages/rocm-dbgapi/package.py | 3 + .../packages/rocm-debug-agent/package.py | 3 + .../packages/rocm-device-libs/package.py | 3 + .../builtin/packages/rocm-gdb/package.py | 3 + .../builtin/packages/rocm-opencl/package.py | 9 +- ...plicate-registration-on-cuda-env-6.2.patch | 13 ++ .../packages/rocm-openmp-extras/package.py | 147 ++++++++++-------- .../builtin/packages/rocm-smi-lib/package.py | 2 + .../builtin/packages/rocm-tensile/package.py | 2 + .../packages/rocm-validation-suite/package.py | 20 +++ .../builtin/packages/rocminfo/package.py | 3 + .../repos/builtin/packages/rocmlir/package.py | 5 +- .../repos/builtin/packages/rocprim/package.py | 2 + .../packages/rocprofiler-dev/package.py | 10 +- .../001-add-cpack-fmt-glog.patch | 38 +++++ .../packages/rocprofiler-register/package.py | 37 +++++ .../repos/builtin/packages/rocrand/package.py | 2 + .../builtin/packages/rocsolver/package.py | 2 + .../builtin/packages/rocsparse/package.py | 2 + .../builtin/packages/rocthrust/package.py | 2 + .../packages/roctracer-dev-api/package.py | 1 + .../roctracer-dev/0002-use-clang-18.patch | 26 ++++ .../builtin/packages/roctracer-dev/package.py | 4 + .../repos/builtin/packages/rocwmma/package.py | 15 +- .../repos/builtin/packages/rpp/package.py | 5 +- 58 files changed, 544 insertions(+), 100 deletions(-) create mode 100644 var/spack/repos/builtin/packages/hipify-clang/0001-use-source-permission-for-hipify-perl.patch create mode 100644 var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack-6.2.patch create mode 100644 var/spack/repos/builtin/packages/rocm-openmp-extras/0001-Avoid-duplicate-registration-on-cuda-env-6.2.patch create mode 100644 var/spack/repos/builtin/packages/rocprofiler-register/001-add-cpack-fmt-glog.patch create mode 100644 var/spack/repos/builtin/packages/rocprofiler-register/package.py create mode 100644 var/spack/repos/builtin/packages/roctracer-dev/0002-use-clang-18.patch diff --git a/var/spack/repos/builtin/packages/amdsmi/package.py b/var/spack/repos/builtin/packages/amdsmi/package.py index 8185f27a0b0405..ccaf5c28f677ac 100644 --- a/var/spack/repos/builtin/packages/amdsmi/package.py +++ b/var/spack/repos/builtin/packages/amdsmi/package.py @@ -20,6 +20,7 @@ class Amdsmi(CMakePackage): libraries = ["libamd_smi"] license("MIT") + version("6.2.0", sha256="49e4b15af62bf9800c02a24c75c6cd99dc8b146d69cc7f00ecbbcd60f6106315") version("6.1.2", sha256="4583ea9bc71d55e987db4a42f9b3b730def22892953d30bca64ca29ac844e058") version("6.1.1", sha256="10ece6b1ca8bb36ab3ae987fc512838f30a92ab788a2200410e9c1707fe0166b") version("6.1.0", sha256="5bd1f150a2191b1703ff2670e40f6fed730f59f155623d6e43b7f64c39ae0967") diff --git a/var/spack/repos/builtin/packages/aqlprofile/package.py b/var/spack/repos/builtin/packages/aqlprofile/package.py index 9fae0246a5290b..37191babaa2161 100644 --- a/var/spack/repos/builtin/packages/aqlprofile/package.py +++ b/var/spack/repos/builtin/packages/aqlprofile/package.py @@ -8,6 +8,20 @@ from spack.package import * _versions = { + "6.2.0": { + "apt": ( + "75f4417477abb80f6a453f836d1ac44c8a3d24447b21cfa4b29787a73725ef4e", + "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hsa-amd-aqlprofile/hsa-amd-aqlprofile_1.0.0.60200.60200-66~20.04_amd64.deb", + ), + "yum": ( + "d8ec6ceffe366c041d4dda11c418da53ca3b2234e8a57d4c4af9fdec936349ed", + "https://repo.radeon.com/rocm/yum/6.2/main/hsa-amd-aqlprofile-1.0.0.60200.60200-66.el7.x86_64.rpm", + ), + "zyp": ( + "e7b34e800e4da6542261379e00b4f3a0e3ebc15e80925bf056ce495aff0b25e9", + "https://repo.radeon.com/rocm/zyp/6.2/main/hsa-amd-aqlprofile-1.0.0.60200.60200-sles155.66.x86_64.rpm", + ), + }, "6.1.2": { "apt": ( "93faa8a0d702bc1623d2346e07a9a1c9134d99c0d3f9de62903e7394e0eedf47", diff --git a/var/spack/repos/builtin/packages/comgr/package.py b/var/spack/repos/builtin/packages/comgr/package.py index b0c0723f8fa397..97eb752c98ced4 100644 --- a/var/spack/repos/builtin/packages/comgr/package.py +++ b/var/spack/repos/builtin/packages/comgr/package.py @@ -30,6 +30,7 @@ def url_for_version(self, version): license("NCSA") version("master", branch="amd-stg-open") + version("6.2.0", sha256="12ce17dc920ec6dac0c5484159b3eec00276e4a5b301ab1250488db3b2852200") version("6.1.2", sha256="300e9d6a137dcd91b18d5809a316fddb615e0e7f982dc7ef1bb56876dff6e097") version("6.1.1", sha256="f1a67efb49f76a9b262e9735d3f75ad21e3bd6a05338c9b15c01e6c625c4460d") version("6.1.0", sha256="6bd9912441de6caf6b26d1323e1c899ecd14ff2431874a2f5883d3bc5212db34") @@ -81,6 +82,7 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: # llvm libs are linked statically, so this *could* be a build dep diff --git a/var/spack/repos/builtin/packages/composable-kernel/package.py b/var/spack/repos/builtin/packages/composable-kernel/package.py index e56bdd63fdbbb9..21401f0bcb415f 100644 --- a/var/spack/repos/builtin/packages/composable-kernel/package.py +++ b/var/spack/repos/builtin/packages/composable-kernel/package.py @@ -19,6 +19,7 @@ class ComposableKernel(CMakePackage): license("MIT") version("master", branch="develop") + version("6.2.0", sha256="4a3024f4f93c080db99d560a607ad758745cd2362a90d0e8f215331686a6bc64") version("6.1.2", sha256="54db801e1c14239f574cf94dd764a2f986b4abcc223393d55c49e4b276e738c9") version("6.1.1", sha256="f55643c6eee0878e8f2d14a382c33c8b84af0bdf8f31b37b6092b377f7a9c6b5") version("6.1.0", sha256="355a4514b96b56aa9edf78198a3e22067e7397857cfe29d9a64d9c5557b9f83d") @@ -56,6 +57,7 @@ class ComposableKernel(CMakePackage): for ver in [ "master", + "6.2.0", "6.1.2", "6.1.1", "6.1.0", @@ -88,11 +90,11 @@ def cmake_args(self): ] if "auto" not in self.spec.variants["amdgpu_target"]: args.append(self.define_from_variant("GPU_TARGETS", "amdgpu_target")) + else: + args.append(self.define("INSTANCES_ONLY", "ON")) if self.spec.satisfies("@5.6.0:"): if self.run_tests: args.append(self.define("BUILD_TESTING", "ON")) - else: - args.append(self.define("INSTANCES_ONLY", "ON")) args.append(self.define("CK_BUILD_JIT_LIB", "ON")) args.append(self.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON")) if self.spec.satisfies("@:5.7"): diff --git a/var/spack/repos/builtin/packages/hip-tensor/package.py b/var/spack/repos/builtin/packages/hip-tensor/package.py index 9d0c887726647c..b6394bef73557d 100644 --- a/var/spack/repos/builtin/packages/hip-tensor/package.py +++ b/var/spack/repos/builtin/packages/hip-tensor/package.py @@ -17,6 +17,7 @@ class HipTensor(CMakePackage, ROCmPackage): maintainers("srekolam", "afzpatel") version("master", branch="master") + version("6.2.0", sha256="adb7459416864fb2664064f5bea5fb669839247b702209a6415b396813626b31") version("6.1.2", sha256="ac0e07a3019bcce4a0a98aafa4922d5fc9e953bed07084abef5306c851717783") version("6.1.1", sha256="09bcdbf6b1d20dc4d75932abd335a9a534b16a8343858121daa5813a38f5ad3a") version("6.1.0", sha256="9cc43b1b3394383f22f30e194d8753ca6ff1887c83ec1de5823cb2e94976eeed") @@ -29,11 +30,11 @@ class HipTensor(CMakePackage, ROCmPackage): variant("asan", default=False, description="Build with address-sanitizer enabled or disabled") - for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "master"]: + for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0", "master"]: depends_on(f"composable-kernel@{ver}", when=f"@{ver}") depends_on(f"rocm-cmake@{ver}", when=f"@{ver}") - for ver in ["6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"hipcc@{ver}", when=f"@{ver}") def setup_build_environment(self, env): diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py index 70f46a5d730eca..3bc5367b0670d6 100644 --- a/var/spack/repos/builtin/packages/hip/package.py +++ b/var/spack/repos/builtin/packages/hip/package.py @@ -27,6 +27,7 @@ class Hip(CMakePackage): license("MIT") version("master", branch="master") + version("6.2.0", sha256="7ca261eba79793427674bf2372c92ac5483cc0fac5278f8ad611de396fad8bee") version("6.1.2", sha256="9ba5f70a553b48b2cea25c7e16b97ad49320750c0152763b173b63b9f151e783") version("6.1.1", sha256="09e8013b8071fca2cf914758001bbd1dccaa237e798e945970e4356cb9b90050") version("6.1.0", sha256="6fd57910a16d0b54df822807e67b6207146233a2de5a46c6a05b940a21e2c4d7") @@ -84,6 +85,7 @@ class Hip(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") @@ -106,6 +108,7 @@ class Hip(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hipify-clang@{ver}", when=f"@{ver}") @@ -121,13 +124,16 @@ class Hip(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") + + depends_on("rocprofiler-register@6.2.0", when="@6.2.0") # hipcc likes to add `-lnuma` by default :( # ref https://github.com/ROCm/HIP/pull/2202 depends_on("numactl", when="@3.7.0:") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"hipcc@{ver}", when=f"@{ver}") # roc-obj-ls requirements @@ -189,6 +195,7 @@ class Hip(CMakePackage): ) # Add hip-clr sources thru the below for d_version, d_shasum in [ + ("6.2.0", "620e4c6a7f05651cc7a170bc4700fef8cae002420307a667c638b981d00b25e8"), ("6.1.2", "1a1e21640035d957991559723cd093f0c7e202874423667d2ba0c7662b01fea4"), ("6.1.1", "2db02f335c9d6fa69befcf7c56278e5cecfe3db0b457eaaa41206c2585ef8256"), ("6.1.0", "49b23eef621f4e8e528bb4de8478a17436f42053a2f7fde21ff221aa683205c7"), @@ -242,6 +249,7 @@ class Hip(CMakePackage): ) # Add hipother sources thru the below for d_version, d_shasum in [ + ("6.2.0", "1f854b0c07d71b10450080e3bbffe47adaf10a9745a9212797d991756a100174"), ("6.1.2", "2740d1e3dcf1f2d07d2a8db6acf4c972941ae392172b83fd8ddcfe8706a40d0b"), ("6.1.1", "8b975623c8ed1db53feea2cfd5d29f2a615e890aee1157d0d17adeb97200643f"), ("6.1.0", "43a48ccc82f705a15852392ee7419e648d913716bfc04063a53d2d17979b1b46"), @@ -260,6 +268,7 @@ class Hip(CMakePackage): # Add hiptests sources thru the below for d_version, d_shasum in [ + ("6.2.0", "314837dbac78be71844ceb959476470c484fdcd4fb622ff8de9277783e0fcf1c"), ("6.1.2", "5b14e4a30d8d8fb56c43e262009646ba9188eac1c8ff882d9a606a4bec69b56b"), ("6.1.1", "10c96ee72adf4580056292ab17cfd858a2fd7bc07abeb41c6780bd147b47f7af"), ("6.1.0", "cf3a6a7c43116032d933cc3bc88bfc4b17a4ee1513c978e751755ca11a5ed381"), diff --git a/var/spack/repos/builtin/packages/hipblas/package.py b/var/spack/repos/builtin/packages/hipblas/package.py index 6563a804a69e24..c67b4fd4b8b637 100644 --- a/var/spack/repos/builtin/packages/hipblas/package.py +++ b/var/spack/repos/builtin/packages/hipblas/package.py @@ -24,6 +24,7 @@ class Hipblas(CMakePackage, CudaPackage, ROCmPackage): version("develop", branch="develop") version("master", branch="master") + version("6.2.0", sha256="33688a4d929b13e1fd800aff7e0833a9f7abf3913754b6b15995595e0d434e94") version("6.1.2", sha256="73699892855775a67f48c38beae78169a516078c17f1ed5d67c80abe5d308502") version("6.1.1", sha256="087ea82dff13c8162bf93343b174b18f1d58681711bce4fb7c8dc7212020c099") version("6.1.0", sha256="5f8193c4ef0508967e608a8adf86d63066a984c5803a4d05dd617021d6298091") @@ -75,7 +76,7 @@ class Hipblas(CMakePackage, CudaPackage, ROCmPackage): depends_on("rocm-cmake@5.2.0:", type="build", when="@5.2.0:5.7") depends_on("rocm-cmake@4.5.0:", type="build") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"rocm-cmake@{ver}", when=f"+rocm @{ver}") depends_on(f"rocm-openmp-extras@{ver}", type="test", when=f"+rocm @{ver}") @@ -97,6 +98,7 @@ class Hipblas(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", "develop", ]: diff --git a/var/spack/repos/builtin/packages/hipblaslt/package.py b/var/spack/repos/builtin/packages/hipblaslt/package.py index d7a9a5c141b289..2510b6bd1759e2 100644 --- a/var/spack/repos/builtin/packages/hipblaslt/package.py +++ b/var/spack/repos/builtin/packages/hipblaslt/package.py @@ -17,6 +17,7 @@ class Hipblaslt(CMakePackage): maintainers("srekolam", "afzpatel", "renjithravindrankannath") license("MIT") + version("6.2.0", sha256="aec9edc75ae4438aa712192c784e2bed683d2839b502b6aadb18f6012306749b") version("6.1.2", sha256="fcfe950f7b87c421565abe090b2de6f463afc1549841002f105ecca7bbbf59e5") version("6.1.1", sha256="1e21730ade59b5e32432fa0981383f689a380b1ffc92fe950822722da9521a72") version("6.1.0", sha256="90fc2f2c9e11c87e0529e824e4b0561dbc850f8ffa21be6932ae63cbaa27cdf0") @@ -35,7 +36,7 @@ class Hipblaslt(CMakePackage): ) variant("asan", default=False, description="Build with address-sanitizer enabled or disabled") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"hipblas@{ver}", when=f"@{ver}") depends_on(f"rocm-openmp-extras@{ver}", type="test", when=f"@{ver}") @@ -51,7 +52,7 @@ class Hipblaslt(CMakePackage): patch("001_Set_LLVM_Paths_And_Add_Includes.patch", when="@6.0") # Below patch sets the proper path for clang++ and clang-offload-blunder. # Also adds hipblas and msgpack include directories for 6.1.0 release. - patch("0001-Set-LLVM_Path-Add-Hiblas-Include-to-CmakeLists-6.1.Patch", when="@6.1") + patch("0001-Set-LLVM_Path-Add-Hiblas-Include-to-CmakeLists-6.1.Patch", when="@6.1:6.2") def setup_build_environment(self, env): env.set("CXX", self.spec["hip"].hipcc) diff --git a/var/spack/repos/builtin/packages/hipcc/package.py b/var/spack/repos/builtin/packages/hipcc/package.py index d94ce19e0c57d6..0e3bbb6aa8c936 100644 --- a/var/spack/repos/builtin/packages/hipcc/package.py +++ b/var/spack/repos/builtin/packages/hipcc/package.py @@ -24,6 +24,7 @@ def url_for_version(self, version): maintainers("srekolam", "renjithravindrankannath", "afzpatel") license("MIT") + version("6.2.0", sha256="12ce17dc920ec6dac0c5484159b3eec00276e4a5b301ab1250488db3b2852200") version("6.1.2", sha256="300e9d6a137dcd91b18d5809a316fddb615e0e7f982dc7ef1bb56876dff6e097") version("6.1.1", sha256="f1a67efb49f76a9b262e9735d3f75ad21e3bd6a05338c9b15c01e6c625c4460d") version("6.1.0", sha256="6bd9912441de6caf6b26d1323e1c899ecd14ff2431874a2f5883d3bc5212db34") diff --git a/var/spack/repos/builtin/packages/hipcub/package.py b/var/spack/repos/builtin/packages/hipcub/package.py index 686645f8425d8e..db9f1ea0618424 100644 --- a/var/spack/repos/builtin/packages/hipcub/package.py +++ b/var/spack/repos/builtin/packages/hipcub/package.py @@ -17,6 +17,7 @@ class Hipcub(CMakePackage, CudaPackage, ROCmPackage): license("BSD-3-Clause") maintainers("srekolam", "renjithravindrankannath") + version("6.2.0", sha256="8dda8b77740e722fd4cf7223476313fc873bad75d50e6cb86ff284a91d76752d") version("6.1.2", sha256="830a0f3231e07fcc6cd6261c4e1af2d7d0ac4862c606ecdc80c2635557ca3d9f") version("6.1.1", sha256="967716d67e4270c599a60b770d543ea9148948edb907a0fa4d8be3a1785c2058") version("6.1.0", sha256="39ac03053ecf35f1faf212e5b197b03c0104b74b0833f7cce5cf625c273ba71c") @@ -74,6 +75,7 @@ class Hipcub(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocprim@{ver}", when=f"+rocm @{ver}") depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/hipfft/package.py b/var/spack/repos/builtin/packages/hipfft/package.py index bb9024dd9e78db..ec06a50214ef7f 100644 --- a/var/spack/repos/builtin/packages/hipfft/package.py +++ b/var/spack/repos/builtin/packages/hipfft/package.py @@ -24,6 +24,7 @@ class Hipfft(CMakePackage, CudaPackage, ROCmPackage): license("MIT") version("master", branch="master") + version("6.2.0", sha256="8d19aebb1bbfea1f235ca08d34393ce39bea35dc9cbfa72a3cf7cdf1c56410e7") version("6.1.2", sha256="6753e45d9c671d58e68bed2b0c1bfcd40fad9d690dba3fe6011e67e51dbe3cc6") version("6.1.1", sha256="df84e488098d457a7411f6b459537fa5c5ee160027efc3a9a076980bbe57c4d3") version("6.1.0", sha256="1a9cf598a932192f7f12b8987d96477f09186f9a95c5a28742f9caeb81640c95") @@ -81,6 +82,7 @@ class Hipfft(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") depends_on(f"rocfft@{ver}", when=f"+rocm @{ver}") diff --git a/var/spack/repos/builtin/packages/hipfort/package.py b/var/spack/repos/builtin/packages/hipfort/package.py index a4823db0e24442..fbb0ca3caee9db 100644 --- a/var/spack/repos/builtin/packages/hipfort/package.py +++ b/var/spack/repos/builtin/packages/hipfort/package.py @@ -17,6 +17,7 @@ class Hipfort(CMakePackage): license("MIT") maintainers("cgmb", "srekolam", "renjithravindrankannath") + version("6.2.0", sha256="7f6db61a0ac7771e5c4604a6113b36736f6c7f05cabd7e1df8e832c98b87311d") version("6.1.2", sha256="f60d07fa3e5b09246c8908b2876addf175a91e91c8b0fac85b000f88b6743c7c") version("6.1.1", sha256="646f7077399db7a70d7102fda8307d0a11039f616399a4a06a64fd824336419f") version("6.1.0", sha256="70d3ccc9f3536f62686e73934f5972ed011c4df7654ed1f8e6d2d42c4289f47e") @@ -59,6 +60,7 @@ class Hipfort(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", type="build", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/hipify-clang/0001-use-source-permission-for-hipify-perl.patch b/var/spack/repos/builtin/packages/hipify-clang/0001-use-source-permission-for-hipify-perl.patch new file mode 100644 index 00000000000000..8d9290e40c8205 --- /dev/null +++ b/var/spack/repos/builtin/packages/hipify-clang/0001-use-source-permission-for-hipify-perl.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d105e2..0c1bbb5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -177,6 +177,7 @@ if (NOT HIPIFY_CLANG_TESTS_ONLY) + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin + DESTINATION . ++ USE_SOURCE_PERMISSIONS + PATTERN "hipify-perl" + PATTERN "*.sh" + PATTERN "findcode.sh" EXCLUDE diff --git a/var/spack/repos/builtin/packages/hipify-clang/package.py b/var/spack/repos/builtin/packages/hipify-clang/package.py index df63043cca3882..9d3fcd6809634b 100644 --- a/var/spack/repos/builtin/packages/hipify-clang/package.py +++ b/var/spack/repos/builtin/packages/hipify-clang/package.py @@ -20,6 +20,7 @@ class HipifyClang(CMakePackage): license("MIT") version("master", branch="master") + version("6.2.0", sha256="11bfbde7c40e5cd5de02a47ec30dc6df4b233a12126bf7ee449432a30a3e6e1e") version("6.1.2", sha256="7cc1e3fd7690a3e1d99cd07f2bd62ee73682cceeb4a46918226fc70f8092eb68") version("6.1.1", sha256="240b83ccbe1b6514a6af6c2261e306948ce6c2b1c4d1056e830bbaebddeabd82") version("6.1.0", sha256="dc61b476081750130c62c7540fce49ee3a45a2b74e185d20049382574c1842d1") @@ -46,7 +47,8 @@ class HipifyClang(CMakePackage): patch("0001-install-hipify-clang-in-bin-dir-and-llvm-clangs-head.patch", when="@5.1.0:5.5") patch("0002-install-hipify-clang-in-bin-dir-and-llvm-clangs-head.patch", when="@5.6:6.0") - patch("0003-install-hipify-clang-in-bin-dir-and-llvm-clangs-head.patch", when="@6.1:") + patch("0003-install-hipify-clang-in-bin-dir-and-llvm-clangs-head.patch", when="@6.1") + patch("0001-use-source-permission-for-hipify-perl.patch", when="@6.2") depends_on("cmake@3.5:", type="build") for ver in [ @@ -65,6 +67,7 @@ class HipifyClang(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"llvm-amdgpu@{ver}", when=f"@{ver}") @@ -81,6 +84,7 @@ class HipifyClang(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/hiprand/package.py b/var/spack/repos/builtin/packages/hiprand/package.py index 3a639126545b9c..30db490a63ce80 100644 --- a/var/spack/repos/builtin/packages/hiprand/package.py +++ b/var/spack/repos/builtin/packages/hiprand/package.py @@ -24,6 +24,7 @@ class Hiprand(CMakePackage, CudaPackage, ROCmPackage): version("develop", branch="develop") version("master", branch="master") + version("6.2.0", sha256="daaf32506eaaf3c3b715ed631387c27992cfe0d938353a88ad6acedc735eb54b") version("6.1.2", sha256="f0f129811c144dd711e967305c7af283cefb94bfdbcd2a11296b92a9e966be2c") version("6.1.1", sha256="dde1526fb6cde17b18bc9ee6daa719056fc468dfbda5801b9a61260daf2b4498") version("6.1.0", sha256="f9d71af23092f8faa888d2c14713ee4d4d350454818ca9331d422c81c2587c1f") @@ -93,6 +94,7 @@ class Hiprand(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", "develop", ]: diff --git a/var/spack/repos/builtin/packages/hipsolver/package.py b/var/spack/repos/builtin/packages/hipsolver/package.py index 1b53a6b04cbb70..f79af0d73689bd 100644 --- a/var/spack/repos/builtin/packages/hipsolver/package.py +++ b/var/spack/repos/builtin/packages/hipsolver/package.py @@ -29,6 +29,7 @@ class Hipsolver(CMakePackage, CudaPackage, ROCmPackage): version("develop", branch="develop") version("master", branch="master") + version("6.2.0", sha256="637577a9cc38e4865894dbcd7eb35050e3de5d45e6db03472e836b318602a84d") version("6.1.2", sha256="406a8e5b82daae2fc03e0a738b5a054ade01bb41785cee4afb9e21c7ec91d492") version("6.1.1", sha256="01d4553458f417824807c069cacfc65d23f6cac79536158473b4356986c8fafd") version("6.1.0", sha256="3cb89ca486cdbdfcb1a07c35ee65f60219ef7bc62a5b0f94ca1a3206a0106495") @@ -99,6 +100,7 @@ class Hipsolver(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", "develop", ]: diff --git a/var/spack/repos/builtin/packages/hipsparse/package.py b/var/spack/repos/builtin/packages/hipsparse/package.py index 57db492ea414db..7d5d6544dfe0bc 100644 --- a/var/spack/repos/builtin/packages/hipsparse/package.py +++ b/var/spack/repos/builtin/packages/hipsparse/package.py @@ -21,6 +21,7 @@ class Hipsparse(CMakePackage, CudaPackage, ROCmPackage): libraries = ["libhipsparse"] license("MIT") + version("6.2.0", sha256="e51b9871d764763519c14be2ec52c1e1ae3959b439afb4be6518b9f9a6f0ebaf") version("6.1.2", sha256="dd44f9b6000b3b0ac0fa238037a80f79d6745a689d4a6755f2d595643be1ef6d") version("6.1.1", sha256="307cff012f0465942dd6666cb00ae60c35941699677c4b26b08e4832bc499059") version("6.1.0", sha256="1d9277a11f71474ea4a9f8419a7a2c37170a86969584e5724e385ec74241e565") @@ -80,6 +81,7 @@ class Hipsparse(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") depends_on(f"rocsparse@{ver}", when=f"+rocm @{ver}") diff --git a/var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack-6.2.patch b/var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack-6.2.patch new file mode 100644 index 00000000000000..143b0e592610ef --- /dev/null +++ b/var/spack/repos/builtin/packages/hipsparselt/0001-update-llvm-path-add-hipsparse-include-dir-for-spack-6.2.patch @@ -0,0 +1,77 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e10585c..a29bc63 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -185,7 +185,7 @@ else() + set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" ) + file (STRINGS "tensilelite_tag.txt" read_tensile_tag) + set( tensile_tag ${read_tensile_tag} CACHE STRING "Tensile tag to download" ) +- virtualenv_install("git+https://github.com/${tensile_fork}/hipBLASLt.git@${tensile_tag}#subdirectory=tensilelite") ++ virtualenv_install("git+https://github.com/ROCm/hipBLASLt.git@modify-tensilelite-spack-6.2#subdirectory=tensilelite") + + message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${tensile_tag}") + endif() +diff --git a/clients/gtest/CMakeLists.txt b/clients/gtest/CMakeLists.txt +index 2057db0..6085133 100644 +--- a/clients/gtest/CMakeLists.txt ++++ b/clients/gtest/CMakeLists.txt +@@ -53,6 +53,7 @@ target_include_directories( hipsparselt-test + $ + $ # may be blank if not used + $ ++ $ + ) + message("BLIS_INCLUDE_DIR=" ${BLIS_INCLUDE_DIR}) + target_link_libraries( hipsparselt-test PRIVATE ${BLAS_LIBRARY} ${GTEST_BOTH_LIBRARIES} roc::hipsparselt ) +diff --git a/clients/samples/CMakeLists.txt b/clients/samples/CMakeLists.txt +index 6b303d5..c6d608c 100644 +--- a/clients/samples/CMakeLists.txt ++++ b/clients/samples/CMakeLists.txt +@@ -50,6 +50,11 @@ foreach( exe ${sample_list_all} ) + $ + ) + ++ target_include_directories( ${exe} ++ SYSTEM PRIVATE ++ $ ++ ) ++ + if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # GCC or hip-clang needs specific flags to turn on f16c intrinsics + target_compile_options( ${exe} PRIVATE -mf16c ) +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index aac8506..e282268 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -58,6 +58,9 @@ include(src/CMakeLists.txt) + # Create hipSPARSELt library + add_library(hipsparselt ${hipsparselt_source} ${hipsparselt_headers_public}) + add_library(roc::hipsparselt ALIAS hipsparselt) ++target_include_directories( hipsparselt PRIVATE ${HIPSPARSE_INCLUDE_DIRS} ) ++target_include_directories( hipsparselt PRIVATE ${MSGPACK_DIR}/include ) ++ + + # Target compile definitions + if(NOT BUILD_CUDA) +diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt +index 85f7cde..4c52b34 100755 +--- a/library/src/CMakeLists.txt ++++ b/library/src/CMakeLists.txt +@@ -61,7 +61,7 @@ if(NOT BUILD_CUDA) + if(Tensile_CPU_THREADS MATCHES "^[0-9]+$") + # only including threads argument if number + TensileCreateLibraryFiles( +- "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic/${Tensile_LOGIC}" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic" + "${PROJECT_BINARY_DIR}/Tensile" + ARCHITECTURE ${Tensile_ARCHITECTURE} + CODE_OBJECT_VERSION ${Tensile_CODE_OBJECT_VERSION} +@@ -72,7 +72,7 @@ if(NOT BUILD_CUDA) + ) + else() + TensileCreateLibraryFiles( +- "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic/${Tensile_LOGIC}" ++ "${CMAKE_CURRENT_SOURCE_DIR}/src/hcc_detail/rocsparselt/src/spmm/Tensile/Logic" + "${PROJECT_BINARY_DIR}/Tensile" + ARCHITECTURE ${Tensile_ARCHITECTURE} + CODE_OBJECT_VERSION ${Tensile_CODE_OBJECT_VERSION} diff --git a/var/spack/repos/builtin/packages/hipsparselt/package.py b/var/spack/repos/builtin/packages/hipsparselt/package.py index 72a0a904c57602..0556f78fb49499 100644 --- a/var/spack/repos/builtin/packages/hipsparselt/package.py +++ b/var/spack/repos/builtin/packages/hipsparselt/package.py @@ -21,6 +21,7 @@ class Hipsparselt(CMakePackage, ROCmPackage): maintainers("srekolam", "afzpatel", "renjithravindrankannath") license("MIT") + version("6.2.0", sha256="a25a3ce0ed3cc616b1a4e38bfdd5e68463bb9fe791a56d1367b8a6373bb63d12") version("6.1.2", sha256="a5a01fec7bc6e1f4792ccd5c8eaee7b42deac315c54298a7ce5265e5551e8640") version("6.1.1", sha256="ca6da099d9e385ffce2b68404f395a93b199af1592037cf52c620f9148a6a78d") version("6.1.0", sha256="66ade6de4fd19d144cab27214352faf5b00bbe12afe59472efb441b16d090265") @@ -43,7 +44,7 @@ class Hipsparselt(CMakePackage, ROCmPackage): ) variant("asan", default=False, description="Build with address-sanitizer enabled or disabled") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"hipsparse@{ver}", when=f"@{ver}") depends_on(f"rocm-openmp-extras@{ver}", when=f"@{ver}", type="test") @@ -64,6 +65,7 @@ class Hipsparselt(CMakePackage, ROCmPackage): # tensorlite subdir of hipblas . Also adds hipsparse and msgpack include directories # for 6.1.0 release. patch("0001-update-llvm-path-add-hipsparse-include-dir-for-spack-6.1.patch", when="@6.1") + patch("0001-update-llvm-path-add-hipsparse-include-dir-for-spack-6.2.patch", when="@6.2") def setup_build_environment(self, env): env.set("CXX", self.spec["hip"].hipcc) diff --git a/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py b/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py index a0825f64e774b9..10783e662fdff7 100644 --- a/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py +++ b/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py @@ -24,6 +24,7 @@ class HsaRocrDev(CMakePackage): libraries = ["libhsa-runtime64"] version("master", branch="master") + version("6.2.0", sha256="c98090041fa56ca4a260709876e2666f85ab7464db9454b177a189e1f52e0b1a") version("6.1.2", sha256="6eb7a02e5f1e5e3499206b9e74c9ccdd644abaafa2609dea0993124637617866") version("6.1.1", sha256="72841f112f953c16619938273370eb8727ddf6c2e00312856c9fca54db583b99") version("6.1.0", sha256="50386ebcb7ff24449afa2a10c76a059597464f877225c582ba3e097632a43f9c") @@ -73,6 +74,7 @@ class HsaRocrDev(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") @@ -92,6 +94,7 @@ class HsaRocrDev(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/hsakmt-roct/package.py b/var/spack/repos/builtin/packages/hsakmt-roct/package.py index 074a5b078ca92f..5ec6f99b1fff06 100644 --- a/var/spack/repos/builtin/packages/hsakmt-roct/package.py +++ b/var/spack/repos/builtin/packages/hsakmt-roct/package.py @@ -22,6 +22,7 @@ class HsakmtRoct(CMakePackage): maintainers("srekolam", "renjithravindrankannath") version("master", branch="master") + version("6.2.0", sha256="73df98ca2be8a887cb76554c23f148ef6556bdbccfac99f34111fa1f87fd7c5d") version("6.1.2", sha256="097a5b7eb136300667b36bd35bf55e4a283a1ed04e614cf24dddca0a65c86389") version("6.1.1", sha256="c586d8a04fbd9a7bc0a15e0a6a161a07f88f654402bb11694bd8aebc343c00f0") version("6.1.0", sha256="1085055068420821f7a7adb816692412b5fb38f89d67b9edb9995198f39e2f31") diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py index ee98ca82c8708d..b061bf2a7af5fe 100644 --- a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py +++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import re +import shutil from spack.package import * @@ -13,7 +15,7 @@ class LlvmAmdgpu(CMakePackage, CompilerPackage): homepage = "https://github.com/ROCm/llvm-project" git = "https://github.com/ROCm/llvm-project.git" - url = "https://github.com/ROCm/llvm-project/archive/rocm-6.1.2.tar.gz" + url = "https://github.com/ROCm/llvm-project/archive/rocm-6.2.0.tar.gz" tags = ["rocm"] executables = [r"amdclang", r"amdclang\+\+", r"amdflang", r"clang.*", r"flang.*", "llvm-.*"] generator("ninja") @@ -23,6 +25,7 @@ class LlvmAmdgpu(CMakePackage, CompilerPackage): license("Apache-2.0") version("master", branch="amd-stg-open") + version("6.2.0", sha256="12ce17dc920ec6dac0c5484159b3eec00276e4a5b301ab1250488db3b2852200") version("6.1.2", sha256="300e9d6a137dcd91b18d5809a316fddb615e0e7f982dc7ef1bb56876dff6e097") version("6.1.1", sha256="f1a67efb49f76a9b262e9735d3f75ad21e3bd6a05338c9b15c01e6c625c4460d") version("6.1.0", sha256="6bd9912441de6caf6b26d1323e1c899ecd14ff2431874a2f5883d3bc5212db34") @@ -66,7 +69,8 @@ class LlvmAmdgpu(CMakePackage, CompilerPackage): provides("libllvm@15", when="@5.3:5.4") provides("libllvm@16", when="@5.5:5.6") - provides("libllvm@17", when="@5.7:") + provides("libllvm@17", when="@5.7:6.1") + provides("libllvm@18", when="@6.2:") depends_on("cmake@3.13.4:", type="build") depends_on("python", type="build") @@ -144,6 +148,7 @@ class LlvmAmdgpu(CMakePackage, CompilerPackage): when="@master +rocm-device-libs", ) for d_version, d_shasum in [ + ("6.2.0", "c98090041fa56ca4a260709876e2666f85ab7464db9454b177a189e1f52e0b1a"), ("6.1.2", "6eb7a02e5f1e5e3499206b9e74c9ccdd644abaafa2609dea0993124637617866"), ("6.1.1", "72841f112f953c16619938273370eb8727ddf6c2e00312856c9fca54db583b99"), ("6.1.0", "50386ebcb7ff24449afa2a10c76a059597464f877225c582ba3e097632a43f9c"), @@ -284,6 +289,22 @@ def setup_dependent_run_environment(self, env, dependent_spec): llvm_amdgpu_home = self.spec["llvm-amdgpu"].prefix env.prepend_path("LD_LIBRARY_PATH", llvm_amdgpu_home + "/lib") + @run_after("install") + def post_install(self): + if self.spec.satisfies("@6.1: +rocm-device-libs"): + exe = self.prefix.bin.join("llvm-config") + output = Executable(exe)("--version", output=str, error=str) + version = re.split("[.]", output)[0] + mkdirp(join_path(self.prefix.lib.clang, version, "lib"), "amdgcn") + install_tree( + self.prefix.amdgcn, join_path(self.prefix.lib.clang, version, "lib", "amdgcn") + ) + shutil.rmtree(self.prefix.amdgcn) + os.symlink( + join_path(self.prefix.lib.clang, version, "lib", "amdgcn"), + os.path.join(self.prefix, "amdgcn"), + ) + # Required for enabling asan on dependent packages def setup_dependent_build_environment(self, env, dependent_spec): for root, _, files in os.walk(self.spec["llvm-amdgpu"].prefix): diff --git a/var/spack/repos/builtin/packages/migraphx/package.py b/var/spack/repos/builtin/packages/migraphx/package.py index a4c8882a79daea..02d400d07db8a2 100644 --- a/var/spack/repos/builtin/packages/migraphx/package.py +++ b/var/spack/repos/builtin/packages/migraphx/package.py @@ -20,6 +20,7 @@ class Migraphx(CMakePackage): libraries = ["libmigraphx"] license("MIT") + version("6.2.0", sha256="7b36c1a0c44dd21f31ce6c9c4e7472923281aa7fdc693e75edd2670b101a6d48") version("6.1.2", sha256="829f4a2bd9fe3dee130dfcca103ddc7691da18382f5b683aaca8f3ceceaef355") version("6.1.1", sha256="e14a62678e97356236b45921e24f28ff430d670fb70456c3e5ebfeeb22160811") version("6.1.0", sha256="2ba44146397624845c64f3898bb1b08837ad7a49f133329e58eb04c05d1f36ac") @@ -94,6 +95,7 @@ class Migraphx(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") depends_on(f"hip@{ver}", when=f"@{ver}") @@ -101,7 +103,7 @@ class Migraphx(CMakePackage): depends_on(f"rocblas@{ver}", when=f"@{ver}") depends_on(f"miopen-hip@{ver}", when=f"@{ver}") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"rocmlir@{ver}", when=f"@{ver}") @property diff --git a/var/spack/repos/builtin/packages/miopen-hip/package.py b/var/spack/repos/builtin/packages/miopen-hip/package.py index 52d9a28c1b1bf3..c853e48053cd89 100644 --- a/var/spack/repos/builtin/packages/miopen-hip/package.py +++ b/var/spack/repos/builtin/packages/miopen-hip/package.py @@ -21,6 +21,7 @@ class MiopenHip(CMakePackage): libraries = ["libMIOpen"] license("MIT") + version("6.2.0", sha256="f4473f724362732019d505a0e01c17b060b542350859cb1e4bd4e3898b609276") version("6.1.2", sha256="c8ff4af72264b2049bfe2685d581ea0f3e43319db7bd00dc347159bcf2731614") version("6.1.1", sha256="cf568ea16dd23b32fe89e250bb33ed4722fea8aa7f407cc66ff37c37aab037ce") version("6.1.0", sha256="3b373117eaeaf618aab9b39bb22e9950fd49bd0e264c8587b0c51fa348afe0d1") @@ -84,12 +85,31 @@ class MiopenHip(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") depends_on(f"hip@{ver}", when=f"@{ver}") - depends_on(f"rocm-clang-ocl@{ver}", when=f"@{ver}") depends_on(f"rocblas@{ver}", when=f"@{ver}") + for ver in [ + "5.3.0", + "5.3.3", + "5.4.0", + "5.4.3", + "5.5.0", + "5.5.1", + "5.6.0", + "5.6.1", + "5.7.0", + "5.7.1", + "6.0.0", + "6.0.2", + "6.1.0", + "6.1.1", + "6.1.2", + ]: + depends_on(f"rocm-clang-ocl@{ver}", when=f"@{ver}") + for ver in ["5.3.0", "5.3.3"]: depends_on(f"mlirmiopen@{ver}", when=f"@{ver}") @@ -104,17 +124,20 @@ class MiopenHip(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on("nlohmann-json", type="link") depends_on(f"composable-kernel@{ver}", when=f"@{ver}") for ver in ["5.4.0", "5.4.3", "5.5.0"]: depends_on("nlohmann-json", type="link") depends_on(f"rocmlir@{ver}", when=f"@{ver}") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on("roctracer-dev@" + ver, when="@" + ver) for ver in ["6.1.0", "6.1.1", "6.1.2"]: depends_on("googletest") + depends_on("rocrand@6.2.0", when="@6.2.0") + def setup_build_environment(self, env): lib_dir = self.spec["zlib-api"].libs.directories[0] env.prepend_path("LIBRARY_PATH", lib_dir) @@ -160,7 +183,7 @@ def cmake_args(self): if self.spec.satisfies("@5.1.0:5.3"): mlir_inc = spec["mlirmiopen"].prefix.include args.append(self.define("CMAKE_CXX_FLAGS", "-I{0}".format(mlir_inc))) - if self.spec.satisfies("@5.4.0:"): + if self.spec.satisfies("@5.4.0:6.1"): args.append( "-DNLOHMANN_JSON_INCLUDE={0}".format(self.spec["nlohmann-json"].prefix.include) ) @@ -174,14 +197,21 @@ def cmake_args(self): args.append(self.define("MIOPEN_USE_MLIR", "OFF")) if self.spec.satisfies("@5.7.0:"): args.append(self.define("MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK", "OFF")) - args.append( - "-DNLOHMANN_JSON_INCLUDE={0}".format(self.spec["nlohmann-json"].prefix.include) - ) - if self.spec.satisfies("@6.0.0:"): + if self.spec.satisfies("@6:6.1"): args.append( "-DROCTRACER_INCLUDE_DIR={0}".format(self.spec["roctracer-dev"].prefix.include) ) args.append("-DROCTRACER_LIB_DIR={0}".format(self.spec["roctracer-dev"].prefix.lib)) - if self.spec.satisfies("@6.1:"): + if self.spec.satisfies("@6.1"): args.append("-DSQLITE_INCLUDE_DIR={0}".format(self.spec["sqlite"].prefix.include)) + if self.spec.satisfies("@6.2:"): + args.append( + self.define( + "CMAKE_CXX_FLAGS", + f"-I{self.spec['roctracer-dev'].prefix.include} " + f"-L{self.spec['roctracer-dev'].prefix.lib} " + f"-I{self.spec['nlohmann-json'].prefix.include} " + f"-I{self.spec['sqlite'].prefix.include} ", + ) + ) return args diff --git a/var/spack/repos/builtin/packages/mivisionx/package.py b/var/spack/repos/builtin/packages/mivisionx/package.py index 404b3f98437b24..fad1f3c18f08a2 100644 --- a/var/spack/repos/builtin/packages/mivisionx/package.py +++ b/var/spack/repos/builtin/packages/mivisionx/package.py @@ -26,6 +26,7 @@ def url_for_version(self, version): return url.format(version) license("MIT") + version("6.2.0", sha256="ce28ac3aef76f28869c4dad9ffd9ef090e0b54ac58088f1f1eef803641125b51") version("6.1.2", sha256="0afa664931f566b7f5a3abd474dd641e56077529a2a5d7c788f5e6700e957ed6") version("6.1.1", sha256="3483b5167c47047cca78581cc6c9685138f9b5b25edb11618b720814788fc2a0") version("6.1.0", sha256="f18a72c4d12c36ab50f9c3a5c22fc3641feb11c99fed513540a16a65cd149fd1") @@ -60,7 +61,7 @@ def url_for_version(self, version): conflicts("+asan", when="os=centos8") patch("0001-add-half-include-path.patch", when="@5.5") - patch("0001-add-half-include-path-5.6.patch", when="@5.6:") + patch("0001-add-half-include-path-5.6.patch", when="@5.6:6.1") patch("0002-add-half-include-path-for-tests.patch", when="@5.5:6.0 +add_tests") patch("0002-add-half-include-path-for-tests-6.1.0.patch", when="@6.1.0: +add_tests") @@ -101,7 +102,7 @@ def patch(self): "amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt", string=True, ) - if self.spec.satisfies("@5.5.0: + hip"): + if self.spec.satisfies("@5.5.0:6.1 + hip"): filter_file( r"${ROCM_PATH}/llvm/bin/clang++", "{0}/bin/clang++".format(self.spec["llvm-amdgpu"].prefix), @@ -249,6 +250,7 @@ def patch(self): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"miopen-hip@{ver}", when=f"@{ver}") for ver in [ @@ -266,6 +268,7 @@ def patch(self): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"migraphx@{ver}", when=f"@{ver}") depends_on(f"hip@{ver}", when=f"@{ver}") @@ -282,10 +285,11 @@ def patch(self): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") depends_on("python@3.5:", type="build") - for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"rpp@{ver}", when=f"@{ver}") def setup_run_environment(self, env): diff --git a/var/spack/repos/builtin/packages/rccl/package.py b/var/spack/repos/builtin/packages/rccl/package.py index 49b9e4081ede08..06d609ec3ab7bd 100644 --- a/var/spack/repos/builtin/packages/rccl/package.py +++ b/var/spack/repos/builtin/packages/rccl/package.py @@ -21,6 +21,7 @@ class Rccl(CMakePackage): maintainers("srekolam", "renjithravindrankannath") libraries = ["librccl"] + version("6.2.0", sha256="a29c94ea3b9c1a0121d7b1450cb01a697f9f9132169632312b9b0bf744d3c0e3") version("6.1.2", sha256="98af99c12d800f5439c7740d797162c35810a25e08e3b11b397d3300d3c0148e") version("6.1.1", sha256="6368275059ba190d554535d5aeaa5c2510d944b56efd85c90a1701d0292a14c5") version("6.1.0", sha256="c6308f6883cbd63dceadbe4ee154cc6fa9e6bdccbd2f0fda295b564b0cf01e9a") @@ -73,6 +74,7 @@ class Rccl(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") depends_on(f"hip@{ver}", when=f"@{ver}") @@ -91,6 +93,7 @@ class Rccl(CMakePackage): "6.0.2", "6.1.0", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rdc/package.py b/var/spack/repos/builtin/packages/rdc/package.py index 57deb2529d6135..4c79ef351f2e7d 100644 --- a/var/spack/repos/builtin/packages/rdc/package.py +++ b/var/spack/repos/builtin/packages/rdc/package.py @@ -27,6 +27,7 @@ def url_for_version(self, version): return url.format(version) license("MIT") + version("6.2.0", sha256="dd12428426a4963d6eb3cfdd818acef7a3c4cddf32504df17f4c1004fa902bef") version("6.1.2", sha256="5553b76d4c8b6381d236197613720587377d03d4fd43a5a20bb6a716d49f7dfc") version("6.1.1", sha256="c133ebd20bf42e543d13c5b84ea420a7f7c069c77b1d6dcae9680de924e5f539") version("6.1.0", sha256="a8ad5d880645c9e95c9c90b0c9026627b22467e3e879525fff38ccd924f36c39") @@ -50,7 +51,8 @@ def url_for_version(self, version): depends_on("grpc@1.28.1+shared", type="build", when="@:5.3") depends_on("grpc@1.44.0+shared", when="@5.4.0:5.4") depends_on("grpc@1.55.0+shared", when="@5.5.0:6.0") - depends_on("grpc@1.59.1+shared", when="@6.1:") + depends_on("grpc@1.59.1+shared", when="@6.1") + depends_on("grpc@1.61.2+shared", when="@6.2:") depends_on("protobuf") depends_on("libcap") @@ -70,6 +72,7 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-smi-lib@{ver}", type=("build", "link"), when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") @@ -86,8 +89,10 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") + depends_on("amdsmi@6.2.0", when="@6.2.0") def patch(self): filter_file(r"\${ROCM_DIR}/rocm_smi", "${ROCM_SMI_DIR}", "CMakeLists.txt") diff --git a/var/spack/repos/builtin/packages/rocalution/package.py b/var/spack/repos/builtin/packages/rocalution/package.py index 02f11b33a883c5..934acafccbcaa2 100644 --- a/var/spack/repos/builtin/packages/rocalution/package.py +++ b/var/spack/repos/builtin/packages/rocalution/package.py @@ -27,6 +27,7 @@ class Rocalution(CMakePackage): license("MIT") + version("6.2.0", sha256="fd9ad0aae5524d3995343d4d7c1948e7b21f0bdf5b1203d1de58548a814a9c39") version("6.1.2", sha256="5f9fb302ab1951a1caf54ed31b41d6f41a353dd4b5ee32bc3de2e9f9244dd4ef") version("6.1.1", sha256="1f80b33813291c2e81e5b1efc325d3f5bb6592c8670c016930d01e73e74ab46b") version("6.1.0", sha256="699a9b73844fcd4e30d0607b4042dc779f9bcdc27ad732e7a038968ff555af2b") @@ -78,6 +79,7 @@ class Rocalution(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocprim@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocblas/package.py b/var/spack/repos/builtin/packages/rocblas/package.py index 5df351eb629bac..ded00b42959a32 100644 --- a/var/spack/repos/builtin/packages/rocblas/package.py +++ b/var/spack/repos/builtin/packages/rocblas/package.py @@ -23,6 +23,7 @@ class Rocblas(CMakePackage): version("develop", branch="develop") version("master", branch="master") + version("6.2.0", sha256="184e9b39dcbed57c25f351b047d44c613f8a2bbab3314a20c335f024a12ad4e5") version("6.1.2", sha256="1e83918bd7b28ec9ee292c6fb7eb0fc5f4db2d5d831a9a3db541f14a90c20a1a") version("6.1.1", sha256="c920742fb8f45512c360cdb40e37d0ac767f042e52f1981264853dab5ec2c876") version("6.1.0", sha256="af00357909da60d82618038aa9a3cc1f9d4ce1bdfb54db20ec746b592d478edf") @@ -69,7 +70,18 @@ class Rocblas(CMakePackage): depends_on("googletest@1.10.0:", type="test") depends_on("amdblis", type="test") - for ver in ["5.6.0", "5.6.1", "5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in [ + "5.6.0", + "5.6.1", + "5.7.0", + "5.7.1", + "6.0.0", + "6.0.2", + "6.1.0", + "6.1.1", + "6.1.2", + "6.2.0", + ]: depends_on(f"rocm-openmp-extras@{ver}", type="test", when=f"@{ver}") depends_on("rocm-cmake@master", type="build", when="@master:") @@ -90,6 +102,7 @@ class Rocblas(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"llvm-amdgpu@{ver}", type="build", when=f"@{ver}") @@ -126,6 +139,7 @@ class Rocblas(CMakePackage): ("@6.1.0", "2b55ccf58712f67b3df0ca53b0445f094fcb96b2"), ("@6.1.1", "2b55ccf58712f67b3df0ca53b0445f094fcb96b2"), ("@6.1.2", "2b55ccf58712f67b3df0ca53b0445f094fcb96b2"), + ("@6.2.0", "dbc2062dced66e4cbee8e0591d76e0a1588a4c70"), ]: resource( name="Tensile", diff --git a/var/spack/repos/builtin/packages/rocfft/package.py b/var/spack/repos/builtin/packages/rocfft/package.py index 39c6f295dba621..552b00c3817414 100644 --- a/var/spack/repos/builtin/packages/rocfft/package.py +++ b/var/spack/repos/builtin/packages/rocfft/package.py @@ -20,6 +20,7 @@ class Rocfft(CMakePackage): libraries = ["librocfft"] license("MIT") + version("6.2.0", sha256="c9886ec2c713c502dcde4f5fed3d6e1a7dd019023fb07e82d3b622e66c6f2c36") version("6.1.2", sha256="6f54609b0ecb8ceae8b7acd4c8692514c2c2dbaf0f8b199fe990fd4711428193") version("6.1.1", sha256="d517a931d49a1e59df4e494ab2b68e301fe7ebf39723863985567467f111111c") version("6.1.0", sha256="9e6643174a2b0f376127f43454e78d4feba6fac695d4cda9796da50005ecac66") @@ -86,6 +87,7 @@ class Rocfft(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py b/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py index c1e290b669d6fe..b914848231458f 100644 --- a/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py +++ b/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py @@ -18,6 +18,7 @@ class RocmBandwidthTest(CMakePackage): maintainers("srekolam", "renjithravindrankannath") version("master", branch="master") + version("6.2.0", sha256="ca4caa4470c7ad0f1a4963072c1a25b0fd243844a72b26c83fcbca1e82091a41") version("6.1.2", sha256="4259d53350d6731613d36c03593750547f84f084569f8017783947486b8189da") version("6.1.1", sha256="01da756228f2bfb5e25ddb74b75a5939693b1b4f4559f37cfc85729e36a98450") version("6.1.0", sha256="b06522efbd1a55247412c8f535321058e2463eab4abd25505c37e8c67941ae26") @@ -55,6 +56,7 @@ class RocmBandwidthTest(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") @@ -72,6 +74,7 @@ class RocmBandwidthTest(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-cmake/package.py b/var/spack/repos/builtin/packages/rocm-cmake/package.py index 3be1f426ba1398..33f3cd15f0839a 100644 --- a/var/spack/repos/builtin/packages/rocm-cmake/package.py +++ b/var/spack/repos/builtin/packages/rocm-cmake/package.py @@ -21,6 +21,7 @@ class RocmCmake(CMakePackage): license("MIT") version("master", branch="master") + version("6.2.0", sha256="7b6aaa1bb616669636aa2cd5dbc7fdb7cd05642a8dcc61138e0efb7d0dc7e1a3") version("6.1.2", sha256="0757bb90f25d6f1e6bc93bdd1e238f76bbaddf154d66f94f37e40c425dc6d259") version("6.1.1", sha256="0eb81245f7573a3cadf9e91a854d9a0a014ce93610e4e7ea4d8309867a470bf6") version("6.1.0", sha256="8b37d458e801b486521f12d18ca2103125173dd0f1130d37c8c36e795d34772b") @@ -54,6 +55,7 @@ class RocmCmake(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-core/package.py b/var/spack/repos/builtin/packages/rocm-core/package.py index fd6f96fe23e6ea..302446c76b67dc 100644 --- a/var/spack/repos/builtin/packages/rocm-core/package.py +++ b/var/spack/repos/builtin/packages/rocm-core/package.py @@ -20,6 +20,7 @@ class RocmCore(CMakePackage): libraries = ["librocm-core"] license("MIT") + version("6.2.0", sha256="9bafaf801721e98b398624c8d2fa78618d297d6800f96113e26c275889205526") version("6.1.2", sha256="ce9cbe12977f2058564ecb4cdcef4fd0d7880f6eff8591630f542441092f4fa3") version("6.1.1", sha256="a27bebdd1ba9d387f33b82a67f64c55cb565b482fe5017d5b5726d68da1ab839") version("6.1.0", sha256="9dfe542d1647c42993b06f594c316dad63ba6d6fb2a7398bd72c5768fd1d7b5b") diff --git a/var/spack/repos/builtin/packages/rocm-dbgapi/package.py b/var/spack/repos/builtin/packages/rocm-dbgapi/package.py index fa5c8503e14fd8..c5dacef273691d 100644 --- a/var/spack/repos/builtin/packages/rocm-dbgapi/package.py +++ b/var/spack/repos/builtin/packages/rocm-dbgapi/package.py @@ -25,6 +25,7 @@ class RocmDbgapi(CMakePackage): license("MIT") version("master", branch="amd-master") + version("6.2.0", sha256="311811ce0970ee83206791c21d539f351ddeac56ce3ff7efbefc830038748c0c") version("6.1.2", sha256="6e55839e3d95c2cfe3ff89e3e31da77aeecc74012a17f5308589e8808df78026") version("6.1.1", sha256="425a6cf6a3942c2854c1f5e7717bed906cf6c3753b46c44476f54bfef6188dac") version("6.1.0", sha256="0985405b6fd44667a7ce8914aa39a7e651613e037e649fbdbfa2adcf744a2d50") @@ -68,6 +69,7 @@ class RocmDbgapi(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"hsa-rocr-dev@{ver}", type="build", when=f"@{ver}") @@ -85,6 +87,7 @@ class RocmDbgapi(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-debug-agent/package.py b/var/spack/repos/builtin/packages/rocm-debug-agent/package.py index 2cbc7d7f68af5c..0e5442ea23a824 100644 --- a/var/spack/repos/builtin/packages/rocm-debug-agent/package.py +++ b/var/spack/repos/builtin/packages/rocm-debug-agent/package.py @@ -18,6 +18,7 @@ class RocmDebugAgent(CMakePackage): maintainers("srekolam", "renjithravindrankannath") libraries = ["librocm-debug-agent"] + version("6.2.0", sha256="a4b839c47b8a1cd8d00c3577eeeea04d3661210eb8124e221d88bcbedc742363") version("6.1.2", sha256="c7cb779915a3d61e39d92cef172997bcf5eae720308f6d9c363a2cbc71b5621c") version("6.1.1", sha256="c631281b346bab9ec3607c59404f548f7cba084a05e9c9ceb3c3579c48361ad1") version("6.1.0", sha256="f52700563e490d662b505693d485272d73521aabff306107586dd1149fb4a70e") @@ -62,6 +63,7 @@ class RocmDebugAgent(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") @@ -79,6 +81,7 @@ class RocmDebugAgent(CMakePackage): "6.0.2", "6.1.0", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-device-libs/package.py b/var/spack/repos/builtin/packages/rocm-device-libs/package.py index 9e7774d39f4fd1..fbe0223ef7c0f7 100644 --- a/var/spack/repos/builtin/packages/rocm-device-libs/package.py +++ b/var/spack/repos/builtin/packages/rocm-device-libs/package.py @@ -25,6 +25,7 @@ def url_for_version(self, version): maintainers("srekolam", "renjithravindrankannath", "haampie") version("master", branch="amd-stg-open") + version("6.2.0", sha256="12ce17dc920ec6dac0c5484159b3eec00276e4a5b301ab1250488db3b2852200") version("6.1.2", sha256="300e9d6a137dcd91b18d5809a316fddb615e0e7f982dc7ef1bb56876dff6e097") version("6.1.1", sha256="f1a67efb49f76a9b262e9735d3f75ad21e3bd6a05338c9b15c01e6c625c4460d") version("6.1.0", sha256="6bd9912441de6caf6b26d1323e1c899ecd14ff2431874a2f5883d3bc5212db34") @@ -73,6 +74,7 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"llvm-amdgpu@{ver}", when=f"@{ver}") @@ -89,6 +91,7 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-gdb/package.py b/var/spack/repos/builtin/packages/rocm-gdb/package.py index 210b1301032b94..1a0f0bb9da22ad 100644 --- a/var/spack/repos/builtin/packages/rocm-gdb/package.py +++ b/var/spack/repos/builtin/packages/rocm-gdb/package.py @@ -18,6 +18,7 @@ class RocmGdb(AutotoolsPackage): license("LGPL-2.0-or-later") maintainers("srekolam", "renjithravindrankannath") + version("6.2.0", sha256="753fd4f34d49fb0297b01dca2dd7cdf12cd039caa622a5f2d153362d27a8659c") version("6.1.2", sha256="19208de18d503e1da79dc0c9085221072a68e299f110dc836204364fa1b532cc") version("6.1.1", sha256="3d982abc130a286d227948aca5783f2e4507ef4275be21dad0914e37217ba19e") version("6.1.0", sha256="e90d855ca4c1478acf143d45ff0811e7ecd068711db155de6d5f3593cdef6230") @@ -67,6 +68,7 @@ class RocmGdb(AutotoolsPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-dbgapi@{ver}", type="link", when=f"@{ver}") depends_on(f"comgr@{ver}", type="link", when=f"@{ver}") @@ -83,6 +85,7 @@ class RocmGdb(AutotoolsPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-opencl/package.py b/var/spack/repos/builtin/packages/rocm-opencl/package.py index 92d3373effd9b3..c9eb36b0a881fe 100644 --- a/var/spack/repos/builtin/packages/rocm-opencl/package.py +++ b/var/spack/repos/builtin/packages/rocm-opencl/package.py @@ -36,6 +36,7 @@ def url_for_version(self, version): license("MIT") version("master", branch="main") + version("6.2.0", sha256="620e4c6a7f05651cc7a170bc4700fef8cae002420307a667c638b981d00b25e8") version("6.1.2", sha256="1a1e21640035d957991559723cd093f0c7e202874423667d2ba0c7662b01fea4") version("6.1.1", sha256="2db02f335c9d6fa69befcf7c56278e5cecfe3db0b457eaaa41206c2585ef8256") version("6.1.0", sha256="49b23eef621f4e8e528bb4de8478a17436f42053a2f7fde21ff221aa683205c7") @@ -67,6 +68,7 @@ def url_for_version(self, version): depends_on("numactl", type="link") depends_on("libx11", when="+asan") depends_on("xproto", when="+asan") + depends_on("opencl-icd-loader@2024.05.08", when="@6.2") for d_version, d_shasum in [ ("5.6.1", "cc9a99c7e4de3d9360c0a471b27d626e84a39c9e60e0aff1e8e1500d82391819"), @@ -119,12 +121,13 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"comgr@{ver}", type="build", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", type="link", when=f"@{ver}") - for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"aqlprofile@{ver}", type="link", when=f"@{ver}") for ver in [ @@ -139,6 +142,7 @@ def url_for_version(self, version): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") @@ -169,6 +173,9 @@ def cmake_args(self): f"-I{self.spec['xproto'].prefix.include}", ) ) + if self.spec.satisfies("@6.2:"): + args.append(self.define("BUILD_ICD", False)) + args.append(self.define("AMD_ICD_LIBRARY_DIR", self.spec["opencl-icd-loader"].prefix)) return args diff --git a/var/spack/repos/builtin/packages/rocm-openmp-extras/0001-Avoid-duplicate-registration-on-cuda-env-6.2.patch b/var/spack/repos/builtin/packages/rocm-openmp-extras/0001-Avoid-duplicate-registration-on-cuda-env-6.2.patch new file mode 100644 index 00000000000000..6f7471fd320f99 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocm-openmp-extras/0001-Avoid-duplicate-registration-on-cuda-env-6.2.patch @@ -0,0 +1,13 @@ +diff --git a/rocm-openmp-extras/llvm-project/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt b/rocm-openmp-extras/llvm-project/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt +index f97bba7..86e4155 100644 +--- a/rocm-openmp-extras/llvm-project/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt ++++ b/rocm-openmp-extras/llvm-project/openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt +@@ -68,8 +68,6 @@ target_include_directories(omptarget.rtl.cuda PRIVATE ${LIBOMPTARGET_INCLUDE_DIR + option(LIBOMPTARGET_FORCE_NVIDIA_TESTS "Build NVIDIA libomptarget tests" OFF) + if (LIBOMPTARGET_FOUND_NVIDIA_GPU OR LIBOMPTARGET_FORCE_NVIDIA_TESTS) + libomptarget_say("Enable tests using CUDA plugin") +- set(LIBOMPTARGET_SYSTEM_TARGETS +- "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda nvptx64-nvidia-cuda-LTO" PARENT_SCOPE) + list(APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.cuda") + set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE) + else() diff --git a/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py b/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py index f6a9717462571c..12edec0bc82101 100644 --- a/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py +++ b/var/spack/repos/builtin/packages/rocm-openmp-extras/package.py @@ -31,6 +31,7 @@ "832b7c48149a730619b577a2863b8d1bf1b2551eda5b815e1865a044929ab9fa", "62a5036a2299ed2e3053ee00b7ea1800469cd545fea486fa17266a8b3acfaf5d", "3de1c7a31a88c3f05a6a66ba6854ac8fdad1ce44462e561cb1e6ad59629029ce", + "5f54d7c7c798bcf1cd47d3a7f17ceaf79991bf166cc5e47e5372a68e7cf7d520", ] devlib = [ @@ -49,6 +50,7 @@ "6bd9912441de6caf6b26d1323e1c899ecd14ff2431874a2f5883d3bc5212db34", "f1a67efb49f76a9b262e9735d3f75ad21e3bd6a05338c9b15c01e6c625c4460d", "300e9d6a137dcd91b18d5809a316fddb615e0e7f982dc7ef1bb56876dff6e097", + "12ce17dc920ec6dac0c5484159b3eec00276e4a5b301ab1250488db3b2852200", ] llvm = [ @@ -67,6 +69,7 @@ "6bd9912441de6caf6b26d1323e1c899ecd14ff2431874a2f5883d3bc5212db34", "f1a67efb49f76a9b262e9735d3f75ad21e3bd6a05338c9b15c01e6c625c4460d", "300e9d6a137dcd91b18d5809a316fddb615e0e7f982dc7ef1bb56876dff6e097", + "12ce17dc920ec6dac0c5484159b3eec00276e4a5b301ab1250488db3b2852200", ] flang = [ @@ -85,6 +88,7 @@ "51ecd2c154568c971f5b46ff0e1e1b57063afe28d128fc88c503de88f7240267", "1bcaa73e73a688cb092f01987cf3ec9ace4aa1fcaab2b812888c610722c4501d", "12418ea61cca58811b7e75fd9df48be568b406f84a489a41ba5a1fd70c47f7ba", + "6af7785b1776aeb9229ce4e5083dcfd451e8450f6e5ebe34214560b13f679d96", ] extras = [ @@ -103,6 +107,7 @@ "57d6d9d26c0cb6ea7f8373996c41165f463ae7936d32e5793822cfae03900f8f", "3dc837fbfcac64e000e1b5518e4f8a6b260eaf1a3e74152d8b8c22f128f575b7", "2b9351fdb1cba229669233919464ae906ca8f70910c6fa508a2812b7c3bed123", + "7cef51c980f29d8b46d8d4b110e4f2f75d93544cf7d63c5e5d158cf531aeec7d", ] versions = [ @@ -121,6 +126,7 @@ "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ] versions_dict = dict() # type: Dict[str,Dict[str,str]] components = ["aomp", "devlib", "llvm", "flang", "extras"] @@ -144,6 +150,7 @@ class RocmOpenmpExtras(Package): license("Apache-2.0") maintainers("srekolam", "renjithravindrankannath", "estewart08") + version("6.2.0", sha256=versions_dict["6.2.0"]["aomp"]) version("6.1.2", sha256=versions_dict["6.1.2"]["aomp"]) version("6.1.1", sha256=versions_dict["6.1.1"]["aomp"]) version("6.1.0", sha256=versions_dict["6.1.0"]["aomp"]) @@ -188,6 +195,7 @@ class RocmOpenmpExtras(Package): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") @@ -248,7 +256,7 @@ class RocmOpenmpExtras(Package): placement="llvm-project", when=f"@{ver}", ) - for ver in ["6.1.0", "6.1.1", "6.1.2"]: + for ver in ["6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") depends_on(f"comgr@{ver}", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") @@ -289,7 +297,8 @@ class RocmOpenmpExtras(Package): working_dir="rocm-openmp-extras/llvm-project/openmp/libomptarget", when="@6.1", ) - patch("0001-Avoid-duplicate-registration-on-cuda-env.patch", when="@6.1:") + patch("0001-Avoid-duplicate-registration-on-cuda-env.patch", when="@6.1") + patch("0001-Avoid-duplicate-registration-on-cuda-env-6.2.patch", when="@6.2") def setup_run_environment(self, env): devlibs_prefix = self.spec["llvm-amdgpu"].prefix @@ -365,75 +374,71 @@ def patch(self): "", libomptarget.format(src) + "/cmake/Modules/LibomptargetGetDependencies.cmake", ) + if self.spec.satisfies("@:6.1"): + filter_file( + r"{OPENMP_INSTALL_LIBDIR}", + "{OPENMP_INSTALL_LIBDIR}/libdevice", + libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt", + ) + filter_file( + "-nogpulib", + "-nogpulib -nogpuinc", + libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt", + ) + filter_file( + "-x hip", + "-x hip -nogpulib -nogpuinc", + libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt", + ) + filter_file( + "-c ", + "-c -nogpulib -nogpuinc -I{LIMIT}", + libomptarget.format(src) + "/hostrpc/CMakeLists.txt", + ) + filter_file( + r"${ROCM_DIR}/hsa/include ${ROCM_DIR}/hsa/include/hsa", + "${HSA_INCLUDE}/hsa/include ${HSA_INCLUDE}/hsa/include/hsa", + libomptarget.format(src) + plugin, + string=True, + ) - filter_file( - r"{OPENMP_INSTALL_LIBDIR}", - "{OPENMP_INSTALL_LIBDIR}/libdevice", - libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt", - ) - - filter_file( - "-nogpulib", - "-nogpulib -nogpuinc", - libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt", - ) - - filter_file( - "-x hip", - "-x hip -nogpulib -nogpuinc", - libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt", - ) - - filter_file( - "-c ", - "-c -nogpulib -nogpuinc -I{LIMIT}", - libomptarget.format(src) + "/hostrpc/CMakeLists.txt", - ) - - filter_file( - r"${ROCM_DIR}/hsa/include ${ROCM_DIR}/hsa/include/hsa", - "${HSA_INCLUDE}/hsa/include ${HSA_INCLUDE}/hsa/include/hsa", - libomptarget.format(src) + plugin, - string=True, - ) - - filter_file("{ROCM_DIR}/hsa/lib", "{HSA_LIB}", libomptarget.format(src) + plugin) + filter_file("{ROCM_DIR}/hsa/lib", "{HSA_LIB}", libomptarget.format(src) + plugin) - filter_file( - r"{ROCM_DIR}/lib\)", - "{HSAKMT_LIB})\nset(HSAKMT_LIB64 ${HSAKMT_LIB64})", - libomptarget.format(src) + plugin, - ) + filter_file( + r"{ROCM_DIR}/lib\)", + "{HSAKMT_LIB})\nset(HSAKMT_LIB64 ${HSAKMT_LIB64})", + libomptarget.format(src) + plugin, + ) - filter_file( - r"-L${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS}", - "-L${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS} -L${HSAKMT_LIB64}", - libomptarget.format(src) + plugin, - string=True, - ) + filter_file( + r"-L${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS}", + "-L${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS} -L${HSAKMT_LIB64}", + libomptarget.format(src) + plugin, + string=True, + ) - filter_file( - r"-rpath,${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS}", - "-rpath,${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS}" + ",-rpath,${HSAKMT_LIB64}", - libomptarget.format(src) + plugin, - string=True, - ) + filter_file( + r"-rpath,${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS}", + "-rpath,${LIBOMPTARGET_DEP_LIBHSAKMT_LIBRARIES_DIRS}" + ",-rpath,${HSAKMT_LIB64}", + libomptarget.format(src) + plugin, + string=True, + ) - filter_file("{ROCM_DIR}/include", "{COMGR_INCLUDE}", libomptarget.format(src) + plugin) + filter_file("{ROCM_DIR}/include", "{COMGR_INCLUDE}", libomptarget.format(src) + plugin) - filter_file( - r"-L${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX}", - "-L${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX} -L${COMGR_LIB}", - libomptarget.format(src) + plugin, - string=True, - ) + filter_file( + r"-L${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX}", + "-L${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX} -L${COMGR_LIB}", + libomptarget.format(src) + plugin, + string=True, + ) - filter_file( - r"rpath,${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX}", - "rpath,${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX}" + "-Wl,-rpath,${COMGR_LIB}", - libomptarget.format(src) + plugin, - string=True, - ) + filter_file( + r"rpath,${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX}", + "rpath,${LLVM_LIBDIR}${OPENMP_LIBDIR_SUFFIX}" + "-Wl,-rpath,${COMGR_LIB}", + libomptarget.format(src) + plugin, + string=True, + ) filter_file( "ADDITIONAL_VERSIONS 2.7", @@ -474,6 +479,8 @@ def install(self, spec, prefix): libpgmath = "/rocm-openmp-extras/flang/runtime/libpgmath/lib/common" elfutils_inc = spec["elfutils"].prefix.include ffi_inc = spec["libffi"].prefix.include + if self.spec.satisfies("@6.2:"): + ncurses_lib_dir = self.spec["ncurses"].prefix.lib # flang1 and flang2 symlink needed for build of flang-runtime # libdevice symlink to rocm-openmp-extras for runtime @@ -614,13 +621,21 @@ def install(self, spec, prefix): "../rocm-openmp-extras/flang/flang-legacy/{0}".format(flang_legacy_version), ] + flang_legacy_flags = [] if ( self.compiler.name == "gcc" and self.compiler.version >= Version("7.0.0") and self.compiler.version < Version("9.0.0") ): - components["flang-legacy-llvm"] += ["-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"] - components["flang-legacy"] += ["-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"] + flang_legacy_flags.append("-D_GLIBCXX_USE_CXX11_ABI=0") + if self.spec.satisfies("@6.2:"): + flang_legacy_flags.append("-L{0}".format(ncurses_lib_dir)) + components["flang-legacy-llvm"] += [ + "-DCMAKE_CXX_FLAGS={0}".format(",".join(flang_legacy_flags)) + ] + components["flang-legacy"] += [ + "-DCMAKE_CXX_FLAGS={0}".format(",".join(flang_legacy_flags)) + ] components["flang"] = [ "../rocm-openmp-extras/flang", diff --git a/var/spack/repos/builtin/packages/rocm-smi-lib/package.py b/var/spack/repos/builtin/packages/rocm-smi-lib/package.py index 0675f774b58f1f..999bf4a1584ac0 100644 --- a/var/spack/repos/builtin/packages/rocm-smi-lib/package.py +++ b/var/spack/repos/builtin/packages/rocm-smi-lib/package.py @@ -24,6 +24,7 @@ class RocmSmiLib(CMakePackage): libraries = ["librocm_smi64"] version("master", branch="master") + version("6.2.0", sha256="95010dfc9de9c608b9ce159107585ff4adce82a52a38daab2a37870aca2428bf") version("6.1.2", sha256="01f46fb1cb8c7a16a4c4db61871ee710ed37c0f8bd3a2dbe3415d3de2dffb4ef") version("6.1.1", sha256="7fd2234b05eb6b9397c5508bb37e81fb16ce2cadc2c97298b2124b46c3687880") version("6.1.0", sha256="d1a1b372489b27cb7eb8c91d74a71370ad9668dd5aaf89c0267172534e417e41") @@ -62,6 +63,7 @@ class RocmSmiLib(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-tensile/package.py b/var/spack/repos/builtin/packages/rocm-tensile/package.py index 9894d524b3fa62..de9da28b89764f 100644 --- a/var/spack/repos/builtin/packages/rocm-tensile/package.py +++ b/var/spack/repos/builtin/packages/rocm-tensile/package.py @@ -19,6 +19,7 @@ class RocmTensile(CMakePackage): license("MIT") maintainers("srekolam", "renjithravindrankannath", "haampie") + version("6.2.0", sha256="6f7d679bfffd1f723f2788b00fdcb1b4673b597f9f85c2cdaab3c2aa17afb33d") version("6.1.2", sha256="6a08190f6d9c8cc76764a68e2dd3e7af4759d4146ddc1c4b3370c7762a6f6d83") version("6.1.1", sha256="04fd76e6a0e9b7528e61df0721b03c0e977c145a2a1ea331d515c9167d7ac35f") version("6.1.0", sha256="69bfdc711d3a86e6651b1dcfb2c461c7d3ae574e6d884833d4e07d3e7ad06491") @@ -78,6 +79,7 @@ class RocmTensile(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-cmake@{ver}", type="build", when=f"@{ver}") depends_on(f"hip@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocm-validation-suite/package.py b/var/spack/repos/builtin/packages/rocm-validation-suite/package.py index b686e1b3bc3d6a..47b23a51d6af2a 100644 --- a/var/spack/repos/builtin/packages/rocm-validation-suite/package.py +++ b/var/spack/repos/builtin/packages/rocm-validation-suite/package.py @@ -22,6 +22,7 @@ class RocmValidationSuite(CMakePackage): license("MIT") maintainers("srekolam", "renjithravindrankannath") + version("6.2.0", sha256="03913a1aae426b9fbb7a4870f408a3af1b8b7d32766515eaccb43107673fe631") version("6.1.2", sha256="8ff0c4ec538841d6b8d008d3849a99173cc5a02df5cf4a11dc1d52f630e079c5") version("6.1.1", sha256="72d1a40bce5b68f7d5959e10c07576234640b9c9fcb24d6301a76336629d9962") version("6.1.0", sha256="712f49bfe3a62c9f9cc6f9dc1c593b57e0b45158bb270d685d1141c9a9e90387") @@ -83,11 +84,14 @@ def setup_build_environment(self, build_env): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocminfo@{ver}", when=f"@{ver}") depends_on(f"rocblas@{ver}", when=f"@{ver}") depends_on(f"rocm-smi-lib@{ver}", when=f"@{ver}") + depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") + depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") def patch(self): if self.spec.satisfies("@5.2:5.4"): @@ -125,4 +129,20 @@ def cmake_args(self): if not os.path.isdir(libloc): libloc = self.spec["yaml-cpp"].prefix.lib args.append(self.define("YAML_CPP_LIB_PATH", libloc)) + if self.spec.satisfies("@6.2:"): + args.append( + self.define( + "CMAKE_CXX_FLAGS", + f"-I{self.spec['rocm-smi-lib'].prefix.include} " + f"-I{self.spec['rocblas'].prefix.include} " + f"-I{self.spec['yaml-cpp'].prefix.include} " + f"-L{self.spec['hip'].prefix.lib} " + f"-L{self.spec['hsa-rocr-dev'].prefix.lib} " + f"-L{self.spec['hsakmt-roct'].prefix.lib} " + f"-L{self.spec['rocm-smi-lib'].prefix.lib} " + f"-L{self.spec['rocblas'].prefix.lib} " + f"{self.spec['yaml-cpp'].prefix.lib}/libyaml-cpp.a ", + ) + ) + args.append(self.define("CPACK_PACKAGING_INSTALL_PREFIX", self.spec.prefix)) return args diff --git a/var/spack/repos/builtin/packages/rocminfo/package.py b/var/spack/repos/builtin/packages/rocminfo/package.py index f8fcc531707f48..fa634e446c35d5 100644 --- a/var/spack/repos/builtin/packages/rocminfo/package.py +++ b/var/spack/repos/builtin/packages/rocminfo/package.py @@ -18,6 +18,7 @@ class Rocminfo(CMakePackage): maintainers("srekolam", "renjithravindrankannath", "haampie") version("master", branch="master") + version("6.2.0", sha256="4d9a9051bda3355f8d2050e981435cd02528a04264a7f61162d685e7e1629f73") version("6.1.2", sha256="882ebe3db60b6290a81a98e0bac9b8923fbf83966f1706fd24484700b8213bcc") version("6.1.1", sha256="ef5e33ad3d0bae462d01e1528ffa9c83c587ccbf7ef5947e096e550480d83819") version("6.1.0", sha256="973352210fdc65932f0125e2db68729383727eaf4ebb7f52c88a948c14bbbb73") @@ -55,6 +56,7 @@ class Rocminfo(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", "master", ]: depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") @@ -72,6 +74,7 @@ class Rocminfo(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocmlir/package.py b/var/spack/repos/builtin/packages/rocmlir/package.py index 67f40176bb47cc..afef030ec761df 100644 --- a/var/spack/repos/builtin/packages/rocmlir/package.py +++ b/var/spack/repos/builtin/packages/rocmlir/package.py @@ -14,10 +14,11 @@ class Rocmlir(CMakePackage): homepage = "https://github.com/ROCm/rocMLIR" git = "https://github.com/ROCm/rocMLIR.git" - url = "https://github.com/ROCm/rocMLIR/archive/refs/tags/rocm-6.1.2.tar.gz" + url = "https://github.com/ROCm/rocMLIR/archive/refs/tags/rocm-6.2.0.tar.gz" maintainers("srekolam", "afzpatel", "renjithravindrankannath") + version("6.2.0", sha256="889e021edab19657947716e0056176ca0298602a21c4b77e7e7b00467fdaa175") version("6.1.2", sha256="9bde02b898896301a30e7007e384b9de9cf8feac04f44c91a3b625e74788fda6") version("6.1.1", sha256="0847fd2325fb287538442cf09daf7fa76e7926a40eafd27049e0b5320371c1b5") version("6.1.0", sha256="dd800783f1ce66ce7c560d5193d053ddf3797abae5ec9375c9842243f5a8ca0b") @@ -69,8 +70,8 @@ def patch(self): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: - depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"llvm-amdgpu@{ver}", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocprim/package.py b/var/spack/repos/builtin/packages/rocprim/package.py index dd4f2d9cd7e431..e76eb6d265f382 100644 --- a/var/spack/repos/builtin/packages/rocprim/package.py +++ b/var/spack/repos/builtin/packages/rocprim/package.py @@ -17,6 +17,7 @@ class Rocprim(CMakePackage): license("MIT") maintainers("cgmb", "srekolam", "renjithravindrankannath") + version("6.2.0", sha256="cd9be3a030830c96c940dc69e4a00f2701539a7e10b62ab1181ab83eeef31e57") version("6.1.2", sha256="560b65fffb103c11bee710e4eb871fd47dd84dfe99f5762a19c5650e490fd85d") version("6.1.1", sha256="94b265b6b4ed366b0ba008ef77ab6623b7b880b45874f202c887f01b67905922") version("6.1.0", sha256="9f02e5f8be90baa679a28f83927495ddf0e17d684536e1f820021e8c3e8e6c84") @@ -70,6 +71,7 @@ class Rocprim(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"comgr@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocprofiler-dev/package.py b/var/spack/repos/builtin/packages/rocprofiler-dev/package.py index 35702f97be9625..8a6bd257a51e87 100644 --- a/var/spack/repos/builtin/packages/rocprofiler-dev/package.py +++ b/var/spack/repos/builtin/packages/rocprofiler-dev/package.py @@ -19,6 +19,7 @@ class RocprofilerDev(CMakePackage): maintainers("srekolam", "renjithravindrankannath") libraries = ["librocprofiler64"] license("MIT") + version("6.2.0", sha256="79b4f29d051e62639b4bf2ca288035514d32e055fc759ff4a82d377bf7ca97ea") version("6.1.2", sha256="e6e8771b8c933c16a99192cc215fe964a95e1718ad286520c8272150e184bc06") version("6.1.1", sha256="b4b01a02de5328c7383c2318a998da86a6a9372e1728fc88a21b52bc1cbe9d9d") version("6.1.0", sha256="14ac0a451428465133583e83d9177ed34b3d4679515018a12ee74f5e0288c956") @@ -57,13 +58,14 @@ class RocprofilerDev(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") depends_on(f"rocminfo@{ver}", when=f"@{ver}") depends_on(f"roctracer-dev-api@{ver}", when=f"@{ver}") - for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocm-smi-lib@{ver}", when=f"@{ver}") @@ -79,6 +81,7 @@ class RocprofilerDev(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"aqlprofile@{ver}", when=f"@{ver}") depends_on(f"comgr@{ver}", when=f"@{ver}") @@ -122,13 +125,16 @@ def determine_version(cls, lib): return None def cmake_args(self): - return [ + args = [ self.define( "PROF_API_HEADER_PATH", self.spec["roctracer-dev-api"].prefix.roctracer.include.ext ), self.define("ROCM_ROOT_DIR", self.spec["hsakmt-roct"].prefix.include), self.define("CMAKE_INSTALL_LIBDIR", "lib"), ] + if self.spec.satisfies("@6.2:"): + args.append(self.define("ROCPROFILER_BUILD_PLUGIN_PERFETTO", "OFF")) + return args @run_after("install") def post_install(self): diff --git a/var/spack/repos/builtin/packages/rocprofiler-register/001-add-cpack-fmt-glog.patch b/var/spack/repos/builtin/packages/rocprofiler-register/001-add-cpack-fmt-glog.patch new file mode 100644 index 00000000000000..d7b758c3e82f07 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocprofiler-register/001-add-cpack-fmt-glog.patch @@ -0,0 +1,38 @@ +From 6eb75bd029d17dbe53a6470ca357b2721ba9d87e Mon Sep 17 00:00:00 2001 +From: Afzal Patel +Date: Mon, 12 Aug 2024 20:43:05 +0000 +Subject: [PATCH] add CPack include and find glog and fmt + +--- + cmake/rocprofiler_register_config_packaging.cmake | 1 + + source/lib/rocprofiler-register/CMakeLists.txt | 3 ++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/cmake/rocprofiler_register_config_packaging.cmake b/cmake/rocprofiler_register_config_packaging.cmake +index 5e98f3e..88c4155 100644 +--- a/cmake/rocprofiler_register_config_packaging.cmake ++++ b/cmake/rocprofiler_register_config_packaging.cmake +@@ -81,6 +81,7 @@ foreach(COMPONENT_GROUP ${ROCPROFILER_REGISTER_COMPONENT_GROUPS}) + set(_NAME "${COMPONENT_NAME_${COMPONENT_GROUP}}") + set(_DESC "${COMPONENT_DESC_${COMPONENT_GROUP}}") + ++ include(CPack) + cpack_add_component_group( + ${COMPONENT_GROUP} + DISPLAY_NAME "${_NAME}" +diff --git a/source/lib/rocprofiler-register/CMakeLists.txt b/source/lib/rocprofiler-register/CMakeLists.txt +index 840fbed..4e30a3f 100644 +--- a/source/lib/rocprofiler-register/CMakeLists.txt ++++ b/source/lib/rocprofiler-register/CMakeLists.txt +@@ -16,7 +16,8 @@ endif() + target_include_directories( + rocprofiler-register PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/source + ${PROJECT_BINARY_DIR}/source) +- ++find_package(fmt CONFIG REQUIRED) ++find_package(glog CONFIG REQUIRED) + target_link_libraries( + rocprofiler-register + PUBLIC rocprofiler-register::headers +-- +2.43.5 diff --git a/var/spack/repos/builtin/packages/rocprofiler-register/package.py b/var/spack/repos/builtin/packages/rocprofiler-register/package.py new file mode 100644 index 00000000000000..1805a43f892641 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocprofiler-register/package.py @@ -0,0 +1,37 @@ +# Copyright 2013-2024 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 RocprofilerRegister(CMakePackage): + """The rocprofiler-register library is a helper library that coordinates + the modification of the intercept API table(s) of the HSA/HIP/ROCTx runtime + libraries by the ROCprofiler (v2) library""" + + homepage = "https://github.com/ROCm/rocprofiler-register" + git = "https://github.com/ROCm/rocprofiler-register.git" + url = "https://github.com/ROCm/rocprofiler-register/archive/refs/tags/rocm-6.2.0.tar.gz" + + tags = ["rocm"] + + maintainers("afzpatel", "srekolam", "renjithravindrankannath") + + license("MIT") + version("6.2.0", sha256="5cdfdfc621da9ef5a6b828d1a3a342db222b648c91359f71651b9404bf7ba62c") + version("6.1.2", sha256="aa57b234cc1db5ae32c7494f4a9120b95a1845b95469dad447f470a6aa5e3cc9") + version("6.1.1", sha256="38242443d9147a04d61374de4cecee686578a3140fed17e88480f564a1f67cc7") + version("6.1.0", sha256="c6e60447ea2ccca8d6acd8758ac00037347892b16b450e1f99ddd04cc4b6cac1") + + depends_on("cxx", type="build") + depends_on("fmt") + depends_on("glog") + + patch("001-add-cpack-fmt-glog.patch") + + def cmake_args(self): + args = ["-DROCPROFILER_REGISTER_BUILD_FMT=OFF", "-DROCPROFILER_REGISTER_BUILD_GLOG=OFF"] + args.append(self.define("ROCPROFILER_REGISTER_BUILD_TESTS", self.run_tests)) + return args diff --git a/var/spack/repos/builtin/packages/rocrand/package.py b/var/spack/repos/builtin/packages/rocrand/package.py index 482d922d1233ed..14b9f617d02104 100644 --- a/var/spack/repos/builtin/packages/rocrand/package.py +++ b/var/spack/repos/builtin/packages/rocrand/package.py @@ -25,6 +25,7 @@ class Rocrand(CMakePackage): version("develop", branch="develop") version("master", branch="master") + version("6.2.0", sha256="7f5318e9c9eb36fb3660392e97520268920c59af3a51af19633aabe5046ef1af") version("6.1.2", sha256="ac3c858c0f76188ac50574591aa6b41b27bda2af5925314451a44242319f28c8") version("6.1.1", sha256="d6302d014045694be85385cdc683ea75476e23fd92ae170079c261c0b041764b") version("6.1.0", sha256="ea80c5d657fa48b1122a47986239a04118977195ee4826d2b14b8bfe0fabce6e") @@ -120,6 +121,7 @@ class Rocrand(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocsolver/package.py b/var/spack/repos/builtin/packages/rocsolver/package.py index 404adac95dcb23..84e5990119bbdf 100644 --- a/var/spack/repos/builtin/packages/rocsolver/package.py +++ b/var/spack/repos/builtin/packages/rocsolver/package.py @@ -46,6 +46,7 @@ class Rocsolver(CMakePackage): version("develop", branch="develop") version("master", branch="master") + version("6.2.0", sha256="74cb799dcddfcbd6ee05398003416dbccd3d06d7f4b23e4324baac3f15440162") version("6.1.2", sha256="8cb45b6a4ed819b8e952c0bfdd8bf7dd941478ac656bea42a6d6751f459e66ea") version("6.1.1", sha256="3bbba30fa7f187676caf858f66c2345e4dcc81b9546eca4a726c0b159dad22bd") version("6.1.0", sha256="f1d7a4edf14ed0b2e2f74aa5cbc9db0c3b0dd31e50bbada1586cb353a28fe015") @@ -102,6 +103,7 @@ class Rocsolver(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocblas@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocsparse/package.py b/var/spack/repos/builtin/packages/rocsparse/package.py index d5af36e08c21e2..00987a446a9cc1 100644 --- a/var/spack/repos/builtin/packages/rocsparse/package.py +++ b/var/spack/repos/builtin/packages/rocsparse/package.py @@ -39,6 +39,7 @@ class Rocsparse(CMakePackage): conflicts("+asan", when="os=centos8") license("MIT") + version("6.2.0", sha256="d07357d180423cedbabc849983a2d4d79b0e9f4c9b5e07d4993043e646fe6df9") version("6.1.2", sha256="e8989c28085275e7c044b19fd2bc86d8493ce6a1b8545126f787722c535fe6eb") version("6.1.1", sha256="9ac2bf84962cfdf24e4fa68e6f1d91ffdad5d5a5287ecdaddf331e6073ba57b3") version("6.1.0", sha256="d69d9b0079159abb2d7514f8f45a41bb2cbcaf8b52e600e794aca3facf274b5e") @@ -78,6 +79,7 @@ class Rocsparse(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocprim@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/rocthrust/package.py b/var/spack/repos/builtin/packages/rocthrust/package.py index c7222ece39ecc8..e2b9147b9c9031 100644 --- a/var/spack/repos/builtin/packages/rocthrust/package.py +++ b/var/spack/repos/builtin/packages/rocthrust/package.py @@ -18,6 +18,7 @@ class Rocthrust(CMakePackage): tags = ["rocm"] maintainers("cgmb", "srekolam", "renjithravindrankannath") + version("6.2.0", sha256="8037aadf7ec3d548aa17944e0a47465d608dc6eb7347173a6d76cbf5342e4ab6") version("6.1.2", sha256="149ca325fb8a8527781ec2853282a73bf66f60366652c19e8583afc3f1a9c4b6") version("6.1.1", sha256="03420d8af687107775a1fbd3db5e8c9872c7c738747de77a5e8c0b3466a3321a") version("6.1.0", sha256="8c36fb7b34758579601365a450700899133da5802e5c8370654051b190bd6e1c") @@ -67,6 +68,7 @@ class Rocthrust(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocprim@{ver}", when=f"@{ver}") diff --git a/var/spack/repos/builtin/packages/roctracer-dev-api/package.py b/var/spack/repos/builtin/packages/roctracer-dev-api/package.py index d86e278afed71c..cf7749a7c3ebda 100644 --- a/var/spack/repos/builtin/packages/roctracer-dev-api/package.py +++ b/var/spack/repos/builtin/packages/roctracer-dev-api/package.py @@ -19,6 +19,7 @@ class RoctracerDevApi(Package): license("MIT") maintainers("srekolam", "renjithravindrankannath") + version("6.2.0", sha256="2fc39f47161f41cc041cd5ee4b1bb0e9832508650e832434056423fec3739735") version("6.1.2", sha256="073e67e728d5eda16d7944f3abd96348b3f278e9f36cab3ac22773ebaad0d2d6") version("6.1.1", sha256="9cb77fd700a0d615056f0db1e9500b73bd0352214f33bdac520e25b9125a926a") version("6.1.0", sha256="3f8e296c4d04123a7177d815ca166e978b085ad7c816ac298e6bb47a299fa187") diff --git a/var/spack/repos/builtin/packages/roctracer-dev/0002-use-clang-18.patch b/var/spack/repos/builtin/packages/roctracer-dev/0002-use-clang-18.patch new file mode 100644 index 00000000000000..26cc1e21ea4b9f --- /dev/null +++ b/var/spack/repos/builtin/packages/roctracer-dev/0002-use-clang-18.patch @@ -0,0 +1,26 @@ + +m 70c457c9d087f83e5587c0d2f65a284a5cbafa1e Mon Sep 17 00:00:00 2001 +From: Afzal Patel +Date: Wed, 14 Aug 2024 16:58:27 +0000 +Subject: [PATCH] Use clang version 18 + +--- + test/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 95563d5..c9a50b9 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -34,7 +34,7 @@ if(DEFINED ROCM_PATH) + endif() + find_package(HIP REQUIRED MODULE) + +-find_package(Clang REQUIRED CONFIG ++find_package(Clang 18 REQUIRED CONFIG + PATHS "${ROCM_PATH}" + PATH_SUFFIXES "llvm/lib/cmake/clang") + +-- +2.43.5 + diff --git a/var/spack/repos/builtin/packages/roctracer-dev/package.py b/var/spack/repos/builtin/packages/roctracer-dev/package.py index a2b145a8ce0bbe..5e49d59980d0bd 100644 --- a/var/spack/repos/builtin/packages/roctracer-dev/package.py +++ b/var/spack/repos/builtin/packages/roctracer-dev/package.py @@ -22,6 +22,7 @@ class RoctracerDev(CMakePackage, ROCmPackage): libraries = ["libroctracer64"] license("MIT") + version("6.2.0", sha256="2fc39f47161f41cc041cd5ee4b1bb0e9832508650e832434056423fec3739735") version("6.1.2", sha256="073e67e728d5eda16d7944f3abd96348b3f278e9f36cab3ac22773ebaad0d2d6") version("6.1.1", sha256="9cb77fd700a0d615056f0db1e9500b73bd0352214f33bdac520e25b9125a926a") version("6.1.0", sha256="3f8e296c4d04123a7177d815ca166e978b085ad7c816ac298e6bb47a299fa187") @@ -63,6 +64,7 @@ class RoctracerDev(CMakePackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"hsakmt-roct@{ver}", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}") @@ -83,10 +85,12 @@ class RoctracerDev(CMakePackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@{ver}") patch("0001-include-rocprofiler-dev-path.patch", when="@5.3:5.4") + patch("0002-use-clang-18.patch", when="@6.2") @classmethod def determine_version(cls, lib): diff --git a/var/spack/repos/builtin/packages/rocwmma/package.py b/var/spack/repos/builtin/packages/rocwmma/package.py index b7275d02c54613..f0aaa9740f0571 100644 --- a/var/spack/repos/builtin/packages/rocwmma/package.py +++ b/var/spack/repos/builtin/packages/rocwmma/package.py @@ -27,6 +27,7 @@ class Rocwmma(CMakePackage): license("MIT") maintainers("srekolam", "renjithravindrankannath") + version("6.2.0", sha256="08c5d19f0417ee9ba0e37055152b22f64ed0eab1d9ab9a7d13d46bf8d3b255dc") version("6.1.2", sha256="7f6171bea5c8b7cdaf5c64dbfb76eecf606f2d34e8409153a74b56027c5e92a7") version("6.1.1", sha256="6e0c15c78feb8fb475ed028ed9b0337feeb45bfce1e206fe5f236a55e33f6135") version("6.1.0", sha256="ca29f33cfe6894909159ad68d786eacd469febab33883886a202f13ae061f691") @@ -85,6 +86,7 @@ class Rocwmma(CMakePackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on("rocm-cmake@%s:" % ver, type="build", when="@" + ver) depends_on("llvm-amdgpu@" + ver, type="build", when="@" + ver) @@ -92,7 +94,18 @@ class Rocwmma(CMakePackage): depends_on("rocblas@" + ver, type="build", when="@" + ver) depends_on("rocm-openmp-extras@" + ver, type="build", when="@" + ver) - for ver in ["5.6.0", "5.6.1", "5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in [ + "5.6.0", + "5.6.1", + "5.7.0", + "5.7.1", + "6.0.0", + "6.0.2", + "6.1.0", + "6.1.1", + "6.1.2", + "6.2.0", + ]: depends_on("rocm-smi-lib@" + ver, when="@" + ver) for tgt in itertools.chain(["auto"], amdgpu_targets): diff --git a/var/spack/repos/builtin/packages/rpp/package.py b/var/spack/repos/builtin/packages/rpp/package.py index 9bafc3826dfb03..34cbfd3d402142 100644 --- a/var/spack/repos/builtin/packages/rpp/package.py +++ b/var/spack/repos/builtin/packages/rpp/package.py @@ -28,6 +28,7 @@ def url_for_version(self, version): maintainers("srekolam", "afzpatel") license("MIT") + version("6.2.0", sha256="69fbebf50b734e055258ea3c5b0399a51babab8f66074166d2b0fc4f1904c09c") version("6.1.2", sha256="3a529bdd17b448a9e05a6aac1b5e173a077f4a4a1fd2ed759bcea331acd2829f") version("6.1.1", sha256="9ca385c6f208a0bbf2be60ad15697d35371992d49ed30077b69e22090cef657c") version("6.1.0", sha256="026c5ac7a92e14e35b9e7630a2ebfff3f4b3544b988eb9aa8af9991d4beea242") @@ -135,7 +136,7 @@ def patch(self): depends_on("cmake@3.5:", type="build") depends_on("pkgconfig", type="build") depends_on(Boost.with_default_variants) - depends_on("boost@1.72.0:1.80.0") + depends_on("boost@1.72.0:1.85.0") depends_on("bzip2") depends_on("half") depends_on("hwloc") @@ -152,7 +153,7 @@ def patch(self): with when("+hip"): with when("@5.7:"): - for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2"]: + for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2", "6.1.0", "6.1.1", "6.1.2", "6.2.0"]: depends_on("hip@" + ver, when="@" + ver) with when("@:1.2"): depends_on("hip@5:") From fc4a4ec70d7c89b6f6b31f7990fbb4155c46f2e9 Mon Sep 17 00:00:00 2001 From: James Smillie <83249606+jamessmillie@users.noreply.github.com> Date: Wed, 11 Sep 2024 01:43:28 -0600 Subject: [PATCH 082/687] boost package: fix Windows build (#43732) * Boost:Adjust bootstrapping/b2 options as needed for Windows (the bootstrapping phase sufficiently differs between Windows/Unix that it is handled entirely within its own branch). * Boost: Paths in user-config.jam should be POSIX, including on Windows * Python: `.libs` for the Python package should return link libraries on Windows. The libraries are also stored in a different directory. --- .../repos/builtin/packages/boost/package.py | 82 ++++++++++++++----- .../repos/builtin/packages/python/package.py | 19 +++-- 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index 366a14509aa7fb..fe0d3928573ebf 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -5,6 +5,7 @@ import os import sys +from pathlib import Path from spack.package import * @@ -303,6 +304,11 @@ def libs(self): # safe to do so on affected platforms. conflicts("+clanglibcpp", when="@1.85: +stacktrace") + # On Windows, the signals variant is required when building any of + # the all_libs variants. + for lib in all_libs: + requires("+signals", when=f"+{lib} platform=windows") + # Patch fix from https://svn.boost.org/trac/boost/ticket/11856 patch("boost_11856.patch", when="@1.60.0%gcc@4.4.7") @@ -495,9 +501,9 @@ def bjam_python_line(self, spec): return "using python : {0} : {1} : {2} : {3} ;\n".format( spec["python"].version.up_to(2), - spec["python"].command.path, - spec["python"].headers.directories[0], - spec["python"].libs[0], + Path(spec["python"].command.path).as_posix(), + Path(spec["python"].headers.directories[0]).as_posix(), + Path(spec["python"].libs[0]).parent.as_posix(), ) def determine_bootstrap_options(self, spec, with_libs, options): @@ -521,6 +527,9 @@ def determine_bootstrap_options(self, spec, with_libs, options): else: options.append("--without-icu") + self.write_jam_file(spec, boost_toolset_id) + + def write_jam_file(self, spec, boost_toolset_id=None): with open("user-config.jam", "w") as f: # Boost may end up using gcc even though clang+gfortran is set in # compilers.yaml. Make sure this does not happen: @@ -535,7 +544,7 @@ def determine_bootstrap_options(self, spec, with_libs, options): # similar, but that doesn't work with the Cray compiler # wrappers. Since Boost doesn't use the MPI C++ bindings, # that can be used as a compiler option instead. - mpi_line = "using mpi : %s" % spec["mpi"].mpicxx + mpi_line = "using mpi : %s" % Path(spec["mpi"].mpicxx).as_posix() f.write(mpi_line + " ;\n") if spec.satisfies("+python"): @@ -608,6 +617,16 @@ def determine_b2_options(self, spec, options): options.extend(["link=%s" % ",".join(link_types), "--layout=%s" % layout]) + if spec.satisfies("platform=windows"): + # The runtime link must either be shared or static, not both. + if "+shared" in spec: + options.append("runtime-link=shared") + else: + options.append("runtime-link=static") + for lib in self.all_libs: + if f"+{lib}" not in spec: + options.append(f"--without-{lib}") + if not spec.satisfies("@:1.75 %intel") and not spec.satisfies("platform=windows"): # When building any version >= 1.76, the toolset must be specified. # Earlier versions could not specify Intel as the toolset @@ -671,6 +690,23 @@ def add_buildopt_symlinks(self, prefix): prefix, remainder = lib.split(".", 1) symlink(lib, "%s-mt.%s" % (prefix, remainder)) + def bootstrap_windows(self): + """Run the Windows-specific bootstrap.bat. The only bootstrapping command + line option that is accepted by the bootstrap.bat script is the compiler + information: either the vc version (e.g. MSVC 14.3.x would be vc143) + or gcc or clang. + """ + bootstrap_options = list() + if self.spec.satisfies("%msvc"): + bootstrap_options.append(f"vc{self.compiler.platform_toolset_ver}") + elif self.spec.satisfies("%gcc"): + bootstrap_options.append("gcc") + elif self.spec.satisfies("%clang"): + bootstrap_options.append("clang") + + bootstrap = Executable("cmd.exe") + bootstrap("/c", ".\\bootstrap.bat", *bootstrap_options) + def install(self, spec, prefix): # On Darwin, Boost expects the Darwin libtool. However, one of the # dependencies may have pulled in Spack's GNU libtool, and these two @@ -710,16 +746,13 @@ def install(self, spec, prefix): if spec.satisfies("+graph") and spec.satisfies("+mpi"): with_libs.add("graph_parallel") - # to make Boost find the user-config.jam - env["BOOST_BUILD_PATH"] = self.stage.source_path - - bootstrap_options = ["--prefix=%s" % prefix] - self.determine_bootstrap_options(spec, with_libs, bootstrap_options) - if self.spec.satisfies("platform=windows"): - bootstrap = Executable("cmd.exe") - bootstrap("/c", ".\\bootstrap.bat", *bootstrap_options) + self.bootstrap_windows() else: + # to make Boost find the user-config.jam + env["BOOST_BUILD_PATH"] = self.stage.source_path + bootstrap_options = ["--prefix=%s" % prefix] + self.determine_bootstrap_options(spec, with_libs, bootstrap_options) bootstrap = Executable("./bootstrap.sh") bootstrap(*bootstrap_options) @@ -742,15 +775,24 @@ def install(self, spec, prefix): if jobs > 64 and spec.satisfies("@:1.58"): jobs = 64 - # Windows just wants a b2 call with no args - b2_options = [] - if not self.spec.satisfies("platform=windows"): - path_to_config = "--user-config=%s" % os.path.join( - self.stage.source_path, "user-config.jam" - ) - b2_options = ["-j", "%s" % jobs] - b2_options.append(path_to_config) + if self.spec.satisfies("platform=windows"): + + def is_64bit(): + # TODO: This method should be abstracted to a more general location + # as it is repeated in many places (msmpi.py for one) + return "64" in str(self.spec.target.family) + b2_options = [f"--prefix={self.prefix}", f"address-model={64 if is_64bit() else 32}"] + if not self.spec.satisfies("+python"): + b2_options.append("--without-python") + + self.write_jam_file(self.spec) + else: + b2_options = ["-j", "%s" % jobs] + path_to_config = "--user-config=%s" % os.path.join( + self.stage.source_path, "user-config.jam" + ) + b2_options.append(path_to_config) threading_opts = self.determine_b2_options(spec, b2_options) # Create headers if building from a git checkout diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 79a8ad2cdc469b..60f403483e996a 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -1023,8 +1023,13 @@ def find_library(self, library): win_root_dir, ] - # The Python shipped with Xcode command line tools isn't in any of these locations - for subdir in ["lib", "lib64"]: + if self.spec.satisfies("platform=windows"): + lib_dirs = ["libs"] + else: + # The Python shipped with Xcode command line tools isn't in any of these locations + lib_dirs = ["lib", "lib64"] + + for subdir in lib_dirs: directories.append(os.path.join(self.config_vars["base"], subdir)) directories = dedupe(directories) @@ -1067,14 +1072,16 @@ def libs(self): # The +shared variant isn't reliable, as `spack external find` currently can't # detect it. If +shared, prefer the shared libraries, but check for static if # those aren't found. Vice versa for ~shared. - if "+shared" in self.spec: + if self.spec.satisfies("platform=windows"): + # Since we are searching for link libraries, on Windows search only for + # ".Lib" extensions by default as those represent import libraries for implict links. + candidates = static_libs + elif self.spec.satisfies("+shared"): candidates = shared_libs + static_libs else: candidates = static_libs + shared_libs - candidates = dedupe(candidates) - - for candidate in candidates: + for candidate in dedupe(candidates): lib = self.find_library(candidate) if lib: return lib From 4f00c7173d12930c135afca79b16575775a43d16 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 11 Sep 2024 09:47:55 +0200 Subject: [PATCH 083/687] nvhpc: add 'compiler' tag to the override (#46301) fixes #46295 A proper solution would be a tag directive that accumulates tags with the ones defined in base classes. For the time being, rewrite them explicitly. Signed-off-by: Massimiliano Culpo --- var/spack/repos/builtin/packages/nvhpc/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/nvhpc/package.py b/var/spack/repos/builtin/packages/nvhpc/package.py index 537630e0ba30e1..a86ec0e06f8cae 100644 --- a/var/spack/repos/builtin/packages/nvhpc/package.py +++ b/var/spack/repos/builtin/packages/nvhpc/package.py @@ -406,7 +406,7 @@ class Nvhpc(Package, CompilerPackage): homepage = "https://developer.nvidia.com/hpc-sdk" maintainers("samcmill") - tags = ["e4s"] + tags = ["e4s", "compiler"] skip_version_audit = ["platform=darwin", "platform=windows"] From 892b5d8037fe8d9314cd47c45cd01b28f22090b5 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Wed, 11 Sep 2024 09:58:03 +0200 Subject: [PATCH 084/687] cp2k: add v2024.3 (#46297) --- var/spack/repos/builtin/packages/cp2k/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 023c972f237899..fbc7b848d5ca10 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -46,6 +46,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): license("GPL-2.0-or-later") + version("2024.3", sha256="a6eeee773b6b1fb417def576e4049a89a08a0ed5feffcd7f0b33c7d7b48f19ba") version("2024.2", sha256="cc3e56c971dee9e89b705a1103765aba57bf41ad39a11c89d3de04c8b8cdf473") version("2024.1", sha256="a7abf149a278dfd5283dc592a2c4ae803b37d040df25d62a5e35af5c4557668f") version("2023.2", sha256="adbcc903c1a78cba98f49fe6905a62b49f12e3dfd7cedea00616d1a5f50550db") From 607d158a44fdc7a880bbe9f4f6b06f894ed0e9a5 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 11 Sep 2024 14:52:39 +0200 Subject: [PATCH 085/687] OpenCV: add v4.8-4.10 (#46223) --- var/spack/repos/builtin/packages/opencv/package.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/opencv/package.py b/var/spack/repos/builtin/packages/opencv/package.py index a5985861b6c2bd..9b16218d390831 100644 --- a/var/spack/repos/builtin/packages/opencv/package.py +++ b/var/spack/repos/builtin/packages/opencv/package.py @@ -22,6 +22,9 @@ class Opencv(CMakePackage, CudaPackage): license("BSD-3-Clause") version("master", branch="master") + version("4.10.0", sha256="b2171af5be6b26f7a06b1229948bbb2bdaa74fcf5cd097e0af6378fce50a6eb9") + version("4.9.0", sha256="ddf76f9dffd322c7c3cb1f721d0887f62d747b82059342213138dc190f28bc6c") + version("4.8.1", sha256="62f650467a60a38794d681ae7e66e3e8cfba38f445e0bf87867e2f2cdc8be9d5") version("4.8.0", sha256="cbf47ecc336d2bff36b0dcd7d6c179a9bb59e805136af6b9670ca944aef889bd") version("4.7.0", sha256="8df0079cdbe179748a18d44731af62a245a45ebf5085223dc03133954c662973") version("4.6.0", sha256="1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277") @@ -46,8 +49,8 @@ class Opencv(CMakePackage, CudaPackage): version("3.3.1", sha256="5dca3bb0d661af311e25a72b04a7e4c22c47c1aa86eb73e70063cd378a2aa6ee") version("3.3.0", sha256="8bb312b9d9fd17336dc1f8b3ac82f021ca50e2034afc866098866176d985adc6") - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated + depends_on("c", type="build") + depends_on("cxx", type="build") contrib_vers = [ "3.3.0", @@ -73,6 +76,9 @@ class Opencv(CMakePackage, CudaPackage): "4.6.0", "4.7.0", "4.8.0", + "4.8.1", + "4.9.0", + "4.10.0", ] for cv in contrib_vers: resource( @@ -254,8 +260,8 @@ class Opencv(CMakePackage, CudaPackage): depends_on("python@3.2:", type=("build", "link", "run")) depends_on("py-setuptools", type="build") depends_on("py-numpy", type=("build", "run")) - # https://github.com/opencv/opencv-python/issues/943 - depends_on("py-numpy@:1", when="@:4.10.0.83", type=("build", "run")) + # https://github.com/opencv/opencv/issues/25455 + depends_on("py-numpy@:1", when="@:4.9", type=("build", "run")) extends("python", when="+python3") with when("+stitching"): From 122c3c2dbb4269869b12b3b6175d731cd8301b6e Mon Sep 17 00:00:00 2001 From: Jannek Squar Date: Wed, 11 Sep 2024 15:00:56 +0200 Subject: [PATCH 086/687] CDO: add patch for missing algorithm header (#45692) * add cdo patch for missing algorithm header * add patch for 2.2.2:2.3.0 Signed-off-by: Jannek * Add conflict of old cdo with new gcc * Update var/spack/repos/builtin/packages/cdo/add_algorithm_header_222.patch Co-authored-by: Wouter Deconinck * Adjust patch hash * Update var/spack/repos/builtin/packages/cdo/package.py fix copy-paste-error on hash Co-authored-by: Wouter Deconinck --------- Signed-off-by: Jannek Co-authored-by: Jannek Co-authored-by: Try2Code Co-authored-by: Wouter Deconinck --- .../packages/cdo/add_algorithm_header.patch | 22 ++++++++++++++++++ .../cdo/add_algorithm_header_222.patch | 23 +++++++++++++++++++ .../repos/builtin/packages/cdo/package.py | 14 +++++++++++ 3 files changed, 59 insertions(+) create mode 100644 var/spack/repos/builtin/packages/cdo/add_algorithm_header.patch create mode 100644 var/spack/repos/builtin/packages/cdo/add_algorithm_header_222.patch diff --git a/var/spack/repos/builtin/packages/cdo/add_algorithm_header.patch b/var/spack/repos/builtin/packages/cdo/add_algorithm_header.patch new file mode 100644 index 00000000000000..2e9e6803ae8689 --- /dev/null +++ b/var/spack/repos/builtin/packages/cdo/add_algorithm_header.patch @@ -0,0 +1,22 @@ +diff --git a/src/cdo_module.cc b/src/cdo_module_patched.cc +index dc408d9..f50c2d3 100644 +--- a/src/cdo_module.cc ++++ b/src/cdo_module_patched.cc +@@ -1,4 +1,5 @@ + #include "cdo_module.h" ++#include + + oper_t::oper_t() : help(default_help) {} + +diff --git a/src/cdo_options.cc b/src/cdo_options_patched.cc +index 465f1f9..0684e78 100644 +--- a/src/cdo_options.cc ++++ b/src/cdo_options_patched.cc +@@ -12,6 +12,7 @@ + #include "cdo_output.h" + + #include ++#include + + namespace cdo + { diff --git a/var/spack/repos/builtin/packages/cdo/add_algorithm_header_222.patch b/var/spack/repos/builtin/packages/cdo/add_algorithm_header_222.patch new file mode 100644 index 00000000000000..319e140ef437ed --- /dev/null +++ b/var/spack/repos/builtin/packages/cdo/add_algorithm_header_222.patch @@ -0,0 +1,23 @@ +diff --git a/src/cdo_options.cc b/src/cdo_options_patched.cc +index 465f1f9..0684e78 100644 +--- a/src/cdo_options.cc ++++ b/src/cdo_options_patched.cc +@@ -12,6 +12,7 @@ + #include "cdo_output.h" + + #include ++#include + + namespace cdo + { +diff -u src/cdo_options.h src/cdo_options_patched.h +--- a/src/cdo_options.h ++++ b/src/cdo_options_patched.h +@@ -3,6 +3,7 @@ + + #include + #include ++#include + + #ifdef HAVE_CONFIG_H + #include "config.h" /* _FILE_OFFSET_BITS influence off_t */ diff --git a/var/spack/repos/builtin/packages/cdo/package.py b/var/spack/repos/builtin/packages/cdo/package.py index 9f6910fa049712..2c399592073715 100644 --- a/var/spack/repos/builtin/packages/cdo/package.py +++ b/var/spack/repos/builtin/packages/cdo/package.py @@ -170,6 +170,20 @@ class Cdo(AutotoolsPackage): depends_on("cxx", type="build") # generated depends_on("fortran", type="build") # generated + # patches + # see https://code.mpimet.mpg.de/boards/1/topics/15594 + patch( + "add_algorithm_header.patch", + when="@2.4.0:2.4.2 %gcc@14:", + sha256="0bc20d2fcb14d8e4010d4222297f259eb7b4220effd97555ed3f027e63cf8b30", + ) + patch( + "add_algorithm_header_222.patch", + when="@2.2.2:2.3.0 %gcc@14:", + sha256="db0d9bd32bbee01d914c1dbebd751403e9c918fafd540fd6ecc6a2f27e0900cf", + ) + conflicts("%gcc@14:", when="@:2.2.0", msg="Compilation with gcc@14: requires cdo@2.2.2:") + variant("netcdf", default=True, description="Enable NetCDF support") variant( "grib2", From 5fa8890bd3f239464fc8375f934c692cec599a70 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 11 Sep 2024 17:43:20 +0200 Subject: [PATCH 087/687] CUDA: support Grace Hopper 9.0a compute capability (#45540) * CUDA: support Grace Hopper 9.0a compute capability * Fix other packages * Add type annotations * Support ancient Python versions * isort * spec -> self.spec Co-authored-by: Andrew W Elble * [@spackbot] updating style on behalf of adamjstewart --------- Co-authored-by: Andrew W Elble Co-authored-by: adamjstewart --- lib/spack/spack/build_systems/cuda.py | 25 +++++++++++++++++++ .../builtin/packages/amr-wind/package.py | 4 +-- .../builtin/packages/babelstream/package.py | 21 ++++++++-------- .../builtin/packages/paraview/package.py | 8 ++++-- .../builtin/packages/py-jaxlib/package.py | 6 ++--- .../builtin/packages/py-tensorflow/package.py | 6 ++--- .../builtin/packages/py-torch/package.py | 6 ++--- 7 files changed, 49 insertions(+), 27 deletions(-) diff --git a/lib/spack/spack/build_systems/cuda.py b/lib/spack/spack/build_systems/cuda.py index 20f7ede13967b2..9320a137a5ee53 100644 --- a/lib/spack/spack/build_systems/cuda.py +++ b/lib/spack/spack/build_systems/cuda.py @@ -3,6 +3,9 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import re +from typing import Iterable, List + import spack.variant from spack.directives import conflicts, depends_on, variant from spack.multimethod import when @@ -44,6 +47,7 @@ class CudaPackage(PackageBase): "87", "89", "90", + "90a", ) # FIXME: keep cuda and cuda_arch separate to make usage easier until @@ -70,6 +74,27 @@ def cuda_flags(arch_list): for s in arch_list ] + @staticmethod + def compute_capabilities(arch_list: Iterable[str]) -> List[str]: + """Adds a decimal place to each CUDA arch. + + >>> compute_capabilities(['90', '90a']) + ['9.0', '9.0a'] + + Args: + arch_list: A list of integer strings, optionally followed by a suffix. + + Returns: + A list of float strings, optionally followed by a suffix + """ + pattern = re.compile(r"(\d+)") + capabilities = [] + for arch in arch_list: + _, number, letter = re.split(pattern, arch) + number = "{0:.1f}".format(float(number) / 10.0) + capabilities.append(number + letter) + return capabilities + depends_on("cuda", when="+cuda") # CUDA version vs Architecture diff --git a/var/spack/repos/builtin/packages/amr-wind/package.py b/var/spack/repos/builtin/packages/amr-wind/package.py index b3875753bcf2ee..ba5c15da37539b 100644 --- a/var/spack/repos/builtin/packages/amr-wind/package.py +++ b/var/spack/repos/builtin/packages/amr-wind/package.py @@ -156,9 +156,7 @@ def cmake_args(self): args.append(define("HDF5_IS_PARALLEL", spec.satisfies("+mpi"))) if spec.satisfies("+cuda"): - amrex_arch = [ - "{0:.1f}".format(float(i) / 10.0) for i in spec.variants["cuda_arch"].value - ] + amrex_arch = CudaPackage.compute_capabilities(spec.variants["cuda_arch"].value) if amrex_arch: args.append(define("AMReX_CUDA_ARCH", amrex_arch)) diff --git a/var/spack/repos/builtin/packages/babelstream/package.py b/var/spack/repos/builtin/packages/babelstream/package.py index b1f518de1f4f8a..ec85b2d3569bc4 100644 --- a/var/spack/repos/builtin/packages/babelstream/package.py +++ b/var/spack/repos/builtin/packages/babelstream/package.py @@ -343,7 +343,6 @@ def cmake_args(self): args.append("-DCMAKE_CUDA_COMPILER=" + cuda_comp) args.append("-DTARGET=NVIDIA") cuda_arch_list = self.spec.variants["cuda_arch"].value - int_cuda_arch = int(cuda_arch_list[0]) cuda_arch = "sm_" + cuda_arch_list[0] args.append("-DCUDA_ARCH=" + cuda_arch) @@ -393,20 +392,20 @@ def cmake_args(self): if "cuda" in self.spec.variants["backend"].value: args.append("-DKokkos_ENABLE_CUDA=ON") cuda_arch_list = self.spec.variants["cuda_arch"].value - int_cuda_arch = int(cuda_arch_list[0]) + cuda_arch = cuda_arch_list[0] # arhitecture kepler optimisations - if int_cuda_arch in (30, 32, 35, 37): - args.append("-D" + "Kokkos_ARCH_KEPLER" + str(int_cuda_arch) + "=ON") + if cuda_arch in ("30", "32", "35", "37"): + args.append("-D" + "Kokkos_ARCH_KEPLER" + cuda_arch + "=ON") # arhitecture maxwell optimisations - if int_cuda_arch in (50, 52, 53): - args.append("-D" + "Kokkos_ARCH_MAXWELL" + str(int_cuda_arch) + "=ON") + if cuda_arch in ("50", "52", "53"): + args.append("-D" + "Kokkos_ARCH_MAXWELL" + cuda_arch + "=ON") # arhitecture pascal optimisations - if int_cuda_arch in (60, 61): - args.append("-D" + "Kokkos_ARCH_PASCAL" + str(int_cuda_arch) + "=ON") + if cuda_arch in ("60", "61"): + args.append("-D" + "Kokkos_ARCH_PASCAL" + cuda_arch + "=ON") # architecture volta optimisations - if int_cuda_arch in (70, 72): - args.append("-D" + "Kokkos_ARCH_VOLTA" + str(int_cuda_arch) + "=ON") - if int_cuda_arch == 75: + if cuda_arch in ("70", "72"): + args.append("-D" + "Kokkos_ARCH_VOLTA" + cuda_arch + "=ON") + if cuda_arch == "75": args.append("-DKokkos_ARCH_TURING75=ON") if "omp" in self.spec.variants["backend"].value: args.append("-DKokkos_ENABLE_OPENMP=ON") diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 2c7bc311deac0d..c0980ae42ccb7e 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -5,6 +5,7 @@ import itertools import os +import re import sys from subprocess import Popen @@ -182,8 +183,11 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage): # Starting from cmake@3.18, CUDA architecture managament can be delegated to CMake. # Hence, it is possible to rely on it instead of relying on custom logic updates from VTK-m for # newer architectures (wrt mapping). - for _arch in [arch for arch in CudaPackage.cuda_arch_values if int(arch) > 86]: - conflicts("cmake@:3.17", when=f"cuda_arch={_arch}") + pattern = re.compile(r"\d+") + for _arch in CudaPackage.cuda_arch_values: + _number = re.match(pattern, _arch).group() + if int(_number) > 86: + conflicts("cmake@:3.17", when=f"cuda_arch={_arch}") # We only support one single Architecture for _arch, _other_arch in itertools.permutations(CudaPackage.cuda_arch_values, 2): diff --git a/var/spack/repos/builtin/packages/py-jaxlib/package.py b/var/spack/repos/builtin/packages/py-jaxlib/package.py index ff67dd46048d12..951aa4d9d39c25 100644 --- a/var/spack/repos/builtin/packages/py-jaxlib/package.py +++ b/var/spack/repos/builtin/packages/py-jaxlib/package.py @@ -149,10 +149,8 @@ def install(self, spec, prefix): args.append("--enable_cuda") args.append("--cuda_path={0}".format(self.spec["cuda"].prefix)) args.append("--cudnn_path={0}".format(self.spec["cudnn"].prefix)) - capabilities = ",".join( - "{0:.1f}".format(float(i) / 10.0) for i in spec.variants["cuda_arch"].value - ) - args.append("--cuda_compute_capabilities={0}".format(capabilities)) + capabilities = CudaPackage.compute_capabilities(spec.variants["cuda_arch"].value) + args.append("--cuda_compute_capabilities={0}".format(",".join(capabilities))) args.append( "--bazel_startup_options=" "--output_user_root={0}".format(self.wrapped_package_object.buildtmp) diff --git a/var/spack/repos/builtin/packages/py-tensorflow/package.py b/var/spack/repos/builtin/packages/py-tensorflow/package.py index 5e7b2986b435a9..9935be8b294fc6 100644 --- a/var/spack/repos/builtin/packages/py-tensorflow/package.py +++ b/var/spack/repos/builtin/packages/py-tensorflow/package.py @@ -630,10 +630,8 @@ def setup_build_environment(self, env): # Please note that each additional compute capability significantly # increases your build time and binary size, and that TensorFlow # only supports compute capabilities >= 3.5 - capabilities = ",".join( - "{0:.1f}".format(float(i) / 10.0) for i in spec.variants["cuda_arch"].value - ) - env.set("TF_CUDA_COMPUTE_CAPABILITIES", capabilities) + capabilities = CudaPackage.compute_capabilities(spec.variants["cuda_arch"].value) + env.set("TF_CUDA_COMPUTE_CAPABILITIES", ",".join(capabilities)) else: env.set("TF_NEED_CUDA", "0") diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py index 2e1631fa027288..ec2f8e3bb393f2 100644 --- a/var/spack/repos/builtin/packages/py-torch/package.py +++ b/var/spack/repos/builtin/packages/py-torch/package.py @@ -481,10 +481,10 @@ def patch(self): def torch_cuda_arch_list(self, env): if "+cuda" in self.spec: - torch_cuda_arch = ";".join( - "{0:.1f}".format(float(i) / 10.0) for i in self.spec.variants["cuda_arch"].value + torch_cuda_arch = CudaPackage.compute_capabilities( + self.spec.variants["cuda_arch"].value ) - env.set("TORCH_CUDA_ARCH_LIST", torch_cuda_arch) + env.set("TORCH_CUDA_ARCH_LIST", ";".join(torch_cuda_arch)) def setup_build_environment(self, env): """Set environment variables used to control the build. From 5beed521bd280d5e1ea2deba3052e92b9dfa5cf4 Mon Sep 17 00:00:00 2001 From: Pierre Augier Date: Wed, 11 Sep 2024 17:45:56 +0200 Subject: [PATCH 088/687] py-fluidfft and co: add new packages (#46236) * Add new packages: py-fluidfft and co * py-fluidfft: add few contrains (version dependencies) --- .../packages/py-fluidfft-builder/package.py | 20 ++++++++++ .../packages/py-fluidfft-fftw/package.py | 30 +++++++++++++++ .../packages/py-fluidfft-fftwmpi/package.py | 31 +++++++++++++++ .../py-fluidfft-mpi-with-fftw/package.py | 31 +++++++++++++++ .../packages/py-fluidfft-p3dfft/package.py | 32 ++++++++++++++++ .../packages/py-fluidfft-pfft/package.py | 32 ++++++++++++++++ .../builtin/packages/py-fluidfft/package.py | 38 +++++++++++++++++++ 7 files changed, 214 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-fluidfft-builder/package.py create mode 100644 var/spack/repos/builtin/packages/py-fluidfft-fftw/package.py create mode 100644 var/spack/repos/builtin/packages/py-fluidfft-fftwmpi/package.py create mode 100644 var/spack/repos/builtin/packages/py-fluidfft-mpi-with-fftw/package.py create mode 100644 var/spack/repos/builtin/packages/py-fluidfft-p3dfft/package.py create mode 100644 var/spack/repos/builtin/packages/py-fluidfft-pfft/package.py create mode 100644 var/spack/repos/builtin/packages/py-fluidfft/package.py diff --git a/var/spack/repos/builtin/packages/py-fluidfft-builder/package.py b/var/spack/repos/builtin/packages/py-fluidfft-builder/package.py new file mode 100644 index 00000000000000..d6b81dcbf1118b --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft-builder/package.py @@ -0,0 +1,20 @@ +# Copyright 2013-2024 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 PyFluidfftBuilder(PythonPackage): + """Fluidfft plugin dependencies""" + + pypi = "fluidfft-builder/fluidfft_builder-0.0.2.tar.gz" + + maintainers("paugier") + license("MIT", checked_by="paugier") + + version("0.0.2", sha256="c0af9ceca27ae3a00ccf2f160703be9e394d8b886b8a02653b6c0a12a4f54a90") + + depends_on("python@3.9:", type=("build", "run")) + depends_on("py-flit-core@3.2:3", type="build") diff --git a/var/spack/repos/builtin/packages/py-fluidfft-fftw/package.py b/var/spack/repos/builtin/packages/py-fluidfft-fftw/package.py new file mode 100644 index 00000000000000..2a72ef81f4497e --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft-fftw/package.py @@ -0,0 +1,30 @@ +# Copyright 2013-2024 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 PyFluidfftFftw(PythonPackage): + """Fluidfft plugin using fftw.""" + + pypi = "fluidfft_fftw/fluidfft_fftw-0.0.1.tar.gz" + + maintainers("paugier") + license("CECILL-B", checked_by="paugier") + + version("0.0.1", sha256="59967846e1d976508db30ff65987e9c1e6c024ec9c095849608ee8913b96d3ff") + + with default_args(type=("build", "run")): + depends_on("python@3.9:") + + with default_args(type="link"): + depends_on("fftw") + + with default_args(type="build"): + depends_on("py-meson-python") + depends_on("py-transonic@0.6.4:") + depends_on("py-fluidfft-builder") + + depends_on("py-fluidfft", type="run") diff --git a/var/spack/repos/builtin/packages/py-fluidfft-fftwmpi/package.py b/var/spack/repos/builtin/packages/py-fluidfft-fftwmpi/package.py new file mode 100644 index 00000000000000..6df9d0e74ba90c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft-fftwmpi/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2024 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 PyFluidfftFftwmpi(PythonPackage): + """Fluidfft plugin using fftwmpi.""" + + pypi = "fluidfft-fftwmpi/fluidfft_fftwmpi-0.0.1.tar.gz" + + maintainers("paugier") + license("CECILL-B", checked_by="paugier") + + version("0.0.1", sha256="af3c606852e991c2c1b3ea4f7558c69ab9138b713a7166a6eedf48ef1af660d3") + + with default_args(type=("build", "run")): + extends("python@3.9:") + depends_on("py-mpi4py") + + with default_args(type="link"): + depends_on("fftw") + + with default_args(type="build"): + depends_on("py-meson-python") + depends_on("py-transonic@0.6.4:") + depends_on("py-fluidfft-builder") + + depends_on("py-fluidfft", type="run") diff --git a/var/spack/repos/builtin/packages/py-fluidfft-mpi-with-fftw/package.py b/var/spack/repos/builtin/packages/py-fluidfft-mpi-with-fftw/package.py new file mode 100644 index 00000000000000..85180586fba916 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft-mpi-with-fftw/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2024 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 PyFluidfftMpiWithFftw(PythonPackage): + """Fluidfft MPI plugin using fftw.""" + + pypi = "fluidfft-mpi_with_fftw/fluidfft_mpi_with_fftw-0.0.1.tar.gz" + + maintainers("paugier") + license("CECILL-B", checked_by="paugier") + + version("0.0.1", sha256="ab8c1867e745715892f8d30c9409e9509467a610f5a702ac7b5cfa003787f6ce") + + with default_args(type=("build", "run")): + depends_on("python@3.9:") + depends_on("py-mpi4py") + + with default_args(type="link"): + depends_on("fftw") + + with default_args(type="build"): + depends_on("py-meson-python") + depends_on("py-transonic@0.6.4:") + depends_on("py-fluidfft-builder") + + depends_on("py-fluidfft", type="run") diff --git a/var/spack/repos/builtin/packages/py-fluidfft-p3dfft/package.py b/var/spack/repos/builtin/packages/py-fluidfft-p3dfft/package.py new file mode 100644 index 00000000000000..dd1da7b6b9b691 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft-p3dfft/package.py @@ -0,0 +1,32 @@ +# Copyright 2013-2024 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 PyFluidfftP3dfft(PythonPackage): + """Fluidfft MPI plugin using p3dfft.""" + + pypi = "fluidfft-p3dfft/fluidfft_p3dfft-0.0.1.tar.gz" + + maintainers("paugier") + license("CECILL-B", checked_by="paugier") + + version("0.0.1", sha256="1c291236a43045b9f8b9725e568277c5f405d2e2d9f811ba1bc9c5e1d9f2f827") + + with default_args(type=("build", "run")): + depends_on("python@3.9:") + depends_on("py-mpi4py") + + with default_args(type="link"): + depends_on("p3dfft3") + depends_on("fftw") + + with default_args(type="build"): + depends_on("py-meson-python") + depends_on("py-transonic@0.6.4:") + depends_on("py-fluidfft-builder") + + depends_on("py-fluidfft", type="run") diff --git a/var/spack/repos/builtin/packages/py-fluidfft-pfft/package.py b/var/spack/repos/builtin/packages/py-fluidfft-pfft/package.py new file mode 100644 index 00000000000000..63a18cc3b84c99 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft-pfft/package.py @@ -0,0 +1,32 @@ +# Copyright 2013-2024 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 PyFluidfftPfft(PythonPackage): + """Fluidfft MPI plugin using pfft.""" + + pypi = "fluidfft-pfft/fluidfft_pfft-0.0.1.tar.gz" + + maintainers("paugier") + license("CECILL-B", checked_by="paugier") + + version("0.0.1", sha256="ef8255bd78c9d2dbfb11715542b221d457eedfa0a5b0bbdd1b95e8fbe64043c5") + + with default_args(type=("build", "run")): + depends_on("python@3.9:") + depends_on("py-mpi4py") + + with default_args(type="link"): + depends_on("fftw") + depends_on("pfft") + + with default_args(type="build"): + depends_on("py-meson-python") + depends_on("py-transonic@0.6.4:") + depends_on("py-fluidfft-builder") + + depends_on("py-fluidfft", type="run") diff --git a/var/spack/repos/builtin/packages/py-fluidfft/package.py b/var/spack/repos/builtin/packages/py-fluidfft/package.py new file mode 100644 index 00000000000000..e674665785f39b --- /dev/null +++ b/var/spack/repos/builtin/packages/py-fluidfft/package.py @@ -0,0 +1,38 @@ +# Copyright 2013-2024 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 PyFluidfft(PythonPackage): + """Efficient and easy Fast Fourier Transform (FFT) for Python.""" + + pypi = "fluidfft/fluidfft-0.4.2.tar.gz" + + maintainers("paugier") + + license("CECILL-B", checked_by="paugier") + + version("0.4.2", sha256="5e35f1fb647da2fa65c116bb0d598fc9cb975cd95c41022644c27dc726c36073") + version("0.4.1", sha256="b17e64c7b2be47c61d6ac7b713e0e8992cf900d2367381288c93a56090e6c0c1") + + variant("native", default=False, description="Compile with -march=native and -Ofast.") + + with default_args(type=("build", "run")): + depends_on("python@3.9:") + depends_on("py-transonic@0.6.4:") + + with default_args(type="build"): + depends_on("py-meson-python") + depends_on("py-pythran@0.9.7:") + + with default_args(type="run"): + depends_on("py-fluiddyn@0.2.3:") + depends_on("py-pyfftw@0.10.4:") + depends_on("py-importlib_metadata", when="^python@:3.10") + + def config_settings(self, spec, prefix): + settings = {"setup-args": {"-Dnative": spec.variants["native"].value}} + return settings From 6c4990525d676eb2ea310570914672dde18c8896 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 11 Sep 2024 17:48:56 +0200 Subject: [PATCH 089/687] fixesproto: add xextproto dep (#46325) needed according to pc file --- var/spack/repos/builtin/packages/fixesproto/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/fixesproto/package.py b/var/spack/repos/builtin/packages/fixesproto/package.py index 92e7f494702341..dd0157bd9d3e28 100644 --- a/var/spack/repos/builtin/packages/fixesproto/package.py +++ b/var/spack/repos/builtin/packages/fixesproto/package.py @@ -20,3 +20,4 @@ class Fixesproto(AutotoolsPackage, XorgPackage): depends_on("pkgconfig", type="build") depends_on("util-macros", type="build") + depends_on("xextproto") From 6287d9845513c0f9458732c704e1ee34980f7db6 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 11 Sep 2024 10:08:52 -0600 Subject: [PATCH 090/687] Update FMS: apply patch for fms@2023.03, add variant shared and patch for fms@2024.02 (#46238) * Update var/spack/repos/builtin/packages/fms/package.py: apply patch for fms@2023.03 to fix compiler options bug in cmake config, add variant shared and corresponding patch for fms@2024.02 * Fix fms package audit: use https://github.com/NOAA-GFDL/FMS/commit/c9bba516ba1115d4a7660fba92f9d67cf3fd32ad.patch?full_index=1 instead of https://github.com/NOAA-GFDL/FMS/pull/1418/commits/c9bba516ba1115d4a7660fba92f9d67cf3fd32ad.patch?full_index=1 * Update checksum of patch for fms@2023.03 --- var/spack/repos/builtin/packages/fms/package.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/var/spack/repos/builtin/packages/fms/package.py b/var/spack/repos/builtin/packages/fms/package.py index c546c315e3a737..59034e63d5813b 100644 --- a/var/spack/repos/builtin/packages/fms/package.py +++ b/var/spack/repos/builtin/packages/fms/package.py @@ -58,6 +58,22 @@ class Fms(CMakePackage): depends_on("c", type="build") # generated depends_on("fortran", type="build") # generated + # https://github.com/NOAA-GFDL/FMS/issues/1417 + patch( + "https://github.com/NOAA-GFDL/FMS/commit/c9bba516ba1115d4a7660fba92f9d67cf3fd32ad.patch?full_index=1", + sha256="07d5b68838bba61ee547bd4cd7c12d81228c91a80a966b8693694fa236d0ac30", + when="@2023.03", + ) + + variant("shared", description="Build shared libraries", when="@2024.02:", default=False) + # What the following patch is providing is available in version 2024.03 + # and newer so it is only needed to 2024.02 + patch( + "https://github.com/NOAA-GFDL/fms/pull/1559.patch?full_index=1", + sha256="2b12a6c35f357c3dddcfa5282576e56ab0e8e6c1ad1dab92a2c85ce3dfb815d4", + when="@2024.02", + ) + variant( "precision", values=("32", "64"), @@ -115,6 +131,7 @@ def cmake_args(self): self.define_from_variant("GFS_PHYS"), self.define_from_variant("OPENMP"), self.define_from_variant("ENABLE_QUAD_PRECISION", "quad_precision"), + self.define_from_variant("SHARED_LIBS", "shared"), self.define_from_variant("WITH_YAML", "yaml"), self.define_from_variant("CONSTANTS"), self.define_from_variant("LARGEFILE", "large_file"), From 2185749bb47ef9b3d13a5415d789e42dc4ac8c73 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Wed, 11 Sep 2024 11:13:17 -0500 Subject: [PATCH 091/687] openmpi: update dependency wrt mpi standard versions (#46102) * openmpi: update mpi version dependency * Use "disjoint sets" for version ranges --- var/spack/repos/builtin/packages/openmpi/package.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 07c9154c1434d0..62c122684eb2c2 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -571,9 +571,10 @@ class Openmpi(AutotoolsPackage, CudaPackage): variant("openshmem", default=False, description="Enable building OpenSHMEM") variant("debug", default=False, description="Make debug build", when="build_system=autotools") - provides("mpi") - provides("mpi@:2.2", when="@1.6.5") - provides("mpi@:3.0", when="@1.7.5:") + provides("mpi@:2.0", when="@:1.2") + provides("mpi@:2.1", when="@1.3:1.7.2") + provides("mpi@:2.2", when="@1.7.3:1.7.4") + provides("mpi@:3.0", when="@1.7.5:1.10.7") provides("mpi@:3.1", when="@2.0.0:") if sys.platform != "darwin": From 3099662df23431a9706874c8d27c7c19100def37 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 Sep 2024 10:59:16 -0700 Subject: [PATCH 092/687] Fix variant expressions that will never match (#46314) In #44425, we add stricter variant audits that catch expressions that can never match. This fixes 13 packages that had this type of issue. Most packages had lingering spec expressions from before conditional variants with `when=` statements were added. For example: * Given `conflicts("+a", when="~b")`, if the package has since added `variant("a", when="+b")`, the conflict is no longer needed, because `a` and `b` will never exist together. * Similarly, two packages that depended on `py-torch` depended on `py-torch~cuda~cudnn`, which can't match because the `cudnn` variant doesn't exist when `cuda` is disabled. Note that neither `+foo` or `~foo` match (intentionally) if the `foo` variant doesn't exist. * Some packages referred to impossible version/variant combinations, e.g., `ceed@1.0.0+mfem~petsc` when the `petsc` variant only exist at version `2` or higher. Some of these correct real issues (e.g. the `py-torch` dependencies would have never worked). Others simply declutter old code in packages by making all constraints consistent with version and variant updates. The only one of these that I think is not all that useful is the one for `acts`, where looping over `cxxstd` versions and package versions ends up adding some constraints that are impossible. The additional dependencies could never have happened and the code is more complicated with the needed extra constriant. I think *probably* the best thing to do in `acts` is to just not to use a loop and to write out the constraints explicitly, but maybe the code is easier to maintain as written. Signed-off-by: Todd Gamblin --- var/spack/repos/builtin/packages/acts/package.py | 5 ++++- var/spack/repos/builtin/packages/aluminum/package.py | 1 - var/spack/repos/builtin/packages/ceed/package.py | 10 +++------- .../builtin/packages/cosmoflow-benchmark/package.py | 2 +- var/spack/repos/builtin/packages/cp2k/package.py | 2 -- var/spack/repos/builtin/packages/dealii/package.py | 10 ---------- var/spack/repos/builtin/packages/lammps/package.py | 1 - .../repos/builtin/packages/mlperf-deepcam/package.py | 2 +- var/spack/repos/builtin/packages/openmpi/package.py | 5 ----- var/spack/repos/builtin/packages/q-e-sirius/package.py | 2 -- var/spack/repos/builtin/packages/sundials/package.py | 1 - var/spack/repos/builtin/packages/trilinos/package.py | 3 --- var/spack/repos/builtin/packages/w3emc/package.py | 1 - 13 files changed, 9 insertions(+), 36 deletions(-) diff --git a/var/spack/repos/builtin/packages/acts/package.py b/var/spack/repos/builtin/packages/acts/package.py index 4686749d7c8392..8935be08acbf0d 100644 --- a/var/spack/repos/builtin/packages/acts/package.py +++ b/var/spack/repos/builtin/packages/acts/package.py @@ -400,7 +400,10 @@ class Acts(CMakePackage, CudaPackage): # ACTS imposes requirements on the C++ standard values used by ROOT for _cxxstd in _cxxstd_values: for _v in _cxxstd: - depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +geant4") + if Spec(_v.when).satisfies("@0.23:"): # geant4 variant only exists at 0.23 or higher + depends_on( + f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +geant4" + ) depends_on( f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +fatras_geant4" ) diff --git a/var/spack/repos/builtin/packages/aluminum/package.py b/var/spack/repos/builtin/packages/aluminum/package.py index 5c1fb482a3871e..b5ca6aa3f59d5d 100644 --- a/var/spack/repos/builtin/packages/aluminum/package.py +++ b/var/spack/repos/builtin/packages/aluminum/package.py @@ -88,7 +88,6 @@ class Aluminum(CachedCMakePackage, CudaPackage, ROCmPackage): # FIXME: Do we want to expose tuning parameters to the Spack # recipe? Some are numeric values, some are on/off switches. - conflicts("~cuda", when="+cuda_rma", msg="CUDA RMA support requires CUDA") conflicts("+cuda", when="+rocm", msg="CUDA and ROCm support are mutually exclusive") depends_on("mpi") diff --git a/var/spack/repos/builtin/packages/ceed/package.py b/var/spack/repos/builtin/packages/ceed/package.py index fd72aa13019723..d346bb667ed865 100644 --- a/var/spack/repos/builtin/packages/ceed/package.py +++ b/var/spack/repos/builtin/packages/ceed/package.py @@ -201,10 +201,6 @@ class Ceed(BundlePackage, CudaPackage, ROCmPackage): # and +mumps: depends_on("petsc@3.11.1+mpi+hypre+suite-sparse+mumps+double~int64", when="@2.0.0+petsc+mfem") depends_on("hpgmg@0.4+fe", when="@2.0.0+petsc") - # ceed-1.0 - # The mfem petsc examples need the petsc variants +hypre, +suite-sparse, - # and +mumps: - depends_on("hpgmg@a0a5510df23b+fe", when="@1.0.0+petsc") # MAGMA # ceed 5.0 @@ -313,8 +309,8 @@ class Ceed(BundlePackage, CudaPackage, ROCmPackage): depends_on("suite-sparse@:5.1.0", when="@2.0.0%gcc@:4.8+mfem+petsc") # ceed-1.0 - depends_on("mfem@3.3.2+mpi+examples+miniapps", when="@1.0.0+mfem~petsc") - depends_on("mfem@3.3.2+mpi+petsc+examples+miniapps", when="@1.0.0+mfem+petsc") + depends_on("mfem@3.3.2+mpi+examples+miniapps", when="@1.0.0+mfem") + depends_on("mfem@3.3.2+mpi+petsc+examples+miniapps", when="@1.0.0+mfem") depends_on("laghos@1.0", when="@1.0.0+mfem") # The next line seems to be necessary because the concretizer somehow # decides that mfem requires 'hypre+internal-superlu' even though the mfem @@ -324,4 +320,4 @@ class Ceed(BundlePackage, CudaPackage, ROCmPackage): depends_on("hypre~internal-superlu", when="@1.0.0+mfem") # If using gcc version <= 4.8 build suite-sparse version <= 5.1.0 - depends_on("suite-sparse@:5.1.0", when="@1.0.0%gcc@:4.8+mfem+petsc") + depends_on("suite-sparse@:5.1.0", when="@1.0.0%gcc@:4.8+mfem") diff --git a/var/spack/repos/builtin/packages/cosmoflow-benchmark/package.py b/var/spack/repos/builtin/packages/cosmoflow-benchmark/package.py index e9b69678edf391..40117462a30e28 100644 --- a/var/spack/repos/builtin/packages/cosmoflow-benchmark/package.py +++ b/var/spack/repos/builtin/packages/cosmoflow-benchmark/package.py @@ -30,7 +30,7 @@ class CosmoflowBenchmark(Package, CudaPackage): depends_on("py-tensorflow+cuda", when="+cuda", type=("build", "run")) depends_on("py-tensorflow~cuda~nccl", when="~cuda", type=("build", "run")) depends_on("py-torch+cuda", when="+cuda", type=("build", "run")) - depends_on("py-torch~cuda~cudnn~nccl", when="~cuda", type=("build", "run")) + depends_on("py-torch~cuda~nccl", when="~cuda", type=("build", "run")) depends_on("py-horovod tensor_ops=mpi", when="~cuda", type=("build", "run")) def install(self, spec, prefix): diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index fbc7b848d5ca10..8e013a39d3c985 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -272,8 +272,6 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): depends_on("sirius+rocm", when="+rocm") depends_on("sirius+openmp", when="+openmp") depends_on("sirius~openmp", when="~openmp") - depends_on("sirius@7.0.0:7.0", when="@8:8.2") - depends_on("sirius@7.2", when="@8.3:8.9") depends_on("sirius@7.3:", when="@9.1") depends_on("sirius@7.4:7.5", when="@2023.2") depends_on("sirius@7.5:", when="@2024.1:") diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index b4664d23e2f096..94563ec32dc78e 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -358,16 +358,6 @@ class Dealii(CMakePackage, CudaPackage): "via ~{0}".format(_package), ) - # interfaces added after 9.5.0: - for _package in ["vtk", "taskflow"]: - conflicts( - "+{0}".format(_package), - when="@:9.5", - msg="The interface to {0} is supported from version 9.6.0 " - "onwards. Please explicitly disable this variant " - "via ~{0}".format(_package), - ) - # Interfaces removed in 9.3.0: conflicts( "+nanoflann", diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py index 4f9a7f32e2eda5..5c1f9c0588c8a1 100644 --- a/var/spack/repos/builtin/packages/lammps/package.py +++ b/var/spack/repos/builtin/packages/lammps/package.py @@ -734,7 +734,6 @@ def url_for_version(self, version): conflicts("+cuda", when="+opencl") conflicts("+rocm", when="+opencl") conflicts("+body", when="+poems@:20180628") - conflicts("+latte", when="@:20170921") conflicts("+python", when="~lib") conflicts("+qeq", when="~manybody") conflicts("+user-atc", when="~manybody") diff --git a/var/spack/repos/builtin/packages/mlperf-deepcam/package.py b/var/spack/repos/builtin/packages/mlperf-deepcam/package.py index 01ce1dbec6bd35..5baed86ac377f2 100644 --- a/var/spack/repos/builtin/packages/mlperf-deepcam/package.py +++ b/var/spack/repos/builtin/packages/mlperf-deepcam/package.py @@ -22,7 +22,7 @@ class MlperfDeepcam(Package, CudaPackage): depends_on("py-pycuda", type=("build", "run")) depends_on("py-mpi4py", type=("build", "run")) depends_on("py-torch+cuda", when="+cuda", type=("build", "run")) - depends_on("py-torch~cuda~cudnn~nccl", when="~cuda", type=("build", "run")) + depends_on("py-torch~cuda~nccl", when="~cuda", type=("build", "run")) depends_on("py-matplotlib", type=("build", "run")) depends_on("py-basemap", type=("build", "run")) depends_on("py-pillow", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 62c122684eb2c2..df602ef8b46dc2 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -668,11 +668,6 @@ class Openmpi(AutotoolsPackage, CudaPackage): # knem support was added in 1.5 conflicts("fabrics=knem", when="@:1.4") - conflicts( - "schedulers=slurm ~pmi", - when="@1.5.4", - msg="+pmi is required for openmpi to work with Slurm.", - ) conflicts( "schedulers=loadleveler", when="@3:", diff --git a/var/spack/repos/builtin/packages/q-e-sirius/package.py b/var/spack/repos/builtin/packages/q-e-sirius/package.py index e376eece0fe40f..93ac1cccceabbd 100644 --- a/var/spack/repos/builtin/packages/q-e-sirius/package.py +++ b/var/spack/repos/builtin/packages/q-e-sirius/package.py @@ -59,8 +59,6 @@ class QESirius(CMakePackage): depends_on("git", type="build") depends_on("pkgconfig", type="build") - conflicts("~scalapack", when="+elpa", msg="ELPA requires SCALAPACK support") - variant("scalapack", default=True, description="Enables scalapack support") with when("+scalapack"): diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py index 13b6c6200ac30e..5be35b6bb04bb6 100644 --- a/var/spack/repos/builtin/packages/sundials/package.py +++ b/var/spack/repos/builtin/packages/sundials/package.py @@ -201,7 +201,6 @@ class Sundials(CMakePackage, CudaPackage, ROCmPackage): # External libraries incompatible with 64-bit indices conflicts("+lapack", when="@3.0.0: +int64") - conflicts("+hypre", when="+hypre@:2.6.1a +int64") # External libraries incompatible with single precision conflicts("+klu", when="precision=single") diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 89ed6a184e4cf4..877c2edc07a2a3 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -383,9 +383,6 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): # Fix: https://github.com/xiaoyeli/superlu_dist/commit/09cb1430f7be288fd4d75b8ed461aa0b7e68fefe # is not tagged yet. See discussion here https://github.com/trilinos/Trilinos/issues/11839 conflicts("+cuda +stokhos +superlu-dist") - # Cuda UVM must be enabled prior to 13.2 - # See https://github.com/spack/spack/issues/28869 - conflicts("~uvm", when="@:13.1 +cuda") # stokhos fails on xl/xl_r conflicts("+stokhos", when="%xl") diff --git a/var/spack/repos/builtin/packages/w3emc/package.py b/var/spack/repos/builtin/packages/w3emc/package.py index 9388a7da7e200d..82dbf7bf8c6b92 100644 --- a/var/spack/repos/builtin/packages/w3emc/package.py +++ b/var/spack/repos/builtin/packages/w3emc/package.py @@ -56,7 +56,6 @@ class W3emc(CMakePackage): ) conflicts("+shared +extradeps", msg="Shared library cannot be built with unknown dependencies") - conflicts("+shared ~pic", msg="Shared library requires PIC") depends_on("bufr", when="@2.10: +bufr") depends_on("bacio", when="@2.9.2:") From 6db1defba0e76f3eee7efa89fa1f2d147bdc34ac Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 11 Sep 2024 12:37:13 -0600 Subject: [PATCH 093/687] New packages: py-regionmask and py-pyogrio (#46209) * Add py-geopandas versions 1.0.0 and 1.0.1, update dependencies * New package py-pyogrio - dependency of newer py-geopandas * New package py-regionmask - needs py-geopandas --- .../builtin/packages/py-geopandas/package.py | 24 ++++++++----- .../builtin/packages/py-pyogrio/package.py | 30 ++++++++++++++++ .../builtin/packages/py-regionmask/package.py | 35 +++++++++++++++++++ 3 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 var/spack/repos/builtin/packages/py-pyogrio/package.py create mode 100644 var/spack/repos/builtin/packages/py-regionmask/package.py diff --git a/var/spack/repos/builtin/packages/py-geopandas/package.py b/var/spack/repos/builtin/packages/py-geopandas/package.py index be699da3f59700..47194df24f17dc 100644 --- a/var/spack/repos/builtin/packages/py-geopandas/package.py +++ b/var/spack/repos/builtin/packages/py-geopandas/package.py @@ -22,6 +22,8 @@ class PyGeopandas(PythonPackage): license("BSD-3-Clause") version("master", branch="master") + version("1.0.1", sha256="b8bf70a5534588205b7a56646e2082fb1de9a03599651b3d80c99ea4c2ca08ab") + version("1.0.0", sha256="386d42c028047e2b0f09191d7859268304761c4711a247173a88891b6161f711") version("0.14.3", sha256="748af035d4a068a4ae00cab384acb61d387685c833b0022e0729aa45216b23ac") version("0.11.1", sha256="f0f0c8d0423d30cf81de2056d853145c4362739350a7f8f2d72cc7409ef1eca1") version("0.11.0", sha256="562fe7dc19a6e0f61532d654c4752f7bf46e0714990c5844fe3de3f9c99cb873") @@ -42,21 +44,27 @@ class PyGeopandas(PythonPackage): depends_on("python@3.9:", type=("build", "run"), when="@0.14:") depends_on("py-setuptools", type="build") depends_on("py-setuptools@61.0.0:", type="build", when="@0.14:") + depends_on("py-numpy", type=("build", "run")) + depends_on("py-numpy@1.22:", type=("build", "run"), when="@0.14.4:") + # Only for versions 0.x.y - replaced by py-pyogrio + depends_on("py-fiona", type=("build", "run"), when="@:0.99") + depends_on("py-fiona@1.8:", type=("build", "run"), when="@0.9:0.99") + depends_on("py-fiona@1.8.21:", type=("build", "run"), when="@0.14:0.99") + # Only for versions 1.x.y - replaces py-fiona + depends_on("py-pyogrio@0.7.2:", type=("build", "run"), when="@1:") + depends_on("py-packaging", type=("build", "run"), when="@0.11:") depends_on("py-pandas", type=("build", "run")) depends_on("py-pandas@0.23.0:", type=("build", "run"), when="@0.6:") depends_on("py-pandas@0.24.0:", type=("build", "run"), when="@0.9:") depends_on("py-pandas@0.25.0:", type=("build", "run"), when="@0.10:") depends_on("py-pandas@1.0.0:", type=("build", "run"), when="@0.11:") depends_on("py-pandas@1.4.0:", type=("build", "run"), when="@0.14:") - depends_on("py-shapely@:1", type=("build", "run")) - depends_on("py-shapely@1.6:1", type=("build", "run"), when="@0.9:0.10") - depends_on("py-shapely@1.7:1", type=("build", "run"), when="@0.11:") - depends_on("py-shapely@1.8.0:", type=("build", "run"), when="@0.14:") - depends_on("py-fiona", type=("build", "run")) - depends_on("py-fiona@1.8:", type=("build", "run"), when="@0.9:") - depends_on("py-fiona@1.8.21:", type=("build", "run"), when="@0.14:") depends_on("py-pyproj", type=("build", "run")) depends_on("py-pyproj@2.2.0:", type=("build", "run"), when="@0.7:") depends_on("py-pyproj@2.6.1.post1:", type=("build", "run"), when="@0.11:") depends_on("py-pyproj@3.3.0:", type=("build", "run"), when="@0.14:") - depends_on("py-packaging", type=("build", "run"), when="@0.11:") + depends_on("py-shapely@:1", type=("build", "run"), when="@:0.99") + depends_on("py-shapely@1.6:1", type=("build", "run"), when="@0.9:0.10") + depends_on("py-shapely@1.7:1", type=("build", "run"), when="@0.11:0.99") + depends_on("py-shapely@1.8.0:", type=("build", "run"), when="@0.14:") + depends_on("py-shapely@2.0.0:", type=("build", "run"), when="@1:") diff --git a/var/spack/repos/builtin/packages/py-pyogrio/package.py b/var/spack/repos/builtin/packages/py-pyogrio/package.py new file mode 100644 index 00000000000000..6493a3e5103a70 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pyogrio/package.py @@ -0,0 +1,30 @@ +# Copyright 2013-2024 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 PyPyogrio(PythonPackage): + """Vectorized spatial vector file format I/O using GDAL/OGR""" + + homepage = "https://pypi.org/project/pyogrio" + pypi = "pyogrio/pyogrio-0.9.0.tar.gz" + git = "https://github.com/geopandas/pyogrio.git" + + maintainers("climbfuji") + + license("MIT", checked_by="climbfuji") + + version("0.9.0", sha256="6a6fa2e8cf95b3d4a7c0fac48bce6e5037579e28d3eb33b53349d6e11f15e5a8") + + depends_on("python@3.8:", type=("build", "run")) + depends_on("py-cython@0.29:", type="build") + depends_on("py-versioneer@0.28 +toml", type="build") + # this is an implicit dependency already listed in py-versioneer, not needed + # depends_on("py-tomli", when="^python@:3.10", type="build") + + depends_on("py-certifi", type=("build", "run")) + depends_on("py-numpy", type=("build", "run")) + depends_on("py-packaging", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-regionmask/package.py b/var/spack/repos/builtin/packages/py-regionmask/package.py new file mode 100644 index 00000000000000..fd91af1214ce20 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-regionmask/package.py @@ -0,0 +1,35 @@ +# Copyright 2013-2024 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 PyRegionmask(PythonPackage): + """Create masks of geospatial regions for arbitrary grids""" + + homepage = "https://pypi.org/project/regionmask" + pypi = "regionmask/regionmask-0.12.1.tar.gz" + git = "https://github.com/regionmask/regionmask.git" + + maintainers("climbfuji") + + license("MIT", checked_by="climbfuji") + + version("0.12.1", sha256="7ef1e70c6ebab7bfc6a80e13f6fe771945b8b6a31b7f8980fc88c8b8505bb854") + + depends_on("py-setuptools@42:", type="build") + depends_on("py-setuptools-scm@7:", type="build") + + depends_on("py-geopandas@0.13:", type=("build", "run")) + depends_on("py-numpy@1.24:", type=("build", "run")) + depends_on("py-packaging@23.1:", type=("build", "run")) + depends_on("py-pooch@1.7:", type=("build", "run")) + depends_on("py-rasterio@1.3:", type=("build", "run")) + depends_on("py-shapely@2.0:", type=("build", "run")) + depends_on("py-xarray@2023.7:", type=("build", "run")) + + # "Optional" dependencies for plotting, but that's what this package is really useful for + depends_on("py-matplotlib@3.7:", type="run") + depends_on("py-cartopy@0.22:", type="run") From ff1bc9e555247b3f4d1495a08adbef52dabd8232 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 11 Sep 2024 21:00:48 +0200 Subject: [PATCH 094/687] py-xgboost: add v2.1.1 (#46260) * py-xgboost: add v2.1.1 * setuptools no longer needed * Better comment --- .../builtin/packages/py-xgboost/package.py | 83 ++++++++++--------- .../repos/builtin/packages/xgboost/package.py | 37 +++------ 2 files changed, 59 insertions(+), 61 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-xgboost/package.py b/var/spack/repos/builtin/packages/py-xgboost/package.py index 9b9818dda74e0e..a5013408389934 100644 --- a/var/spack/repos/builtin/packages/py-xgboost/package.py +++ b/var/spack/repos/builtin/packages/py-xgboost/package.py @@ -14,19 +14,19 @@ class PyXgboost(PythonPackage): homepage = "https://xgboost.ai/" pypi = "xgboost/xgboost-1.3.3.tar.gz" - - maintainers("adamjstewart") import_modules = ["xgboost"] license("Apache-2.0") + maintainers("adamjstewart") + version("2.1.1", sha256="4b1729837f9f1ba88a32ef1be3f8efb860fee6454a68719b196dc88032c23d97") + version("2.1.0", sha256="7144980923e76ce741c7b03a14d3bd7514db6de5c7cabe96ba95b229d274f5ca") + version("1.7.6", sha256="1c527554a400445e0c38186039ba1a00425dcdb4e40b37eed0e74cb39a159c47") version("1.6.2", sha256="e1f5c91ba88cf8edb409d7fd2ca150dcd80b6f2115587d87365f0c10b2d4f009") version("1.6.1", sha256="24072028656f3428e7b8aabf77340ece057f273e41f7f85d67ccaefb7454bb18") version("1.5.2", sha256="404dc09dca887ef5a9bc0268f882c54b33bfc16ac365a859a11e7b24d49da387") version("1.3.3", sha256="397051647bb837915f3ff24afc7d49f7fca57630ffd00fb5ef66ae2a0881fb43") - depends_on("cxx", type="build") # generated - variant("pandas", default=False, description="Enable Pandas extensions for training.") variant( "scikit-learn", default=False, description="Enable scikit-learn extensions for training." @@ -34,48 +34,57 @@ class PyXgboost(PythonPackage): variant("dask", default=False, description="Enables Dask extensions for distributed training.") variant("plotting", default=False, description="Enables tree and importance plotting.") - for ver in ["1.3.3", "1.5.2", "1.6.1", "1.6.2"]: + for ver in ["1.3.3", "1.5.2", "1.6.1", "1.6.2", "1.7.6", "2.1.0", "2.1.1"]: depends_on("xgboost@" + ver, when="@" + ver) - depends_on("python@3.7:", when="@1.6:", type=("build", "run")) - depends_on("python@3.6:", type=("build", "run")) - depends_on("py-setuptools", type=("build")) - # in newer pip versions --install-option does not exist - depends_on("py-pip@:23.0", type="build") + with default_args(type="build"): + depends_on("py-hatchling@1.12.1:", type="build", when="@2:") + # Required to use --config-settings + depends_on("py-pip@22.1:", when="@2:") + + # Historical dependencies + depends_on("py-setuptools", when="@:1") + # in newer pip versions --install-option does not exist + depends_on("py-pip@:23.0", when="@:1") - depends_on("py-numpy", type=("build", "run")) - # https://github.com/dmlc/xgboost/issues/10221 - depends_on("py-numpy@:1", when="@:2.0", type=("build", "run")) - depends_on("py-scipy", type=("build", "run")) + with default_args(type=("build", "run")): + depends_on("py-numpy", type=("build", "run")) + # https://github.com/dmlc/xgboost/issues/10221 + depends_on("py-numpy@:1", when="@:2.0", type=("build", "run")) + depends_on("py-scipy", type=("build", "run")) - depends_on("py-pandas", when="+pandas", type=("build", "run")) + with when("+pandas"): + depends_on("py-pandas@1.2:", when="@2:") + depends_on("py-pandas") - depends_on("py-scikit-learn", when="+scikit-learn", type=("build", "run")) + with when("+scikit-learn"): + depends_on("py-scikit-learn") - depends_on("py-dask", when="+dask", type=("build", "run")) - depends_on("py-pandas", when="+dask", type=("build", "run")) - depends_on("py-distributed", when="+dask", type=("build", "run")) + with when("+dask"): + depends_on("py-dask") + depends_on("py-pandas") + depends_on("py-distributed") - depends_on("py-graphviz", when="+plotting", type=("build", "run")) - depends_on("py-matplotlib", when="+plotting", type=("build", "run")) + with when("+plotting"): + depends_on("py-graphviz") + depends_on("py-matplotlib") def patch(self): + # Hard-coded to search for system libxgboost in the Python installation prefix # https://github.com/dmlc/xgboost/issues/6706 - # 'setup.py' is hard-coded to search in Python installation prefix - filter_file( - "lib_path = os.path.join(sys.prefix, 'lib')", - "lib_path = '{0}'".format(self.spec["xgboost"].libs.directories[0]), - "setup.py", - string=True, - ) - - # Same for run-time search - filter_file( - "os.path.join(curr_path, 'lib'),", - "'{0}',".format(self.spec["xgboost"].libs.directories[0]), - os.path.join("xgboost", "libpath.py"), - string=True, - ) - + files = [os.path.join("xgboost", "libpath.py")] + if self.spec.satisfies("@2:"): + regex = "sys.base_prefix" + files.append(os.path.join("packager", "nativelib.py")) + else: + regex = "sys.prefix" + files.append("setup.py") + filter_file(regex, repr(self.spec["xgboost"].prefix), *files, string=True) + + @when("@2:") + def config_settings(self, spec, prefix): + return {"use_system_libxgboost": True} + + @when("@:1") def install_options(self, spec, prefix): return ["--use-system-libxgboost"] diff --git a/var/spack/repos/builtin/packages/xgboost/package.py b/var/spack/repos/builtin/packages/xgboost/package.py index 3451f7af696b74..ea48be3d6ad6cb 100644 --- a/var/spack/repos/builtin/packages/xgboost/package.py +++ b/var/spack/repos/builtin/packages/xgboost/package.py @@ -18,33 +18,22 @@ class Xgboost(CMakePackage, CudaPackage): homepage = "https://xgboost.ai/" git = "https://github.com/dmlc/xgboost.git" - - maintainers("adamjstewart") + submodules = True license("Apache-2.0") + maintainers("adamjstewart") - version("master", branch="master", submodules=True) - version( - "2.1.0", tag="v2.1.0", commit="213ebf7796b757448dfa2cfba532074696fa1524", submodules=True - ) - version( - "1.7.6", tag="v1.7.6", commit="36eb41c960483c8b52b44082663c99e6a0de440a", submodules=True - ) - version( - "1.6.2", tag="v1.6.2", commit="b9934246faa9a25e10a12339685dfbe56d56f70b", submodules=True - ) - version( - "1.6.1", tag="v1.6.1", commit="5d92a7d936fc3fad4c7ecb6031c3c1c7da882a14", submodules=True - ) - version( - "1.5.2", tag="v1.5.2", commit="742c19f3ecf2135b4e008a4f4a10b59add8b1045", submodules=True - ) - version( - "1.3.3", tag="v1.3.3", commit="000292ce6d99ed658f6f9aebabc6e9b330696e7e", submodules=True - ) + version("master", branch="master") + version("2.1.1", tag="v2.1.1", commit="9c9db1259240bffe9040ed7ca6e3fb2c1bda80e4") + version("2.1.0", tag="v2.1.0", commit="213ebf7796b757448dfa2cfba532074696fa1524") + version("1.7.6", tag="v1.7.6", commit="36eb41c960483c8b52b44082663c99e6a0de440a") + version("1.6.2", tag="v1.6.2", commit="b9934246faa9a25e10a12339685dfbe56d56f70b") + version("1.6.1", tag="v1.6.1", commit="5d92a7d936fc3fad4c7ecb6031c3c1c7da882a14") + version("1.5.2", tag="v1.5.2", commit="742c19f3ecf2135b4e008a4f4a10b59add8b1045") + version("1.3.3", tag="v1.3.3", commit="000292ce6d99ed658f6f9aebabc6e9b330696e7e") - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated + depends_on("c", type="build") + depends_on("cxx", type="build") variant("nccl", default=False, description="Build with NCCL to enable distributed GPU support") variant("openmp", default=True, description="Build with OpenMP support") @@ -64,7 +53,7 @@ class Xgboost(CMakePackage, CudaPackage): # thrust 2.3.1 tuple issues depends_on("cuda@:12.3", when="@:1.7") # https://github.com/dmlc/xgboost/issues/10555 - depends_on("cuda@:12.4", when="@:2.1.0") # assuming fix is backported + depends_on("cuda@:12.4", when="@:2.1") depends_on("nccl", when="+nccl") depends_on("llvm-openmp", when="%apple-clang +openmp") From 5833fe0c3684a8a24f140bdb86fee8711d810e41 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 11 Sep 2024 21:23:42 +0200 Subject: [PATCH 095/687] py-scikit-learn: add v1.5.2 (#46327) --- var/spack/repos/builtin/packages/py-scikit-learn/package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-scikit-learn/package.py b/var/spack/repos/builtin/packages/py-scikit-learn/package.py index fcbcee75e02322..4fb94f843f70a0 100644 --- a/var/spack/repos/builtin/packages/py-scikit-learn/package.py +++ b/var/spack/repos/builtin/packages/py-scikit-learn/package.py @@ -19,6 +19,7 @@ class PyScikitLearn(PythonPackage): version("main", branch="main") version("master", branch="main", deprecated=True) + version("1.5.2", sha256="b4237ed7b3fdd0a4882792e68ef2545d5baa50aca3bb45aa7df468138ad8f94d") version("1.5.1", sha256="0ea5d40c0e3951df445721927448755d3fe1d80833b0b7308ebff5d2a45e6414") version("1.5.0", sha256="789e3db01c750ed6d496fa2db7d50637857b451e57bcae863bff707c1247bef7") version("1.4.2", sha256="daa1c471d95bad080c6e44b4946c9390a4842adc3082572c20e4f8884e39e959") @@ -48,8 +49,8 @@ class PyScikitLearn(PythonPackage): version("0.22.1", sha256="51ee25330fc244107588545c70e2f3570cfc4017cff09eed69d6e1d82a212b7d") version("0.22", sha256="314abf60c073c48a1e95feaae9f3ca47a2139bd77cebb5b877c23a45c9e03012") - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated + depends_on("c", type="build") + depends_on("cxx", type="build") # Based on PyPI wheel availability with default_args(type=("build", "link", "run")): From 8160cd1b9edf04efe2389f862ec8e41f93edf2d9 Mon Sep 17 00:00:00 2001 From: Pranav Sivaraman Date: Wed, 11 Sep 2024 16:18:12 -0400 Subject: [PATCH 096/687] scnlib: new package (#46313) --- .../repos/builtin/packages/scnlib/package.py | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 var/spack/repos/builtin/packages/scnlib/package.py diff --git a/var/spack/repos/builtin/packages/scnlib/package.py b/var/spack/repos/builtin/packages/scnlib/package.py new file mode 100644 index 00000000000000..24135986e55333 --- /dev/null +++ b/var/spack/repos/builtin/packages/scnlib/package.py @@ -0,0 +1,61 @@ +# Copyright 2013-2024 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 Scnlib(CMakePackage): + """scanf for modern C++""" + + homepage = "https://scnlib.dev" + url = "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v3.0.1.tar.gz" + + maintainers("pranav-sivaraman") + + license("Apache-2.0", checked_by="pranav-sivaraman") + + version("3.0.1", sha256="bc8a668873601d00cce6841c2d0f2c93f836f63f0fbc77997834dea12e951eb1") + + variant("shared", default=True, description="Build shared libs") + variant( + "regex-backend", + default="std", + description="Regex backend to use", + multi=False, + values=("std", "Boost"), + ) + variant( + "icu", + default=False, + description="Use the ICU when using the Boost regex backend", + when="regex-backend=Boost", + ) + + depends_on("cxx", type="build") + depends_on("cmake@3.16:", type="build") + + depends_on("fast-float@5:") + + depends_on("boost +regex cxxstd=17", when="regex-backend=Boost") + depends_on("boost +icu", when="+icu") + + depends_on("googletest cxxstd=17", type="test") + depends_on("python@3:", type="test") + + def cmake_args(self): + args = [ + self.define("SCN_TESTS", self.run_tests), + self.define("SCN_BENCHMARKS", False), + self.define("SCN_EXAMPLES", False), + self.define("SCN_DOCS", False), + self.define("SCN_USE_EXTERNAL_FAST_FLOAT", True), + self.define("SCN_USE_EXTERNAL_GTEST", True), + self.define("SCN_USE_EXTERNAL_BENCHMARK", True), + self.define("SCN_USE_EXTERNAL_REGEX_BACKEND", True), + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), + self.define_from_variant("SCN_REGEX_BACKEND", "regex-backend"), + ] + + return args From bca975e66a69a93be2f70eb5c23629216a78622c Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Thu, 12 Sep 2024 00:49:18 +0200 Subject: [PATCH 097/687] hep tag: new versions as of 2024/09/11 (#46322) This commit updates acts-algebra-plugins to v0.25.0, actsvg to v0.4.47, detray to v0.74.2, geomodel to v6.5.0, and vecmem to v1.7.0. --- .../repos/builtin/packages/acts-algebra-plugins/package.py | 1 + var/spack/repos/builtin/packages/actsvg/package.py | 3 +++ var/spack/repos/builtin/packages/detray/package.py | 1 + var/spack/repos/builtin/packages/geomodel/package.py | 1 + var/spack/repos/builtin/packages/vecmem/package.py | 1 + 5 files changed, 7 insertions(+) diff --git a/var/spack/repos/builtin/packages/acts-algebra-plugins/package.py b/var/spack/repos/builtin/packages/acts-algebra-plugins/package.py index 0e12d5e25cefcf..6de001e545bd8e 100644 --- a/var/spack/repos/builtin/packages/acts-algebra-plugins/package.py +++ b/var/spack/repos/builtin/packages/acts-algebra-plugins/package.py @@ -17,6 +17,7 @@ class ActsAlgebraPlugins(CMakePackage): license("MPL-2.0", checked_by="stephenswat") + version("0.25.0", sha256="bb0cba6e37558689d780a6de8f749abb3b96f8cd9e0c8851474eb4532e1e98b8") version("0.24.0", sha256="f44753e62b1ba29c28ab86b282ab67ac6028a0f9fe41e599b7fc6fc50b586b62") depends_on("cxx", type="build") # generated diff --git a/var/spack/repos/builtin/packages/actsvg/package.py b/var/spack/repos/builtin/packages/actsvg/package.py index f0e8bc66cdf783..e541f3e78e1538 100644 --- a/var/spack/repos/builtin/packages/actsvg/package.py +++ b/var/spack/repos/builtin/packages/actsvg/package.py @@ -20,6 +20,9 @@ class Actsvg(CMakePackage): license("MPL-2.0") + version("0.4.47", sha256="11924fddbdd01f6337875797dc3a97b62be565688e678485e992bcfc9bfb142f") + version("0.4.46", sha256="0b75e91de240aeac8b91cd4fb8e314d0ab2a4b220048fb373dee9352d571b792") + version("0.4.45", sha256="402ca863e453055e5abc65a37908f44b03b15f90c694807d78627d7800d2e39c") version("0.4.44", sha256="6eda7306b8b863e1860e090f328ac6e7982dc2d3b3d674db2799c13007ffd07f") version("0.4.43", sha256="e2aef32185db37cfdc023282b25c003e63dc974a11118ab2040bd30b2d346147") version("0.4.42", sha256="a8439d50b469ccc4428973507db1adf56aa68b34900ce0c6077ddb92a133a4f2") diff --git a/var/spack/repos/builtin/packages/detray/package.py b/var/spack/repos/builtin/packages/detray/package.py index c32e0ec6d58a49..b4a1d11c61e472 100644 --- a/var/spack/repos/builtin/packages/detray/package.py +++ b/var/spack/repos/builtin/packages/detray/package.py @@ -20,6 +20,7 @@ class Detray(CMakePackage): license("MPL-2.0", checked_by="stephenswat") + version("0.74.2", sha256="9fd14cf1ec30477d33c530670e9fed86b07db083912fe51dac64bf2453b321e8") version("0.73.0", sha256="f574016bc7515a34a675b577e93316e18cf753f1ab7581dcf1c8271a28cb7406") version("0.72.1", sha256="6cc8d34bc0d801338e9ab142c4a9884d19d9c02555dbb56972fab86b98d0f75b") version("0.71.0", sha256="2be2b3dac6f77aa8cea033eba841378dc3703ff93c99e4d05ea03df685e6d508") diff --git a/var/spack/repos/builtin/packages/geomodel/package.py b/var/spack/repos/builtin/packages/geomodel/package.py index 43f81110c54477..9292fd04098c09 100644 --- a/var/spack/repos/builtin/packages/geomodel/package.py +++ b/var/spack/repos/builtin/packages/geomodel/package.py @@ -18,6 +18,7 @@ class Geomodel(CMakePackage): license("Apache-2.0", checked_by="wdconinc") + version("6.5.0", sha256="8a2f71493e54ea4d393f4c0075f3ca13df132f172c891825f3ab949cda052c5f") version("6.4.0", sha256="369f91f021be83d294ba6a9bdbe00077625e9fe798a396aceece8970e7dd5838") version("6.3.0", sha256="d2b101e06d20a8a3b638e6021f517a939f49ea6d8347ce40c927c27efe66b28c") version("6.2.0", sha256="99bb3908bf710ce5ba0bcdd192942705a183a9f2886079df091dc69423b7bdf1") diff --git a/var/spack/repos/builtin/packages/vecmem/package.py b/var/spack/repos/builtin/packages/vecmem/package.py index 5eddb8b61a779d..cb82181cb04ae9 100644 --- a/var/spack/repos/builtin/packages/vecmem/package.py +++ b/var/spack/repos/builtin/packages/vecmem/package.py @@ -17,6 +17,7 @@ class Vecmem(CMakePackage, CudaPackage): license("MPL-2.0-no-copyleft-exception") + version("1.7.0", sha256="ff4bf8ea86a5edcb4a1e3d8dd0c42c73c60e998c6fb6512a40182c1f4620a73d") version("1.6.0", sha256="797b016ac0b79bb39abad059ffa9f4817e519218429c9ab4c115f989616bd5d4") version("1.5.0", sha256="5d7a2d2dd8eb961af12a1ed9e4e427b89881e843064ffa96ad0cf0934ba9b7ae") version("1.4.0", sha256="545dfb4de4f9f3d773eef6a0e3297ebf981bb81950930d0991ad739e31ab16af") From 5c59bb87a4d3ed5a190f9ef37b98cd91c91f020f Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Thu, 12 Sep 2024 00:55:26 +0200 Subject: [PATCH 098/687] acts: add v36.3.0 (#46320) This commit adds v36.3.0 of ACTS, and also marks a previously missing conflict with Boost 1.85.0 --- var/spack/repos/builtin/packages/acts/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/acts/package.py b/var/spack/repos/builtin/packages/acts/package.py index 8935be08acbf0d..6be1e0aff22e1b 100644 --- a/var/spack/repos/builtin/packages/acts/package.py +++ b/var/spack/repos/builtin/packages/acts/package.py @@ -41,6 +41,7 @@ class Acts(CMakePackage, CudaPackage): # Supported Acts versions version("main", branch="main") version("master", branch="main", deprecated=True) # For compatibility + version("36.3.0", commit="3b875cebabdd10462e224279558429f49ed75945", submodules=True) version("36.2.0", commit="e2fb53da911dc481969e56d635898a46b8d78df9", submodules=True) version("36.1.0", commit="3f19d1a0eec1d11937d66d0ef603f0b25b9b4e96", submodules=True) version("36.0.0", commit="6eca77c45b136861272694edbb61bb77200948a5", submodules=True) @@ -418,6 +419,8 @@ class Acts(CMakePackage, CudaPackage): conflicts("%gcc@:7", when="@0.23:") # When using C++20, disable gcc 9 and lower. conflicts("%gcc@:9", when="cxxstd=20") + # See https://github.com/acts-project/acts/pull/3512 + conflicts("^boost@1.85.0") def cmake_args(self): spec = self.spec From c7e3fc90494ef0717389754e97c96ddb1015bdc7 Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Thu, 12 Sep 2024 04:37:43 +0200 Subject: [PATCH 099/687] boost: add v1.86.0 (#46321) This commit adds Boost v1.86.0. --- var/spack/repos/builtin/packages/boost/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index fe0d3928573ebf..50cd7d5a46f9c2 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -30,6 +30,7 @@ class Boost(Package): license("BSL-1.0") version("develop", branch="develop", submodules=True) + version("1.86.0", sha256="1bed88e40401b2cb7a1f76d4bab499e352fa4d0c5f31c0dbae64e24d34d7513b") version("1.85.0", sha256="7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617") version("1.84.0", sha256="cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454") version("1.83.0", sha256="6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e") From 527e0fb4b4830536826487232d213a7b9240ed3d Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Wed, 11 Sep 2024 19:52:40 -0700 Subject: [PATCH 100/687] bugfix: unit test broken everywhere by package change(#46344) Openmpi provider statements were changed in #46102. The package change was fine in and of itself, but apparently one of our tests depends on the precise constraints used in those statements. I updated the test to remove the checks for constraints that were removed. --- lib/spack/spack/test/cmd/providers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/spack/spack/test/cmd/providers.py b/lib/spack/spack/test/cmd/providers.py index 25d17ab9af3949..4ea642ef32b61b 100644 --- a/lib/spack/spack/test/cmd/providers.py +++ b/lib/spack/spack/test/cmd/providers.py @@ -31,7 +31,6 @@ def test_it_just_runs(pkg): "mpilander", "mvapich2", "openmpi", - "openmpi@1.6.5", "openmpi@1.7.5:", "openmpi@2.0.0:", "spectrum-mpi", From f417e9f00c992e5c124b94fa88964a973e13274e Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Wed, 11 Sep 2024 22:14:50 -0700 Subject: [PATCH 101/687] acts: further simplify `cxxstd` handling (#46333) See https://github.com/spack/spack/pull/46314#discussion_r1752940332. This further simplifies `cxxstd` variant handling in `acts` by removing superfluous version constraints from dependencies for `geant4` and `root`. The version constraints in the loop are redundant with the conditional variant values here: ```python _cxxstd_values = ( conditional("14", when="@:0.8.1"), conditional("17", when="@:35"), conditional("20", when="@24:"), ) _cxxstd_common = { "values": _cxxstd_values, "multi": False, "description": "Use the specified C++ standard when building.", } variant("cxxstd", default="17", when="@:35", **_cxxstd_common) variant("cxxstd", default="20", when="@36:", **_cxxstd_common) ``` So we can simplify the dependencies in the loop to: ```python for _cxxstd in _cxxstd_values: for _v in _cxxstd: depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +geant4") depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +fatras_geant4") depends_on(f"root cxxstd={_v.value}", when=f"cxxstd={_v.value} +tgeo") ``` And avoid the potential for impossible variant expressions. Signed-off-by: Todd Gamblin --- var/spack/repos/builtin/packages/acts/package.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/acts/package.py b/var/spack/repos/builtin/packages/acts/package.py index 6be1e0aff22e1b..026a2096cb0f38 100644 --- a/var/spack/repos/builtin/packages/acts/package.py +++ b/var/spack/repos/builtin/packages/acts/package.py @@ -401,14 +401,9 @@ class Acts(CMakePackage, CudaPackage): # ACTS imposes requirements on the C++ standard values used by ROOT for _cxxstd in _cxxstd_values: for _v in _cxxstd: - if Spec(_v.when).satisfies("@0.23:"): # geant4 variant only exists at 0.23 or higher - depends_on( - f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +geant4" - ) - depends_on( - f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +fatras_geant4" - ) - depends_on(f"root cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +tgeo") + depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +geant4") + depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +fatras_geant4") + depends_on(f"root cxxstd={_v.value}", when=f"cxxstd={_v.value} +tgeo") # When the traccc plugin is enabled, detray should match the Acts scalars with when("+traccc"): From cec770b26eb2d3d162ba7ceb80889f6f73c7b7b7 Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Thu, 12 Sep 2024 09:03:58 +0200 Subject: [PATCH 102/687] pika: Add conflict between HIP and GCC (libstdc++) >= 13 (#46291) --- var/spack/repos/builtin/packages/pika/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/pika/package.py b/var/spack/repos/builtin/packages/pika/package.py index 4916681eaf2385..1a0e7477e243a9 100644 --- a/var/spack/repos/builtin/packages/pika/package.py +++ b/var/spack/repos/builtin/packages/pika/package.py @@ -141,6 +141,8 @@ class Pika(CMakePackage, CudaPackage, ROCmPackage): depends_on("apex", when="+apex") depends_on("cuda@11:", when="+cuda") depends_on("hip@5.2:", when="@0.8: +rocm") + # https://github.com/pika-org/pika/issues/1238 + conflicts("%gcc@13:", when="+rocm") depends_on("hipblas", when="@:0.8 +rocm") depends_on("mpi", when="+mpi") depends_on("stdexec", when="+stdexec") From 0cc38d685f941217ea6a421c18ad4249e85e2f08 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 05:24:49 -0500 Subject: [PATCH 103/687] pcre2: add v10.44 (#46341) --- var/spack/repos/builtin/packages/pcre2/package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/pcre2/package.py b/var/spack/repos/builtin/packages/pcre2/package.py index 2e1f4c03f3be06..dd2c99f9672507 100644 --- a/var/spack/repos/builtin/packages/pcre2/package.py +++ b/var/spack/repos/builtin/packages/pcre2/package.py @@ -14,8 +14,9 @@ class Pcre2(AutotoolsPackage): homepage = "https://www.pcre.org" url = "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.bz2" - license("BSD-3-Clause") + license("BSD-3-Clause AND PCRE2-exception", when="@10:", checked_by="wdconinc") + version("10.44", sha256="d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96") version("10.43", sha256="e2a53984ff0b07dfdb5ae4486bbb9b21cca8e7df2434096cc9bf1b728c350bcb") version("10.42", sha256="8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840") version("10.41", sha256="0f78cebd3e28e346475fb92e95fe9999945b4cbaad5f3b42aca47b887fb53308") @@ -26,7 +27,7 @@ class Pcre2(AutotoolsPackage): version("10.31", sha256="e07d538704aa65e477b6a392b32ff9fc5edf75ab9a40ddfc876186c4ff4d68ac") version("10.20", sha256="332e287101c9e9567d1ed55391b338b32f1f72c5b5ee7cc81ef2274a53ad487a") - depends_on("c", type="build") # generated + depends_on("c", type="build") variant("multibyte", default=True, description="Enable support for 16 and 32 bit characters.") variant("jit", default=False, description="enable Just-In-Time compiling support") From 68df483bc6a992886fb06354ed009db612e56017 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 06:37:30 -0500 Subject: [PATCH 104/687] re2: add versions through 2024-07-02; add variant icu (#46337) --- .../repos/builtin/packages/re2/package.py | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/re2/package.py b/var/spack/repos/builtin/packages/re2/package.py index 6ddf02a9b86788..f7232c7051891d 100644 --- a/var/spack/repos/builtin/packages/re2/package.py +++ b/var/spack/repos/builtin/packages/re2/package.py @@ -13,8 +13,29 @@ class Re2(CMakePackage): homepage = "https://github.com/google/re2" url = "https://github.com/google/re2/archive/2020-08-01.tar.gz" - license("BSD-3-Clause") + license("BSD-3-Clause", checked_by="wdconinc") + version( + "2024-07-02", sha256="eb2df807c781601c14a260a507a5bb4509be1ee626024cb45acbd57cb9d4032b" + ) + version( + "2024-06-01", sha256="7326c74cddaa90b12090fcfc915fe7b4655723893c960ee3c2c66e85c5504b6c" + ) + version( + "2024-05-01", sha256="fef2f366578401eada34f5603679fb2aebe9b409de8d275a482ce5f2cbac2492" + ) + version( + "2024-04-01", sha256="3f6690c3393a613c3a0b566309cf04dc381d61470079b653afc47c67fb898198" + ) + version( + "2024-03-01", sha256="7b2b3aa8241eac25f674e5b5b2e23d4ac4f0a8891418a2661869f736f03f57f4" + ) + version( + "2024-02-01", sha256="cd191a311b84fcf37310e5cd876845b4bf5aee76fdd755008eef3b6478ce07bb" + ) + version( + "2023-11-01", sha256="4e6593ac3c71de1c0f322735bc8b0492a72f66ffccfad76e259fa21c41d27d8a" + ) version( "2023-09-01", sha256="5bb6875ae1cd1e9fedde98018c346db7260655f86fdb8837e3075103acd3649b" ) @@ -28,20 +49,33 @@ class Re2(CMakePackage): "2020-04-01", sha256="98794bc5416326817498384a9c43cbb5a406bab8da9f84f83c39ecad43ed5cea" ) - depends_on("cxx", type="build") # generated + depends_on("cxx", type="build") + variant( + "icu", + default=False, + description="Build against ICU for full Unicode properties support", + when="@2023-02-01:", + ) variant("shared", default=False, description="Build shared instead of static libraries") variant("pic", default=True, description="Enable position independent code") depends_on("abseil-cpp", when="@2023-09-01:") + depends_on("icu4c", when="+icu") + + depends_on("googletest", type="test") + depends_on("benchmark ~performance_counters", type="test") + # shared libs must have position-independent code conflicts("+shared ~pic") def cmake_args(self): args = [ + self.define_from_variant("RE2_USE_ICU", "icu"), self.define_from_variant("BUILD_SHARED_LIBS", "shared"), self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + self.define("RE2_BUILD_TESTING", self.run_tests), ] abseil = self.spec.dependencies("abseil-cpp") From 2623b9727f82e0cb5691b3aadce55f23955172cb Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 06:37:57 -0500 Subject: [PATCH 105/687] mdspan: fix typo in satisfies condition (#46340) --- var/spack/repos/builtin/packages/mdspan/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/mdspan/package.py b/var/spack/repos/builtin/packages/mdspan/package.py index bb5be2536bc34d..00c815e2c39273 100644 --- a/var/spack/repos/builtin/packages/mdspan/package.py +++ b/var/spack/repos/builtin/packages/mdspan/package.py @@ -30,7 +30,7 @@ def cmake_args(self): if self.spec.satisfies("+tests"): args.append("-DMDSPAN_ENABLE_TESTS=ON") args.append("-DMDSPAN_USE_SYSTEM_GTEST=ON") - if self.spec.satisfies("+bencmarks"): + if self.spec.satisfies("+benchmarks"): args.append("-DMDSPAN_ENABLE_BENCHMARKS=ON") if self.spec.satisfies("+examples"): args.append("-DMDSPAN_ENABLE_EXAMPLES=ON") From 257ebce1083624ed77bc028650af4c4c1578a738 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 06:39:17 -0500 Subject: [PATCH 106/687] py-zope-*: add new versions (#46338) --- .../builtin/packages/py-zope-event/package.py | 5 ++++- .../packages/py-zope-interface/package.py | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-zope-event/package.py b/var/spack/repos/builtin/packages/py-zope-event/package.py index deec70d19eb508..db68fb119b406d 100644 --- a/var/spack/repos/builtin/packages/py-zope-event/package.py +++ b/var/spack/repos/builtin/packages/py-zope-event/package.py @@ -12,10 +12,13 @@ class PyZopeEvent(PythonPackage): homepage = "https://github.com/zopefoundation/zope.event" pypi = "zope.event/zope.event-4.3.0.tar.gz" - license("ZPL-2.1") + license("ZPL-2.1", checked_by="wdconinc") + version("5.0", sha256="bac440d8d9891b4068e2b5a2c5e2c9765a9df762944bda6955f96bb9b91e67cd") version("4.6", sha256="81d98813046fc86cc4136e3698fee628a3282f9c320db18658c21749235fce80") + version("4.5.1", sha256="4ab47faac13163ca3c5d6d8a5595212e14770322e95c338d955e3688ba19082a") version("4.5.0", sha256="5e76517f5b9b119acf37ca8819781db6c16ea433f7e2062c4afc2b6fbedb1330") version("4.3.0", sha256="e0ecea24247a837c71c106b0341a7a997e3653da820d21ef6c08b32548f733e7") + depends_on("python@3.7:", type=("build", "run"), when="@5:") depends_on("py-setuptools", type=("build", "run")) diff --git a/var/spack/repos/builtin/packages/py-zope-interface/package.py b/var/spack/repos/builtin/packages/py-zope-interface/package.py index 5e7270ba43f1e9..349c1b04421b1e 100644 --- a/var/spack/repos/builtin/packages/py-zope-interface/package.py +++ b/var/spack/repos/builtin/packages/py-zope-interface/package.py @@ -15,16 +15,27 @@ class PyZopeInterface(PythonPackage): homepage = "https://github.com/zopefoundation/zope.interface" pypi = "zope.interface/zope.interface-4.5.0.tar.gz" - license("ZPL-2.1") - + license("ZPL-2.1", checked_by="wdconinc") + + version("7.0.3", sha256="cd2690d4b08ec9eaf47a85914fe513062b20da78d10d6d789a792c0b20307fb1") + version("7.0.2", sha256="f1146bb27a411d0d40cc0e88182a6b0e979d68ab526c8e5ae9e27c06506ed017") + version("7.0.1", sha256="f0f5fda7cbf890371a59ab1d06512da4f2c89a6ea194e595808123c863c38eff") + version("7.0", sha256="a6699621e2e9565fb34e40677fba6eb0974afc400063b3110d8a14d5b0c7a916") + version("6.3", sha256="f83d6b4b22262d9a826c3bd4b2fbfafe1d0000f085ef8e44cd1328eea274ae6a") + version("6.2", sha256="3b6c62813c63c543a06394a636978b22dffa8c5410affc9331ce6cdb5bfa8565") + version("6.1", sha256="2fdc7ccbd6eb6b7df5353012fbed6c3c5d04ceaca0038f75e601060e95345309") + version("6.0", sha256="aab584725afd10c710b8f1e6e208dbee2d0ad009f57d674cb9d1b3964037275d") + version("5.5.2", sha256="bfee1f3ff62143819499e348f5b8a7f3aa0259f9aca5e0ddae7391d059dce671") + version("5.5.1", sha256="6d678475fdeb11394dc9aaa5c564213a1567cc663082e0ee85d52f78d1fbaab2") + version("5.5.0", sha256="700ebf9662cf8df70e2f0cb4988e078c53f65ee3eefd5c9d80cf988c4175c8e3") version("5.4.0", sha256="5dba5f530fec3f0988d83b78cc591b58c0b6eb8431a85edd1569a0539a8a5a0e") version("5.1.0", sha256="40e4c42bd27ed3c11b2c983fecfb03356fae1209de10686d03c02c8696a1d90e") version("4.5.0", sha256="57c38470d9f57e37afb460c399eb254e7193ac7fb8042bd09bdc001981a9c74c") - depends_on("c", type="build") # generated - depends_on("python@2.7:2.8,3.4:", type=("build", "run"), when="@4.5.0") depends_on("python@2.7:2.8,3.5:", type=("build", "run"), when="@5.1.0:") + depends_on("python@3.7:", type=("build", "run"), when="@6:") + depends_on("python@3.8:", type=("build", "run"), when="@7:") depends_on("py-setuptools", type=("build", "run")) depends_on("py-setuptools@:45", type=("build", "run"), when="@4.5.0") From 3fea1d67103a83d37c0d6eed9757ecc475746cbc Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 06:40:05 -0500 Subject: [PATCH 107/687] codespaces: add ubuntu22.04 (#46100) --- .devcontainer/{ => ubuntu20.04}/devcontainer.json | 1 + .devcontainer/ubuntu22.04/devcontainer.json | 5 +++++ 2 files changed, 6 insertions(+) rename .devcontainer/{ => ubuntu20.04}/devcontainer.json (84%) create mode 100644 .devcontainer/ubuntu22.04/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/ubuntu20.04/devcontainer.json similarity index 84% rename from .devcontainer/devcontainer.json rename to .devcontainer/ubuntu20.04/devcontainer.json index ec4c2690b70e72..325e6e57fdc109 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/ubuntu20.04/devcontainer.json @@ -1,4 +1,5 @@ { + "name": "Ubuntu 20.04", "image": "ghcr.io/spack/ubuntu20.04-runner-amd64-gcc-11.4:2023.08.01", "postCreateCommand": "./.devcontainer/postCreateCommand.sh" } diff --git a/.devcontainer/ubuntu22.04/devcontainer.json b/.devcontainer/ubuntu22.04/devcontainer.json new file mode 100644 index 00000000000000..c4b5d24302bff2 --- /dev/null +++ b/.devcontainer/ubuntu22.04/devcontainer.json @@ -0,0 +1,5 @@ +{ + "name": "Ubuntu 22.04", + "image": "ghcr.io/spack/ubuntu-22.04:v2024-05-07", + "postCreateCommand": "./.devcontainer/postCreateCommand.sh" +} From 533de03fefc9b302db661011c4ddaa60b09967d8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 06:41:48 -0500 Subject: [PATCH 108/687] libssh: add v0.9.8, v0.10.6, v0.11.0 (#45689) --- var/spack/repos/builtin/packages/libssh/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/libssh/package.py b/var/spack/repos/builtin/packages/libssh/package.py index d79d02d826ee12..5371b0c99debee 100644 --- a/var/spack/repos/builtin/packages/libssh/package.py +++ b/var/spack/repos/builtin/packages/libssh/package.py @@ -11,7 +11,12 @@ class Libssh(CMakePackage): homepage = "https://www.libssh.org" url = "https://www.libssh.org/files/0.8/libssh-0.8.5.tar.xz" + list_url = "https://www.libssh.org/files" + list_depth = 1 + version("0.11.0", sha256="860e814579e7606f3fc3db98c5807bef2ab60f793ec871d81bcd23acdcdd3e91") + version("0.10.6", sha256="1861d498f5b6f1741b6abc73e608478491edcf9c9d4b6630eef6e74596de9dc1") + version("0.9.8", sha256="9f834b732341d428d67bbe835b7d10ae97ccf25d6f5bd0288fa51ae683f2e7cd") version("0.8.9", sha256="8559e19da0c40b6f93482b6160219ad77a4d9f1dc190bf174757455c6ae26825") version("0.8.5", sha256="07d2c431240fc88f6b06bcb36ae267f9afeedce2e32f6c42f8844b205ab5a335") version("0.7.5", sha256="54e86dd5dc20e5367e58f3caab337ce37675f863f80df85b6b1614966a337095") From 74034694135b8b7c02bf09155c9d08cb663cb001 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 06:44:55 -0500 Subject: [PATCH 109/687] w3m: add v0.5.3.git20230121 (#45747) --- .../repos/builtin/packages/w3m/package.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/w3m/package.py b/var/spack/repos/builtin/packages/w3m/package.py index b84381db121004..5478c2348159e9 100644 --- a/var/spack/repos/builtin/packages/w3m/package.py +++ b/var/spack/repos/builtin/packages/w3m/package.py @@ -22,11 +22,17 @@ class W3m(AutotoolsPackage): # Currently, Arch and Ubuntu (and Debian derivatives) use Debian's branch. # Also, Gentoo, Fedora and openSUSE switched to Debian's branch. homepage = "https://w3m.sourceforge.net/index.en.html" - url = "https://downloads.sourceforge.net/project/w3m/w3m/w3m-0.5.3/w3m-0.5.3.tar.gz" + url = "https://salsa.debian.org/debian/w3m/-/archive/upstream/0.5.3+git20230121/w3m-upstream-0.5.3+git20230121.tar.gz" + git = "https://salsa.debian.org/debian/w3m.git" + maintainers("ronin_gw") license("MIT") + version( + "0.5.3.git20230121", + sha256="8f0592e1cf7cf1de053e22c114cd79b85ebdb8dab925be7d343a130343b97c25", + ) version("0.5.3", sha256="e994d263f2fd2c22febfbe45103526e00145a7674a0fda79c822b97c2770a9e3") depends_on("c", type="build") # generated @@ -66,8 +72,15 @@ class W3m(AutotoolsPackage): depends_on("imlib2@1.0.5:", when="imagelib=imlib2 +image") # fix for modern libraries - patch("fix_redef.patch") - patch("fix_gc.patch") + patch("fix_redef.patch", when="@=0.5.3") + patch("fix_gc.patch", when="@=0.5.3") + + def url_for_version(self, version): + if ".git" in version.string: + v = version.string.replace(".git", "+git") + return f"https://salsa.debian.org/debian/w3m/-/archive/upstream/{v}/w3m-upstream-{v}.tar.gz" + else: + return f"https://downloads.sourceforge.net/project/w3m/w3m/w3m-{version}/w3m-{version}.tar.gz" def patch(self): # w3m is not developed since 2012, everybody is doing this: From 6cb16c39ab85fbc211e50be804fa7a15f24ccebc Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Thu, 12 Sep 2024 13:46:39 +0200 Subject: [PATCH 110/687] pika: Add conflicts between pika's and apex's allocator options (#46318) --- var/spack/repos/builtin/packages/pika/package.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/pika/package.py b/var/spack/repos/builtin/packages/pika/package.py index 1a0e7477e243a9..e4a155f9dbf71f 100644 --- a/var/spack/repos/builtin/packages/pika/package.py +++ b/var/spack/repos/builtin/packages/pika/package.py @@ -69,11 +69,12 @@ class Pika(CMakePackage, CudaPackage, ROCmPackage): description="Use the specified C++ standard when building", ) + mallocs = ("system", "jemalloc", "mimalloc", "tbbmalloc", "tcmalloc") variant( "malloc", default="mimalloc", description="Define which allocator will be linked in", - values=("system", "jemalloc", "mimalloc", "tbbmalloc", "tcmalloc"), + values=mallocs, ) default_generic_coroutines = True @@ -137,6 +138,9 @@ class Pika(CMakePackage, CudaPackage, ROCmPackage): depends_on("jemalloc", when="malloc=jemalloc") depends_on("mimalloc", when="malloc=mimalloc") depends_on("tbb", when="malloc=tbbmalloc") + for malloc in filter(lambda x: x != "system", mallocs): + conflicts("^apex +gperftools", when=f"+apex malloc={malloc}") + conflicts("^apex +jemalloc", when=f"+apex malloc={malloc}") depends_on("apex", when="+apex") depends_on("cuda@11:", when="+cuda") From 8fa65b286c3ca71e845553700d6042b70251b296 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 12 Sep 2024 14:05:50 +0200 Subject: [PATCH 111/687] fix various pkgs depending on libtool only (#46299) autotools packages with a configure script should generate the libtool executable, there's no point in `depends_on("libtool", type="build")`. the libtool executable in `/bin/libtool` is configured for the wrong toolchain (libtools %compiler instead of the package's %compiler). Some package link to `libltdl.so`, which is fine, but had a wrong dependency type. --- .../repos/builtin/packages/3proxy/package.py | 16 ++++++++-------- .../builtin/packages/geopm-runtime/package.py | 1 + .../builtin/packages/geopm-service/package.py | 1 + .../builtin/packages/graphicsmagick/package.py | 1 - .../repos/builtin/packages/guile/package.py | 2 +- .../builtin/packages/imagemagick/package.py | 3 --- .../builtin/packages/libcanberra/package.py | 2 +- .../builtin/packages/libpciaccess/package.py | 3 +-- var/spack/repos/builtin/packages/nest/package.py | 2 +- .../repos/builtin/packages/open-iscsi/package.py | 9 ++++++--- .../repos/builtin/packages/open-isns/package.py | 10 ++++++---- .../packages/openspeedshop-utils/package.py | 2 +- .../builtin/packages/openspeedshop/package.py | 2 +- var/spack/repos/builtin/packages/pocl/package.py | 2 +- .../repos/builtin/packages/pulseaudio/package.py | 2 +- .../repos/builtin/packages/racket/package.py | 1 - .../repos/builtin/packages/scrot/package.py | 3 +-- .../repos/builtin/packages/unixodbc/package.py | 3 +-- var/spack/repos/builtin/packages/xbae/package.py | 3 +-- 19 files changed, 33 insertions(+), 35 deletions(-) diff --git a/var/spack/repos/builtin/packages/3proxy/package.py b/var/spack/repos/builtin/packages/3proxy/package.py index a8750657715c31..38d69f2ed5501d 100644 --- a/var/spack/repos/builtin/packages/3proxy/package.py +++ b/var/spack/repos/builtin/packages/3proxy/package.py @@ -18,17 +18,17 @@ class _3proxy(MakefilePackage): version("0.8.12", sha256="c2ad3798b4f0df06cfcc7b49f658304e451d60e4834e2705ef83ddb85a03f849") version("0.8.11", sha256="fc4295e1a462baa61977fcc21747db7861c4e3d0dcca86cbaa3e06017e5c66c9") - depends_on("c", type="build") # generated - - depends_on("autoconf", type="build") - depends_on("automake", type="build") - depends_on("libtool", type="build") - depends_on("m4", type="build") + depends_on("c", type="build") def build(self, spec, prefix): - make("-f", f"Makefile.{platform.system()}", f"CC={spack_cc}") + make("-f", f"Makefile.{platform.system()}", f"CC={spack_cc}", f"LN={spack_cc}") def install(self, spec, prefix): make( - "-f", f"Makefile.{platform.system()}", f"prefix={prefix}", f"CC={spack_cc}", "install" + "-f", + f"Makefile.{platform.system()}", + f"prefix={prefix}", + f"CC={spack_cc}", + f"LN={spack_cc}", + "install", ) diff --git a/var/spack/repos/builtin/packages/geopm-runtime/package.py b/var/spack/repos/builtin/packages/geopm-runtime/package.py index bae53f8f407e98..74fb3736eebfe0 100644 --- a/var/spack/repos/builtin/packages/geopm-runtime/package.py +++ b/var/spack/repos/builtin/packages/geopm-runtime/package.py @@ -58,6 +58,7 @@ class GeopmRuntime(AutotoolsPackage): # Autotools dependencies depends_on("automake", type="build") + depends_on("autoconf", type="build") depends_on("libtool", type="build") depends_on("file") diff --git a/var/spack/repos/builtin/packages/geopm-service/package.py b/var/spack/repos/builtin/packages/geopm-service/package.py index 557f6371825fe4..2bfaa68a0026e6 100644 --- a/var/spack/repos/builtin/packages/geopm-service/package.py +++ b/var/spack/repos/builtin/packages/geopm-service/package.py @@ -67,6 +67,7 @@ class GeopmService(AutotoolsPackage): # Autotools dependencies depends_on("automake", type="build") + depends_on("autoconf", type="build") depends_on("libtool", type="build") depends_on("file") diff --git a/var/spack/repos/builtin/packages/graphicsmagick/package.py b/var/spack/repos/builtin/packages/graphicsmagick/package.py index 60a5e2123db093..e3713d294644db 100644 --- a/var/spack/repos/builtin/packages/graphicsmagick/package.py +++ b/var/spack/repos/builtin/packages/graphicsmagick/package.py @@ -42,7 +42,6 @@ class Graphicsmagick(AutotoolsPackage): depends_on("libpng") depends_on("libsm") depends_on("libtiff") - depends_on("libtool") depends_on("libxml2") depends_on("xz") depends_on("zlib-api") diff --git a/var/spack/repos/builtin/packages/guile/package.py b/var/spack/repos/builtin/packages/guile/package.py index 32c3e4527354eb..170b0f92bae96a 100644 --- a/var/spack/repos/builtin/packages/guile/package.py +++ b/var/spack/repos/builtin/packages/guile/package.py @@ -41,7 +41,7 @@ class Guile(AutotoolsPackage, GNUMirrorPackage): depends_on("bdw-gc@7.0: threads=dgux386", when="threads=dgux386") depends_on("gmp@4.2:") depends_on("gettext") - depends_on("libtool@1.5.6:") + depends_on("libtool@1.5.6:", type="link") # links to libltdl.so depends_on("libunistring@0.9.3:") depends_on("libffi") depends_on("readline", when="+readline") diff --git a/var/spack/repos/builtin/packages/imagemagick/package.py b/var/spack/repos/builtin/packages/imagemagick/package.py index 3d74e7546bab78..b61c8e4356e20b 100644 --- a/var/spack/repos/builtin/packages/imagemagick/package.py +++ b/var/spack/repos/builtin/packages/imagemagick/package.py @@ -34,8 +34,6 @@ class Imagemagick(AutotoolsPackage): variant("rsvg", default=False, description="Enable RSVG support") depends_on("pkgconfig@0.20:", type="build") - depends_on("libtool", when="@:7.1.0-60", type="build") - depends_on("libtool", when="@7.0.8:7.1.0-60", type=("build", "link")) depends_on("fontconfig@2.1:") depends_on("freetype@2.8:") @@ -48,7 +46,6 @@ class Imagemagick(AutotoolsPackage): depends_on("ghostscript-fonts", when="+ghostscript") depends_on("libsm", when="@:7.1.0-60 platform=linux") - depends_on("libtool", when="platform=linux") def configure_args(self): args = [] diff --git a/var/spack/repos/builtin/packages/libcanberra/package.py b/var/spack/repos/builtin/packages/libcanberra/package.py index 19807aa5fae72a..a629cd8318680e 100644 --- a/var/spack/repos/builtin/packages/libcanberra/package.py +++ b/var/spack/repos/builtin/packages/libcanberra/package.py @@ -39,7 +39,7 @@ class Libcanberra(AutotoolsPackage): depends_on("gtkplus", when="+gtk") depends_on("libvorbis") - depends_on("libtool", type="build") + depends_on("libtool", type="link") # libltdl depends_on("pkgconfig", type="build") diff --git a/var/spack/repos/builtin/packages/libpciaccess/package.py b/var/spack/repos/builtin/packages/libpciaccess/package.py index 4704611854212c..6cab9031dd779d 100644 --- a/var/spack/repos/builtin/packages/libpciaccess/package.py +++ b/var/spack/repos/builtin/packages/libpciaccess/package.py @@ -19,9 +19,8 @@ class Libpciaccess(AutotoolsPackage, XorgPackage): version("0.13.5", sha256="fe26ec788732b4ef60b550f2d3fa51c605d27f646e18ecec878f061807a3526e") version("0.13.4", sha256="74d92bda448e6fdb64fee4e0091255f48d625d07146a121653022ed3a0ca1f2f") - depends_on("c", type="build") # generated + depends_on("c", type="build") - depends_on("libtool", type="build") depends_on("pkgconfig", type="build") depends_on("util-macros", type="build") diff --git a/var/spack/repos/builtin/packages/nest/package.py b/var/spack/repos/builtin/packages/nest/package.py index 5dcfcdec2de0fa..416930ac7b3242 100644 --- a/var/spack/repos/builtin/packages/nest/package.py +++ b/var/spack/repos/builtin/packages/nest/package.py @@ -53,7 +53,7 @@ class Nest(CMakePackage): depends_on("gsl", when="+gsl") depends_on("readline") - depends_on("libtool") + depends_on("libtool", type="link") # links against libltdl depends_on("pkgconfig", type="build") extends("python", when="+python") diff --git a/var/spack/repos/builtin/packages/open-iscsi/package.py b/var/spack/repos/builtin/packages/open-iscsi/package.py index 9012dc92ae399b..f93ecfae800ae9 100644 --- a/var/spack/repos/builtin/packages/open-iscsi/package.py +++ b/var/spack/repos/builtin/packages/open-iscsi/package.py @@ -21,13 +21,16 @@ class OpenIscsi(MakefilePackage): version("2.0.877", sha256="69eb95b0c39dee2da9d0d751bfdcdb8d11f9d37390de15c1a0b4558f9d0c4a57") version("2.0.876", sha256="9f01327d5e100ed794dc5083fc18dc4a06a0c29c77b252e21abd1b8f56edd9a7") - depends_on("c", type="build") # generated + depends_on("c", type="build") depends_on("gettext") depends_on("uuid") depends_on("util-linux") depends_on("kmod") depends_on("open-isns") + + depends_on("autoconf", type="build") + depends_on("automake", type="build") depends_on("libtool", type="build") def setup_build_environment(self, env): @@ -35,7 +38,7 @@ def setup_build_environment(self, env): def setup_run_environment(self, env): env.prepend_path("PATH", self.prefix.sbin) - env.prepend_path("LD_LIBRARY_PATH", self.prefix.usr.lib64) def install(self, spec, prefix): - make("install", "DESTDIR={0}".format(prefix)) + etc_dir = join_path(prefix, "etc") + make("install", f"prefix={prefix}", f"exec_prefix={prefix}", f"etcdir={etc_dir}") diff --git a/var/spack/repos/builtin/packages/open-isns/package.py b/var/spack/repos/builtin/packages/open-isns/package.py index a389cf8ca9a552..3f9f7d10a5eabf 100644 --- a/var/spack/repos/builtin/packages/open-isns/package.py +++ b/var/spack/repos/builtin/packages/open-isns/package.py @@ -21,13 +21,15 @@ class OpenIsns(AutotoolsPackage): version("0.97", sha256="c1c9ae740172e55a1ff33bc22151ec3d916562bf5d60c8420cd64496343683a9") version("0.96", sha256="487fd0d87826423ea99dc159826d0b654a5da016ed670d4395a77bfa4f62e2ec") - depends_on("c", type="build") # generated + depends_on("c", type="build") def configure_args(self): args = ["--enable-shared"] return args def install(self, spec, prefix): - make("install") - make("install_hdrs") - make("install_lib") + etc_dir = join_path(prefix, "etc") + var_dir = join_path(prefix, "var") + make("install", f"etcdir={etc_dir}", f"vardir={var_dir}") + make("install_hdrs", f"etcdir={etc_dir}", f"vardir={var_dir}") + make("install_lib", f"etcdir={etc_dir}", f"vardir={var_dir}") diff --git a/var/spack/repos/builtin/packages/openspeedshop-utils/package.py b/var/spack/repos/builtin/packages/openspeedshop-utils/package.py index 0e9c5caf6d639a..c77a608fd21b3c 100644 --- a/var/spack/repos/builtin/packages/openspeedshop-utils/package.py +++ b/var/spack/repos/builtin/packages/openspeedshop-utils/package.py @@ -90,7 +90,7 @@ class OpenspeedshopUtils(CMakePackage): # Dependencies for openspeedshop that are common to all # the variants of the OpenSpeedShop build - depends_on("libtool", type="build") + depends_on("libtool", type="link") # links against libltdl depends_on("bison", type="build") depends_on("flex@2.6.1", type="build") diff --git a/var/spack/repos/builtin/packages/openspeedshop/package.py b/var/spack/repos/builtin/packages/openspeedshop/package.py index 5ceb5113300c74..6dddc60f97d49c 100644 --- a/var/spack/repos/builtin/packages/openspeedshop/package.py +++ b/var/spack/repos/builtin/packages/openspeedshop/package.py @@ -94,7 +94,7 @@ class Openspeedshop(CMakePackage): # Dependencies for openspeedshop that are common to all # the variants of the OpenSpeedShop build - depends_on("libtool", type="build") + depends_on("libtool", type="link") # links against libltdl depends_on("bison", type="build") depends_on("flex@2.6.1", type="build") diff --git a/var/spack/repos/builtin/packages/pocl/package.py b/var/spack/repos/builtin/packages/pocl/package.py index 31fc0b3574cf92..290c488357b2f3 100644 --- a/var/spack/repos/builtin/packages/pocl/package.py +++ b/var/spack/repos/builtin/packages/pocl/package.py @@ -47,7 +47,7 @@ class Pocl(CMakePackage): depends_on("cmake @2.8.12:", type="build") depends_on("hwloc") depends_on("hwloc@:1", when="@:1.1") - depends_on("libtool", type=("build", "link", "run")) + depends_on("libtool", type="link", when="@:1.3") # links against libltdl depends_on("pkgconfig", type="build") depends_on("llvm +clang") diff --git a/var/spack/repos/builtin/packages/pulseaudio/package.py b/var/spack/repos/builtin/packages/pulseaudio/package.py index 8a3396c520e703..81e6db06b456ff 100644 --- a/var/spack/repos/builtin/packages/pulseaudio/package.py +++ b/var/spack/repos/builtin/packages/pulseaudio/package.py @@ -44,7 +44,7 @@ class Pulseaudio(AutotoolsPackage): depends_on("libcap") depends_on("iconv") depends_on("libsndfile@1.0.18:") - depends_on("libtool@2.4:") # links to libltdl.so + depends_on("libtool@2.4:", type="link") # links to libltdl.so depends_on("libsm", when="+x11") depends_on("uuid", when="+x11") depends_on("libx11", when="+x11") diff --git a/var/spack/repos/builtin/packages/racket/package.py b/var/spack/repos/builtin/packages/racket/package.py index 25188da281c9b0..bd53c4b3b444a5 100644 --- a/var/spack/repos/builtin/packages/racket/package.py +++ b/var/spack/repos/builtin/packages/racket/package.py @@ -22,7 +22,6 @@ class Racket(MakefilePackage): depends_on("libffi", type=("build", "link", "run")) depends_on("patchutils") - depends_on("libtool", type=("build")) variant("cs", default=True, description="Build Racket CS (new ChezScheme VM)") variant("bc", default=False, description="Build Racket BC (old MZScheme VM)") diff --git a/var/spack/repos/builtin/packages/scrot/package.py b/var/spack/repos/builtin/packages/scrot/package.py index 23709f59a20144..c28f40fb7f888c 100644 --- a/var/spack/repos/builtin/packages/scrot/package.py +++ b/var/spack/repos/builtin/packages/scrot/package.py @@ -20,10 +20,9 @@ class Scrot(AutotoolsPackage): version("1.6", sha256="42f64d38f04ec530c8b4ebdae04cce8b6893b2f8d30627391d390edcba917090") version("1.5", sha256="42fcf1c97940f4b4e34ca69990a0fc9b98991357bd6a4b67f30ebe0ccc10f093") - depends_on("c", type="build") # generated + depends_on("c", type="build") depends_on("giblib", when="@:1.5") depends_on("imlib2") - depends_on("libtool") depends_on("libxcomposite") depends_on("libxfixes") diff --git a/var/spack/repos/builtin/packages/unixodbc/package.py b/var/spack/repos/builtin/packages/unixodbc/package.py index a972c9f02c4586..bad8222a98bb57 100644 --- a/var/spack/repos/builtin/packages/unixodbc/package.py +++ b/var/spack/repos/builtin/packages/unixodbc/package.py @@ -18,10 +18,9 @@ class Unixodbc(AutotoolsPackage): version("2.3.4", sha256="2e1509a96bb18d248bf08ead0d74804957304ff7c6f8b2e5965309c632421e39") - depends_on("c", type="build") # generated + depends_on("c", type="build") depends_on("iconv") - depends_on("libtool") @property def libs(self): diff --git a/var/spack/repos/builtin/packages/xbae/package.py b/var/spack/repos/builtin/packages/xbae/package.py index 38b74d64af9f99..f17282d21c2179 100644 --- a/var/spack/repos/builtin/packages/xbae/package.py +++ b/var/spack/repos/builtin/packages/xbae/package.py @@ -17,9 +17,8 @@ class Xbae(AutotoolsPackage): version("4.60.4", sha256="eb72702ed0a36d043f2075a9d5a4545556da1b8dab4d67d85fca92f37aeb04a8") - depends_on("c", type="build") # generated + depends_on("c", type="build") - depends_on("libtool", type="build") depends_on("libxext") depends_on("libxmu") depends_on("libxpm") From 128cac34e0bb89f5eb608732e79aec2aca629a20 Mon Sep 17 00:00:00 2001 From: Xuefeng Ding Date: Thu, 12 Sep 2024 20:34:26 +0800 Subject: [PATCH 112/687] geant4: add hdf5 variant (#46312) --- var/spack/repos/builtin/packages/geant4/package.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py index 3a65b8c40c6b05..ef53b3e4d49a82 100644 --- a/var/spack/repos/builtin/packages/geant4/package.py +++ b/var/spack/repos/builtin/packages/geant4/package.py @@ -78,6 +78,7 @@ class Geant4(CMakePackage): variant("x11", default=False, description="Optional X11 support") variant("motif", default=False, description="Optional motif support") variant("qt", default=False, description="Enable Qt support") + variant("hdf5", default=False, description="Enable HDF5 support", when="@10.4:") variant("python", default=False, description="Enable Python bindings", when="@10.6.2:11.0") variant("tbb", default=False, description="Use TBB as a tasking backend", when="@11:") variant("timemory", default=False, description="Use TiMemory for profiling", when="@9.5:") @@ -140,6 +141,9 @@ class Geant4(CMakePackage): depends_on("vecgeom@1.1.0", when="@10.5.0:10.5") depends_on("vecgeom@0.5.2", when="@10.4.0:10.4") + with when("+hdf5"): + depends_on("hdf5 +threadsafe") + def std_when(values): for v in values: if isinstance(v, _ConditionalVariantValues): @@ -316,6 +320,8 @@ def cmake_args(self): options.append(self.define("GEANT4_USE_QT_QT6", True)) options.append(self.define("QT_QMAKE_EXECUTABLE", spec["qmake"].prefix.bin.qmake)) + options.append(self.define_from_variant("GEANT4_USE_HDF5", "hdf5")) + options.append(self.define_from_variant("GEANT4_USE_VTK", "vtk")) # Python From 8b18f95e058544cf618b0a14f5c70c1fef508829 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Thu, 12 Sep 2024 14:34:48 +0200 Subject: [PATCH 113/687] ELSI: add v2.11 and dlaf variant (#46317) * provide dlaff libs * fix incompatibility with ntpoly * add cuda conflicts * [@spackbot] updating style on behalf of RMeli * Update var/spack/repos/builtin/packages/elsi/package.py Co-authored-by: Alberto Invernizzi <9337627+albestro@users.noreply.github.com> * move pexsi conflict to context --------- Co-authored-by: RMeli Co-authored-by: Alberto Invernizzi <9337627+albestro@users.noreply.github.com> --- .../packages/dla-future-fortran/package.py | 6 +++++ .../repos/builtin/packages/elsi/package.py | 25 ++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/dla-future-fortran/package.py b/var/spack/repos/builtin/packages/dla-future-fortran/package.py index 184c2a4db25411..0d50d05e002b28 100644 --- a/var/spack/repos/builtin/packages/dla-future-fortran/package.py +++ b/var/spack/repos/builtin/packages/dla-future-fortran/package.py @@ -51,3 +51,9 @@ def cmake_args(self): args.append(self.define("MPIEXEC_MAX_NUMPROCS", 6)) return args + + @property + def libs(self): + return find_libraries( + "libDLAF_Fortran", root=self.home, shared=self.spec.satisfies("+shared") + ) diff --git a/var/spack/repos/builtin/packages/elsi/package.py b/var/spack/repos/builtin/packages/elsi/package.py index 25b87e28293210..e06936a754e693 100644 --- a/var/spack/repos/builtin/packages/elsi/package.py +++ b/var/spack/repos/builtin/packages/elsi/package.py @@ -18,6 +18,7 @@ class Elsi(CMakePackage, CudaPackage): license("BSD-3-Clause") + version("2.11.0", sha256="2e6929827ed9c99a32381ed9da40482e862c28608d59d4f27db7dcbcaed1520d") version("2.10.1", sha256="b3c7526d46a9139a26680787172a3df15bc648715a35bdf384053231e94ab829") version( "2.2.1", @@ -30,6 +31,8 @@ class Elsi(CMakePackage, CudaPackage): depends_on("cxx", type="build") # generated depends_on("fortran", type="build") # generated + generator("ninja") + variant( "add_underscore", default=True, @@ -65,11 +68,12 @@ class Elsi(CMakePackage, CudaPackage): ) variant( "internal_elpa_version", - default="2024", - values=("2024", "2023_11", "2023", "2021", "2020"), + default="2020", + values=("2020", "2021", conditional("2023", "2023_11", "2024", when="@:2.11")), description="Internal ELPA version", multi=False, ) + variant("dlaf", default=False, when="@2.11:", description="Enable DLA-Future support") # Basic dependencies depends_on("blas", type="link") @@ -78,7 +82,10 @@ class Elsi(CMakePackage, CudaPackage): depends_on("mpi") # Library dependencies - depends_on("ntpoly", when="+use_external_ntpoly") + with when("+use_external_ntpoly"): + depends_on("ntpoly") + depends_on("ntpoly@3:", when="@2.11:") + conflicts("^ntpoly@3:", when="@:2.10") with when("+use_external_elpa"): depends_on("elpa+cuda", when="+cuda") depends_on("elpa~cuda", when="~cuda") @@ -94,9 +101,14 @@ class Elsi(CMakePackage, CudaPackage): depends_on("pexsi+fortran") depends_on("superlu-dist+cuda", when="+cuda") depends_on("superlu-dist~cuda", when="~cuda") + conflicts("^pexsi@2:", when="@:2.11") with when("+use_external_omm"): depends_on("omm") depends_on("matrix-switch") # Direct dependency + with when("+dlaf"): + depends_on("dla-future-fortran") + conflicts("dla-future~cuda", when="+cuda") + conflicts("dla-future+cuda", when="~cuda") def cmake_args(self): libs_names = ["scalapack", "lapack", "blas"] @@ -114,6 +126,8 @@ def cmake_args(self): if self.spec.satisfies("+use_external_omm"): libs_names.append("omm") libs_names.append("matrix-switch") + if self.spec.satisfies("+dlaf"): + libs_names.append("dla-future-fortran") lib_paths, inc_paths, libs = [], [], [] for lib in libs_names: @@ -140,6 +154,7 @@ def cmake_args(self): self.define_from_variant("ADD_UNDERSCORE", "add_underscore"), self.define_from_variant("ENABLE_PEXSI", "enable_pexsi"), self.define_from_variant("ENABLE_SIPS", "enable_sips"), + self.define_from_variant("ENABLE_DLAF", "dlaf"), self.define_from_variant("USE_EXTERNAL_ELPA", "use_external_elpa"), self.define_from_variant("USE_EXTERNAL_NTPOLY", "use_external_ntpoly"), self.define_from_variant("USE_EXTERNAL_OMM", "use_external_omm"), @@ -161,6 +176,10 @@ def cmake_args(self): if self.spec.variants["elpa2_kernel"].value != "none": args.append(self.define_from_variant("ELPA2_KERNEL", "elpa2_kernel")) + if self.spec.satisfies("^elpa+cuda"): + elpa_gpu_string = "nvidia-gpu" if self.spec.satisfies("^elpa@2021:") else "gpu" + args.append(self.define(ELSI_ELPA_GPU_STRING, elpa_gpu_string)) + args.append(self.define("INC_PATHS", ";".join(set(inc_paths)))) # Only when using fujitsu compiler From 3531ee28f87c7d7833087cfae8dac6ca0d55810c Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 08:05:41 -0700 Subject: [PATCH 114/687] curl: add v8.8.0 (#44622) Co-authored-by: Harmen Stoppels --- .../repos/builtin/packages/curl/package.py | 9 +- .../repos/builtin/packages/mbedtls/package.py | 105 +++--------------- 2 files changed, 20 insertions(+), 94 deletions(-) diff --git a/var/spack/repos/builtin/packages/curl/package.py b/var/spack/repos/builtin/packages/curl/package.py index c3d46c6634694e..b1565f06e4d27d 100644 --- a/var/spack/repos/builtin/packages/curl/package.py +++ b/var/spack/repos/builtin/packages/curl/package.py @@ -32,6 +32,7 @@ class Curl(NMakePackage, AutotoolsPackage): license("curl") + version("8.8.0", sha256="40d3792d38cfa244d8f692974a567e9a5f3387c547579f1124e95ea2a1020d0d") version("8.7.1", sha256="05bbd2b698e9cfbab477c33aa5e99b4975501835a41b7ca6ca71de03d8849e76") version("8.6.0", sha256="b4785f2d8877fa92c0e45d7155cf8cc6750dbda961f4b1a45bcbec990cf2fa9b") version("8.4.0", sha256="e5250581a9c032b1b6ed3cf2f9c114c811fc41881069e9892d115cc73f9e88c6") @@ -112,8 +113,12 @@ class Curl(NMakePackage, AutotoolsPackage): depends_on("pkgconfig", type="build", when="platform=freebsd") depends_on("gnutls", when="tls=gnutls") - depends_on("mbedtls@2: +pic", when="@7.79: tls=mbedtls") - depends_on("mbedtls@:2 +pic", when="@:7.78 tls=mbedtls") + + with when("tls=mbedtls"): + depends_on("mbedtls@:2 +pic", when="@:7.78") + depends_on("mbedtls@2: +pic", when="@7.79:") + depends_on("mbedtls@3.6.0: +pic", when="@8.8.0:") + depends_on("nss", when="tls=nss") with when("tls=openssl"): diff --git a/var/spack/repos/builtin/packages/mbedtls/package.py b/var/spack/repos/builtin/packages/mbedtls/package.py index 7f0bbc100006c7..73f463239d026c 100644 --- a/var/spack/repos/builtin/packages/mbedtls/package.py +++ b/var/spack/repos/builtin/packages/mbedtls/package.py @@ -14,112 +14,28 @@ class Mbedtls(MakefilePackage): """ homepage = "https://tls.mbed.org" - url = "https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.2.1.tar.gz" + url = "https://github.com/Mbed-TLS/mbedtls/releases/download/v3.6.0/mbedtls-3.6.0.tar.bz2" + maintainers("haampie") license("Apache-2.0 OR GPL-2.0-or-later") # version 3.x + version("3.6.0", sha256="3ecf94fcfdaacafb757786a01b7538a61750ebd85c4b024f56ff8ba1490fcd38") version("3.3.0", sha256="a22ff38512697b9cd8472faa2ea2d35e320657f6d268def3a64765548b81c3ec") - version( - "3.2.1", - sha256="5850089672560eeaca03dc36678ee8573bb48ef6e38c94f5ce349af60c16da33", - deprecated=True, - ) - version( - "3.1.0", - sha256="64d01a3b22b91cf3a25630257f268f11bc7bfa37981ae6d397802dd4ccec4690", - deprecated=True, - ) - version( - "3.0.0", - sha256="377d376919be19f07c7e7adeeded088a525be40353f6d938a78e4f986bce2ae0", - deprecated=True, - ) # version 2.x + version("2.28.8", sha256="241c68402cef653e586be3ce28d57da24598eb0df13fcdea9d99bfce58717132") version("2.28.2", sha256="1db6d4196178fa9f8264bef5940611cd9febcd5d54ec05f52f1e8400f792b5a4") - version( - "2.28.1", - sha256="82ff5fda18ecbdee9053bdbeed6059c89e487f3024227131657d4c4536735ed1", - deprecated=True, - ) - version( - "2.28.0", - sha256="f644248f23cf04315cf9bb58d88c4c9471c16ca0533ecf33f86fb7749a3e5fa6", - deprecated=True, - ) - version( - "2.27.0", - sha256="4f6a43f06ded62aa20ef582436a39b65902e1126cbbe2fb17f394e9e9a552767", - deprecated=True, - ) + version("2.7.19", sha256="3da12b1cebe1a25da8365d5349f67db514aefcaa75e26082d7cb2fa3ce9608aa") + + # deprecated versions + # required by julia@1.6:1.7 version( "2.24.0", sha256="b5a779b5f36d5fc4cba55faa410685f89128702423ad07b36c5665441a06a5f3", deprecated=True, ) - version( - "2.16.12", - sha256="0afb4a4ce5b771f2fb86daee786362fbe48285f05b73cd205f46a224ec031783", - deprecated=True, - ) - version( - "2.16.11", - sha256="51bb9685c4f4ff9255da5659ff346b89dcaf129e3ba0f3b2b0c48a1a7495e701", - deprecated=True, - ) - version( - "2.16.9", - sha256="b7ca99ee10551b5b13242b7effebefd2a5cc38c287e5f5be1267d51ee45effe3", - deprecated=True, - ) - version( - "2.16.7", - sha256="4786b7d1676f5e4d248f3a7f2d28446876d64962634f060ff21b92c690cfbe86", - deprecated=True, - ) - version( - "2.16.1", - sha256="daf0d40f3016c34eb42d1e4b3b52be047e976d566aba8668977723c829af72f3", - deprecated=True, - ) - version("2.7.19", sha256="3da12b1cebe1a25da8365d5349f67db514aefcaa75e26082d7cb2fa3ce9608aa") - version( - "2.7.10", - sha256="42b19b30b86a798bdb69c5da2f8bbd7d72ffede9a35b888ab986a29480f9dc3e", - deprecated=True, - ) - version( - "2.3.0", - sha256="1614ee70be99a18ca8298148308fb725aad4ad31c569438bb51655a4999b14f9", - deprecated=True, - ) - version( - "2.2.1", - sha256="32819c62c20e8740a11b49daa5d09ac6f179edf120a87ac559cd63120b66b699", - deprecated=True, - ) - version( - "2.2.0", - sha256="75494361e412444b38ebb9c908b7e17a5fb582eb9c3fadb2fe9b21e96f1bf8cb", - deprecated=True, - ) - version( - "2.1.4", - sha256="a0ee4d3dd135baf67a3cf5ad9e70d67575561704325d6c93d8f087181f4db338", - deprecated=True, - ) - version( - "2.1.3", - sha256="94da4618d5a518b99f7914a5e348be436e3571113d9a9978d130725a1fc7bfac", - deprecated=True, - ) - version( - "1.3.16", - sha256="0c2666222b66cf09c4630fa60a715aafd7decb1a09933b75c0c540b0625ac5df", - deprecated=True, - ) depends_on("c", type="build") # generated @@ -160,6 +76,11 @@ class Mbedtls(MakefilePackage): # libs=shared building both shared and static libs. # conflicts('libs=shared', msg='Makefile build cannot build shared libs only now') + def url_for_version(self, version): + if self.spec.satisfies("@:2.28.7,3:3.5"): + return f"https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v{version}.tar.gz" + return f"https://github.com/Mbed-TLS/mbedtls/releases/download/v{version}/mbedtls-{version}.tar.bz2" + def flag_handler(self, name, flags): # Compile with PIC, if requested. if name == "cflags": From d8d1bc5d7e2e8c52fa285705159dddad468220ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 08:57:05 -0700 Subject: [PATCH 115/687] build(deps): bump pytest from 8.3.2 to 8.3.3 in /lib/spack/docs (#46315) Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.2 to 8.3.3. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.3.2...8.3.3) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- lib/spack/docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/docs/requirements.txt b/lib/spack/docs/requirements.txt index 09655e609e6900..5fbd59cdd99977 100644 --- a/lib/spack/docs/requirements.txt +++ b/lib/spack/docs/requirements.txt @@ -6,7 +6,7 @@ python-levenshtein==0.25.1 docutils==0.20.1 pygments==2.18.0 urllib3==2.2.2 -pytest==8.3.2 +pytest==8.3.3 isort==5.13.2 black==24.8.0 flake8==7.1.1 From e8e8d598035139e13ac6b139a0f0d3fa79bb074e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lyd=C3=A9ric=20Debussch=C3=A8re?= Date: Thu, 12 Sep 2024 19:10:23 +0200 Subject: [PATCH 116/687] cpp-argparse: Add version 3.1 (#46319) --- var/spack/repos/builtin/packages/cpp-argparse/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/cpp-argparse/package.py b/var/spack/repos/builtin/packages/cpp-argparse/package.py index 5241608a8ad118..e50ff93c4936bc 100644 --- a/var/spack/repos/builtin/packages/cpp-argparse/package.py +++ b/var/spack/repos/builtin/packages/cpp-argparse/package.py @@ -16,6 +16,7 @@ class CppArgparse(CMakePackage): license("MIT") + version("3.1", sha256="d01733552ca4a18ab501ae8b8be878131baa32e89090fafdeef018ebfa4c6e46") version("2.9", sha256="cd563293580b9dc592254df35b49cf8a19b4870ff5f611c7584cf967d9e6031e") version("2.2", sha256="f0fc6ab7e70ac24856c160f44ebb0dd79dc1f7f4a614ee2810d42bb73799872b") From 6b10f80ccaa1076cbe8227909893986d30a184f1 Mon Sep 17 00:00:00 2001 From: Vanessasaurus <814322+vsoch@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:12:21 -0600 Subject: [PATCH 117/687] flux-sched: add v0.37.0, v0.38.0 (#46215) * Automated deployment to update package flux-sched 2024-09-05 * flux-sched: add back check for run environment * flux-sched: add conflict for gcc and clang above 0.37.0 --------- Co-authored-by: github-actions --- var/spack/repos/builtin/packages/flux-sched/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/flux-sched/package.py b/var/spack/repos/builtin/packages/flux-sched/package.py index 24f75fe18652af..66d5532bf31db9 100644 --- a/var/spack/repos/builtin/packages/flux-sched/package.py +++ b/var/spack/repos/builtin/packages/flux-sched/package.py @@ -24,6 +24,8 @@ class FluxSched(CMakePackage, AutotoolsPackage): license("LGPL-3.0-only") version("master", branch="master") + version("0.38.0", sha256="0cb3efbd490256b28df580bb14f8e89c02084a9126e0b1754d6334a99ecfa969") + version("0.37.0", sha256="b354d451183fcb8455e6a61d31e18c7f4af13e16a86b71216738f0991a7bcd50") version("0.36.1", sha256="0ee37ed364912f3f5a48ed5b5f5f21cb86cda43ff357486695b9454c217ad8b8") version("0.36.0", sha256="c20814eae65b6eb9f2c919dbcc216dd4b87f038a341cf99510cca88d43631c41") version("0.35.0", sha256="38fde51464f4e34ecbd1e4fbbf00267f96b639db5987257a7ad07f811e2f09d2") @@ -72,6 +74,8 @@ class FluxSched(CMakePackage, AutotoolsPackage): depends_on("uuid") depends_on("pkgconfig") conflicts("%gcc@:9.3", when="@0.34:") + conflicts("%gcc@:11", when="@0.37:", msg="gcc version must be 12 or higher") + conflicts("%clang@:14", when="@0.37:", msg="clang must be version 15 or higher") depends_on("py-sphinx@1.6.3:", when="+docs", type="build") depends_on("flux-core", type=("build", "link", "run")) From 9a4f83be1d71d1450a7847841e49fb799440eed9 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 10:16:15 -0700 Subject: [PATCH 118/687] fzf: add v0.55.0 (#46342) --- var/spack/repos/builtin/packages/fzf/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/fzf/package.py b/var/spack/repos/builtin/packages/fzf/package.py index 7616724ea2a193..a3c75798c47fd6 100644 --- a/var/spack/repos/builtin/packages/fzf/package.py +++ b/var/spack/repos/builtin/packages/fzf/package.py @@ -19,6 +19,7 @@ class Fzf(MakefilePackage): license("MIT") + version("0.55.0", sha256="805383f71bca7f8fb271ecd716852aea88fd898d5027d58add9e43df6ea766da") version("0.54.3", sha256="6413f3916f8058b396820f9078b1336d94c72cbae39c593b1d16b83fcc4fdf74") version("0.53.0", sha256="d45abbfb64f21913c633d46818d9d3eb3d7ebc7e94bd16f45941958aa5480e1d") version("0.52.1", sha256="96848746ca78249c1fdd16f170776ce2f667097b60e4ffbd5ecdbd7dfac72ef9") From 56f3ae18f6bd5470e051dc1306542f76f83c3c73 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 10:17:16 -0700 Subject: [PATCH 119/687] kubectl: add v1.31.0 (#46343) --- var/spack/repos/builtin/packages/kubectl/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/kubectl/package.py b/var/spack/repos/builtin/packages/kubectl/package.py index b36f26f37ad256..b0f40209c4239f 100644 --- a/var/spack/repos/builtin/packages/kubectl/package.py +++ b/var/spack/repos/builtin/packages/kubectl/package.py @@ -18,13 +18,13 @@ class Kubectl(Package): license("Apache-2.0") + version("1.31.0", sha256="6679eb90815cc4c3bef6c1b93f7a8451bf3f40d003f45ab57fdc9f8c4e8d4b4f") version("1.27.1", sha256="3a3f7c6b8cf1d9f03aa67ba2f04669772b1205b89826859f1636062d5f8bec3f") version("1.27.0", sha256="536025dba2714ee5e940bb0a6b1df9ca97c244fa5b00236e012776a69121c323") - depends_on("c", type="build") # generated - depends_on("bash", type="build") depends_on("go", type="build") + depends_on("go@1.22:", type="build", when="@1.30:") phases = ["build", "install"] From 9154df9062d327be66d072cdc82fe50932ca78d3 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 10:18:25 -0700 Subject: [PATCH 120/687] ripgrep: add v14.1.1 (#46348) * ripgrep: add v14.1.1 * ripgrep: fix rust dependency type --- var/spack/repos/builtin/packages/ripgrep/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/ripgrep/package.py b/var/spack/repos/builtin/packages/ripgrep/package.py index f8c0649e7f82aa..cfa392714ce441 100644 --- a/var/spack/repos/builtin/packages/ripgrep/package.py +++ b/var/spack/repos/builtin/packages/ripgrep/package.py @@ -19,7 +19,10 @@ class Ripgrep(CargoPackage): license("MIT OR Unlicense") + version("14.1.1", sha256="4dad02a2f9c8c3c8d89434e47337aa654cb0e2aa50e806589132f186bf5c2b66") version("14.1.0", sha256="33c6169596a6bbfdc81415910008f26e0809422fda2d849562637996553b2ab6") version("14.0.3", sha256="f5794364ddfda1e0411ab6cad6dd63abe3a6b421d658d9fee017540ea4c31a0e") version("13.0.0", sha256="0fb17aaf285b3eee8ddab17b833af1e190d73de317ff9648751ab0660d763ed2") version("11.0.2", sha256="0983861279936ada8bc7a6d5d663d590ad34eb44a44c75c2d6ccd0ab33490055") + + depends_on("rust@1.72:", type="build", when="@14:") From c89c84770ff6fbd96c758df6dc9d3d7eddf62899 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 10:25:04 -0700 Subject: [PATCH 121/687] restic: add v0.17.1 (#46351) --- var/spack/repos/builtin/packages/restic/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/restic/package.py b/var/spack/repos/builtin/packages/restic/package.py index eca1662df3fa82..342d614a042882 100644 --- a/var/spack/repos/builtin/packages/restic/package.py +++ b/var/spack/repos/builtin/packages/restic/package.py @@ -16,6 +16,7 @@ class Restic(Package): license("BSD-2-Clause") + version("0.17.1", sha256="cba3a5759690d11dae4b5620c44f56be17a5688e32c9856776db8a9a93d6d59a") version("0.16.4", sha256="d736a57972bb7ee3398cf6b45f30e5455d51266f5305987534b45a4ef505f965") version("0.16.3", sha256="a94d6c1feb0034fcff3e8b4f2d65c0678f906fc21a1cf2d435341f69e7e7af52") version("0.16.2", sha256="88165b5b89b6064df37a9964d660f40ac62db51d6536e459db9aaea6f2b2fc11") From 6d16d7ff830ae844ec916d943c56ee3a4f0181bb Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 10:32:33 -0700 Subject: [PATCH 122/687] fd: add v10.2.0 (#46352) * fd: add v10.2.0 * fd: add rust build dependency constraint --- var/spack/repos/builtin/packages/fd/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/fd/package.py b/var/spack/repos/builtin/packages/fd/package.py index 4f4887c1a24ae9..3bfc475c33e1a6 100644 --- a/var/spack/repos/builtin/packages/fd/package.py +++ b/var/spack/repos/builtin/packages/fd/package.py @@ -16,8 +16,11 @@ class Fd(CargoPackage): license("Apache-2.0 OR MIT") + version("10.2.0", sha256="73329fe24c53f0ca47cd0939256ca5c4644742cb7c14cf4114c8c9871336d342") version("10.1.0", sha256="ee4b2403388344ff60125c79ff25b7895a170e7960f243ba2b5d51d2c3712d97") version("9.0.0", sha256="306d7662994e06e23d25587246fa3fb1f528579e42a84f5128e75feec635a370") version("8.7.0", sha256="13da15f3197d58a54768aaad0099c80ad2e9756dd1b0c7df68c413ad2d5238c9") version("8.4.0", sha256="d0c2fc7ddbe74e3fd88bf5bb02e0f69078ee6d2aeea3d8df42f508543c9db05d") version("7.4.0", sha256="33570ba65e7f8b438746cb92bb9bc4a6030b482a0d50db37c830c4e315877537") + + depends_on("rust@1.64:", type="build", when="@9:") From 1a17d0b535bd51f9fdb324ae37c30d36993cf235 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 10:34:43 -0700 Subject: [PATCH 123/687] go: add v1.23.1 (#46354) --- var/spack/repos/builtin/packages/go/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/go/package.py b/var/spack/repos/builtin/packages/go/package.py index 05ef84c252ee39..bb073dccd12a12 100644 --- a/var/spack/repos/builtin/packages/go/package.py +++ b/var/spack/repos/builtin/packages/go/package.py @@ -41,6 +41,7 @@ class Go(Package): license("BSD-3-Clause") + version("1.23.1", sha256="6ee44e298379d146a5e5aa6b1c5b5d5f5d0a3365eabdd70741e6e21340ec3b0d") version("1.22.6", sha256="9e48d99d519882579917d8189c17e98c373ce25abaebb98772e2927088992a51") version("1.22.4", sha256="fed720678e728a7ca30ba8d1ded1caafe27d16028fab0232b8ba8e22008fb784") From a81baaa12e5ca22d1f802a38b52a9da7de266265 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Thu, 12 Sep 2024 11:48:43 -0700 Subject: [PATCH 124/687] emacs: add v29.4 (#46350) * emacs: add v29.4 * confirmed license * emacs: update git link for https clones --------- Co-authored-by: Wouter Deconinck --- .../repos/builtin/packages/emacs/package.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/var/spack/repos/builtin/packages/emacs/package.py b/var/spack/repos/builtin/packages/emacs/package.py index 738bfd649bae75..56200e29d935ff 100644 --- a/var/spack/repos/builtin/packages/emacs/package.py +++ b/var/spack/repos/builtin/packages/emacs/package.py @@ -13,14 +13,17 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage): """The Emacs programmable text editor.""" homepage = "https://www.gnu.org/software/emacs" - git = "git://git.savannah.gnu.org/emacs.git" + git = "https://git.savannah.gnu.org/git/emacs.git" gnu_mirror_path = "emacs/emacs-24.5.tar.gz" + list_url = " https://ftpmirror.gnu.org/emacs/" + list_depth = 0 maintainers("alecbcs") - license("GPL-3.0-or-later") + license("GPL-3.0-or-later", checked_by="wdconinc") version("master", branch="master") + version("29.4", sha256="1adb1b9a2c6cdb316609b3e86b0ba1ceb523f8de540cfdda2aec95b6a5343abf") version("29.3", sha256="2de8df5cab8ac697c69a1c46690772b0cf58fe7529f1d1999582c67d927d22e4") version("29.2", sha256="ac8773eb17d8b3c0c4a3bccbb478f7c359266b458563f9a5e2c23c53c05e4e59") version("29.1", sha256="5b80e0475b0e619d2ad395ef5bc481b7cb9f13894ed23c301210572040e4b5b1") @@ -36,10 +39,11 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage): version("25.1", sha256="763344b90db4d40e9fe90c5d14748a9dbd201ce544e2cf0835ab48a0aa4a1c67") version("24.5", sha256="2737a6622fb2d9982e9c47fb6f2fb297bda42674e09db40fc9bcc0db4297c3b6") - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated - depends_on("fortran", type="build") # generated - + variant("gui", default=False, description="Enable GUI build on Mac") + variant("json", default=False, when="@27:", description="Build with json support") + variant("native", default=False, when="@28:", description="enable native compilation of elisp") + variant("tls", default=True, description="Build Emacs with gnutls") + variant("treesitter", default=False, when="@29:", description="Build with tree-sitter support") variant("X", default=False, description="Enable an X toolkit") variant( "toolkit", @@ -47,12 +51,8 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage): values=("gtk", "athena"), description="Select an X toolkit (gtk, athena)", ) - variant("gui", default=False, description="Enable GUI build on Mac") - variant("tls", default=True, description="Build Emacs with gnutls") - variant("native", default=False, when="@28:", description="enable native compilation of elisp") - variant("treesitter", default=False, when="@29:", description="Build with tree-sitter support") - variant("json", default=False, when="@27:", description="Build with json support") + depends_on("c", type="build") depends_on("pkgconfig", type="build") depends_on("gzip", type="build") From d4bc1b8be2f239b5febc437ba7c71d34d535d674 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Thu, 12 Sep 2024 15:00:20 -0400 Subject: [PATCH 125/687] py-httpx: added version 0.27.0 and 0.27.2 (#46311) * py-httpx: New version * [py-httpx] fix when for dependencies * [py-httpx] organized dependencies * [py-httpx] added version 0.27.2 --------- Co-authored-by: Alex C Leute --- .../builtin/packages/py-httpx/package.py | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-httpx/package.py b/var/spack/repos/builtin/packages/py-httpx/package.py index 4da435bbd3cc1c..7ec617183517c2 100644 --- a/var/spack/repos/builtin/packages/py-httpx/package.py +++ b/var/spack/repos/builtin/packages/py-httpx/package.py @@ -11,10 +11,12 @@ class PyHttpx(PythonPackage): and async APIs, and support for both HTTP/1.1 and HTTP/2.""" homepage = "https://github.com/encode/httpx" - pypi = "httpx/httpx-0.15.2.tar.gz" + pypi = "httpx/httpx-0.27.0.tar.gz" license("BSD-3-Clause") + version("0.27.2", sha256="f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2") + version("0.27.0", sha256="a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5") version("0.23.3", sha256="9818458eb565bb54898ccb9b8b251a28785dd4a55afbc23d0eb410754fe7d0f9") version("0.22.0", sha256="d8e778f76d9bbd46af49e7f062467e3157a5a3d2ae4876a4bbfd8a51ed9c9cb4") version("0.15.2", sha256="713a2deaf96d85bbd4a1fbdf0edb27d6b4ee2c9aaeda8433042367e4b9e1628d") @@ -22,26 +24,36 @@ class PyHttpx(PythonPackage): variant("http2", default=False, when="@0.15.2:", description="Enable http2 support") + depends_on("python@3.8", when="@0.27:", type=("build", "run")) + depends_on("py-setuptools", when="@:0.22", type="build") depends_on("py-hatchling", when="@0.23:", type="build") depends_on("py-hatch-fancy-pypi-readme", when="@0.23:", type="build") - depends_on("py-certifi", type=("build", "run")) - depends_on("py-httpcore@0.15:0.16", when="@0.23:", type=("build", "run")) - depends_on("py-httpcore@0.14.5:0.14", type=("build", "run"), when="@0.22") - depends_on("py-httpcore@0.11.0:0.11", type=("build", "run"), when="@0.15.2") - depends_on("py-rfc3986+idna2008@1.3:1", type=("build", "run"), when="@0.15.2:") - depends_on("py-rfc3986@1.3:1", type=("build", "run"), when="@0.11.1") - depends_on("py-sniffio", type=("build", "run"), when="@0.15.2:") - depends_on("py-sniffio@1.0:1", type=("build", "run"), when="@0.11.1") - - depends_on("py-h2@3.0:4", type=("build", "run"), when="@0.22.0:+http2") - depends_on("py-h2@3.0:3", type=("build", "run"), when="@0.15.2+http2") - depends_on("py-h2@3.0:3", type=("build", "run"), when="@0.11.1") - - # Historical dependencies - depends_on("py-setuptools", when="@:0.22", type="build") - depends_on("py-charset-normalizer", type=("build", "run"), when="@0.22") - depends_on("py-hstspreload", type=("build", "run"), when="@0.11.1") - depends_on("py-chardet@3.0:3", type=("build", "run"), when="@0.11.1") - depends_on("py-h11@0.8:0.9", type=("build", "run"), when="@0.11.1") - depends_on("py-idna@2.0:2", type=("build", "run"), when="@0.11.1") - depends_on("py-urllib3@1.0:1", type=("build", "run"), when="@0.11.1") + + with default_args(type=("build", "run")): + depends_on("py-certifi") + + depends_on("py-httpcore@0.11.0:0.11", when="@0.15.2") + depends_on("py-httpcore@0.14.5:0.14", when="@0.22") + depends_on("py-httpcore@0.15:0.16", when="@0.23") + depends_on("py-httpcore@1", when="@0.27:") + + depends_on("py-anyio", when="@0.27:") + depends_on("py-idna", when="@0.27:") + + depends_on("py-sniffio@1.0:1", when="@0.11.1") + depends_on("py-sniffio", when="@0.15.2:") + + depends_on("py-h2@3.0:3", when="@0.11.1") + depends_on("py-h2@3.0:3", when="@0.15.2+http2") + depends_on("py-h2@3.0:4", when="@0.22.0:+http2") + + # Historical dependencies + depends_on("py-hstspreload", when="@0.11.1") + depends_on("py-chardet@3.0:3", when="@0.11.1") + depends_on("py-h11@0.8:0.9", when="@0.11.1") + depends_on("py-idna@2.0:2", when="@0.11.1") + depends_on("py-urllib3@1.0:1", when="@0.11.1") + depends_on("py-charset-normalizer", when="@0.22") + + depends_on("py-rfc3986@1.3:1", when="@0.11.1") + depends_on("py-rfc3986+idna2008@1.3:1", when="@0.15.2:2.23.3") From 94af1d2dfe88c41ef041402d80094bbce74ee0a6 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 14:08:37 -0500 Subject: [PATCH 126/687] tl-expected: add v1.1.0; deprecated custom calver version (#46036) * tl-expected: add v1.1.0; deprecated calver version * tl-expected: fix url --- .../builtin/packages/tl-expected/package.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/tl-expected/package.py b/var/spack/repos/builtin/packages/tl-expected/package.py index 0bd6107cfc9c93..bffc895b9e2615 100644 --- a/var/spack/repos/builtin/packages/tl-expected/package.py +++ b/var/spack/repos/builtin/packages/tl-expected/package.py @@ -10,18 +10,20 @@ class TlExpected(CMakePackage): """C++11/14/17 std::expected with functional-style extensions.""" homepage = "https://tl.tartanllama.xyz/en/latest/" - url = "https://github.com/TartanLlama/expected/archive/1.0.0.tar.gz" + url = "https://github.com/TartanLlama/expected/archive/refs/tags/v1.0.0.tar.gz" git = "https://github.com/TartanLlama/expected.git" maintainers("charmoniumQ") - license("CC0-1.0") + license("CC0-1.0", checked_by="wdconinc") - # Note that the 1.0.0 has this issue: - # https://github.com/TartanLlama/expected/issues/114 - # But no new patch version has been released, - # so I will use the latest commit at the time of writing: - version("2022-11-24", commit="b74fecd4448a1a5549402d17ddc51e39faa5020c") + version("1.1.0", sha256="1db357f46dd2b24447156aaf970c4c40a793ef12a8a9c2ad9e096d9801368df6") + with default_args(deprecated=True): + # Note that the 1.0.0 has this issue: + # https://github.com/TartanLlama/expected/issues/114 + # But no new patch version has been released, + # so I will use the latest commit at the time of writing: + version("2022-11-24", commit="b74fecd4448a1a5549402d17ddc51e39faa5020c") version("1.0.0", sha256="8f5124085a124113e75e3890b4e923e3a4de5b26a973b891b3deb40e19c03cee") - depends_on("cxx", type="build") # generated + depends_on("cxx", type="build") From 6051d56014730528da8dfa69934d93f9b7941a70 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Thu, 12 Sep 2024 15:46:08 -0500 Subject: [PATCH 127/687] fastjet: avoid plugins=all,cxx combinations (#46276) * fastjet: avoid plugins=all,cxx combinations * fastjet: depends_on fortran when plugins=all or plugins=pxcone --- var/spack/repos/builtin/packages/fastjet/package.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/fastjet/package.py b/var/spack/repos/builtin/packages/fastjet/package.py index e5b83176a7d454..c2738a3bbf0cd5 100644 --- a/var/spack/repos/builtin/packages/fastjet/package.py +++ b/var/spack/repos/builtin/packages/fastjet/package.py @@ -58,11 +58,12 @@ class Fastjet(AutotoolsPackage): version("2.3.2", sha256="ba8b17fcc8edae16faa74608e8da53e87a8c574aa21a28c985ea0dfedcb95210") version("2.3.1", sha256="16c32b420e1aa7d0b6fecddd980ea0f2b7e3c2c66585e06f0eb3142677ab6ccf") version("2.3.0", sha256="e452fe4a9716627bcdb726cfb0917f46a7ac31f6006330a6ccc1abc43d9c2d53") - - depends_on("cxx", type="build") # generated - depends_on("fortran", type="build") # generated # older version use .tar instead of .tar.gz extension, to be added + depends_on("cxx", type="build") + depends_on("fortran", type="build", when="plugins=all") + depends_on("fortran", type="build", when="plugins=pxcone") + variant("shared", default=True, description="Builds a shared version of the library") variant("auto-ptr", default=False, description="Use auto_ptr") variant( @@ -99,9 +100,9 @@ class Fastjet(AutotoolsPackage): ) variant( "plugins", - multi=True, - values=("all", "cxx") + available_plugins, - default="all", + values=disjoint_sets(("all",), ("cxx",), available_plugins) + .prohibit_empty_set() + .with_default("all"), description="List of plugins to enable, or 'cxx' or 'all'", ) From 79d938fb1f76679b19cbe9b76e58036eda52b074 Mon Sep 17 00:00:00 2001 From: James Smillie <83249606+jamessmillie@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:40:30 -0600 Subject: [PATCH 128/687] py-pip package: fix bootstrap for Python 3.12+ on Windows (#46332) --- var/spack/repos/builtin/packages/py-pip/package.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-pip/package.py b/var/spack/repos/builtin/packages/py-pip/package.py index 111e50911b87b1..8d7dd6561c5631 100644 --- a/var/spack/repos/builtin/packages/py-pip/package.py +++ b/var/spack/repos/builtin/packages/py-pip/package.py @@ -48,11 +48,20 @@ class PyPip(Package, PythonExtension): name="pip-bootstrap", url="https://bootstrap.pypa.io/pip/zipapp/pip-22.3.1.pyz", checksum="c9363c70ad91d463f9492a8a2c89f60068f86b0239bd2a6aa77367aab5fefb3e", - when="platform=windows", + when="platform=windows ^python@:3.11", placement={"pip-22.3.1.pyz": "pip.pyz"}, expand=False, ) + resource( + name="pip-bootstrap", + url="https://bootstrap.pypa.io/pip/zipapp/pip-23.1.pyz", + checksum="d9f2fe58c472f9107964df35954f8b74e68c307497a12364b00dc28f36f96816", + when="platform=windows ^python@3.12:", + placement={"pip-23.1.pyz": "pip.pyz"}, + expand=False, + ) + def url_for_version(self, version): url = "https://files.pythonhosted.org/packages/{0}/p/pip/pip-{1}-{0}-none-any.whl" if version >= Version("21"): From 2277052a6be6dedf03de63121db332ced3135394 Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:51:19 -0700 Subject: [PATCH 129/687] e4s rocm external ci stack: upgrade to rocm v6.2.0 (#46328) * e4s rocm external ci stack: upgrade to rocm v6.2.0 * magma: add rocm 6.2.0 --- .../gitlab/cloud_pipelines/.gitlab-ci.yml | 2 +- .../stacks/e4s-rocm-external/spack.yaml | 150 +++++++++--------- .../repos/builtin/packages/magma/package.py | 1 + 3 files changed, 77 insertions(+), 76 deletions(-) diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index e50d06919862df..9bee896586eb90 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -376,7 +376,7 @@ e4s-neoverse_v1-build: e4s-rocm-external-generate: extends: [ ".e4s-rocm-external", ".generate-x86_64"] - image: ecpe4s/ubuntu22.04-runner-amd64-gcc-11.4-rocm6.1.2:2024.07.22 + image: ecpe4s/ubuntu22.04-runner-amd64-gcc-11.4-rocm6.2.0:2024.09.11 e4s-rocm-external-build: extends: [ ".e4s-rocm-external", ".build" ] diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml index 6344a725c3e754..f3391b7337ad72 100644 --- a/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s-rocm-external/spack.yaml @@ -27,186 +27,186 @@ spack: comgr: buildable: false externals: - - spec: comgr@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: comgr@6.2.0 + prefix: /opt/rocm-6.2.0/ hip-rocclr: buildable: false externals: - - spec: hip-rocclr@6.1.2 - prefix: /opt/rocm-6.1.2/hip + - spec: hip-rocclr@6.2.0 + prefix: /opt/rocm-6.2.0/hip hipblas: buildable: false externals: - - spec: hipblas@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: hipblas@6.2.0 + prefix: /opt/rocm-6.2.0/ hipcub: buildable: false externals: - - spec: hipcub@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: hipcub@6.2.0 + prefix: /opt/rocm-6.2.0/ hipfft: buildable: false externals: - - spec: hipfft@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: hipfft@6.2.0 + prefix: /opt/rocm-6.2.0/ hipsparse: buildable: false externals: - - spec: hipsparse@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: hipsparse@6.2.0 + prefix: /opt/rocm-6.2.0/ miopen-hip: buildable: false externals: - - spec: miopen-hip@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: miopen-hip@6.2.0 + prefix: /opt/rocm-6.2.0/ miopengemm: buildable: false externals: - - spec: miopengemm@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: miopengemm@6.2.0 + prefix: /opt/rocm-6.2.0/ rccl: buildable: false externals: - - spec: rccl@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rccl@6.2.0 + prefix: /opt/rocm-6.2.0/ rocblas: buildable: false externals: - - spec: rocblas@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocblas@6.2.0 + prefix: /opt/rocm-6.2.0/ rocfft: buildable: false externals: - - spec: rocfft@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocfft@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-clang-ocl: buildable: false externals: - - spec: rocm-clang-ocl@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-clang-ocl@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-cmake: buildable: false externals: - - spec: rocm-cmake@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-cmake@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-dbgapi: buildable: false externals: - - spec: rocm-dbgapi@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-dbgapi@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-debug-agent: buildable: false externals: - - spec: rocm-debug-agent@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-debug-agent@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-device-libs: buildable: false externals: - - spec: rocm-device-libs@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-device-libs@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-gdb: buildable: false externals: - - spec: rocm-gdb@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-gdb@6.2.0 + prefix: /opt/rocm-6.2.0/ rocm-opencl: buildable: false externals: - - spec: rocm-opencl@6.1.2 - prefix: /opt/rocm-6.1.2/opencl + - spec: rocm-opencl@6.2.0 + prefix: /opt/rocm-6.2.0/opencl rocm-smi-lib: buildable: false externals: - - spec: rocm-smi-lib@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: rocm-smi-lib@6.2.0 + prefix: /opt/rocm-6.2.0/ hip: buildable: false externals: - - spec: hip@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: hip@6.2.0 + prefix: /opt/rocm-6.2.0 extra_attributes: compilers: - c: /opt/rocm-6.1.2/llvm/bin/clang++ - c++: /opt/rocm-6.1.2/llvm/bin/clang++ - hip: /opt/rocm-6.1.2/hip/bin/hipcc + c: /opt/rocm-6.2.0/llvm/bin/clang++ + c++: /opt/rocm-6.2.0/llvm/bin/clang++ + hip: /opt/rocm-6.2.0/hip/bin/hipcc hipify-clang: buildable: false externals: - - spec: hipify-clang@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: hipify-clang@6.2.0 + prefix: /opt/rocm-6.2.0 llvm-amdgpu: buildable: false externals: - - spec: llvm-amdgpu@6.1.2 - prefix: /opt/rocm-6.1.2/llvm + - spec: llvm-amdgpu@6.2.0 + prefix: /opt/rocm-6.2.0/llvm extra_attributes: compilers: - c: /opt/rocm-6.1.2/llvm/bin/clang++ - cxx: /opt/rocm-6.1.2/llvm/bin/clang++ + c: /opt/rocm-6.2.0/llvm/bin/clang++ + cxx: /opt/rocm-6.2.0/llvm/bin/clang++ hsakmt-roct: buildable: false externals: - - spec: hsakmt-roct@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: hsakmt-roct@6.2.0 + prefix: /opt/rocm-6.2.0/ hsa-rocr-dev: buildable: false externals: - - spec: hsa-rocr-dev@6.1.2 - prefix: /opt/rocm-6.1.2/ + - spec: hsa-rocr-dev@6.2.0 + prefix: /opt/rocm-6.2.0/ extra_atributes: compilers: - c: /opt/rocm-6.1.2/llvm/bin/clang++ - cxx: /opt/rocm-6.1.2/llvm/bin/clang++ + c: /opt/rocm-6.2.0/llvm/bin/clang++ + cxx: /opt/rocm-6.2.0/llvm/bin/clang++ roctracer-dev-api: buildable: false externals: - - spec: roctracer-dev-api@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: roctracer-dev-api@6.2.0 + prefix: /opt/rocm-6.2.0 roctracer-dev: buildable: false externals: - spec: roctracer-dev@4.5.3 - prefix: /opt/rocm-6.1.2 + prefix: /opt/rocm-6.2.0 rocprim: buildable: false externals: - - spec: rocprim@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocprim@6.2.0 + prefix: /opt/rocm-6.2.0 rocrand: buildable: false externals: - - spec: rocrand@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocrand@6.2.0 + prefix: /opt/rocm-6.2.0 hipsolver: buildable: false externals: - - spec: hipsolver@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: hipsolver@6.2.0 + prefix: /opt/rocm-6.2.0 rocsolver: buildable: false externals: - - spec: rocsolver@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocsolver@6.2.0 + prefix: /opt/rocm-6.2.0 rocsparse: buildable: false externals: - - spec: rocsparse@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocsparse@6.2.0 + prefix: /opt/rocm-6.2.0 rocthrust: buildable: false externals: - - spec: rocthrust@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocthrust@6.2.0 + prefix: /opt/rocm-6.2.0 rocprofiler-dev: buildable: false externals: - - spec: rocprofiler-dev@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocprofiler-dev@6.2.0 + prefix: /opt/rocm-6.2.0 rocm-core: buildable: false externals: - - spec: rocm-core@6.1.2 - prefix: /opt/rocm-6.1.2 + - spec: rocm-core@6.2.0 + prefix: /opt/rocm-6.2.0 specs: # ROCM NOARCH @@ -302,7 +302,7 @@ spack: ci: pipeline-gen: - build-job: - image: ecpe4s/ubuntu22.04-runner-amd64-gcc-11.4-rocm6.1.2:2024.07.22 + image: ecpe4s/ubuntu22.04-runner-amd64-gcc-11.4-rocm6.2.0:2024.09.11 cdash: build-group: E4S ROCm External diff --git a/var/spack/repos/builtin/packages/magma/package.py b/var/spack/repos/builtin/packages/magma/package.py index 6e91a051443d5b..86be7b09d97db6 100644 --- a/var/spack/repos/builtin/packages/magma/package.py +++ b/var/spack/repos/builtin/packages/magma/package.py @@ -66,6 +66,7 @@ class Magma(CMakePackage, CudaPackage, ROCmPackage): "6.1.0", "6.1.1", "6.1.2", + "6.2.0", ]: depends_on(f"rocm-core@{ver}", when=f"@2.8.0: +rocm ^hip@{ver}") depends_on("python", when="@master", type="build") From 668aba15a0d6fe28d8a39ea7b0f6b13b42d27450 Mon Sep 17 00:00:00 2001 From: Joseph Wang Date: Fri, 13 Sep 2024 15:56:26 +0800 Subject: [PATCH 130/687] py-pycontour: add dev/fixes (#46290) --- var/spack/repos/builtin/packages/py-contourpy/package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-contourpy/package.py b/var/spack/repos/builtin/packages/py-contourpy/package.py index 4020cbf679bf2c..9bd134913f6db7 100644 --- a/var/spack/repos/builtin/packages/py-contourpy/package.py +++ b/var/spack/repos/builtin/packages/py-contourpy/package.py @@ -23,8 +23,9 @@ class PyContourpy(PythonPackage): with default_args(type="build"): depends_on("meson@1.2:") depends_on("py-meson-python@0.13.1:") - depends_on("py-pybind11@2.13.1:", when="@1.3:") - depends_on("py-pybind11@2.6:") + with default_args(type=("build", "link")): + depends_on("py-pybind11@2.13.1:", when="@1.3:") + depends_on("py-pybind11@2.6:") # Historical dependencies depends_on("py-setuptools@42:", when="@:1.0") From 71df434d1fdf719dd781b1c7d48f4e9b4bf8da7d Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 13 Sep 2024 11:16:36 +0200 Subject: [PATCH 131/687] remove self-import cycles (#46371) --- lib/spack/spack/container/writers/__init__.py | 5 ++--- lib/spack/spack/mirror.py | 1 - lib/spack/spack/modules/common.py | 3 +-- lib/spack/spack/stage.py | 5 ++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/spack/spack/container/writers/__init__.py b/lib/spack/spack/container/writers/__init__.py index cf186b57645cd1..eabc25d2187133 100644 --- a/lib/spack/spack/container/writers/__init__.py +++ b/lib/spack/spack/container/writers/__init__.py @@ -308,8 +308,7 @@ def __call__(self): return t.render(**self.to_dict()) -import spack.container.writers.docker # noqa: E402 - # Import after function definition all the modules in this package, # so that registration of writers will happen automatically -import spack.container.writers.singularity # noqa: E402 +from . import docker # noqa: F401 E402 +from . import singularity # noqa: F401 E402 diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py index 8caa27213735a4..02ddeae42a9f27 100644 --- a/lib/spack/spack/mirror.py +++ b/lib/spack/spack/mirror.py @@ -29,7 +29,6 @@ import spack.config import spack.error import spack.fetch_strategy -import spack.mirror import spack.oci.image import spack.repo import spack.spec diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index 5e46ca4c6c3a85..e4f7a197f3386c 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -46,7 +46,6 @@ import spack.deptypes as dt import spack.environment import spack.error -import spack.modules.common import spack.paths import spack.projections as proj import spack.repo @@ -352,7 +351,7 @@ def get_module(module_type, spec, get_full_path, module_set_name="default", requ except spack.repo.UnknownPackageError: upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash()) if upstream: - module = spack.modules.common.upstream_module_index.upstream_module(spec, module_type) + module = upstream_module_index.upstream_module(spec, module_type) if not module: return None diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 752ac42e4ec8d5..a8e945e7485dc5 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -39,7 +39,6 @@ import spack.paths import spack.resource import spack.spec -import spack.stage import spack.util.crypto import spack.util.lock import spack.util.path as sup @@ -981,8 +980,8 @@ def interactive_version_filter( data = buffer.getvalue().encode("utf-8") short_hash = hashlib.sha1(data).hexdigest()[:7] - filename = f"{spack.stage.stage_prefix}versions-{short_hash}.txt" - filepath = os.path.join(spack.stage.get_stage_root(), filename) + filename = f"{stage_prefix}versions-{short_hash}.txt" + filepath = os.path.join(get_stage_root(), filename) # Write contents with open(filepath, "wb") as f: From a85afb829e70616585e7ae94ba90a85e6a70ae15 Mon Sep 17 00:00:00 2001 From: David Collins Date: Fri, 13 Sep 2024 03:54:56 -0600 Subject: [PATCH 132/687] bash: use libc malloc on musl instead of internal malloc (#46370) --- var/spack/repos/builtin/packages/bash/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/bash/package.py b/var/spack/repos/builtin/packages/bash/package.py index 3e520521062ef6..1aa02c1f7a56fb 100644 --- a/var/spack/repos/builtin/packages/bash/package.py +++ b/var/spack/repos/builtin/packages/bash/package.py @@ -203,6 +203,9 @@ def configure_args(self): args.append(f"--with-libiconv-prefix={spec['iconv'].prefix}") else: args.append("--without-libiconv-prefix") + # bash malloc relies on sbrk which fails intentionally in musl + if spec.satisfies("^[virtuals=libc] musl"): + options.append("--without-bash-malloc") return args def check(self): From a798f40d0405c92d6e9a1c933be12b4e9903a775 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:14:03 +0200 Subject: [PATCH 133/687] zziplib: add v0.13.78 (#46361) Co-authored-by: jmcarcell --- var/spack/repos/builtin/packages/zziplib/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/zziplib/package.py b/var/spack/repos/builtin/packages/zziplib/package.py index fbccabdc7de1f4..d91c0cf2ce07b2 100644 --- a/var/spack/repos/builtin/packages/zziplib/package.py +++ b/var/spack/repos/builtin/packages/zziplib/package.py @@ -17,6 +17,7 @@ class Zziplib(AutotoolsPackage, CMakePackage): homepage = "https://github.com/gdraheim/zziplib" url = "https://github.com/gdraheim/zziplib/archive/v0.13.69.tar.gz" + version("0.13.78", sha256="feaeee7c34f18aa27bd3da643cc6a47d04d2c41753a59369d09102d79b9b0a31") version("0.13.72", sha256="93ef44bf1f1ea24fc66080426a469df82fa631d13ca3b2e4abaeab89538518dc") version("0.13.69", sha256="846246d7cdeee405d8d21e2922c6e97f55f24ecbe3b6dcf5778073a88f120544") From ef35811f39e85774d644472795f0af982c09a8ac Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 13 Sep 2024 05:40:34 -0500 Subject: [PATCH 134/687] nasm: add v2.16.03 (#46357) * nasm: add v2.16.03 * nasm: don't need 2.16.02 --- var/spack/repos/builtin/packages/nasm/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/nasm/package.py b/var/spack/repos/builtin/packages/nasm/package.py index a9861e96cedb7a..c2dbee285ff3bc 100644 --- a/var/spack/repos/builtin/packages/nasm/package.py +++ b/var/spack/repos/builtin/packages/nasm/package.py @@ -22,6 +22,7 @@ class Nasm(AutotoolsPackage, Package): license("BSD-2-Clause") + version("2.16.03", sha256="5bc940dd8a4245686976a8f7e96ba9340a0915f2d5b88356874890e207bdb581") version("2.15.05", sha256="9182a118244b058651c576baa9d0366ee05983c4d4ae1d9ddd3236a9f2304997") version("2.14.02", sha256="b34bae344a3f2ed93b2ca7bf25f1ed3fb12da89eeda6096e3551fd66adeae9fc") version("2.13.03", sha256="23e1b679d64024863e2991e5c166e19309f0fe58a9765622b35bd31be5b2cc99") From 7573ea2ae5d0e772b82263d5543ab0f9551dfb35 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 13 Sep 2024 13:21:58 +0200 Subject: [PATCH 135/687] audit: deprecate certain globals (#44895) --- lib/spack/spack/audit.py | 88 +++++++++++++++++++++++++++++++++++- lib/spack/spack/cmd/audit.py | 14 ++---- 2 files changed, 92 insertions(+), 10 deletions(-) diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 28b7727e5ec2f8..14fe7a5f33a43d 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -46,12 +46,14 @@ def _search_duplicate_compilers(error_cls): import pickle import re import warnings +from typing import Iterable, List, Set, Tuple from urllib.request import urlopen import llnl.util.lang import spack.config import spack.patch +import spack.paths import spack.repo import spack.spec import spack.util.crypto @@ -73,7 +75,9 @@ def __init__(self, summary, details): self.details = tuple(details) def __str__(self): - return self.summary + "\n" + "\n".join([" " + detail for detail in self.details]) + if self.details: + return f"{self.summary}\n" + "\n".join(f" {detail}" for detail in self.details) + return self.summary def __eq__(self, other): if self.summary != other.summary or self.details != other.details: @@ -679,6 +683,88 @@ def _ensure_env_methods_are_ported_to_builders(pkgs, error_cls): return errors +class DeprecatedMagicGlobals(ast.NodeVisitor): + def __init__(self, magic_globals: Iterable[str]): + super().__init__() + + self.magic_globals: Set[str] = set(magic_globals) + + # State to track whether we're in a class function + self.depth: int = 0 + self.in_function: bool = False + self.path = (ast.Module, ast.ClassDef, ast.FunctionDef) + + # Defined locals in the current function (heuristically at least) + self.locals: Set[str] = set() + + # List of (name, lineno) tuples for references to magic globals + self.references_to_globals: List[Tuple[str, int]] = [] + + def descend_in_function_def(self, node: ast.AST) -> None: + if not isinstance(node, self.path[self.depth]): + return + self.depth += 1 + if self.depth == len(self.path): + self.in_function = True + super().generic_visit(node) + if self.depth == len(self.path): + self.in_function = False + self.locals.clear() + self.depth -= 1 + + def generic_visit(self, node: ast.AST) -> None: + # Recurse into function definitions + if self.depth < len(self.path): + return self.descend_in_function_def(node) + elif not self.in_function: + return + elif isinstance(node, ast.Global): + for name in node.names: + if name in self.magic_globals: + self.references_to_globals.append((name, node.lineno)) + elif isinstance(node, ast.Assign): + # visit the rhs before lhs + super().visit(node.value) + for target in node.targets: + super().visit(target) + elif isinstance(node, ast.Name) and node.id in self.magic_globals: + if isinstance(node.ctx, ast.Load) and node.id not in self.locals: + self.references_to_globals.append((node.id, node.lineno)) + elif isinstance(node.ctx, ast.Store): + self.locals.add(node.id) + else: + super().generic_visit(node) + + +@package_properties +def _uses_deprecated_globals(pkgs, error_cls): + """Ensure that packages do not use deprecated globals""" + errors = [] + + for pkg_name in pkgs: + # some packages scheduled to be removed in v0.23 are not worth fixing. + pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) + if all(v.get("deprecated", False) for v in pkg_cls.versions.values()): + continue + + file = spack.repo.PATH.filename_for_package_name(pkg_name) + tree = ast.parse(open(file).read()) + visitor = DeprecatedMagicGlobals(("std_cmake_args",)) + visitor.visit(tree) + if visitor.references_to_globals: + errors.append( + error_cls( + f"Package '{pkg_name}' uses deprecated globals", + [ + f"{file}:{line} references '{name}'" + for name, line in visitor.references_to_globals + ], + ) + ) + + return errors + + @package_https_directives def _linting_package_file(pkgs, error_cls): """Check for correctness of links""" diff --git a/lib/spack/spack/cmd/audit.py b/lib/spack/spack/cmd/audit.py index 77bbbc5d82b7d4..e5512d9a903662 100644 --- a/lib/spack/spack/cmd/audit.py +++ b/lib/spack/spack/cmd/audit.py @@ -115,15 +115,11 @@ def audit(parser, args): def _process_reports(reports): for check, errors in reports: if errors: - msg = "{0}: {1} issue{2} found".format( - check, len(errors), "" if len(errors) == 1 else "s" - ) - header = "@*b{" + msg + "}" - print(cl.colorize(header)) + status = f"{len(errors)} issue{'' if len(errors) == 1 else 's'} found" + print(cl.colorize(f"{check}: @*r{{{status}}}")) + numdigits = len(str(len(errors))) for idx, error in enumerate(errors): - print(str(idx + 1) + ". " + str(error)) + print(f"{idx + 1:>{numdigits}}. {error}") raise SystemExit(1) else: - msg = "{0}: 0 issues found.".format(check) - header = "@*b{" + msg + "}" - print(cl.colorize(header)) + print(cl.colorize(f"{check}: @*g{{passed}}")) From e3c5d5817b02d91cdfacf0c2e939851956f5179a Mon Sep 17 00:00:00 2001 From: jeffmauldin Date: Fri, 13 Sep 2024 05:36:49 -0600 Subject: [PATCH 136/687] Seacas add libcatalyst variant 2 (#46339) * Update seacas package.py Adding libcatalyst variant to seacas package When seacas is installed with "seacas +libcatalyst" then a dependency on the spack package "libcatalyst" (which is catalyst api 2 from kitware) is added, and the appropriage cmake variable for the catalyst TPL is set. The mpi variant option in catalyst (i.e. build with mpi or build without mpi) is passed on to libcatalyst. The default of the libcatalyst variant is false/off, so if seacas is installed without the "+libcatalyst" in the spec it will behave exactly as it did before the introduction of this variant. * shortened line 202 to comply with < 100 characters per line style requirement --- var/spack/repos/builtin/packages/seacas/package.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/var/spack/repos/builtin/packages/seacas/package.py b/var/spack/repos/builtin/packages/seacas/package.py index 7bcdc2173661ed..a222024541934b 100644 --- a/var/spack/repos/builtin/packages/seacas/package.py +++ b/var/spack/repos/builtin/packages/seacas/package.py @@ -196,6 +196,11 @@ class Seacas(CMakePackage): default=False, description="Enable Faodel. See https://github.com/sandialabs/faodel", ) + variant( + "libcatalyst", + default=False, + description="Enable libcatalyst tpl (catalyst api 2); Kitware insitu library", + ) variant( "matio", default=True, @@ -262,6 +267,10 @@ class Seacas(CMakePackage): depends_on("catch2@3:", when="@2024-03-11:+tests") depends_on("matio", when="+matio") + + depends_on("libcatalyst+mpi~python", when="+libcatalyst+mpi") + depends_on("libcatalyst~mpi~python", when="+libcatalyst~mpi") + depends_on("libx11", when="+x11") with when("+cgns"): @@ -481,6 +490,9 @@ def cmake_args(self): if "+adios2" in spec: options.append(define("ADIOS2_ROOT", spec["adios2"].prefix)) + if "+libcatalyst" in spec: + options.append(define("TPL_ENABLE_Catalyst2", "ON")) + # ################# RPath Handling ###################### if sys.platform == "darwin" and macos_version() >= Version("10.12"): # use @rpath on Sierra due to limit of dynamic loader From 4fe417b6203b9d31d2d52085aa10eaead0eaf23a Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Fri, 13 Sep 2024 08:08:58 -0500 Subject: [PATCH 137/687] Optionally output package namespace (#46359) --- lib/spack/spack/cmd/info.py | 11 +++++++++++ share/spack/spack-completion.bash | 2 +- share/spack/spack-completion.fish | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py index c5d776212b8bf1..a57667705287ab 100644 --- a/lib/spack/spack/cmd/info.py +++ b/lib/spack/spack/cmd/info.py @@ -48,6 +48,7 @@ def setup_parser(subparser): options = [ ("--detectable", print_detectable.__doc__), ("--maintainers", print_maintainers.__doc__), + ("--namespace", print_namespace.__doc__), ("--no-dependencies", "do not " + print_dependencies.__doc__), ("--no-variants", "do not " + print_variants.__doc__), ("--no-versions", "do not " + print_versions.__doc__), @@ -189,6 +190,15 @@ def print_maintainers(pkg, args): color.cprint(section_title("Maintainers: ") + mnt) +def print_namespace(pkg, args): + """output package namespace""" + + repo = spack.repo.PATH.get_repo(pkg.namespace) + color.cprint("") + color.cprint(section_title("Namespace:")) + color.cprint(f" @c{{{repo.namespace}}} at {repo.root}") + + def print_phases(pkg, args): """output installation phases""" @@ -522,6 +532,7 @@ def info(parser, args): # Now output optional information in expected order sections = [ (args.all or args.maintainers, print_maintainers), + (args.all or args.namespace, print_namespace), (args.all or args.detectable, print_detectable), (args.all or args.tags, print_tags), (args.all or not args.no_versions, print_versions), diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 079f021706d9c9..7546c6ade69012 100644 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1299,7 +1299,7 @@ _spack_help() { _spack_info() { if $list_options then - SPACK_COMPREPLY="-h --help -a --all --detectable --maintainers --no-dependencies --no-variants --no-versions --phases --tags --tests --virtuals --variants-by-name" + SPACK_COMPREPLY="-h --help -a --all --detectable --maintainers --namespace --no-dependencies --no-variants --no-versions --phases --tags --tests --virtuals --variants-by-name" else _all_packages fi diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index 0a20a82d57ce24..43616c2fae802d 100644 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -1954,7 +1954,7 @@ complete -c spack -n '__fish_spack_using_command help' -l spec -f -a guide complete -c spack -n '__fish_spack_using_command help' -l spec -d 'help on the package specification syntax' # spack info -set -g __fish_spack_optspecs_spack_info h/help a/all detectable maintainers no-dependencies no-variants no-versions phases tags tests virtuals variants-by-name +set -g __fish_spack_optspecs_spack_info h/help a/all detectable maintainers namespace no-dependencies no-variants no-versions phases tags tests virtuals variants-by-name complete -c spack -n '__fish_spack_using_command_pos 0 info' -f -a '(__fish_spack_packages)' complete -c spack -n '__fish_spack_using_command info' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command info' -s h -l help -d 'show this help message and exit' @@ -1964,6 +1964,8 @@ complete -c spack -n '__fish_spack_using_command info' -l detectable -f -a detec complete -c spack -n '__fish_spack_using_command info' -l detectable -d 'output information on external detection' complete -c spack -n '__fish_spack_using_command info' -l maintainers -f -a maintainers complete -c spack -n '__fish_spack_using_command info' -l maintainers -d 'output package maintainers' +complete -c spack -n '__fish_spack_using_command info' -l namespace -f -a namespace +complete -c spack -n '__fish_spack_using_command info' -l namespace -d 'output package namespace' complete -c spack -n '__fish_spack_using_command info' -l no-dependencies -f -a no_dependencies complete -c spack -n '__fish_spack_using_command info' -l no-dependencies -d 'do not output build, link, and run package dependencies' complete -c spack -n '__fish_spack_using_command info' -l no-variants -f -a no_variants From d04358c36990b049cab684681c4132b019735c3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:15:21 -0500 Subject: [PATCH 138/687] build(deps): bump urllib3 from 2.2.2 to 2.2.3 in /lib/spack/docs (#46368) Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.2.3. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.2.2...2.2.3) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- lib/spack/docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/docs/requirements.txt b/lib/spack/docs/requirements.txt index 5fbd59cdd99977..cb766413d951c3 100644 --- a/lib/spack/docs/requirements.txt +++ b/lib/spack/docs/requirements.txt @@ -5,7 +5,7 @@ sphinx-rtd-theme==2.0.0 python-levenshtein==0.25.1 docutils==0.20.1 pygments==2.18.0 -urllib3==2.2.2 +urllib3==2.2.3 pytest==8.3.3 isort==5.13.2 black==24.8.0 From 60104f916d63fa8a66f80c3bc945c18067b853d5 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Fri, 13 Sep 2024 10:56:47 -0400 Subject: [PATCH 139/687] py-pypdf: new package (#46303) * [py-pypdf] New package * [py-pypdf] added webpage --- .../builtin/packages/py-pypdf/package.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-pypdf/package.py diff --git a/var/spack/repos/builtin/packages/py-pypdf/package.py b/var/spack/repos/builtin/packages/py-pypdf/package.py new file mode 100644 index 00000000000000..7a9896d17d85b9 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pypdf/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2024 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 PyPypdf(PythonPackage): + """A pure-python PDF library capable of splitting, merging, cropping, and + transforming PDF files""" + + homepage = "https://github.com/py-pdf/pypdf" + pypi = "pypdf/pypdf-4.3.1.tar.gz" + + license("BSD-3-Clause", checked_by="qwertos") + + version("4.3.1", sha256="b2f37fe9a3030aa97ca86067a56ba3f9d3565f9a791b305c7355d8392c30d91b") + + depends_on("py-flit-core@3.9:3", type="build") + depends_on("py-typing-extensions@4:", when="^python@:3.10", type=("build", "run")) From a80d2d42d6a9fe1cc1e71b7f8a84b50e084cf1b9 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Fri, 13 Sep 2024 14:56:57 -0400 Subject: [PATCH 140/687] py-pydantic-core: new package (#46306) * py-pydantic-core: new package * [py-pydantic-core] fixed licence(checked_by) * [py-pydantic-core] removed unnecessary python dependency --------- Co-authored-by: Alex C Leute --- .../packages/py-pydantic-core/package.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-pydantic-core/package.py diff --git a/var/spack/repos/builtin/packages/py-pydantic-core/package.py b/var/spack/repos/builtin/packages/py-pydantic-core/package.py new file mode 100644 index 00000000000000..ec7dd02dfa9d1e --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pydantic-core/package.py @@ -0,0 +1,22 @@ +# Copyright 2013-2024 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 PyPydanticCore(PythonPackage): + """Core functionality for Pydantic validation and serialization""" + + homepage = "https://github.com/pydantic/pydantic-core" + pypi = "pydantic_core/pydantic_core-2.18.4.tar.gz" + + license("MIT", checked_by="qwertos") + + version("2.18.4", sha256="ec3beeada09ff865c344ff3bc2f427f5e6c26401cc6113d77e372c3fdac73864") + + depends_on("rust@1.76:", type="build") + depends_on("py-maturin@1", type="build") + depends_on("py-typing-extensions@4.6,4.7.1:", type="build") From 5398b1be15245e1be480c5aa4706f57795208505 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 14 Sep 2024 12:31:15 -0600 Subject: [PATCH 141/687] texlive: add new versions (#46374) * texlive: use https * texlive: add 20230313 and 20240312 versions --- .../repos/builtin/packages/texlive/package.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/texlive/package.py b/var/spack/repos/builtin/packages/texlive/package.py index 27e580cf4c3145..909aade8618fbc 100644 --- a/var/spack/repos/builtin/packages/texlive/package.py +++ b/var/spack/repos/builtin/packages/texlive/package.py @@ -19,14 +19,26 @@ class Texlive(AutotoolsPackage): homepage = "https://www.tug.org/texlive" url = "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2020/texlive-20200406-source.tar.xz" - base_url = "http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/{year}/texlive-{version}-{dist}.tar.xz" - list_url = "http://ftp.math.utah.edu/pub/tex/historic/systems/texlive" + base_url = "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/{year}/texlive-{version}-{dist}.tar.xz" + list_url = "https://ftp.math.utah.edu/pub/tex/historic/systems/texlive" list_depth = 1 license("GPL-2.0-or-later AND GPL-3.0-or-later", checked_by="tgamblin") # Add information for new versions below. releases = [ + { + "version": "20240312", + "year": "2024", + "sha256_source": "7b6d87cf01661670fac45c93126bed97b9843139ed510f975d047ea938b6fe96", + "sha256_texmf": "c8eae2deaaf51e86d93baa6bbcc4e94c12aa06a0d92893df474cc7d2a012c7a7", + }, + { + "version": "20230313", + "year": "2023", + "sha256_source": "3878aa0e1ed0301c053b0e2ee4e9ad999c441345f4882e79bdd1c8f4ce9e79b9", + "sha256_texmf": "4c4dc77a025acaad90fb6140db2802cdb7ca7a9a2332b5e3d66aa77c43a81253", + }, { "version": "20220321", "year": "2022", From 1a55f2cdab83e0acfdfba2126c0440cc8df2b6ad Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 14 Sep 2024 14:05:56 -0600 Subject: [PATCH 142/687] enchant: new versions, update homepage and url (#46386) --- .../repos/builtin/packages/enchant/package.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/enchant/package.py b/var/spack/repos/builtin/packages/enchant/package.py index ca045bb5f80594..673a4d4152b6d6 100644 --- a/var/spack/repos/builtin/packages/enchant/package.py +++ b/var/spack/repos/builtin/packages/enchant/package.py @@ -12,14 +12,25 @@ class Enchant(AutotoolsPackage): number of different spelling libraries and programs with a consistent interface.""" - homepage = "https://abiword.github.io/enchant/" - url = "https://github.com/AbiWord/enchant/releases/download/v2.2.5/enchant-2.2.5.tar.gz" + homepage = "https://rrthomas.github.io/enchant/" + url = "https://github.com/rrthomas/enchant/releases/download/v2.8.2/enchant-2.8.2.tar.gz" license("LGPL-2.1-or-later") + version("2.8.2", sha256="8f19535adb5577b83b00e02f330fe9b9eb40dd21f19e2899636fc4d3a7696375") + version("2.8.1", sha256="ff79de470b8eb16f53849dc49f2bce8ca4eb7decabfc1349716fe12616e52f4e") + version("2.8.0", sha256="c57add422237b8a7eed116a9a88d8be4f7b9281778fa36f03e1f2c051ecb0372") + version("2.7.3", sha256="fe6ad4cbe8c71b9384ffdef962be52d4d2bd5ebfb6351435bb390543d4f78b1e") + version("2.7.2", sha256="7cc3400a6657974a740b6e3c2568e2935c70e5302f07fadb2095366b75ecad6f") + version("2.7.1", sha256="a1cb8239095d6b0bd99ba2dd012a1402cef1a194f5de1b7214bd528676a65229") + version("2.7.0", sha256="2a073dc6ebe753196c0674a781ccf321bed25d1c6e43bffb97e2c92af420952c") + version("2.6.9", sha256="d9a5a10dc9b38a43b3a0fa22c76ed6ebb7e09eb535aff62954afcdbd40efff6b") + version("2.6.8", sha256="f565923062c77f3d58846f0558d21e6d07ca4a488c58812dfdefb35202fac7ae") + version("2.6.7", sha256="a1c2e5b59acca000bbfb24810af4a1165733d407f2154786588e076c8cd57bfc") + version("2.2.7", sha256="1b22976135812b35cb5b8d21a53ad11d5e7c1426c93f51e7a314a2a42cab3a09") version("2.2.6", sha256="8048c5bd26190b21279745cfecd05808c635bc14912e630340cd44a49b87d46d") - version("2.2.5", sha256="ffce4ea00dbda1478d91c3e1538cadfe5761d9d6c0ceb27bc3dba51882fe1c47") + version("2.2.5", sha256="ee8a663295c0e039b05d418af065ebcba9e539f785531e552e908030bec48164") version("2.2.4", sha256="f5d6b689d23c0d488671f34b02d07b84e408544b2f9f6e74fb7221982b1ecadc") version("2.2.3", sha256="abd8e915675cff54c0d4da5029d95c528362266557c61c7149d53fa069b8076d") version("2.2.2", sha256="661e0bd6e82deceb97fc94bea8c6cdbcd8ff631cfa9b7a8196de2e2aca13f54b") @@ -38,6 +49,7 @@ class Enchant(AutotoolsPackage): depends_on("glib") depends_on("aspell") depends_on("hunspell", when="+hunspell") + depends_on("groff", type="build", when="@2.6.7:") def configure_args(self): spec = self.spec From 4da2444a43b0728a1af1459f636080fe4e8fd7d2 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sat, 14 Sep 2024 14:09:49 -0600 Subject: [PATCH 143/687] py-future: add version 1.0.0 (#46375) --- var/spack/repos/builtin/packages/py-future/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-future/package.py b/var/spack/repos/builtin/packages/py-future/package.py index 14a51ad53bcb94..9ed6394c0f256b 100644 --- a/var/spack/repos/builtin/packages/py-future/package.py +++ b/var/spack/repos/builtin/packages/py-future/package.py @@ -15,6 +15,7 @@ class PyFuture(PythonPackage): license("MIT") + version("1.0.0", sha256="bd2968309307861edae1458a4f8a4f3598c03be43b97521076aebf5d94c07b05") version("0.18.3", sha256="34a17436ed1e96697a86f9de3d15a3b0be01d8bc8de9c1dffd59fb8234ed5307") version("0.18.2", sha256="b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d") version("0.17.1", sha256="67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8") From 88aa96b53bf82a0a28fa44b3f2a57affc34037ed Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 14 Sep 2024 22:15:29 +0200 Subject: [PATCH 144/687] py-torchmetrics: add v1.4.2 (#46389) --- var/spack/repos/builtin/packages/py-torchmetrics/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-torchmetrics/package.py b/var/spack/repos/builtin/packages/py-torchmetrics/package.py index 122fb8c485aed9..c3065b5d29807d 100644 --- a/var/spack/repos/builtin/packages/py-torchmetrics/package.py +++ b/var/spack/repos/builtin/packages/py-torchmetrics/package.py @@ -12,10 +12,10 @@ class PyTorchmetrics(PythonPackage): homepage = "https://github.com/PyTorchLightning/metrics" pypi = "torchmetrics/torchmetrics-0.3.1.tar.gz" - maintainers("adamjstewart") - license("Apache-2.0") + maintainers("adamjstewart") + version("1.4.2", sha256="7a40cbec85e5645090812b87601696b4adf158294ec8c407ae58a71710938b87") version("1.4.0", sha256="0b1e5acdcc9beb05bfe369d3d56cfa5b143f060ebfd6079d19ccc59ba46465b3") version("1.3.2", sha256="0a67694a4c4265eeb54cda741eaf5cb1f3a71da74b7e7e6215ad156c9f2379f6") version("1.3.1", sha256="8d371f7597a1a5eb02d5f2ed59642d6fef09093926997ce91e18b1147cc8defa") @@ -60,7 +60,7 @@ class PyTorchmetrics(PythonPackage): depends_on("py-typing-extensions", when="@0.9: ^python@:3.8") depends_on("py-lightning-utilities@0.8:", when="@1.1:") depends_on("py-lightning-utilities@0.7:", when="@1:") - depends_on("py-pretty-errors@1.2.25", when="@1.4:") # Historical dependencies + depends_on("py-pretty-errors@1.2.25", when="@1.4.0") depends_on("py-pydeprecate@0.3", when="@0.7:0.8") From 7df4ac70da534bebc9ed9104d577d25b86b0596c Mon Sep 17 00:00:00 2001 From: Weston Ortiz Date: Sat, 14 Sep 2024 14:45:21 -0600 Subject: [PATCH 145/687] goma: add v7.7.0 (#46362) --- var/spack/repos/builtin/packages/goma/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/goma/package.py b/var/spack/repos/builtin/packages/goma/package.py index 2bcb29e9141c59..7bb4e5cf3a9152 100644 --- a/var/spack/repos/builtin/packages/goma/package.py +++ b/var/spack/repos/builtin/packages/goma/package.py @@ -18,6 +18,7 @@ class Goma(CMakePackage): license("GPL-2.0-or-later") + version("7.7.0", commit="936caf27cab74023d8dfd792cc5411b8c92f2a04") version("7.6.1", commit="c799e935009b85e00979fa8b248952194f6ade7a") version("7.4.3", commit="bb0cf8030f9e8d61066d052ea6fad67fe49651f8") version("7.3.0", commit="415f442953e2171afae1f8ad55868052c6f511ce") From ca46fec985ca4137c14570bc3a0ec5db6afbb08f Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Sat, 14 Sep 2024 13:47:53 -0700 Subject: [PATCH 146/687] glab: add v1.46.1 (#46353) --- var/spack/repos/builtin/packages/glab/package.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/glab/package.py b/var/spack/repos/builtin/packages/glab/package.py index fb4d9007fb6fca..0d2dd6b458b4ff 100644 --- a/var/spack/repos/builtin/packages/glab/package.py +++ b/var/spack/repos/builtin/packages/glab/package.py @@ -16,6 +16,7 @@ class Glab(Package): license("MIT") + version("1.46.1", sha256="935f732ddacc6e54fc83d06351fc25454ac8a58c465c3efa43e066ea226257c2") version("1.36.0", sha256="8d6c759ebfe9c6942fcdb7055a4a5c7209a3b22beb25947f906c9aef3bc067e8") version("1.35.0", sha256="7ed31c7a9b425fc15922f83c5dd8634a2758262a4f25f92583378655fcad6303") version("1.33.0", sha256="447a9b76acb5377642a4975908f610a3082026c176329c7c8cfed1461d2e1570") @@ -31,8 +32,14 @@ class Glab(Package): version("1.20.0", sha256="6beb0186fa50d0dea3b05fcfe6e4bc1f9be0c07aa5fa15b37ca2047b16980412") depends_on("go@1.13:", type="build") - depends_on("go@1.17:", type="build", when="@1.22.0:") - depends_on("go@1.18:", type="build", when="@1.23.0:") + depends_on("go@1.17:", type="build", when="@1.22:") + depends_on("go@1.18:", type="build", when="@1.23:") + depends_on("go@1.19:", type="build", when="@1.35:") + depends_on("go@1.21:", type="build", when="@1.37:") + depends_on("go@1.22.3:", type="build", when="@1.41:") + depends_on("go@1.22.4:", type="build", when="@1.42:") + depends_on("go@1.22.5:", type="build", when="@1.44:") + depends_on("go@1.23:", type="build", when="@1.46:") phases = ["build", "install"] From 363215717d207c922c21c1309afd49ed135107e5 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Sat, 14 Sep 2024 23:04:46 +0200 Subject: [PATCH 147/687] py-awkward: add v2.6.6 and py-awkward-cpp v35 (#46372) * py-awkward: add v2.6.6 and py-awkward-cpp v35 * Add dependencies on python and numpy * Add a conflict with GCC 14 * Move conflict to py-awkward-cpp * py-awkward: 2.1.1 depends on py-awkward-cpp@12 --------- Co-authored-by: jmcarcell Co-authored-by: Wouter Deconinck --- var/spack/repos/builtin/packages/py-awkward-cpp/package.py | 6 ++++++ var/spack/repos/builtin/packages/py-awkward/package.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-awkward-cpp/package.py b/var/spack/repos/builtin/packages/py-awkward-cpp/package.py index ba43f7a3375a79..cc149dd981e81f 100644 --- a/var/spack/repos/builtin/packages/py-awkward-cpp/package.py +++ b/var/spack/repos/builtin/packages/py-awkward-cpp/package.py @@ -18,6 +18,7 @@ class PyAwkwardCpp(PythonPackage): license("BSD-3-Clause") + version("35", sha256="1f8b112a597bd2438794e1a721a63aa61869fa9598a17ac6bd811ad6f6400d06") version("12", sha256="429f7fcc37a671afa67fe9680f2edc3a123d1c74d399e5889c654f9529f9f8f2") version("11", sha256="02d719a4da7487564b29b8e8b78925a32ac818b6f5572c2f55912b4e0e59c7a4") version("10", sha256="d1c856cb6ef5cf3d4f67506a7efc59239f595635865cc9f4ab18440b8bfb11c6") @@ -33,10 +34,15 @@ class PyAwkwardCpp(PythonPackage): depends_on("cxx", type="build") # generated depends_on("python@3.7:", type=("build", "run")) + depends_on("python@3.8:", type=("build", "run"), when="@19:") depends_on("py-scikit-build-core@0.2.0:+pyproject", when="@11:", type="build") depends_on("py-pybind11", type=("build", "link")) depends_on("py-numpy@1.17.0:", when="@12:", type=("build", "run")) + depends_on("py-numpy@1.18.0:", when="@19:", type=("build", "run")) # older versions depends_on("py-numpy@1.14.5:", when="@:11", type=("build", "run")) depends_on("py-scikit-build-core@0.1.3:+pyproject", when="@:9", type="build") + + # https://github.com/scikit-hep/awkward/issues/3132#issuecomment-2136042870 + conflicts("%gcc@14:", when="@:33") diff --git a/var/spack/repos/builtin/packages/py-awkward/package.py b/var/spack/repos/builtin/packages/py-awkward/package.py index eac61100ab0afa..218c67b60a783d 100644 --- a/var/spack/repos/builtin/packages/py-awkward/package.py +++ b/var/spack/repos/builtin/packages/py-awkward/package.py @@ -18,6 +18,7 @@ class PyAwkward(PythonPackage): license("BSD-3-Clause") version("main", branch="main") + version("2.6.6", sha256="6eeb426ca41b51fe3c36fbe767b90259979b08c14e3562497a71195a447c8b3c") version("2.1.1", sha256="fda8e1634161b8b46b151c074ff0fc631fc0feaec2ec277c4b40a2095110b0dd") version("2.1.0", sha256="73f7a76a1fb43e2557befee54b1381f3e6d90636983cdc54da1c2bcb9ad4c1a8") version("2.0.10", sha256="8dae67afe50f5cf1677b4062f9b29dc7e6893420d0af5a0649364b117a3502af") @@ -66,7 +67,8 @@ class PyAwkward(PythonPackage): ("@2.0.8", "@9"), ("@2.0.9", "@10"), ("@2.0.10", "@11"), - ("@2.1.0:", "@12"), + ("@2.1.0:2.1.1", "@12"), + ("@2.6.6:", "@35"), ] for _awkward, _awkward_cpp in _awkward_to_awkward_cpp_map: depends_on("py-awkward-cpp{}".format(_awkward_cpp), when=_awkward, type=("build", "run")) @@ -74,9 +76,11 @@ class PyAwkward(PythonPackage): depends_on("python@2.7:2.8,3.5:", type=("build", "run")) depends_on("python@3.6:", when="@1.9:", type=("build", "run")) depends_on("python@3.7:", when="@1.10:", type=("build", "run")) + depends_on("python@3.8:", when="@2.3:", type=("build", "run")) depends_on("py-numpy@1.13.1:", when="@:1", type=("build", "run")) depends_on("py-numpy@1.14.5:", when="@2.0", type=("build", "run")) depends_on("py-numpy@1.17.0:", when="@2.1:", type=("build", "run")) + depends_on("py-numpy@1.18.0:", when="@2.3:", type=("build", "run")) depends_on("py-pybind11", type=("build", "link")) depends_on("py-importlib-resources", when="@2: ^python@:3.8", type=("build", "run")) depends_on("py-typing-extensions@4.1:", when="@2: ^python@:3.10", type=("build", "run")) From bcde9a3afbff7bc542792f949d8e31f5424f2c70 Mon Sep 17 00:00:00 2001 From: Debojyoti Ghosh Date: Sun, 15 Sep 2024 08:45:57 -0700 Subject: [PATCH 148/687] Updated HyPar package (#46394) * updated HyPar repo links * updated configure args with and without MPI * updated checksum for zipped source --- var/spack/repos/builtin/packages/hypar/package.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/hypar/package.py b/var/spack/repos/builtin/packages/hypar/package.py index f8c69c30d6a613..3a1b8780873c21 100644 --- a/var/spack/repos/builtin/packages/hypar/package.py +++ b/var/spack/repos/builtin/packages/hypar/package.py @@ -18,14 +18,14 @@ class Hypar(AutotoolsPackage): """ homepage = "http://hypar.github.io/" - url = "https://bitbucket.org/deboghosh/hypar/get/v4.1.tar.gz" - git = "https://bitbucket.org/deboghosh/hypar.git" + url = "https://github.com/debog/hypar/archive/refs/tags/v4.1.tar.gz" + git = "https://github.com/debog/hypar.git" maintainers("debog") tags = ["proxy-app", "ecp-proxy-app"] - version("4.1", sha256="36c11dcfda006115f4656ff73790992e5caea99dbc64776c9db4e0a29b4c60da") + version("4.1", sha256="b3bfc6da28d78e2cc89868a35990617e4f77521b68911772887c2f8d0b1fec21") variant("mpi", default=True, description="Build with MPI support") variant("openmp", default=False, description="Build with OpenMP support") @@ -48,8 +48,9 @@ def configure_args(self): args = [] spec = self.spec if "+mpi" in spec: - args.append("--enable-mpi") args.append("--with-mpi-dir={0}".format(spec["mpi"].prefix)) + else: + args.append("--enable-serial") if "+openmp" in spec: args.append("--enable-omp") if "+scalapack" in spec: From b4e32706db0aba26b1fdf16755694444cb11e89c Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Sun, 15 Sep 2024 20:26:02 +0200 Subject: [PATCH 149/687] fetch_strategy: show the effective URL on checksum validation failure (#46349) --- lib/spack/spack/fetch_strategy.py | 46 +++++++++++++++++-------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index f163f2cb3459fa..82b01121736f89 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -24,6 +24,7 @@ """ import copy import functools +import http.client import os import os.path import re @@ -59,19 +60,6 @@ #: List of all fetch strategies, created by FetchStrategy metaclass. all_strategies = [] -CONTENT_TYPE_MISMATCH_WARNING_TEMPLATE = ( - "The contents of {subject} look like {content_type}. Either the URL" - " you are trying to use does not exist or you have an internet gateway" - " issue. You can remove the bad archive using 'spack clean" - " ', then try again using the correct URL." -) - - -def warn_content_type_mismatch(subject, content_type="HTML"): - tty.warn( - CONTENT_TYPE_MISMATCH_WARNING_TEMPLATE.format(subject=subject, content_type=content_type) - ) - def _needs_stage(fun): """Many methods on fetch strategies require a stage to be set @@ -265,6 +253,7 @@ def __init__(self, *, url: str, checksum: Optional[str] = None, **kwargs) -> Non self.extra_options: dict = kwargs.get("fetch_options", {}) self._curl: Optional[Executable] = None self.extension: Optional[str] = kwargs.get("extension", None) + self._effective_url: Optional[str] = None @property def curl(self) -> Executable: @@ -320,7 +309,13 @@ def _check_headers(self, headers): # redirects properly. content_types = re.findall(r"Content-Type:[^\r\n]+", headers, flags=re.IGNORECASE) if content_types and "text/html" in content_types[-1]: - warn_content_type_mismatch(self.archive_file or "the archive") + msg = ( + f"The contents of {self.archive_file or 'the archive'} fetched from {self.url} " + " looks like HTML. This can indicate a broken URL, or an internet gateway issue." + ) + if self._effective_url != self.url: + msg += f" The URL redirected to {self._effective_url}." + tty.warn(msg) @_needs_stage def _fetch_urllib(self, url): @@ -346,6 +341,12 @@ def _fetch_urllib(self, url): with open(save_file, "wb") as f: shutil.copyfileobj(response, f) + # Save the redirected URL for error messages. Sometimes we're redirected to an arbitrary + # mirror that is broken, leading to spurious download failures. In that case it's helpful + # for users to know which URL was actually fetched. + if isinstance(response, http.client.HTTPResponse): + self._effective_url = response.geturl() + self._check_headers(str(response.headers)) @_needs_stage @@ -465,7 +466,7 @@ def check(self): if not self.digest: raise NoDigestError(f"Attempt to check {self.__class__.__name__} with no digest.") - verify_checksum(self.archive_file, self.digest) + verify_checksum(self.archive_file, self.digest, self.url, self._effective_url) @_needs_stage def reset(self): @@ -1433,21 +1434,26 @@ def expand(self): if len(files) != 1: raise ChecksumError(self, f"Expected a single file in {src_dir}.") - verify_checksum(os.path.join(src_dir, files[0]), self.expanded_sha256) + verify_checksum( + os.path.join(src_dir, files[0]), self.expanded_sha256, self.url, self._effective_url + ) -def verify_checksum(file, digest): +def verify_checksum(file: str, digest: str, url: str, effective_url: Optional[str]) -> None: checker = crypto.Checker(digest) if not checker.check(file): # On failure, provide some information about the file size and # contents, so that we can quickly see what the issue is (redirect # was not followed, empty file, text instead of binary, ...) size, contents = fs.filesummary(file) - raise ChecksumError( - f"{checker.hash_name} checksum failed for {file}", + long_msg = ( f"Expected {digest} but got {checker.sum}. " - f"File size = {size} bytes. Contents = {contents!r}", + f"File size = {size} bytes. Contents = {contents!r}. " + f"URL = {url}" ) + if effective_url and effective_url != url: + long_msg += f", redirected to = {effective_url}" + raise ChecksumError(f"{checker.hash_name} checksum failed for {file}", long_msg) def stable_target(fetcher): From 02320b18f32e9119e83ba620bf19a2bd8265564d Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Sun, 15 Sep 2024 13:30:55 -0500 Subject: [PATCH 150/687] petsc, mfem: update rocm dependency (#46324) * petsc: configure requires rocm-core/rocm_version.h to detect ROCM_VERSION_MAJOR.ROCM_VERSION_MINOR.ROCM_VERSION_PATCH * mfem: add dependency on rocprim (as needed via petsc dependency) In file included from linalg/petsc.cpp:19: In file included from linalg/linalg.hpp:65: In file included from linalg/petsc.hpp:48: In file included from /scratch/svcpetsc/spack.x/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/petsc-3.22.0-7dsxwizo24ycnqvwnsscupuh4i7yusrh/include/petscsystypes.h:530: In file included from /scratch/svcpetsc/spack.x/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/rocthrust-6.1.2-ux5nmi4utw27oaqmz3sfjmhb6hyt5zed/include/thrust/complex.h:30: /scratch/svcpetsc/spack.x/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/rocthrust-6.1.2-ux5nmi4utw27oaqmz3sfjmhb6hyt5zed/include/thrust/detail/type_traits.h:29:10: fatal error: 'rocprim/detail/match_result_type.hpp' file not found 29 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- var/spack/repos/builtin/packages/mfem/package.py | 3 +++ var/spack/repos/builtin/packages/petsc/package.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py index 8efa3fbb3f90e0..df419c1423c11c 100644 --- a/var/spack/repos/builtin/packages/mfem/package.py +++ b/var/spack/repos/builtin/packages/mfem/package.py @@ -973,6 +973,9 @@ def find_optional_library(name, prefix): if "^rocthrust" in spec and not spec["hip"].external: # petsc+rocm needs the rocthrust header path hip_headers += spec["rocthrust"].headers + if "^rocprim" in spec and not spec["hip"].external: + # rocthrust [via petsc+rocm] has a dependency on rocprim + hip_headers += spec["rocprim"].headers if "^hipblas" in spec and not spec["hip"].external: # superlu-dist+rocm needs the hipblas header path hip_headers += spec["hipblas"].headers diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index af2d225246c950..ae06e55a1285a3 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -253,6 +253,7 @@ def check_fortran_compiler(self): depends_on("hip", when="+rocm") with when("+rocm"): + depends_on("rocm-core") depends_on("hipblas") depends_on("hipsparse") depends_on("hipsolver") @@ -602,7 +603,7 @@ def configure_options(self): hip_arch = spec.variants["amdgpu_target"].value options.append("--with-hip-arch={0}".format(hip_arch[0])) hip_pkgs = ["hipsparse", "hipblas", "hipsolver", "rocsparse", "rocsolver", "rocblas"] - hip_ipkgs = hip_pkgs + ["rocthrust", "rocprim"] + hip_ipkgs = hip_pkgs + ["rocthrust", "rocprim", "rocm-core"] hip_lpkgs = hip_pkgs if spec.satisfies("^rocrand@5.1:"): hip_ipkgs.extend(["rocrand"]) From 8225b189855acd895cd5b2e4eba7c0c1cdf86bd3 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 16 Sep 2024 09:15:51 +0200 Subject: [PATCH 151/687] Fix a few circular deps (#46373) --- lib/spack/spack/__init__.py | 52 ++++++++++++++++- lib/spack/spack/binary_distribution.py | 5 +- lib/spack/spack/caches.py | 1 - lib/spack/spack/ci.py | 4 +- lib/spack/spack/cmd/debug.py | 4 +- .../{writers/__init__.py => writers.py} | 58 +++++++++++++++++-- lib/spack/spack/container/writers/docker.py | 34 ----------- .../spack/container/writers/singularity.py | 35 ----------- lib/spack/spack/environment/environment.py | 10 +--- lib/spack/spack/error.py | 12 ++++ lib/spack/spack/main.py | 50 +--------------- lib/spack/spack/oci/oci.py | 6 -- lib/spack/spack/package_base.py | 2 +- lib/spack/spack/patch.py | 22 ++----- lib/spack/spack/platforms/__init__.py | 8 --- lib/spack/spack/reporters/cdash.py | 4 +- lib/spack/spack/solver/asp.py | 15 +---- lib/spack/spack/solver/version_order.py | 21 +++++++ lib/spack/spack/spec.py | 13 ++--- lib/spack/spack/test/cmd/ci.py | 8 +-- lib/spack/spack/test/cmd/debug.py | 5 +- lib/spack/spack/test/concretize.py | 3 +- lib/spack/spack/test/main.py | 15 ++--- lib/spack/spack/test/patch.py | 7 ++- lib/spack/spack/util/environment.py | 26 +++------ lib/spack/spack/util/executable.py | 2 +- 26 files changed, 196 insertions(+), 226 deletions(-) rename lib/spack/spack/container/{writers/__init__.py => writers.py} (86%) delete mode 100644 lib/spack/spack/container/writers/docker.py delete mode 100644 lib/spack/spack/container/writers/singularity.py create mode 100644 lib/spack/spack/solver/version_order.py diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index b37c63b5bd955f..cf7d62c7fd02e1 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -3,6 +3,13 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os +import re +from typing import Optional + +import spack.paths +import spack.util.git + #: PEP440 canonical ... string __version__ = "0.23.0.dev0" spack_version = __version__ @@ -19,4 +26,47 @@ def __try_int(v): spack_version_info = tuple([__try_int(v) for v in __version__.split(".")]) -__all__ = ["spack_version_info", "spack_version"] +def get_spack_commit() -> Optional[str]: + """Get the Spack git commit sha. + + Returns: + (str or None) the commit sha if available, otherwise None + """ + git_path = os.path.join(spack.paths.prefix, ".git") + if not os.path.exists(git_path): + return None + + git = spack.util.git.git() + if not git: + return None + + rev = git( + "-C", + spack.paths.prefix, + "rev-parse", + "HEAD", + output=str, + error=os.devnull, + fail_on_error=False, + ) + if git.returncode != 0: + return None + + match = re.match(r"[a-f\d]{7,}$", rev) + return match.group(0) if match else None + + +def get_version() -> str: + """Get a descriptive version of this instance of Spack. + + Outputs ' ()'. + + The commit sha is only added when available. + """ + commit = get_spack_commit() + if commit: + return f"{spack_version} ({commit})" + return spack_version + + +__all__ = ["spack_version_info", "spack_version", "get_version", "get_spack_commit"] diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 15189f9d438f62..61db2bebe12d1c 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -44,6 +44,7 @@ import spack.oci.image import spack.oci.oci import spack.oci.opener +import spack.paths import spack.platforms import spack.relocate as relocate import spack.repo @@ -1447,7 +1448,9 @@ def _oci_push_pkg_blob( filename = os.path.join(tmpdir, f"{spec.dag_hash()}.tar.gz") # Create an oci.image.layer aka tarball of the package - compressed_tarfile_checksum, tarfile_checksum = spack.oci.oci.create_tarball(spec, filename) + compressed_tarfile_checksum, tarfile_checksum = _do_create_tarball( + filename, spec.prefix, get_buildinfo_dict(spec) + ) blob = spack.oci.oci.Blob( Digest.from_sha256(compressed_tarfile_checksum), diff --git a/lib/spack/spack/caches.py b/lib/spack/spack/caches.py index eda141ed15d544..1ffef9343b0f42 100644 --- a/lib/spack/spack/caches.py +++ b/lib/spack/spack/caches.py @@ -13,7 +13,6 @@ import spack.config import spack.error import spack.fetch_strategy -import spack.mirror import spack.paths import spack.util.file_cache import spack.util.path diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index bc661e09701aed..c40b88d9e2e1c7 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -1219,8 +1219,8 @@ def main_script_replacements(cmd): # Capture the version of Spack used to generate the pipeline, that can be # passed to `git checkout` for version consistency. If we aren't in a Git # repository, presume we are a Spack release and use the Git tag instead. - spack_version = spack.main.get_version() - version_to_clone = spack.main.get_spack_commit() or f"v{spack.spack_version}" + spack_version = spack.get_version() + version_to_clone = spack.get_spack_commit() or f"v{spack.spack_version}" output_object["variables"] = { "SPACK_ARTIFACTS_ROOT": rel_artifacts_root, diff --git a/lib/spack/spack/cmd/debug.py b/lib/spack/spack/cmd/debug.py index b1d33eb67df2a5..9a93cc0a14df32 100644 --- a/lib/spack/spack/cmd/debug.py +++ b/lib/spack/spack/cmd/debug.py @@ -13,11 +13,11 @@ import llnl.util.tty as tty from llnl.util.filesystem import working_dir +import spack import spack.config import spack.paths import spack.platforms import spack.util.git -from spack.main import get_version from spack.util.executable import which description = "debugging commands for troubleshooting Spack" @@ -89,7 +89,7 @@ def report(args): host_os = host_platform.operating_system("frontend") host_target = host_platform.target("frontend") architecture = spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target))) - print("* **Spack:**", get_version()) + print("* **Spack:**", spack.get_version()) print("* **Python:**", platform.python_version()) print("* **Platform:**", architecture) diff --git a/lib/spack/spack/container/writers/__init__.py b/lib/spack/spack/container/writers.py similarity index 86% rename from lib/spack/spack/container/writers/__init__.py rename to lib/spack/spack/container/writers.py index eabc25d2187133..0b5d14157c71de 100644 --- a/lib/spack/spack/container/writers/__init__.py +++ b/lib/spack/spack/container/writers.py @@ -6,6 +6,7 @@ convenience functions. """ import copy +import shlex from collections import namedtuple from typing import Optional @@ -15,7 +16,7 @@ import spack.tengine as tengine import spack.util.spack_yaml as syaml -from ..images import ( +from .images import ( bootstrap_template_for, build_info, checkout_command, @@ -308,7 +309,54 @@ def __call__(self): return t.render(**self.to_dict()) -# Import after function definition all the modules in this package, -# so that registration of writers will happen automatically -from . import docker # noqa: F401 E402 -from . import singularity # noqa: F401 E402 +@writer("docker") +class DockerContext(PathContext): + """Context used to instantiate a Dockerfile""" + + #: Name of the template used for Dockerfiles + template_name = "container/Dockerfile" + + @tengine.context_property + def manifest(self): + manifest_str = super().manifest + # Docker doesn't support HEREDOC, so we need to resort to + # a horrible echo trick to have the manifest in the Dockerfile + echoed_lines = [] + for idx, line in enumerate(manifest_str.split("\n")): + quoted_line = shlex.quote(line) + if idx == 0: + echoed_lines.append("&& (echo " + quoted_line + " \\") + continue + echoed_lines.append("&& echo " + quoted_line + " \\") + + echoed_lines[-1] = echoed_lines[-1].replace(" \\", ")") + + return "\n".join(echoed_lines) + + +@writer("singularity") +class SingularityContext(PathContext): + """Context used to instantiate a Singularity definition file""" + + #: Name of the template used for Singularity definition files + template_name = "container/singularity.def" + + @property + def singularity_config(self): + return self.container_config.get("singularity", {}) + + @tengine.context_property + def runscript(self): + return self.singularity_config.get("runscript", "") + + @tengine.context_property + def startscript(self): + return self.singularity_config.get("startscript", "") + + @tengine.context_property + def test(self): + return self.singularity_config.get("test", "") + + @tengine.context_property + def help(self): + return self.singularity_config.get("help", "") diff --git a/lib/spack/spack/container/writers/docker.py b/lib/spack/spack/container/writers/docker.py deleted file mode 100644 index 287ef9d1ac79cc..00000000000000 --- a/lib/spack/spack/container/writers/docker.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2013-2024 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) -import shlex - -import spack.tengine as tengine - -from . import PathContext, writer - - -@writer("docker") -class DockerContext(PathContext): - """Context used to instantiate a Dockerfile""" - - #: Name of the template used for Dockerfiles - template_name = "container/Dockerfile" - - @tengine.context_property - def manifest(self): - manifest_str = super().manifest - # Docker doesn't support HEREDOC, so we need to resort to - # a horrible echo trick to have the manifest in the Dockerfile - echoed_lines = [] - for idx, line in enumerate(manifest_str.split("\n")): - quoted_line = shlex.quote(line) - if idx == 0: - echoed_lines.append("&& (echo " + quoted_line + " \\") - continue - echoed_lines.append("&& echo " + quoted_line + " \\") - - echoed_lines[-1] = echoed_lines[-1].replace(" \\", ")") - - return "\n".join(echoed_lines) diff --git a/lib/spack/spack/container/writers/singularity.py b/lib/spack/spack/container/writers/singularity.py deleted file mode 100644 index 5cbb055fd3fd5f..00000000000000 --- a/lib/spack/spack/container/writers/singularity.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2013-2024 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) -import spack.tengine as tengine - -from . import PathContext, writer - - -@writer("singularity") -class SingularityContext(PathContext): - """Context used to instantiate a Singularity definition file""" - - #: Name of the template used for Singularity definition files - template_name = "container/singularity.def" - - @property - def singularity_config(self): - return self.container_config.get("singularity", {}) - - @tengine.context_property - def runscript(self): - return self.singularity_config.get("runscript", "") - - @tengine.context_property - def startscript(self): - return self.singularity_config.get("startscript", "") - - @tengine.context_property - def test(self): - return self.singularity_config.get("test", "") - - @tengine.context_property - def help(self): - return self.singularity_config.get("help", "") diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index f6f4ffa0adf865..727fd7f234f7e0 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -24,25 +24,20 @@ from llnl.util.link_tree import ConflictingSpecsError from llnl.util.symlink import readlink, symlink +import spack import spack.caches -import spack.cmd import spack.compilers import spack.concretize import spack.config import spack.deptypes as dt import spack.error -import spack.fetch_strategy import spack.filesystem_view as fsv import spack.hash_types as ht -import spack.hooks -import spack.main import spack.paths import spack.repo import spack.schema.env import spack.spec -import spack.stage import spack.store -import spack.subprocess_context import spack.user_environment as uenv import spack.util.cpus import spack.util.environment @@ -53,7 +48,6 @@ import spack.util.spack_json as sjson import spack.util.spack_yaml as syaml import spack.util.url -import spack.version from spack import traverse from spack.installer import PackageInstaller from spack.schema.env import TOP_LEVEL_KEY @@ -2179,7 +2173,7 @@ def _to_lockfile_dict(self): root_specs = self._concrete_roots_dict() spack_dict = {"version": spack.spack_version} - spack_commit = spack.main.get_spack_commit() + spack_commit = spack.get_spack_commit() if spack_commit: spack_dict["type"] = "git" spack_dict["commit"] = spack_commit diff --git a/lib/spack/spack/error.py b/lib/spack/spack/error.py index 804dc6867b20f1..ea37d5787b9766 100644 --- a/lib/spack/spack/error.py +++ b/lib/spack/spack/error.py @@ -132,3 +132,15 @@ def __init__(self, provided, required, constraint_type): class FetchError(SpackError): """Superclass for fetch-related errors.""" + + +class NoSuchPatchError(SpackError): + """Raised when a patch file doesn't exist.""" + + +class PatchDirectiveError(SpackError): + """Raised when the wrong arguments are suppled to the patch directive.""" + + +class PatchLookupError(NoSuchPatchError): + """Raised when a patch file cannot be located from sha256.""" diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 78fda27c4628c4..9ca5453f23ce1c 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -32,6 +32,7 @@ import llnl.util.tty.color as color from llnl.util.tty.log import log_output +import spack import spack.cmd import spack.config import spack.environment as ev @@ -44,8 +45,6 @@ import spack.store import spack.util.debug import spack.util.environment -import spack.util.git -import spack.util.path from spack.error import SpackError #: names of profile statistics @@ -122,51 +121,6 @@ def add_all_commands(parser): parser.add_command(cmd) -def get_spack_commit(): - """Get the Spack git commit sha. - - Returns: - (str or None) the commit sha if available, otherwise None - """ - git_path = os.path.join(spack.paths.prefix, ".git") - if not os.path.exists(git_path): - return None - - git = spack.util.git.git() - if not git: - return None - - rev = git( - "-C", - spack.paths.prefix, - "rev-parse", - "HEAD", - output=str, - error=os.devnull, - fail_on_error=False, - ) - if git.returncode != 0: - return None - - match = re.match(r"[a-f\d]{7,}$", rev) - return match.group(0) if match else None - - -def get_version(): - """Get a descriptive version of this instance of Spack. - - Outputs ' ()'. - - The commit sha is only added when available. - """ - version = spack.spack_version - commit = get_spack_commit() - if commit: - version += " ({0})".format(commit) - - return version - - def index_commands(): """create an index of commands by section for this help level""" index = {} @@ -954,7 +908,7 @@ def _main(argv=None): # version is special as it does not require a command or loading and additional infrastructure if args.version: - print(get_version()) + print(spack.get_version()) return 0 # ------------------------------------------------------------------------ diff --git a/lib/spack/spack/oci/oci.py b/lib/spack/spack/oci/oci.py index cacb53e08c0baf..ae70e287a6de96 100644 --- a/lib/spack/spack/oci/oci.py +++ b/lib/spack/spack/oci/oci.py @@ -15,7 +15,6 @@ import llnl.util.tty as tty -import spack.binary_distribution import spack.config import spack.error import spack.fetch_strategy @@ -37,11 +36,6 @@ class Blob(NamedTuple): size: int -def create_tarball(spec: spack.spec.Spec, tarfile_path): - buildinfo = spack.binary_distribution.get_buildinfo_dict(spec) - return spack.binary_distribution._do_create_tarball(tarfile_path, spec.prefix, buildinfo) - - def with_query_param(url: str, param: str, value: str) -> str: """Add a query parameter to a URL diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index f3cbcbe4a624c4..d157ab4a66c134 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -65,6 +65,7 @@ install_test_root, ) from spack.installer import InstallError, PackageInstaller +from spack.solver.version_order import concretization_version_order from spack.stage import DevelopStage, ResourceStage, Stage, StageComposite, compute_stage_name from spack.util.executable import ProcessError, which from spack.util.package_hash import package_hash @@ -116,7 +117,6 @@ def preferred_version(pkg: "PackageBase"): Arguments: pkg: The package whose versions are to be assessed. """ - from spack.solver.asp import concretization_version_order version, _ = max(pkg.versions.items(), key=concretization_version_order) return version diff --git a/lib/spack/spack/patch.py b/lib/spack/spack/patch.py index 6a57f49bb07c25..50393ecfad11e8 100644 --- a/lib/spack/spack/patch.py +++ b/lib/spack/spack/patch.py @@ -113,7 +113,7 @@ def apply(self, stage: "spack.stage.Stage") -> None: stage: stage where source code lives """ if not self.path or not os.path.isfile(self.path): - raise NoSuchPatchError(f"No such patch: {self.path}") + raise spack.error.NoSuchPatchError(f"No such patch: {self.path}") apply_patch(stage, self.path, self.level, self.working_dir, self.reverse) @@ -275,14 +275,14 @@ def __init__( self.ordering_key = ordering_key if allowed_archive(self.url) and not archive_sha256: - raise PatchDirectiveError( + raise spack.error.PatchDirectiveError( "Compressed patches require 'archive_sha256' " "and patch 'sha256' attributes: %s" % self.url ) self.archive_sha256 = archive_sha256 if not sha256: - raise PatchDirectiveError("URL patches require a sha256 checksum") + raise spack.error.PatchDirectiveError("URL patches require a sha256 checksum") self.sha256 = sha256 def apply(self, stage: "spack.stage.Stage") -> None: @@ -480,7 +480,7 @@ def patch_for_package(self, sha256: str, pkg: "spack.package_base.PackageBase") """ sha_index = self.index.get(sha256) if not sha_index: - raise PatchLookupError( + raise spack.error.PatchLookupError( f"Couldn't find patch for package {pkg.fullname} with sha256: {sha256}" ) @@ -490,7 +490,7 @@ def patch_for_package(self, sha256: str, pkg: "spack.package_base.PackageBase") if patch_dict: break else: - raise PatchLookupError( + raise spack.error.PatchLookupError( f"Couldn't find patch for package {pkg.fullname} with sha256: {sha256}" ) @@ -573,15 +573,3 @@ def _index_patches( index[patch.sha256] = {dspec_cls.fullname: patch_dict} return index - - -class NoSuchPatchError(spack.error.SpackError): - """Raised when a patch file doesn't exist.""" - - -class PatchLookupError(NoSuchPatchError): - """Raised when a patch file cannot be located from sha256.""" - - -class PatchDirectiveError(spack.error.SpackError): - """Raised when the wrong arguments are suppled to the patch directive.""" diff --git a/lib/spack/spack/platforms/__init__.py b/lib/spack/spack/platforms/__init__.py index e49f87b2a70f84..7b7a668fb1a184 100644 --- a/lib/spack/spack/platforms/__init__.py +++ b/lib/spack/spack/platforms/__init__.py @@ -51,7 +51,6 @@ def __call__(self): def use_platform(new_platform): global host - import spack.compilers import spack.config msg = '"{0}" must be an instance of Platform' @@ -61,16 +60,9 @@ def use_platform(new_platform): try: host = _PickleableCallable(new_platform) - - # Clear configuration and compiler caches spack.config.CONFIG.clear_caches() - spack.compilers._cache_config_files = [] - yield new_platform finally: host = original_host_fn - - # Clear configuration and compiler caches spack.config.CONFIG.clear_caches() - spack.compilers._cache_config_files = [] diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py index 0c140a488d67b1..5d50f05c60e682 100644 --- a/lib/spack/spack/reporters/cdash.py +++ b/lib/spack/spack/reporters/cdash.py @@ -19,9 +19,11 @@ import llnl.util.tty as tty from llnl.util.filesystem import working_dir +import spack import spack.build_environment import spack.fetch_strategy import spack.package_base +import spack.paths import spack.platforms import spack.util.git from spack.error import SpackError @@ -119,7 +121,7 @@ def __init__(self, configuration: CDashConfiguration): git = spack.util.git.git() with working_dir(spack.paths.spack_root): self.revision = git("rev-parse", "HEAD", output=str).strip() - self.generator = "spack-{0}".format(spack.main.get_version()) + self.generator = "spack-{0}".format(spack.get_version()) self.multiple_packages = False def report_build_name(self, pkg_name): diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index ba04e7cb339cc1..af6d3c94f7eabf 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -64,6 +64,7 @@ parse_term, ) from .counter import FullDuplicatesCounter, MinimalDuplicatesCounter, NoDuplicatesCounter +from .version_order import concretization_version_order GitOrStandardVersion = Union[spack.version.GitVersion, spack.version.StandardVersion] @@ -579,20 +580,6 @@ def _is_checksummed_version(version_info: Tuple[GitOrStandardVersion, dict]): return _is_checksummed_git_version(version) -def concretization_version_order(version_info: Tuple[GitOrStandardVersion, dict]): - """Version order key for concretization, where preferred > not preferred, - not deprecated > deprecated, finite > any infinite component; only if all are - the same, do we use default version ordering.""" - version, info = version_info - return ( - info.get("preferred", False), - not info.get("deprecated", False), - not version.isdevelop(), - not version.is_prerelease(), - version, - ) - - def _spec_with_default_name(spec_str, name): """Return a spec with a default name if none is provided, used for requirement specs""" spec = spack.spec.Spec(spec_str) diff --git a/lib/spack/spack/solver/version_order.py b/lib/spack/spack/solver/version_order.py new file mode 100644 index 00000000000000..23d3e390ce0838 --- /dev/null +++ b/lib/spack/spack/solver/version_order.py @@ -0,0 +1,21 @@ +# Copyright 2013-2024 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 typing import Tuple, Union + +from spack.version import GitVersion, StandardVersion + + +def concretization_version_order(version_info: Tuple[Union[GitVersion, StandardVersion], dict]): + """Version order key for concretization, where preferred > not preferred, + not deprecated > deprecated, finite > any infinite component; only if all are + the same, do we use default version ordering.""" + version, info = version_info + return ( + info.get("preferred", False), + not info.get("deprecated", False), + not version.isdevelop(), + not version.is_prerelease(), + version, + ) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 3d5a1ce3203ad3..be1d08399e7496 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -68,6 +68,7 @@ import llnl.util.tty as tty import llnl.util.tty.color as clr +import spack import spack.compiler import spack.compilers import spack.config @@ -75,7 +76,6 @@ import spack.error import spack.hash_types as ht import spack.parser -import spack.patch import spack.paths import spack.platforms import spack.provider_index @@ -1307,7 +1307,7 @@ def copy(self, *args, **kwargs): def tree( - specs: List["spack.spec.Spec"], + specs: List["Spec"], *, color: Optional[bool] = None, depth: bool = False, @@ -2032,7 +2032,7 @@ def _lookup_hash(self): raise InvalidHashError(self, self.abstract_hash) if len(matches) != 1: - raise spack.spec.AmbiguousHashError( + raise AmbiguousHashError( f"Multiple packages specify hash beginning '{self.abstract_hash}'.", *matches ) @@ -3464,7 +3464,7 @@ def patches(self): pkg_cls = spack.repo.PATH.get_pkg_class(self.name) try: patch = index.patch_for_package(sha256, pkg_cls) - except spack.patch.PatchLookupError as e: + except spack.error.PatchLookupError as e: raise spack.error.SpecError( f"{e}. This usually means the patch was modified or removed. " "To fix this, either reconcretize or use the original package " @@ -4535,7 +4535,7 @@ def merge_abstract_anonymous_specs(*abstract_specs: Spec): Args: *abstract_specs: abstract specs to be merged """ - merged_spec = spack.spec.Spec() + merged_spec = Spec() for current_spec_constraint in abstract_specs: merged_spec.constrain(current_spec_constraint, deps=False) @@ -4890,7 +4890,6 @@ def get_host_environment_metadata() -> Dict[str, str]: """Get the host environment, reduce to a subset that we can store in the install directory, and add the spack version. """ - import spack.main environ = get_host_environment() return { @@ -4898,7 +4897,7 @@ def get_host_environment_metadata() -> Dict[str, str]: "platform": environ["platform"], "host_target": environ["target"], "hostname": environ["hostname"], - "spack_version": spack.main.get_version(), + "spack_version": spack.get_version(), "kernel_version": platform.version(), } diff --git a/lib/spack/spack/test/cmd/ci.py b/lib/spack/spack/test/cmd/ci.py index 0eaabfd5a718ed..e2d87d5bb0a758 100644 --- a/lib/spack/spack/test/cmd/ci.py +++ b/lib/spack/spack/test/cmd/ci.py @@ -305,8 +305,8 @@ def test_ci_generate_with_custom_settings( ci_generate_test, tmp_path, mock_binary_index, monkeypatch ): """Test use of user-provided scripts and attributes""" - monkeypatch.setattr(spack.main, "get_version", lambda: "0.15.3") - monkeypatch.setattr(spack.main, "get_spack_commit", lambda: "big ol commit sha") + monkeypatch.setattr(spack, "get_version", lambda: "0.15.3") + monkeypatch.setattr(spack, "get_spack_commit", lambda: "big ol commit sha") spack_yaml, outputfile, _ = ci_generate_test( f"""\ spack: @@ -1040,8 +1040,8 @@ def test_ci_generate_override_runner_attrs( inherit them from the top level, as well as when we override one or more at the runner level""" monkeypatch.setattr(spack, "spack_version", "0.20.0.test0") - monkeypatch.setattr(spack.main, "get_version", lambda: "0.20.0.test0 (blah)") - monkeypatch.setattr(spack.main, "get_spack_commit", lambda: git_version) + monkeypatch.setattr(spack, "get_version", lambda: "0.20.0.test0 (blah)") + monkeypatch.setattr(spack, "get_spack_commit", lambda: git_version) spack_yaml, outputfile, _ = ci_generate_test( f"""\ spack: diff --git a/lib/spack/spack/test/cmd/debug.py b/lib/spack/spack/test/cmd/debug.py index 55d0928fbde53b..4e16cc92c96ca9 100644 --- a/lib/spack/spack/test/cmd/debug.py +++ b/lib/spack/spack/test/cmd/debug.py @@ -9,9 +9,10 @@ import pytest +import spack import spack.config import spack.platforms -from spack.main import SpackCommand, get_version +from spack.main import SpackCommand from spack.util.executable import which debug = SpackCommand("debug") @@ -55,6 +56,6 @@ def test_report(): host_target = host_platform.target("frontend") architecture = spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target))) - assert get_version() in out + assert spack.get_version() in out assert platform.python_version() in out assert str(architecture) in out diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 4843861730bb21..7349e4227d744f 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -25,6 +25,7 @@ import spack.platforms import spack.repo import spack.solver.asp +import spack.solver.version_order import spack.store import spack.util.file_cache import spack.util.libc @@ -2928,7 +2929,7 @@ def test_concretization_version_order(): result = [ v for v, _ in sorted( - versions, key=spack.solver.asp.concretization_version_order, reverse=True + versions, key=spack.solver.version_order.concretization_version_order, reverse=True ) ] assert result == [ diff --git a/lib/spack/spack/test/main.py b/lib/spack/spack/test/main.py index ed66df4c88d1fe..5c64865e56d169 100644 --- a/lib/spack/spack/test/main.py +++ b/lib/spack/spack/test/main.py @@ -8,10 +8,11 @@ import llnl.util.filesystem as fs +import spack import spack.paths import spack.util.executable as exe import spack.util.git -from spack.main import get_version, main +from spack.main import main pytestmark = pytest.mark.not_on_windows( "Test functionality supported but tests are failing on Win" @@ -29,7 +30,7 @@ def test_version_git_nonsense_output(tmpdir, working_env, monkeypatch): fs.set_executable(git) monkeypatch.setattr(spack.util.git, "git", lambda: exe.which(git)) - assert spack.spack_version == get_version() + assert spack.spack_version == spack.get_version() def test_version_git_fails(tmpdir, working_env, monkeypatch): @@ -44,7 +45,7 @@ def test_version_git_fails(tmpdir, working_env, monkeypatch): fs.set_executable(git) monkeypatch.setattr(spack.util.git, "git", lambda: exe.which(git)) - assert spack.spack_version == get_version() + assert spack.spack_version == spack.get_version() def test_git_sha_output(tmpdir, working_env, monkeypatch): @@ -62,17 +63,17 @@ def test_git_sha_output(tmpdir, working_env, monkeypatch): monkeypatch.setattr(spack.util.git, "git", lambda: exe.which(git)) expected = "{0} ({1})".format(spack.spack_version, sha) - assert expected == get_version() + assert expected == spack.get_version() def test_get_version_no_repo(tmpdir, monkeypatch): monkeypatch.setattr(spack.paths, "prefix", str(tmpdir)) - assert spack.spack_version == get_version() + assert spack.spack_version == spack.get_version() def test_get_version_no_git(tmpdir, working_env, monkeypatch): monkeypatch.setattr(spack.util.git, "git", lambda: None) - assert spack.spack_version == get_version() + assert spack.spack_version == spack.get_version() def test_main_calls_get_version(tmpdir, capsys, working_env, monkeypatch): @@ -96,4 +97,4 @@ def test_get_version_bad_git(tmpdir, working_env, monkeypatch): fs.set_executable(bad_git) monkeypatch.setattr(spack.util.git, "git", lambda: exe.which(bad_git)) - assert spack.spack_version == get_version() + assert spack.spack_version == spack.get_version() diff --git a/lib/spack/spack/test/patch.py b/lib/spack/spack/test/patch.py index 4ec4cec7e79d67..04bce857c54e70 100644 --- a/lib/spack/spack/test/patch.py +++ b/lib/spack/spack/test/patch.py @@ -13,6 +13,7 @@ from llnl.util.filesystem import mkdirp, touch, working_dir +import spack.error import spack.patch import spack.paths import spack.repo @@ -434,7 +435,7 @@ def test_patch_no_file(): patch = spack.patch.Patch(fp, "nonexistent_file", 0, "") patch.path = "test" - with pytest.raises(spack.patch.NoSuchPatchError, match="No such patch:"): + with pytest.raises(spack.error.NoSuchPatchError, match="No such patch:"): patch.apply("") @@ -444,10 +445,10 @@ def test_patch_no_sha256(): fp = FakePackage("fake-package", "test", "fake-package") url = url_util.path_to_file_url("foo.tgz") match = "Compressed patches require 'archive_sha256' and patch 'sha256' attributes: file://" - with pytest.raises(spack.patch.PatchDirectiveError, match=match): + with pytest.raises(spack.error.PatchDirectiveError, match=match): spack.patch.UrlPatch(fp, url, sha256="", archive_sha256="") match = "URL patches require a sha256 checksum" - with pytest.raises(spack.patch.PatchDirectiveError, match=match): + with pytest.raises(spack.error.PatchDirectiveError, match=match): spack.patch.UrlPatch(fp, url, sha256="", archive_sha256="abc") diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index 12b2bbb1d0b1e1..2e0ef7c9b96be2 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -12,6 +12,7 @@ import pickle import re import shlex +import subprocess import sys from functools import wraps from typing import Any, Callable, Dict, List, MutableMapping, Optional, Tuple, Union @@ -20,8 +21,6 @@ from llnl.util import tty from llnl.util.lang import dedupe -from .executable import Executable, which - if sys.platform == "win32": SYSTEM_PATHS = [ "C:\\", @@ -1034,8 +1033,6 @@ def environment_after_sourcing_files( source_command = kwargs.get("source_command", "source") concatenate_on_success = kwargs.get("concatenate_on_success", "&&") - shell = Executable(shell_cmd) - def _source_single_file(file_and_args, environment): shell_options_list = shell_options.split() @@ -1043,26 +1040,21 @@ def _source_single_file(file_and_args, environment): source_file.extend(x for x in file_and_args) source_file = " ".join(source_file) - # If the environment contains 'python' use it, if not - # go with sys.executable. Below we just need a working - # Python interpreter, not necessarily sys.executable. - python_cmd = which("python3", "python", "python2") - python_cmd = python_cmd.path if python_cmd else sys.executable - dump_cmd = "import os, json; print(json.dumps(dict(os.environ)))" - dump_environment_cmd = python_cmd + f' -E -c "{dump_cmd}"' + dump_environment_cmd = sys.executable + f' -E -c "{dump_cmd}"' # Try to source the file source_file_arguments = " ".join( [source_file, suppress_output, concatenate_on_success, dump_environment_cmd] ) - output = shell( - *shell_options_list, - source_file_arguments, - output=str, + + with subprocess.Popen( + [shell_cmd, *shell_options_list, source_file_arguments], env=environment, - ignore_quotes=True, - ) + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) as shell: + output, _ = shell.communicate() return json.loads(output) diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index 92933221cad5af..0c1901cb1a9368 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -12,6 +12,7 @@ import llnl.util.tty as tty import spack.error +from spack.util.environment import EnvironmentModifications __all__ = ["Executable", "which", "ProcessError"] @@ -27,7 +28,6 @@ def __init__(self, name): self.exe = [file_path] self.default_env = {} - from spack.util.environment import EnvironmentModifications # no cycle self.default_envmod = EnvironmentModifications() self.returncode = None From ef0e54726d0deeb36c10f527f07301ee0e2e7915 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 16 Sep 2024 12:12:38 +0200 Subject: [PATCH 152/687] freexl: add missing deps (#46330) --- var/spack/repos/builtin/packages/freexl/package.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/freexl/package.py b/var/spack/repos/builtin/packages/freexl/package.py index 41f593df26e75c..3288dd477e228e 100644 --- a/var/spack/repos/builtin/packages/freexl/package.py +++ b/var/spack/repos/builtin/packages/freexl/package.py @@ -17,6 +17,16 @@ class Freexl(AutotoolsPackage): version("1.0.6", sha256="3de8b57a3d130cb2881ea52d3aa9ce1feedb1b57b7daa4eb37f751404f90fc22") version("1.0.5", sha256="3dc9b150d218b0e280a3d6a41d93c1e45f4d7155829d75f1e5bf3e0b0de6750d") - depends_on("c", type="build") # generated + depends_on("c", type="build") depends_on("minizip", when="@2:") + depends_on("expat", type="link") + depends_on("iconv", type="link") + + def flag_handler(self, name, flags): + # avoid that header is taken from libiconv, but library from libc -- configure script is + # missing a compile + link test. + iconv = self.spec["iconv"] + if name == "ldflags" and iconv.name == "libiconv": + flags.append(iconv.libs.ld_flags) + return (flags, None, None) From 55e0ef1e647ff1bbaab6c39589a6f9225fde64b0 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 16 Sep 2024 12:54:16 +0200 Subject: [PATCH 153/687] Add missing & remove redundant imports (#46407) --- lib/spack/spack/audit.py | 1 - lib/spack/spack/binary_distribution.py | 2 -- lib/spack/spack/bootstrap/core.py | 6 ------ lib/spack/spack/bootstrap/environment.py | 2 -- lib/spack/spack/build_environment.py | 4 ---- lib/spack/spack/caches.py | 1 - lib/spack/spack/ci.py | 1 - lib/spack/spack/cmd/bootstrap.py | 1 - lib/spack/spack/cmd/buildcache.py | 5 ----- lib/spack/spack/cmd/checksum.py | 1 - lib/spack/spack/cmd/ci.py | 1 - lib/spack/spack/cmd/clean.py | 3 --- lib/spack/spack/cmd/common/arguments.py | 1 - lib/spack/spack/cmd/common/env_utility.py | 1 - lib/spack/spack/cmd/config.py | 2 -- lib/spack/spack/cmd/create.py | 1 - lib/spack/spack/cmd/debug.py | 1 - lib/spack/spack/cmd/dependencies.py | 1 - lib/spack/spack/cmd/develop.py | 1 - lib/spack/spack/cmd/diff.py | 1 - lib/spack/spack/cmd/env.py | 4 ---- lib/spack/spack/cmd/external.py | 1 - lib/spack/spack/cmd/fetch.py | 1 - lib/spack/spack/cmd/find.py | 1 - lib/spack/spack/cmd/install.py | 2 -- lib/spack/spack/cmd/load.py | 2 -- lib/spack/spack/cmd/mark.py | 3 --- lib/spack/spack/cmd/mirror.py | 1 - lib/spack/spack/cmd/patch.py | 1 - lib/spack/spack/cmd/pkg.py | 1 - lib/spack/spack/cmd/restage.py | 1 - lib/spack/spack/cmd/solve.py | 1 - lib/spack/spack/cmd/stage.py | 2 -- lib/spack/spack/cmd/tags.py | 1 - lib/spack/spack/cmd/test.py | 1 - lib/spack/spack/cmd/unload.py | 1 - lib/spack/spack/compilers/__init__.py | 1 - lib/spack/spack/compilers/apple_clang.py | 1 - lib/spack/spack/concretize.py | 8 -------- lib/spack/spack/directives.py | 2 -- lib/spack/spack/fetch_strategy.py | 1 - lib/spack/spack/install_test.py | 15 ++++++++++++--- lib/spack/spack/installer.py | 1 - lib/spack/spack/main.py | 1 - lib/spack/spack/oci/oci.py | 6 ------ lib/spack/spack/oci/opener.py | 1 - lib/spack/spack/package_base.py | 3 --- lib/spack/spack/relocate.py | 4 ---- lib/spack/spack/repo.py | 1 - lib/spack/spack/report.py | 1 - lib/spack/spack/reporters/cdash.py | 3 --- lib/spack/spack/rewiring.py | 2 -- lib/spack/spack/schema/env.py | 1 - lib/spack/spack/solver/asp.py | 3 --- lib/spack/spack/spec.py | 1 - lib/spack/spack/stage.py | 1 - lib/spack/spack/test/bindist.py | 1 - lib/spack/spack/test/build_distribution.py | 2 -- lib/spack/spack/test/build_systems.py | 1 - lib/spack/spack/test/cc.py | 1 - lib/spack/spack/test/ci.py | 2 -- lib/spack/spack/test/cmd/blame.py | 1 - lib/spack/spack/test/cmd/buildcache.py | 1 - lib/spack/spack/test/cmd/ci.py | 2 -- lib/spack/spack/test/cmd/create.py | 1 - lib/spack/spack/test/cmd/debug.py | 1 - lib/spack/spack/test/cmd/dev_build.py | 1 - lib/spack/spack/test/cmd/diff.py | 2 -- lib/spack/spack/test/cmd/edit.py | 1 - lib/spack/spack/test/cmd/gpg.py | 1 - lib/spack/spack/test/cmd/install.py | 1 - lib/spack/spack/test/cmd/load.py | 1 - lib/spack/spack/test/cmd/stage.py | 2 -- lib/spack/spack/test/cmd/test.py | 3 --- lib/spack/spack/test/compilers/basics.py | 1 - lib/spack/spack/test/concretize.py | 1 - lib/spack/spack/test/concretize_requirements.py | 1 - lib/spack/spack/test/config.py | 3 --- lib/spack/spack/test/conftest.py | 5 ----- lib/spack/spack/test/container/cli.py | 1 - lib/spack/spack/test/cray_manifest.py | 1 - lib/spack/spack/test/flag_handlers.py | 1 - lib/spack/spack/test/flag_mixing.py | 4 ---- lib/spack/spack/test/gcs_fetch.py | 2 -- lib/spack/spack/test/graph.py | 1 - lib/spack/spack/test/hg_fetch.py | 1 - lib/spack/spack/test/installer.py | 4 ---- lib/spack/spack/test/mirror.py | 1 - lib/spack/spack/test/modules/common.py | 1 - lib/spack/spack/test/modules/conftest.py | 4 ---- lib/spack/spack/test/multimethod.py | 1 - lib/spack/spack/test/oci/integration_test.py | 1 - lib/spack/spack/test/packaging.py | 2 -- lib/spack/spack/test/patch.py | 1 - lib/spack/spack/test/relocate.py | 5 ----- lib/spack/spack/test/reporters.py | 1 - lib/spack/spack/test/sbang.py | 1 - lib/spack/spack/test/solver/intermediate.py | 1 - lib/spack/spack/test/spec_dag.py | 1 - lib/spack/spack/test/spec_syntax.py | 1 - lib/spack/spack/test/stage.py | 1 - lib/spack/spack/test/svn_fetch.py | 1 - lib/spack/spack/test/tag.py | 1 - lib/spack/spack/test/url_fetch.py | 1 - lib/spack/spack/test/util/spack_lock_wrapper.py | 2 +- lib/spack/spack/test/web.py | 1 - lib/spack/spack/user_environment.py | 1 - lib/spack/spack/util/lock.py | 1 - lib/spack/spack/util/package_hash.py | 2 +- lib/spack/spack/verify.py | 1 - lib/spack/spack/version/git_ref_lookup.py | 1 - 111 files changed, 14 insertions(+), 189 deletions(-) diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 14fe7a5f33a43d..d682cc6d587580 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -53,7 +53,6 @@ def _search_duplicate_compilers(error_cls): import spack.config import spack.patch -import spack.paths import spack.repo import spack.spec import spack.util.crypto diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 61db2bebe12d1c..ad236ff056cd1a 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -33,7 +33,6 @@ from llnl.util.symlink import readlink import spack.caches -import spack.cmd import spack.config as config import spack.database as spack_db import spack.error @@ -47,7 +46,6 @@ import spack.paths import spack.platforms import spack.relocate as relocate -import spack.repo import spack.spec import spack.stage import spack.store diff --git a/lib/spack/spack/bootstrap/core.py b/lib/spack/spack/bootstrap/core.py index 02909cbdf7bd8a..9713e2866a8105 100644 --- a/lib/spack/spack/bootstrap/core.py +++ b/lib/spack/spack/bootstrap/core.py @@ -37,16 +37,10 @@ import spack.binary_distribution import spack.config import spack.detection -import spack.environment -import spack.modules -import spack.paths import spack.platforms -import spack.platforms.linux -import spack.repo import spack.spec import spack.store import spack.user_environment -import spack.util.environment import spack.util.executable import spack.util.path import spack.util.spack_yaml diff --git a/lib/spack/spack/bootstrap/environment.py b/lib/spack/spack/bootstrap/environment.py index 13942ba86f4693..ac8db642bf6986 100644 --- a/lib/spack/spack/bootstrap/environment.py +++ b/lib/spack/spack/bootstrap/environment.py @@ -15,8 +15,6 @@ import spack.environment import spack.tengine -import spack.util.cpus -import spack.util.executable from ._common import _root_spec from .config import root_path, spec_for_current_python, store_path diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index e807bf6fd02234..3dfda841011b13 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -65,16 +65,12 @@ import spack.package_base import spack.paths import spack.platforms -import spack.repo import spack.schema.environment import spack.spec import spack.stage import spack.store import spack.subprocess_context -import spack.user_environment import spack.util.executable -import spack.util.path -import spack.util.pattern from spack import traverse from spack.context import Context from spack.error import NoHeadersError, NoLibrariesError diff --git a/lib/spack/spack/caches.py b/lib/spack/spack/caches.py index 1ffef9343b0f42..58594059a58d09 100644 --- a/lib/spack/spack/caches.py +++ b/lib/spack/spack/caches.py @@ -11,7 +11,6 @@ from llnl.util.filesystem import mkdirp import spack.config -import spack.error import spack.fetch_strategy import spack.paths import spack.util.file_cache diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index c40b88d9e2e1c7..2420bf4df78d5c 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -38,7 +38,6 @@ import spack.paths import spack.repo import spack.spec -import spack.stage import spack.util.git import spack.util.gpg as gpg_util import spack.util.spack_yaml as syaml diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py index c321b1213093be..ffc46152780a9b 100644 --- a/lib/spack/spack/cmd/bootstrap.py +++ b/lib/spack/spack/cmd/bootstrap.py @@ -16,7 +16,6 @@ import spack.bootstrap.config import spack.bootstrap.core import spack.config -import spack.main import spack.mirror import spack.spec import spack.stage diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index 7839f315129677..960f468c7d13b6 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -23,14 +23,9 @@ import spack.error import spack.mirror import spack.oci.oci -import spack.oci.opener -import spack.relocate -import spack.repo import spack.spec import spack.stage import spack.store -import spack.user_environment -import spack.util.crypto import spack.util.parallel import spack.util.url as url_util import spack.util.web as web_util diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index 44478c61ce7ea9..92413f6f0033fb 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -15,7 +15,6 @@ import spack.repo import spack.spec import spack.stage -import spack.util.crypto import spack.util.web as web_util from spack.cmd.common import arguments from spack.package_base import ( diff --git a/lib/spack/spack/cmd/ci.py b/lib/spack/spack/cmd/ci.py index 934acc0d4e1bed..44557488fef6d0 100644 --- a/lib/spack/spack/cmd/ci.py +++ b/lib/spack/spack/cmd/ci.py @@ -19,7 +19,6 @@ import spack.cmd.buildcache as buildcache import spack.config as cfg import spack.environment as ev -import spack.environment.depfile import spack.hash_types as ht import spack.mirror import spack.util.gpg as gpg_util diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py index 9dd3efa45992fb..4a8d238dbd1d06 100644 --- a/lib/spack/spack/cmd/clean.py +++ b/lib/spack/spack/cmd/clean.py @@ -10,11 +10,8 @@ import llnl.util.filesystem import llnl.util.tty as tty -import spack.bootstrap import spack.caches -import spack.cmd.test import spack.config -import spack.repo import spack.stage import spack.store import spack.util.path diff --git a/lib/spack/spack/cmd/common/arguments.py b/lib/spack/spack/cmd/common/arguments.py index aa652919f84690..456ad0f5ac2260 100644 --- a/lib/spack/spack/cmd/common/arguments.py +++ b/lib/spack/spack/cmd/common/arguments.py @@ -15,7 +15,6 @@ import spack.deptypes as dt import spack.environment as ev import spack.mirror -import spack.modules import spack.reporters import spack.spec import spack.store diff --git a/lib/spack/spack/cmd/common/env_utility.py b/lib/spack/spack/cmd/common/env_utility.py index 1d04e199d9cced..6371ef65a8365b 100644 --- a/lib/spack/spack/cmd/common/env_utility.py +++ b/lib/spack/spack/cmd/common/env_utility.py @@ -10,7 +10,6 @@ import spack.cmd import spack.deptypes as dt import spack.error -import spack.paths import spack.spec import spack.store from spack import build_environment, traverse diff --git a/lib/spack/spack/cmd/config.py b/lib/spack/spack/cmd/config.py index ca68cbbd9d1f62..fdecc0156eeac0 100644 --- a/lib/spack/spack/cmd/config.py +++ b/lib/spack/spack/cmd/config.py @@ -13,9 +13,7 @@ import spack.config import spack.environment as ev -import spack.repo import spack.schema.env -import spack.schema.packages import spack.store import spack.util.spack_yaml as syaml from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index e2f198b06da163..1aa619149706c9 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -13,7 +13,6 @@ import spack.repo import spack.stage -import spack.util.web from spack.spec import Spec from spack.url import ( UndetectableNameError, diff --git a/lib/spack/spack/cmd/debug.py b/lib/spack/spack/cmd/debug.py index 9a93cc0a14df32..a920784e545ffe 100644 --- a/lib/spack/spack/cmd/debug.py +++ b/lib/spack/spack/cmd/debug.py @@ -14,7 +14,6 @@ from llnl.util.filesystem import working_dir import spack -import spack.config import spack.paths import spack.platforms import spack.util.git diff --git a/lib/spack/spack/cmd/dependencies.py b/lib/spack/spack/cmd/dependencies.py index 676da2f089f8f5..51d2389f796d34 100644 --- a/lib/spack/spack/cmd/dependencies.py +++ b/lib/spack/spack/cmd/dependencies.py @@ -11,7 +11,6 @@ import spack.cmd import spack.environment as ev import spack.package_base -import spack.repo import spack.store from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/develop.py b/lib/spack/spack/cmd/develop.py index cc181d9a926b82..0a9b7d13875ad3 100644 --- a/lib/spack/spack/cmd/develop.py +++ b/lib/spack/spack/cmd/develop.py @@ -10,7 +10,6 @@ import spack.cmd import spack.config import spack.fetch_strategy -import spack.package_base import spack.repo import spack.spec import spack.stage diff --git a/lib/spack/spack/cmd/diff.py b/lib/spack/spack/cmd/diff.py index a841986355b71f..3a9311e0e6f311 100644 --- a/lib/spack/spack/cmd/diff.py +++ b/lib/spack/spack/cmd/diff.py @@ -12,7 +12,6 @@ import spack.cmd import spack.environment as ev import spack.solver.asp as asp -import spack.util.environment import spack.util.spack_json as sjson from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index b943f3d3bd3b81..5494773c2f40a9 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -21,15 +21,11 @@ import spack.cmd import spack.cmd.common import spack.cmd.common.arguments -import spack.cmd.install import spack.cmd.modules -import spack.cmd.uninstall import spack.config import spack.environment as ev import spack.environment.depfile as depfile import spack.environment.shell -import spack.schema.env -import spack.spec import spack.tengine from spack.cmd.common import arguments from spack.util.environment import EnvironmentModifications diff --git a/lib/spack/spack/cmd/external.py b/lib/spack/spack/cmd/external.py index 421685d42a3e30..2c0d26edc259df 100644 --- a/lib/spack/spack/cmd/external.py +++ b/lib/spack/spack/cmd/external.py @@ -20,7 +20,6 @@ import spack.error import spack.repo import spack.spec -import spack.util.environment from spack.cmd.common import arguments description = "manage external packages in Spack configuration" diff --git a/lib/spack/spack/cmd/fetch.py b/lib/spack/spack/cmd/fetch.py index 0d794eb54787dc..ef831dd05413f4 100644 --- a/lib/spack/spack/cmd/fetch.py +++ b/lib/spack/spack/cmd/fetch.py @@ -8,7 +8,6 @@ import spack.cmd import spack.config import spack.environment as ev -import spack.repo import spack.traverse from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py index d09b2d84238553..3674cae4cfb7d8 100644 --- a/lib/spack/spack/cmd/find.py +++ b/lib/spack/spack/cmd/find.py @@ -10,7 +10,6 @@ import llnl.util.tty as tty import llnl.util.tty.color as color -import spack.bootstrap import spack.cmd as cmd import spack.environment as ev import spack.repo diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 8458e7ce050439..c262d569bc2f14 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -17,8 +17,6 @@ import spack.cmd import spack.config import spack.environment as ev -import spack.fetch_strategy -import spack.package_base import spack.paths import spack.report import spack.spec diff --git a/lib/spack/spack/cmd/load.py b/lib/spack/spack/cmd/load.py index 81f13194844de4..a868494a32cb5a 100644 --- a/lib/spack/spack/cmd/load.py +++ b/lib/spack/spack/cmd/load.py @@ -6,11 +6,9 @@ import sys import spack.cmd -import spack.cmd.find import spack.environment as ev import spack.store import spack.user_environment as uenv -import spack.util.environment from spack.cmd.common import arguments description = "add package to the user environment" diff --git a/lib/spack/spack/cmd/mark.py b/lib/spack/spack/cmd/mark.py index cf816a21f544cf..38701b97475547 100644 --- a/lib/spack/spack/cmd/mark.py +++ b/lib/spack/spack/cmd/mark.py @@ -8,9 +8,6 @@ from llnl.util import tty import spack.cmd -import spack.error -import spack.package_base -import spack.repo import spack.store from spack.cmd.common import arguments from spack.database import InstallStatuses diff --git a/lib/spack/spack/cmd/mirror.py b/lib/spack/spack/cmd/mirror.py index d25a9018e88b71..af6a45e3990752 100644 --- a/lib/spack/spack/cmd/mirror.py +++ b/lib/spack/spack/cmd/mirror.py @@ -17,7 +17,6 @@ import spack.mirror import spack.repo import spack.spec -import spack.util.path import spack.util.web as web_util from spack.cmd.common import arguments from spack.error import SpackError diff --git a/lib/spack/spack/cmd/patch.py b/lib/spack/spack/cmd/patch.py index b5805afd8058c6..885ff2f746c352 100644 --- a/lib/spack/spack/cmd/patch.py +++ b/lib/spack/spack/cmd/patch.py @@ -9,7 +9,6 @@ import spack.config import spack.environment as ev import spack.package_base -import spack.repo import spack.traverse from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/pkg.py b/lib/spack/spack/cmd/pkg.py index b21313cbc498fb..fa4084437ffa78 100644 --- a/lib/spack/spack/cmd/pkg.py +++ b/lib/spack/spack/cmd/pkg.py @@ -12,7 +12,6 @@ from llnl.util.tty.colify import colify import spack.cmd -import spack.paths import spack.repo import spack.util.executable as exe import spack.util.package_hash as ph diff --git a/lib/spack/spack/cmd/restage.py b/lib/spack/spack/cmd/restage.py index a21317405c459a..d3d596fa12915d 100644 --- a/lib/spack/spack/cmd/restage.py +++ b/lib/spack/spack/cmd/restage.py @@ -6,7 +6,6 @@ import llnl.util.tty as tty import spack.cmd -import spack.repo from spack.cmd.common import arguments description = "revert checked out package source code" diff --git a/lib/spack/spack/cmd/solve.py b/lib/spack/spack/cmd/solve.py index 2d6197f75846ad..47d733fe63fcdf 100644 --- a/lib/spack/spack/cmd/solve.py +++ b/lib/spack/spack/cmd/solve.py @@ -15,7 +15,6 @@ import spack.config import spack.environment import spack.hash_types as ht -import spack.package_base import spack.solver.asp as asp from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py index 10a94e34102c37..af5fa412ea7e1a 100644 --- a/lib/spack/spack/cmd/stage.py +++ b/lib/spack/spack/cmd/stage.py @@ -11,8 +11,6 @@ import spack.config import spack.environment as ev import spack.package_base -import spack.repo -import spack.stage import spack.traverse from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/tags.py b/lib/spack/spack/cmd/tags.py index a4f9786b93de34..736b3062c59163 100644 --- a/lib/spack/spack/cmd/tags.py +++ b/lib/spack/spack/cmd/tags.py @@ -10,7 +10,6 @@ import llnl.util.tty.colify as colify import spack.repo -import spack.store import spack.tag description = "show package tags and associated packages" diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py index 5aded576b05e84..4eedb0d37078e6 100644 --- a/lib/spack/spack/cmd/test.py +++ b/lib/spack/spack/cmd/test.py @@ -17,7 +17,6 @@ import spack.cmd import spack.environment as ev import spack.install_test -import spack.package_base import spack.repo import spack.report from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/unload.py b/lib/spack/spack/cmd/unload.py index 65daabcd468181..a6ea80e5820a48 100644 --- a/lib/spack/spack/cmd/unload.py +++ b/lib/spack/spack/cmd/unload.py @@ -9,7 +9,6 @@ import spack.cmd import spack.error import spack.user_environment as uenv -import spack.util.environment from spack.cmd.common import arguments description = "remove package from the user environment" diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index aec829cd0173ef..8c14ab759cd190 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -25,7 +25,6 @@ import spack.platforms import spack.repo import spack.spec -import spack.version from spack.operating_systems import windows_os from spack.util.environment import get_path from spack.util.naming import mod_to_class diff --git a/lib/spack/spack/compilers/apple_clang.py b/lib/spack/spack/compilers/apple_clang.py index 9201b164027e48..7537620709ac2e 100644 --- a/lib/spack/spack/compilers/apple_clang.py +++ b/lib/spack/spack/compilers/apple_clang.py @@ -8,7 +8,6 @@ import spack.compiler import spack.compilers.clang -import spack.util.executable from spack.version import Version diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index 9aed68f34d7bec..387c7f2de27efd 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -8,16 +8,8 @@ from contextlib import contextmanager from itertools import chain -import spack.compilers import spack.config -import spack.environment import spack.error -import spack.platforms -import spack.repo -import spack.spec -import spack.target -import spack.tengine -import spack.util.path CHECK_COMPILER_EXISTENCE = True diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index 55b040e68aadaf..7119339d5a319f 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -40,10 +40,8 @@ class OpenMpi(Package): import llnl.util.tty.color import spack.deptypes as dt -import spack.error import spack.patch import spack.spec -import spack.url import spack.util.crypto import spack.variant from spack.dependency import Dependency diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 82b01121736f89..a4e8fcc2030320 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -46,7 +46,6 @@ import spack.config import spack.error import spack.oci.opener -import spack.url import spack.util.archive import spack.util.crypto as crypto import spack.util.git diff --git a/lib/spack/spack/install_test.py b/lib/spack/spack/install_test.py index 559b5b389c1d2c..f0b62523d1d701 100644 --- a/lib/spack/spack/install_test.py +++ b/lib/spack/spack/install_test.py @@ -17,12 +17,21 @@ import llnl.util.filesystem as fs import llnl.util.tty as tty +import llnl.util.tty.log from llnl.string import plural from llnl.util.lang import nullcontext from llnl.util.tty.color import colorize +import spack.build_environment +import spack.builder +import spack.config import spack.error +import spack.package_base import spack.paths +import spack.repo +import spack.spec +import spack.util.executable +import spack.util.path import spack.util.spack_json as sjson from spack.installer import InstallError from spack.spec import Spec @@ -42,7 +51,7 @@ ListOrStringType = Union[str, List[str]] -LogType = Union["tty.log.nixlog", "tty.log.winlog"] +LogType = Union[llnl.util.tty.log.nixlog, llnl.util.tty.log.winlog] Pb = TypeVar("Pb", bound="spack.package_base.PackageBase") PackageObjectOrClass = Union[Pb, Type[Pb]] @@ -280,7 +289,7 @@ def __init__(self, pkg: Pb): def logger(self) -> Optional[LogType]: """The current logger or, if none, sets to one.""" if not self._logger: - self._logger = tty.log.log_output(self.test_log_file) + self._logger = llnl.util.tty.log.log_output(self.test_log_file) return self._logger @@ -297,7 +306,7 @@ def test_logger(self, verbose: bool = False, externals: bool = False): fs.touch(self.test_log_file) # Otherwise log_parse complains fs.set_install_permissions(self.test_log_file) - with tty.log.log_output(self.test_log_file, verbose) as self._logger: + with llnl.util.tty.log.log_output(self.test_log_file, verbose) as self._logger: with self.logger.force_echo(): # type: ignore[union-attr] tty.msg("Testing package " + colorize(r"@*g{" + self.pkg_id + r"}")) diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index 1adc5b9ee31e3b..42325e22f73108 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -48,7 +48,6 @@ import spack.binary_distribution as binary_distribution import spack.build_environment -import spack.compilers import spack.config import spack.database import spack.deptypes as dt diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 9ca5453f23ce1c..db5d45034cc995 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -40,7 +40,6 @@ import spack.paths import spack.platforms import spack.repo -import spack.solver.asp import spack.spec import spack.store import spack.util.debug diff --git a/lib/spack/spack/oci/oci.py b/lib/spack/spack/oci/oci.py index ae70e287a6de96..1b84860d2682cb 100644 --- a/lib/spack/spack/oci/oci.py +++ b/lib/spack/spack/oci/oci.py @@ -15,16 +15,10 @@ import llnl.util.tty as tty -import spack.config -import spack.error import spack.fetch_strategy import spack.mirror import spack.oci.opener -import spack.repo -import spack.spec import spack.stage -import spack.traverse -import spack.util.crypto import spack.util.url from .image import Digest, ImageReference diff --git a/lib/spack/spack/oci/opener.py b/lib/spack/spack/oci/opener.py index 53535b85ed7672..906d5d2b92c60b 100644 --- a/lib/spack/spack/oci/opener.py +++ b/lib/spack/spack/oci/opener.py @@ -22,7 +22,6 @@ import spack.config import spack.mirror import spack.parser -import spack.repo import spack.util.web from .image import ImageReference diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index d157ab4a66c134..382d0b25f7aa8e 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -38,16 +38,13 @@ import spack.dependency import spack.deptypes as dt import spack.directives -import spack.directory_layout import spack.environment import spack.error import spack.fetch_strategy as fs import spack.hooks import spack.mirror -import spack.mixins import spack.multimethod import spack.patch -import spack.paths import spack.repo import spack.spec import spack.store diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py index 364e72f7c3ca50..c376a261a63d80 100644 --- a/lib/spack/spack/relocate.py +++ b/lib/spack/spack/relocate.py @@ -17,15 +17,11 @@ from llnl.util.lang import memoized from llnl.util.symlink import readlink, symlink -import spack.paths import spack.platforms -import spack.repo -import spack.spec import spack.store import spack.util.elf as elf import spack.util.executable as executable import spack.util.filesystem as ssys -import spack.util.path from .relocate_text import BinaryFilePrefixReplacer, TextFilePrefixReplacer diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py index 1e95b4ec64866f..fd1609df8301d4 100644 --- a/lib/spack/spack/repo.py +++ b/lib/spack/spack/repo.py @@ -41,7 +41,6 @@ import spack.provider_index import spack.spec import spack.tag -import spack.util.file_cache import spack.util.git import spack.util.naming as nm import spack.util.path diff --git a/lib/spack/spack/report.py b/lib/spack/spack/report.py index 9c56e7edbe0722..409810f58a900f 100644 --- a/lib/spack/spack/report.py +++ b/lib/spack/spack/report.py @@ -15,7 +15,6 @@ import llnl.util.lang import spack.build_environment -import spack.fetch_strategy import spack.install_test import spack.installer import spack.package_base diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py index 5d50f05c60e682..2ecfacb60bd006 100644 --- a/lib/spack/spack/reporters/cdash.py +++ b/lib/spack/spack/reporters/cdash.py @@ -20,9 +20,6 @@ from llnl.util.filesystem import working_dir import spack -import spack.build_environment -import spack.fetch_strategy -import spack.package_base import spack.paths import spack.platforms import spack.util.git diff --git a/lib/spack/spack/rewiring.py b/lib/spack/spack/rewiring.py index fa95d339b3bfe2..f2a01cd6d1a22d 100644 --- a/lib/spack/spack/rewiring.py +++ b/lib/spack/spack/rewiring.py @@ -14,9 +14,7 @@ import spack.binary_distribution as bindist import spack.error import spack.hooks -import spack.paths import spack.relocate as relocate -import spack.stage import spack.store diff --git a/lib/spack/spack/schema/env.py b/lib/spack/spack/schema/env.py index 8b37f3e236fc68..17cf29d4c6c1d2 100644 --- a/lib/spack/spack/schema/env.py +++ b/lib/spack/spack/schema/env.py @@ -14,7 +14,6 @@ import spack.schema.gitlab_ci # DEPRECATED import spack.schema.merged -import spack.schema.projections from .spec_list import spec_list_schema diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index af6d3c94f7eabf..9b694d3850521e 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -27,7 +27,6 @@ import spack import spack.binary_distribution -import spack.cmd import spack.compilers import spack.config import spack.config as sc @@ -36,13 +35,11 @@ import spack.error import spack.package_base import spack.package_prefs -import spack.parser import spack.platforms import spack.repo import spack.spec import spack.store import spack.util.crypto -import spack.util.elf import spack.util.libc import spack.util.path import spack.util.timer diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index be1d08399e7496..1e23ebc63f2d30 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -84,7 +84,6 @@ import spack.store import spack.target import spack.traverse as traverse -import spack.util.crypto import spack.util.executable import spack.util.hash import spack.util.module_cmd as md diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index a8e945e7485dc5..776b3ce6b94b67 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -36,7 +36,6 @@ import spack.error import spack.fetch_strategy as fs import spack.mirror -import spack.paths import spack.resource import spack.spec import spack.util.crypto diff --git a/lib/spack/spack/test/bindist.py b/lib/spack/spack/test/bindist.py index fcc781b1422655..a418ef360ac0ac 100644 --- a/lib/spack/spack/test/bindist.py +++ b/lib/spack/spack/test/bindist.py @@ -32,7 +32,6 @@ import spack.hooks.sbang as sbang import spack.main import spack.mirror -import spack.repo import spack.store import spack.util.gpg import spack.util.spack_yaml as syaml diff --git a/lib/spack/spack/test/build_distribution.py b/lib/spack/spack/test/build_distribution.py index cdfd961e3a293e..dc1e763e2a9d05 100644 --- a/lib/spack/spack/test/build_distribution.py +++ b/lib/spack/spack/test/build_distribution.py @@ -9,10 +9,8 @@ import pytest import spack.binary_distribution as bd -import spack.main import spack.mirror import spack.spec -import spack.util.url pytestmark = pytest.mark.not_on_windows("does not run on windows") diff --git a/lib/spack/spack/test/build_systems.py b/lib/spack/spack/test/build_systems.py index 57516b445c18d0..f224982e1a6924 100644 --- a/lib/spack/spack/test/build_systems.py +++ b/lib/spack/spack/test/build_systems.py @@ -17,7 +17,6 @@ import spack.build_systems.cmake import spack.environment import spack.platforms -import spack.repo from spack.build_environment import ChildError, setup_package from spack.spec import Spec from spack.util.executable import which diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py index 27d05fb7861430..4a394680f480b8 100644 --- a/lib/spack/spack/test/cc.py +++ b/lib/spack/spack/test/cc.py @@ -13,7 +13,6 @@ import spack.build_environment import spack.config -import spack.spec from spack.paths import build_env_path from spack.util.environment import SYSTEM_DIR_CASE_ENTRY, set_env from spack.util.executable import Executable, ProcessError diff --git a/lib/spack/spack/test/ci.py b/lib/spack/spack/test/ci.py index 9eb0d45d2d1b8c..6742e02c74809e 100644 --- a/lib/spack/spack/test/ci.py +++ b/lib/spack/spack/test/ci.py @@ -10,12 +10,10 @@ import llnl.util.filesystem as fs import spack.ci as ci -import spack.config import spack.environment as ev import spack.error import spack.paths as spack_paths import spack.util.git -import spack.util.gpg @pytest.fixture diff --git a/lib/spack/spack/test/cmd/blame.py b/lib/spack/spack/test/cmd/blame.py index dcc26c91539d06..2514750b881df9 100644 --- a/lib/spack/spack/test/cmd/blame.py +++ b/lib/spack/spack/test/cmd/blame.py @@ -9,7 +9,6 @@ from llnl.util.filesystem import working_dir -import spack.cmd import spack.paths import spack.util.spack_json as sjson from spack.main import SpackCommand diff --git a/lib/spack/spack/test/cmd/buildcache.py b/lib/spack/spack/test/cmd/buildcache.py index de0e40c05af430..30c779e705665b 100644 --- a/lib/spack/spack/test/cmd/buildcache.py +++ b/lib/spack/spack/test/cmd/buildcache.py @@ -13,7 +13,6 @@ import spack.binary_distribution import spack.cmd.buildcache -import spack.deptypes import spack.environment as ev import spack.error import spack.main diff --git a/lib/spack/spack/test/cmd/ci.py b/lib/spack/spack/test/cmd/ci.py index e2d87d5bb0a758..01e3e4e5694b1b 100644 --- a/lib/spack/spack/test/cmd/ci.py +++ b/lib/spack/spack/test/cmd/ci.py @@ -18,13 +18,11 @@ import spack.binary_distribution import spack.ci as ci import spack.cmd.ci -import spack.config import spack.environment as ev import spack.hash_types as ht import spack.main import spack.paths as spack_paths import spack.repo as repo -import spack.util.gpg import spack.util.spack_yaml as syaml from spack.cmd.ci import FAILED_CREATE_BUILDCACHE_CODE from spack.schema.buildcache_spec import schema as specfile_schema diff --git a/lib/spack/spack/test/cmd/create.py b/lib/spack/spack/test/cmd/create.py index bc3854e9f55453..13967adb52b2d8 100644 --- a/lib/spack/spack/test/cmd/create.py +++ b/lib/spack/spack/test/cmd/create.py @@ -9,7 +9,6 @@ import pytest import spack.cmd.create -import spack.util.editor from spack.main import SpackCommand from spack.url import UndetectableNameError from spack.util.executable import which diff --git a/lib/spack/spack/test/cmd/debug.py b/lib/spack/spack/test/cmd/debug.py index 4e16cc92c96ca9..2cff3b29c63c58 100644 --- a/lib/spack/spack/test/cmd/debug.py +++ b/lib/spack/spack/test/cmd/debug.py @@ -10,7 +10,6 @@ import pytest import spack -import spack.config import spack.platforms from spack.main import SpackCommand from spack.util.executable import which diff --git a/lib/spack/spack/test/cmd/dev_build.py b/lib/spack/spack/test/cmd/dev_build.py index 16252b1af7e0a3..8545a9dc5290da 100644 --- a/lib/spack/spack/test/cmd/dev_build.py +++ b/lib/spack/spack/test/cmd/dev_build.py @@ -9,7 +9,6 @@ import llnl.util.filesystem as fs -import spack.build_environment import spack.environment as ev import spack.error import spack.spec diff --git a/lib/spack/spack/test/cmd/diff.py b/lib/spack/spack/test/cmd/diff.py index 259f6b871afa7f..322b33b3d4eed4 100644 --- a/lib/spack/spack/test/cmd/diff.py +++ b/lib/spack/spack/test/cmd/diff.py @@ -6,9 +6,7 @@ import pytest import spack.cmd.diff -import spack.config import spack.main -import spack.store import spack.util.spack_json as sjson from spack.test.conftest import create_test_repo diff --git a/lib/spack/spack/test/cmd/edit.py b/lib/spack/spack/test/cmd/edit.py index 93b4bd7949acd3..1735f7f4a5cc28 100644 --- a/lib/spack/spack/test/cmd/edit.py +++ b/lib/spack/spack/test/cmd/edit.py @@ -5,7 +5,6 @@ import os -import spack.paths import spack.repo import spack.util.editor from spack.build_systems import autotools, cmake diff --git a/lib/spack/spack/test/cmd/gpg.py b/lib/spack/spack/test/cmd/gpg.py index d342897db7f800..b720b7d9e62f67 100644 --- a/lib/spack/spack/test/cmd/gpg.py +++ b/lib/spack/spack/test/cmd/gpg.py @@ -9,7 +9,6 @@ import llnl.util.filesystem as fs -import spack.bootstrap import spack.util.executable import spack.util.gpg from spack.main import SpackCommand diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 47dd194f879acd..748c162db79a5e 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -24,7 +24,6 @@ import spack.hash_types as ht import spack.package_base import spack.store -import spack.util.executable from spack.error import SpackError from spack.main import SpackCommand from spack.parser import SpecSyntaxError diff --git a/lib/spack/spack/test/cmd/load.py b/lib/spack/spack/test/cmd/load.py index 73a062ebd41203..1c36bcc86aba82 100644 --- a/lib/spack/spack/test/cmd/load.py +++ b/lib/spack/spack/test/cmd/load.py @@ -10,7 +10,6 @@ import spack.spec import spack.user_environment as uenv -import spack.util.environment from spack.main import SpackCommand load = SpackCommand("load") diff --git a/lib/spack/spack/test/cmd/stage.py b/lib/spack/spack/test/cmd/stage.py index e91d2ed7662528..ba37eff0dc9dca 100644 --- a/lib/spack/spack/test/cmd/stage.py +++ b/lib/spack/spack/test/cmd/stage.py @@ -10,8 +10,6 @@ import spack.config import spack.environment as ev import spack.package_base -import spack.repo -import spack.stage import spack.traverse from spack.main import SpackCommand, SpackCommandError from spack.version import Version diff --git a/lib/spack/spack/test/cmd/test.py b/lib/spack/spack/test/cmd/test.py index 3cfaa5b58f28ba..3b3785a9aed54b 100644 --- a/lib/spack/spack/test/cmd/test.py +++ b/lib/spack/spack/test/cmd/test.py @@ -11,14 +11,11 @@ from llnl.util.filesystem import copy_tree import spack.cmd.common.arguments -import spack.cmd.install import spack.cmd.test import spack.config import spack.install_test -import spack.package_base import spack.paths import spack.spec -import spack.store from spack.install_test import TestStatus from spack.main import SpackCommand diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py index 8f8d7fb876d07f..59edeaea151739 100644 --- a/lib/spack/spack/test/compilers/basics.py +++ b/lib/spack/spack/test/compilers/basics.py @@ -13,7 +13,6 @@ import spack.compiler import spack.compilers import spack.spec -import spack.util.environment import spack.util.module_cmd from spack.compiler import Compiler from spack.util.executable import Executable, ProcessError diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 7349e4227d744f..e362cc27ff01e2 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -28,7 +28,6 @@ import spack.solver.version_order import spack.store import spack.util.file_cache -import spack.util.libc import spack.variant as vt from spack.concretize import find_spec from spack.spec import CompilerSpec, Spec diff --git a/lib/spack/spack/test/concretize_requirements.py b/lib/spack/spack/test/concretize_requirements.py index 386ad1c1940bf5..db919415764819 100644 --- a/lib/spack/spack/test/concretize_requirements.py +++ b/lib/spack/spack/test/concretize_requirements.py @@ -7,7 +7,6 @@ import pytest -import spack.build_systems.generic import spack.config import spack.error import spack.package_base diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py index 7c1c8f365b6f3e..abe9f9121bf290 100644 --- a/lib/spack/spack/test/config.py +++ b/lib/spack/spack/test/config.py @@ -18,8 +18,6 @@ import spack.config import spack.directory_layout import spack.environment as ev -import spack.fetch_strategy -import spack.main import spack.package_base import spack.paths import spack.repo @@ -27,7 +25,6 @@ import spack.schema.config import spack.schema.env import spack.schema.mirrors -import spack.schema.packages import spack.schema.repos import spack.store import spack.util.path as spack_path diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 2db0206bec5de8..b8cec8611d43bb 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -35,16 +35,12 @@ import spack.binary_distribution import spack.bootstrap.core import spack.caches -import spack.cmd.buildcache import spack.compiler import spack.compilers import spack.config -import spack.database -import spack.directory_layout import spack.environment as ev import spack.error import spack.package_base -import spack.package_prefs import spack.paths import spack.platforms import spack.repo @@ -52,7 +48,6 @@ import spack.stage import spack.store import spack.subprocess_context -import spack.test.cray_manifest import spack.util.executable import spack.util.git import spack.util.gpg diff --git a/lib/spack/spack/test/container/cli.py b/lib/spack/spack/test/container/cli.py index 660f84aef19d50..5e1ecd58a74e33 100644 --- a/lib/spack/spack/test/container/cli.py +++ b/lib/spack/spack/test/container/cli.py @@ -8,7 +8,6 @@ import spack.container.images import spack.main -import spack.platforms containerize = spack.main.SpackCommand("containerize") diff --git a/lib/spack/spack/test/cray_manifest.py b/lib/spack/spack/test/cray_manifest.py index 532261b3ee834e..dd5bd3e4a64b35 100644 --- a/lib/spack/spack/test/cray_manifest.py +++ b/lib/spack/spack/test/cray_manifest.py @@ -18,7 +18,6 @@ import spack.cmd import spack.cmd.external import spack.compilers -import spack.config import spack.cray_manifest as cray_manifest import spack.solver.asp import spack.spec diff --git a/lib/spack/spack/test/flag_handlers.py b/lib/spack/spack/test/flag_handlers.py index d2b67d63bc3eca..fd63de4b82ffcc 100644 --- a/lib/spack/spack/test/flag_handlers.py +++ b/lib/spack/spack/test/flag_handlers.py @@ -8,7 +8,6 @@ import pytest import spack.build_environment -import spack.repo import spack.spec from spack.package import build_system_flags, env_flags, inject_flags diff --git a/lib/spack/spack/test/flag_mixing.py b/lib/spack/spack/test/flag_mixing.py index f1c2cf7defbce0..d3db72625f1012 100644 --- a/lib/spack/spack/test/flag_mixing.py +++ b/lib/spack/spack/test/flag_mixing.py @@ -4,14 +4,10 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import pytest -import spack.build_systems.generic import spack.config import spack.environment as ev -import spack.error -import spack.package_base import spack.repo import spack.util.spack_yaml as syaml -import spack.version from spack.spec import Spec from spack.test.conftest import create_test_repo diff --git a/lib/spack/spack/test/gcs_fetch.py b/lib/spack/spack/test/gcs_fetch.py index ec53f0b633c33a..8e226242220f8b 100644 --- a/lib/spack/spack/test/gcs_fetch.py +++ b/lib/spack/spack/test/gcs_fetch.py @@ -3,8 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import spack.config -import spack.error import spack.fetch_strategy import spack.stage diff --git a/lib/spack/spack/test/graph.py b/lib/spack/spack/test/graph.py index 001091d22c6dc4..c26363bb46d993 100644 --- a/lib/spack/spack/test/graph.py +++ b/lib/spack/spack/test/graph.py @@ -5,7 +5,6 @@ import io import spack.graph -import spack.repo import spack.spec diff --git a/lib/spack/spack/test/hg_fetch.py b/lib/spack/spack/test/hg_fetch.py index 6d63f64dc8998a..f186ea14541437 100644 --- a/lib/spack/spack/test/hg_fetch.py +++ b/lib/spack/spack/test/hg_fetch.py @@ -10,7 +10,6 @@ from llnl.util.filesystem import mkdirp, touch, working_dir import spack.config -import spack.repo from spack.fetch_strategy import HgFetchStrategy from spack.spec import Spec from spack.stage import Stage diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 95084ba8ee6d06..8d7669f544a2be 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -17,9 +17,6 @@ import llnl.util.tty as tty import spack.binary_distribution -import spack.compilers -import spack.concretize -import spack.config import spack.database import spack.deptypes as dt import spack.installer as inst @@ -29,7 +26,6 @@ import spack.spec import spack.store import spack.util.lock as lk -import spack.version def _mock_repo(root, namespace): diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py index 5609595f464a8c..10d375a7fb652b 100644 --- a/lib/spack/spack/test/mirror.py +++ b/lib/spack/spack/test/mirror.py @@ -15,7 +15,6 @@ import spack.fetch_strategy import spack.mirror import spack.patch -import spack.repo import spack.stage import spack.util.executable import spack.util.spack_json as sjson diff --git a/lib/spack/spack/test/modules/common.py b/lib/spack/spack/test/modules/common.py index f6688963460f74..694f3f65380523 100644 --- a/lib/spack/spack/test/modules/common.py +++ b/lib/spack/spack/test/modules/common.py @@ -14,7 +14,6 @@ import spack.error import spack.modules.tcl import spack.package_base -import spack.schema.modules import spack.spec from spack.modules.common import UpstreamModuleIndex from spack.spec import Spec diff --git a/lib/spack/spack/test/modules/conftest.py b/lib/spack/spack/test/modules/conftest.py index 57396da426fb30..8869d60d8d9a85 100644 --- a/lib/spack/spack/test/modules/conftest.py +++ b/lib/spack/spack/test/modules/conftest.py @@ -6,11 +6,7 @@ import pytest -import spack.config -import spack.modules.common -import spack.paths import spack.spec -import spack.util.path @pytest.fixture() diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py index 84272a15d10d4b..974985d5b880a6 100644 --- a/lib/spack/spack/test/multimethod.py +++ b/lib/spack/spack/test/multimethod.py @@ -8,7 +8,6 @@ import pytest import spack.platforms -import spack.repo import spack.spec from spack.multimethod import NoSuchMethodError diff --git a/lib/spack/spack/test/oci/integration_test.py b/lib/spack/spack/test/oci/integration_test.py index 10ec12e406ed1c..85673e953aa148 100644 --- a/lib/spack/spack/test/oci/integration_test.py +++ b/lib/spack/spack/test/oci/integration_test.py @@ -17,7 +17,6 @@ import pytest import spack.binary_distribution -import spack.cmd.buildcache import spack.database import spack.environment as ev import spack.error diff --git a/lib/spack/spack/test/packaging.py b/lib/spack/spack/test/packaging.py index 2356515c05916d..9fb7e3b1527a8c 100644 --- a/lib/spack/spack/test/packaging.py +++ b/lib/spack/spack/test/packaging.py @@ -24,8 +24,6 @@ import spack.error import spack.fetch_strategy import spack.package_base -import spack.repo -import spack.store import spack.util.gpg import spack.util.url as url_util from spack.fetch_strategy import URLFetchStrategy diff --git a/lib/spack/spack/test/patch.py b/lib/spack/spack/test/patch.py index 04bce857c54e70..8c8ea24227fb74 100644 --- a/lib/spack/spack/test/patch.py +++ b/lib/spack/spack/test/patch.py @@ -17,7 +17,6 @@ import spack.patch import spack.paths import spack.repo -import spack.util.compression import spack.util.url as url_util from spack.spec import Spec from spack.stage import Stage diff --git a/lib/spack/spack/test/relocate.py b/lib/spack/spack/test/relocate.py index e02bc9ae3ac855..31c206264acc9e 100644 --- a/lib/spack/spack/test/relocate.py +++ b/lib/spack/spack/test/relocate.py @@ -9,14 +9,9 @@ import pytest -import spack.concretize -import spack.paths import spack.platforms import spack.relocate import spack.relocate_text as relocate_text -import spack.spec -import spack.store -import spack.tengine import spack.util.executable pytestmark = pytest.mark.not_on_windows("Tests fail on Windows") diff --git a/lib/spack/spack/test/reporters.py b/lib/spack/spack/test/reporters.py index d1a78f6d7e4842..72fb8ddd522972 100644 --- a/lib/spack/spack/test/reporters.py +++ b/lib/spack/spack/test/reporters.py @@ -10,7 +10,6 @@ import llnl.util.tty as tty import spack.reporters.extract -import spack.spec from spack.install_test import TestStatus from spack.reporters import CDash, CDashConfiguration diff --git a/lib/spack/spack/test/sbang.py b/lib/spack/spack/test/sbang.py index e409f49c61bdad..24cc098d697e0a 100644 --- a/lib/spack/spack/test/sbang.py +++ b/lib/spack/spack/test/sbang.py @@ -18,7 +18,6 @@ import llnl.util.filesystem as fs import spack.hooks.sbang as sbang -import spack.paths import spack.store import spack.util.spack_yaml as syaml from spack.util.executable import which diff --git a/lib/spack/spack/test/solver/intermediate.py b/lib/spack/spack/test/solver/intermediate.py index 42fdb316aa1bc9..f3d624cbd36dae 100644 --- a/lib/spack/spack/test/solver/intermediate.py +++ b/lib/spack/spack/test/solver/intermediate.py @@ -6,7 +6,6 @@ import pytest import spack.compilers -import spack.config import spack.spec from spack.concretize import UnavailableCompilerVersionError from spack.solver import asp diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py index e66c3e1390cb9e..e0ecfce90a7d8a 100644 --- a/lib/spack/spack/test/spec_dag.py +++ b/lib/spack/spack/test/spec_dag.py @@ -9,7 +9,6 @@ import spack.deptypes as dt import spack.error -import spack.package_base import spack.parser import spack.repo import spack.util.hash as hashutil diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index affa69e48cad00..33bb9bdf7b38d9 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -12,7 +12,6 @@ import spack.cmd import spack.platforms.test import spack.spec -import spack.variant from spack.parser import ( UNIX_FILENAME, WINDOWS_FILENAME, diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py index 084d95475cf6fe..63cd20eb2aa796 100644 --- a/lib/spack/spack/test/stage.py +++ b/lib/spack/spack/test/stage.py @@ -19,7 +19,6 @@ import spack.error import spack.fetch_strategy -import spack.paths import spack.stage import spack.util.executable import spack.util.url as url_util diff --git a/lib/spack/spack/test/svn_fetch.py b/lib/spack/spack/test/svn_fetch.py index 0b3750001431c1..de47864fc2497e 100644 --- a/lib/spack/spack/test/svn_fetch.py +++ b/lib/spack/spack/test/svn_fetch.py @@ -10,7 +10,6 @@ from llnl.util.filesystem import mkdirp, touch, working_dir import spack.config -import spack.repo from spack.fetch_strategy import SvnFetchStrategy from spack.spec import Spec from spack.stage import Stage diff --git a/lib/spack/spack/test/tag.py b/lib/spack/spack/test/tag.py index 6a979eca4b6b7d..1d493d3a791c66 100644 --- a/lib/spack/spack/test/tag.py +++ b/lib/spack/spack/test/tag.py @@ -7,7 +7,6 @@ import pytest -import spack.cmd.install import spack.tag from spack.main import SpackCommand diff --git a/lib/spack/spack/test/url_fetch.py b/lib/spack/spack/test/url_fetch.py index b86a2f5cce1956..ff7e4a142e84c0 100644 --- a/lib/spack/spack/test/url_fetch.py +++ b/lib/spack/spack/test/url_fetch.py @@ -17,7 +17,6 @@ import spack.config import spack.error import spack.fetch_strategy as fs -import spack.repo import spack.util.crypto as crypto import spack.util.executable import spack.util.web as web_util diff --git a/lib/spack/spack/test/util/spack_lock_wrapper.py b/lib/spack/spack/test/util/spack_lock_wrapper.py index 9838324a03ef19..bf162627f5356a 100644 --- a/lib/spack/spack/test/util/spack_lock_wrapper.py +++ b/lib/spack/spack/test/util/spack_lock_wrapper.py @@ -10,7 +10,7 @@ from llnl.util.filesystem import getuid, group_ids -import spack.config +import spack.error import spack.util.lock as lk diff --git a/lib/spack/spack/test/web.py b/lib/spack/spack/test/web.py index 1ae76c6e8dbf7f..8998d89efc5fbb 100644 --- a/lib/spack/spack/test/web.py +++ b/lib/spack/spack/test/web.py @@ -17,7 +17,6 @@ import spack.mirror import spack.paths import spack.url -import spack.util.path import spack.util.s3 import spack.util.url as url_util import spack.util.web diff --git a/lib/spack/spack/user_environment.py b/lib/spack/spack/user_environment.py index 756b7c09a2f429..b5b455fad64fa5 100644 --- a/lib/spack/spack/user_environment.py +++ b/lib/spack/spack/user_environment.py @@ -8,7 +8,6 @@ import spack.build_environment import spack.config -import spack.error import spack.spec import spack.util.environment as environment from spack import traverse diff --git a/lib/spack/spack/util/lock.py b/lib/spack/spack/util/lock.py index 3f6480b26ae23c..f96145518b203e 100644 --- a/lib/spack/spack/util/lock.py +++ b/lib/spack/spack/util/lock.py @@ -19,7 +19,6 @@ from llnl.util.lock import WriteTransaction # noqa: F401 import spack.error -import spack.paths class Lock(llnl.util.lock.Lock): diff --git a/lib/spack/spack/util/package_hash.py b/lib/spack/spack/util/package_hash.py index 7a4fd39115a2da..ab10d561ab6ecf 100644 --- a/lib/spack/spack/util/package_hash.py +++ b/lib/spack/spack/util/package_hash.py @@ -7,11 +7,11 @@ import spack.directives_meta import spack.error +import spack.fetch_strategy import spack.package_base import spack.repo import spack.spec import spack.util.hash -import spack.util.naming from spack.util.unparse import unparse diff --git a/lib/spack/spack/verify.py b/lib/spack/spack/verify.py index 7125481c6d6b8c..9854e8906f4015 100644 --- a/lib/spack/spack/verify.py +++ b/lib/spack/spack/verify.py @@ -11,7 +11,6 @@ import llnl.util.tty as tty from llnl.util.symlink import readlink -import spack.filesystem_view import spack.store import spack.util.file_permissions as fp import spack.util.spack_json as sjson diff --git a/lib/spack/spack/version/git_ref_lookup.py b/lib/spack/spack/version/git_ref_lookup.py index 6168fc44a5266e..e7a3b02ce811cf 100644 --- a/lib/spack/spack/version/git_ref_lookup.py +++ b/lib/spack/spack/version/git_ref_lookup.py @@ -17,7 +17,6 @@ import spack.util.executable import spack.util.hash import spack.util.spack_json as sjson -import spack.version from .common import VersionLookupError from .lookup import AbstractRefLookup From 576251f0dad79d0e69f73eb393ce40a0921df0b4 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 16 Sep 2024 17:17:36 +0200 Subject: [PATCH 154/687] allow failure for cray-sles (#46411) --- share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index 9bee896586eb90..f538704732f6cf 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -905,6 +905,7 @@ e4s-cray-rhel-build: SPACK_CI_STACK_NAME: e4s-cray-sles e4s-cray-sles-generate: + allow_failure: true # no machines available extends: [ ".generate-cray-sles", ".e4s-cray-sles" ] e4s-cray-sles-build: From 61d6c5486c76acc71ff875b7c10be4b7ae0b582a Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 16 Sep 2024 17:59:35 +0200 Subject: [PATCH 155/687] Add repositories for "requirements" and "flag mixing" unit tests (#46412) --- .../spack/test/concretize_requirements.py | 122 ++++-------------- lib/spack/spack/test/flag_mixing.py | 88 +------------ .../repos/flags.test/packages/t/package.py | 15 +++ .../repos/flags.test/packages/u/package.py | 13 ++ .../repos/flags.test/packages/v/package.py | 14 ++ .../repos/flags.test/packages/w/package.py | 18 +++ .../repos/flags.test/packages/x/package.py | 16 +++ .../repos/flags.test/packages/y/package.py | 12 ++ var/spack/repos/flags.test/repo.yaml | 2 + .../requirements.test/packages/t/package.py | 14 ++ .../requirements.test/packages/u/package.py | 12 ++ .../requirements.test/packages/v/package.py | 12 ++ .../requirements.test/packages/x/package.py | 16 +++ .../requirements.test/packages/y/package.py | 15 +++ var/spack/repos/requirements.test/repo.yaml | 2 + 15 files changed, 190 insertions(+), 181 deletions(-) create mode 100644 var/spack/repos/flags.test/packages/t/package.py create mode 100644 var/spack/repos/flags.test/packages/u/package.py create mode 100644 var/spack/repos/flags.test/packages/v/package.py create mode 100644 var/spack/repos/flags.test/packages/w/package.py create mode 100644 var/spack/repos/flags.test/packages/x/package.py create mode 100644 var/spack/repos/flags.test/packages/y/package.py create mode 100644 var/spack/repos/flags.test/repo.yaml create mode 100644 var/spack/repos/requirements.test/packages/t/package.py create mode 100644 var/spack/repos/requirements.test/packages/u/package.py create mode 100644 var/spack/repos/requirements.test/packages/v/package.py create mode 100644 var/spack/repos/requirements.test/packages/x/package.py create mode 100644 var/spack/repos/requirements.test/packages/y/package.py create mode 100644 var/spack/repos/requirements.test/repo.yaml diff --git a/lib/spack/spack/test/concretize_requirements.py b/lib/spack/spack/test/concretize_requirements.py index db919415764819..420db9fa9de92c 100644 --- a/lib/spack/spack/test/concretize_requirements.py +++ b/lib/spack/spack/test/concretize_requirements.py @@ -15,7 +15,6 @@ import spack.version from spack.solver.asp import InternalConcretizerError, UnsatisfiableSpecError from spack.spec import Spec -from spack.test.conftest import create_test_repo from spack.util.url import path_to_file_url @@ -24,76 +23,10 @@ def update_packages_config(conf_str): spack.config.set("packages", conf["packages"], scope="concretize") -_pkgx = ( - "x", - """\ -class X(Package): - version("1.1") - version("1.0") - version("0.9") - - variant("shared", default=True, - description="Build shared libraries") - - depends_on("y") -""", -) - - -_pkgy = ( - "y", - """\ -class Y(Package): - version("2.5") - version("2.4") - version("2.3", deprecated=True) - - variant("shared", default=True, - description="Build shared libraries") -""", -) - - -_pkgv = ( - "v", - """\ -class V(Package): - version("2.1") - version("2.0") -""", -) - - -_pkgt = ( - "t", - """\ -class T(Package): - version('2.1') - version('2.0') - - depends_on('u', when='@2.1:') -""", -) - - -_pkgu = ( - "u", - """\ -class U(Package): - version('1.1') - version('1.0') -""", -) - - @pytest.fixture -def _create_test_repo(tmpdir, mutable_config): - yield create_test_repo(tmpdir, [_pkgx, _pkgy, _pkgv, _pkgt, _pkgu]) - - -@pytest.fixture -def test_repo(_create_test_repo, monkeypatch, mock_stage): - with spack.repo.use_repositories(_create_test_repo) as mock_repo_path: +def test_repo(mutable_config, monkeypatch, mock_stage): + repo_dir = pathlib.Path(spack.paths.repos_path) / "requirements.test" + with spack.repo.use_repositories(str(repo_dir)) as mock_repo_path: yield mock_repo_path @@ -491,23 +424,24 @@ def test_oneof_ordering(concretize_scope, test_repo): assert s2.satisfies("@2.5") -def test_reuse_oneof(concretize_scope, _create_test_repo, mutable_database, mock_fetch): +def test_reuse_oneof(concretize_scope, test_repo, tmp_path, mock_fetch): conf_str = """\ packages: y: require: - - one_of: ["@2.5", "%gcc"] + - one_of: ["@2.5", "~shared"] """ - with spack.repo.use_repositories(_create_test_repo): - s1 = Spec("y@2.5%gcc").concretized() + store_dir = tmp_path / "store" + with spack.store.use_store(str(store_dir)): + s1 = Spec("y@2.5 ~shared").concretized() s1.package.do_install(fake=True, explicit=True) update_packages_config(conf_str) with spack.config.override("concretizer:reuse", True): s2 = Spec("y").concretized() - assert not s2.satisfies("@2.5 %gcc") + assert not s2.satisfies("@2.5 ~shared") @pytest.mark.parametrize( @@ -546,13 +480,11 @@ def test_requirements_and_deprecated_versions( @pytest.mark.parametrize("spec_str,requirement_str", [("x", "%gcc"), ("x", "%clang")]) def test_default_requirements_with_all(spec_str, requirement_str, concretize_scope, test_repo): """Test that default requirements are applied to all packages.""" - conf_str = """\ + conf_str = f"""\ packages: all: - require: "{}" -""".format( - requirement_str - ) + require: "{requirement_str}" +""" update_packages_config(conf_str) spec = Spec(spec_str).concretized() @@ -573,15 +505,13 @@ def test_default_and_package_specific_requirements( """Test that specific package requirements override default package requirements.""" generic_req, specific_req = requirements generic_exp, specific_exp = expectations - conf_str = """\ + conf_str = f"""\ packages: all: - require: "{}" + require: "{generic_req}" x: - require: "{}" -""".format( - generic_req, specific_req - ) + require: "{specific_req}" +""" update_packages_config(conf_str) spec = Spec("x").concretized() @@ -592,13 +522,11 @@ def test_default_and_package_specific_requirements( @pytest.mark.parametrize("mpi_requirement", ["mpich", "mpich2", "zmpi"]) def test_requirements_on_virtual(mpi_requirement, concretize_scope, mock_packages): - conf_str = """\ + conf_str = f"""\ packages: mpi: - require: "{}" -""".format( - mpi_requirement - ) + require: "{mpi_requirement}" +""" update_packages_config(conf_str) spec = Spec("callpath").concretized() @@ -613,15 +541,13 @@ def test_requirements_on_virtual(mpi_requirement, concretize_scope, mock_package def test_requirements_on_virtual_and_on_package( mpi_requirement, specific_requirement, concretize_scope, mock_packages ): - conf_str = """\ + conf_str = f"""\ packages: mpi: - require: "{0}" - {0}: - require: "{1}" -""".format( - mpi_requirement, specific_requirement - ) + require: "{mpi_requirement}" + {mpi_requirement}: + require: "{specific_requirement}" +""" update_packages_config(conf_str) spec = Spec("callpath").concretized() diff --git a/lib/spack/spack/test/flag_mixing.py b/lib/spack/spack/test/flag_mixing.py index d3db72625f1012..6009ade058e5bd 100644 --- a/lib/spack/spack/test/flag_mixing.py +++ b/lib/spack/spack/test/flag_mixing.py @@ -2,6 +2,8 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import pathlib + import pytest import spack.config @@ -9,7 +11,6 @@ import spack.repo import spack.util.spack_yaml as syaml from spack.spec import Spec -from spack.test.conftest import create_test_repo """ These tests include the following package DAGs: @@ -40,90 +41,11 @@ y """ -_pkgx = ( - "x", - """\ -class X(Package): - version("1.1") - version("1.0") - - variant("activatemultiflag", default=False) - depends_on('y cflags="-d1"', when="~activatemultiflag") - depends_on('y cflags="-d1 -d2"', when="+activatemultiflag") -""", -) - - -_pkgy = ( - "y", - """\ -class Y(Package): - version("2.1") - version("2.0") -""", -) - - -_pkgw = ( - "w", - """\ -class W(Package): - version("3.1") - version("3.0") - - variant("moveflaglater", default=False) - - depends_on('x +activatemultiflag') - depends_on('y cflags="-d0"', when="~moveflaglater") - depends_on('y cflags="-d3"', when="+moveflaglater") -""", -) - - -_pkgv = ( - "v", - """\ -class V(Package): - version("4.1") - version("4.0") - - depends_on("y") -""", -) - - -_pkgt = ( - "t", - """\ -class T(Package): - version("5.0") - - depends_on("u") - depends_on("x+activatemultiflag") - depends_on("y cflags='-c1 -c2'") -""", -) - - -_pkgu = ( - "u", - """\ -class U(Package): - version("6.0") - - depends_on("y cflags='-e1 -e2'") -""", -) - - -@pytest.fixture -def _create_test_repo(tmpdir, mutable_config): - yield create_test_repo(tmpdir, [_pkgt, _pkgu, _pkgv, _pkgw, _pkgx, _pkgy]) - @pytest.fixture -def test_repo(_create_test_repo, monkeypatch, mock_stage): - with spack.repo.use_repositories(_create_test_repo) as mock_repo_path: +def test_repo(mutable_config, monkeypatch, mock_stage): + repo_dir = pathlib.Path(spack.paths.repos_path) / "flags.test" + with spack.repo.use_repositories(str(repo_dir)) as mock_repo_path: yield mock_repo_path diff --git a/var/spack/repos/flags.test/packages/t/package.py b/var/spack/repos/flags.test/packages/t/package.py new file mode 100644 index 00000000000000..359f8f4f0345e8 --- /dev/null +++ b/var/spack/repos/flags.test/packages/t/package.py @@ -0,0 +1,15 @@ +# Copyright 2013-2024 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 T(Package): + version("5.0") + + depends_on("u") + depends_on("x+activatemultiflag") + depends_on("y cflags='-c1 -c2'") + + depends_on("c", type="build") diff --git a/var/spack/repos/flags.test/packages/u/package.py b/var/spack/repos/flags.test/packages/u/package.py new file mode 100644 index 00000000000000..7839ab8191af5d --- /dev/null +++ b/var/spack/repos/flags.test/packages/u/package.py @@ -0,0 +1,13 @@ +# Copyright 2013-2024 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 U(Package): + version("6.0") + + depends_on("y cflags='-e1 -e2'") + + depends_on("c", type="build") diff --git a/var/spack/repos/flags.test/packages/v/package.py b/var/spack/repos/flags.test/packages/v/package.py new file mode 100644 index 00000000000000..afc8c5117c8d10 --- /dev/null +++ b/var/spack/repos/flags.test/packages/v/package.py @@ -0,0 +1,14 @@ +# Copyright 2013-2024 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 V(Package): + version("4.1") + version("4.0") + + depends_on("y") + + depends_on("c", type="build") diff --git a/var/spack/repos/flags.test/packages/w/package.py b/var/spack/repos/flags.test/packages/w/package.py new file mode 100644 index 00000000000000..dbfadf6851a9c0 --- /dev/null +++ b/var/spack/repos/flags.test/packages/w/package.py @@ -0,0 +1,18 @@ +# Copyright 2013-2024 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 W(Package): + version("3.1") + version("3.0") + + variant("moveflaglater", default=False) + + depends_on("x +activatemultiflag") + depends_on('y cflags="-d0"', when="~moveflaglater") + depends_on('y cflags="-d3"', when="+moveflaglater") + + depends_on("c", type="build") diff --git a/var/spack/repos/flags.test/packages/x/package.py b/var/spack/repos/flags.test/packages/x/package.py new file mode 100644 index 00000000000000..d7c1c076306dc9 --- /dev/null +++ b/var/spack/repos/flags.test/packages/x/package.py @@ -0,0 +1,16 @@ +# Copyright 2013-2024 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 X(Package): + version("1.1") + version("1.0") + + variant("activatemultiflag", default=False) + depends_on('y cflags="-d1"', when="~activatemultiflag") + depends_on('y cflags="-d1 -d2"', when="+activatemultiflag") + + depends_on("c", type="build") diff --git a/var/spack/repos/flags.test/packages/y/package.py b/var/spack/repos/flags.test/packages/y/package.py new file mode 100644 index 00000000000000..ea736afb8a7933 --- /dev/null +++ b/var/spack/repos/flags.test/packages/y/package.py @@ -0,0 +1,12 @@ +# Copyright 2013-2024 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 Y(Package): + version("2.1") + version("2.0") + + depends_on("c", type="build") diff --git a/var/spack/repos/flags.test/repo.yaml b/var/spack/repos/flags.test/repo.yaml new file mode 100644 index 00000000000000..a87dc9ca963093 --- /dev/null +++ b/var/spack/repos/flags.test/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: flags.test diff --git a/var/spack/repos/requirements.test/packages/t/package.py b/var/spack/repos/requirements.test/packages/t/package.py new file mode 100644 index 00000000000000..f0ca8563dac874 --- /dev/null +++ b/var/spack/repos/requirements.test/packages/t/package.py @@ -0,0 +1,14 @@ +# Copyright 2013-2024 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 T(Package): + version("2.1") + version("2.0") + + depends_on("u", when="@2.1:") + + depends_on("c", type="build") diff --git a/var/spack/repos/requirements.test/packages/u/package.py b/var/spack/repos/requirements.test/packages/u/package.py new file mode 100644 index 00000000000000..b2203459089fa1 --- /dev/null +++ b/var/spack/repos/requirements.test/packages/u/package.py @@ -0,0 +1,12 @@ +# Copyright 2013-2024 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 U(Package): + version("1.1") + version("1.0") + + depends_on("c", type="build") diff --git a/var/spack/repos/requirements.test/packages/v/package.py b/var/spack/repos/requirements.test/packages/v/package.py new file mode 100644 index 00000000000000..426edbfb80bf0b --- /dev/null +++ b/var/spack/repos/requirements.test/packages/v/package.py @@ -0,0 +1,12 @@ +# Copyright 2013-2024 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 V(Package): + version("2.1") + version("2.0") + + depends_on("c", type="build") diff --git a/var/spack/repos/requirements.test/packages/x/package.py b/var/spack/repos/requirements.test/packages/x/package.py new file mode 100644 index 00000000000000..93771c3311c991 --- /dev/null +++ b/var/spack/repos/requirements.test/packages/x/package.py @@ -0,0 +1,16 @@ +# Copyright 2013-2024 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 X(Package): + version("1.1") + version("1.0") + version("0.9") + + variant("shared", default=True, description="Build shared libraries") + + depends_on("y") + depends_on("c", type="build") diff --git a/var/spack/repos/requirements.test/packages/y/package.py b/var/spack/repos/requirements.test/packages/y/package.py new file mode 100644 index 00000000000000..0ba70acf0603be --- /dev/null +++ b/var/spack/repos/requirements.test/packages/y/package.py @@ -0,0 +1,15 @@ +# Copyright 2013-2024 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 Y(Package): + version("2.5") + version("2.4") + version("2.3", deprecated=True) + + variant("shared", default=True, description="Build shared libraries") + + depends_on("c", type="build") diff --git a/var/spack/repos/requirements.test/repo.yaml b/var/spack/repos/requirements.test/repo.yaml new file mode 100644 index 00000000000000..7be2a780ea7223 --- /dev/null +++ b/var/spack/repos/requirements.test/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: requirements.test From f4f59b7f1807cf7eed2de795d86d5c44d0d31726 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Mon, 16 Sep 2024 09:14:24 -0700 Subject: [PATCH 156/687] openblas and others: change flag_handler idiom to respect incoming flags (#46211) * openblas: fix flag_handler to respect flags * arpack-ng: fix flag_handler to respect flags * czmq: fix flag_handler to respect flags * flex: fix flag_handler to respect flags * json-c: fix flag_handler to respect flags * mpifileutils: fix flag_handler to respect flags * netlib-scalapack: fix flag_handler to respect flags * sed: fix flag_handler to respect flags --------- Co-authored-by: Harmen Stoppels --- var/spack/repos/builtin/packages/arpack-ng/package.py | 7 +++---- var/spack/repos/builtin/packages/czmq/package.py | 7 +++---- var/spack/repos/builtin/packages/flex/package.py | 5 ++--- var/spack/repos/builtin/packages/json-c/package.py | 5 ++--- var/spack/repos/builtin/packages/mpifileutils/package.py | 5 ++--- .../repos/builtin/packages/netlib-scalapack/package.py | 7 +++---- var/spack/repos/builtin/packages/openblas/package.py | 5 ++--- var/spack/repos/builtin/packages/sed/package.py | 5 ++--- 8 files changed, 19 insertions(+), 27 deletions(-) diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py index 06435b9248b038..564c684e38af76 100644 --- a/var/spack/repos/builtin/packages/arpack-ng/package.py +++ b/var/spack/repos/builtin/packages/arpack-ng/package.py @@ -93,16 +93,15 @@ class ArpackNg(CMakePackage, AutotoolsPackage): def flag_handler(self, name, flags): spec = self.spec - iflags = [] if name == "cflags": if spec.satisfies("%oneapi"): - iflags.append("-Wno-error=implicit-function-declaration") + flags.append("-Wno-error=implicit-function-declaration") if name == "fflags": if self.spec.satisfies("%cce"): - iflags.append("-hnopattern") + flags.append("-hnopattern") - return (iflags, None, None) + return (flags, None, None) @property def libs(self): diff --git a/var/spack/repos/builtin/packages/czmq/package.py b/var/spack/repos/builtin/packages/czmq/package.py index 9f8805bed9e8f4..7206bbe28efb90 100644 --- a/var/spack/repos/builtin/packages/czmq/package.py +++ b/var/spack/repos/builtin/packages/czmq/package.py @@ -32,12 +32,11 @@ class Czmq(AutotoolsPackage): depends_on("libzmq") def flag_handler(self, name, flags): - iflags = [] if name == "cflags": if self.spec.satisfies("%oneapi@2022.2.0:"): - iflags.append("-Wno-error=gnu-null-pointer-arithmetic") - iflags.append("-Wno-error=strict-prototypes") - return (iflags, None, None) + flags.append("-Wno-error=gnu-null-pointer-arithmetic") + flags.append("-Wno-error=strict-prototypes") + return (flags, None, None) def autoreconf(self, spec, prefix): autogen = Executable("./autogen.sh") diff --git a/var/spack/repos/builtin/packages/flex/package.py b/var/spack/repos/builtin/packages/flex/package.py index 3b2bf4f1ebf368..cacd5c71a92b6d 100644 --- a/var/spack/repos/builtin/packages/flex/package.py +++ b/var/spack/repos/builtin/packages/flex/package.py @@ -65,11 +65,10 @@ class Flex(AutotoolsPackage): def flag_handler(self, name, flags): spec = self.spec - iflags = [] if name == "cflags": if spec.satisfies("%oneapi"): - iflags.append("-Wno-error=implicit-function-declaration") - return (iflags, None, None) + flags.append("-Wno-error=implicit-function-declaration") + return (flags, None, None) @classmethod def determine_version(cls, exe): diff --git a/var/spack/repos/builtin/packages/json-c/package.py b/var/spack/repos/builtin/packages/json-c/package.py index fbd69a01b6ac22..59da279e5e79fc 100644 --- a/var/spack/repos/builtin/packages/json-c/package.py +++ b/var/spack/repos/builtin/packages/json-c/package.py @@ -48,11 +48,10 @@ def patch(self): filter_file("-Werror", "", "CMakeLists.txt") def flag_handler(self, name, flags): - iflags = [] if name == "cflags": if self.spec.satisfies("%oneapi"): - iflags.append("-Wno-error=implicit-function-declaration") - return (iflags, None, None) + flags.append("-Wno-error=implicit-function-declaration") + return (flags, None, None) @run_after("install") def darwin_fix(self): diff --git a/var/spack/repos/builtin/packages/mpifileutils/package.py b/var/spack/repos/builtin/packages/mpifileutils/package.py index 2d51b9425ec3c6..ffe5e9e9e70da7 100644 --- a/var/spack/repos/builtin/packages/mpifileutils/package.py +++ b/var/spack/repos/builtin/packages/mpifileutils/package.py @@ -65,11 +65,10 @@ class Mpifileutils(CMakePackage): def flag_handler(self, name, flags): spec = self.spec - iflags = [] if name == "cflags": if spec.satisfies("%oneapi"): - iflags.append("-Wno-error=implicit-function-declaration") - return (iflags, None, None) + flags.append("-Wno-error=implicit-function-declaration") + return (flags, None, None) def cmake_args(self): args = [ diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py index 38ad49f7957aad..245dcfaf0c7a70 100644 --- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py +++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py @@ -41,15 +41,14 @@ class ScalapackBase(CMakePackage): patch("fix-build-macos.patch", when="@2.2.0") def flag_handler(self, name, flags): - iflags = [] if name == "cflags": if self.spec.satisfies("%gcc@14:"): # https://bugzilla.redhat.com/show_bug.cgi?id=2178710 - iflags.append("-std=gnu89") + flags.append("-std=gnu89") elif name == "fflags": if self.spec.satisfies("%cce"): - iflags.append("-hnopattern") - return (iflags, None, None) + flags.append("-hnopattern") + return (flags, None, None) @property def libs(self): diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index 832fdda9db1ed2..dcb965dbc2a8d0 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -270,11 +270,10 @@ class Openblas(CMakePackage, MakefilePackage): def flag_handler(self, name, flags): spec = self.spec - iflags = [] if name == "cflags": if spec.satisfies("@0.3.20: %oneapi") or spec.satisfies("@0.3.20: %arm"): - iflags.append("-Wno-error=implicit-function-declaration") - return (iflags, None, None) + flags.append("-Wno-error=implicit-function-declaration") + return (flags, None, None) @classmethod def determine_version(cls, lib): diff --git a/var/spack/repos/builtin/packages/sed/package.py b/var/spack/repos/builtin/packages/sed/package.py index 0c556310799ebf..5a6b21b4b95760 100644 --- a/var/spack/repos/builtin/packages/sed/package.py +++ b/var/spack/repos/builtin/packages/sed/package.py @@ -44,8 +44,7 @@ def determine_version(cls, exe): return match.group(1) if match else None def flag_handler(self, name, flags): - iflags = [] if name == "cflags": if self.spec.satisfies("%oneapi@2023.0.0:"): - iflags.append("-Wno-error=incompatible-function-pointer-types") - return (iflags, None, None) + flags.append("-Wno-error=incompatible-function-pointer-types") + return (flags, None, None) From ade9c8da0e60ea2ab7d92de81f652c4bf99e9741 Mon Sep 17 00:00:00 2001 From: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:42:24 -0500 Subject: [PATCH 157/687] Revert "allow failure for cray-sles (#46411)" (#46413) This reverts commit 576251f0dad79d0e69f73eb393ce40a0921df0b4. --- share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index f538704732f6cf..9bee896586eb90 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -905,7 +905,6 @@ e4s-cray-rhel-build: SPACK_CI_STACK_NAME: e4s-cray-sles e4s-cray-sles-generate: - allow_failure: true # no machines available extends: [ ".generate-cray-sles", ".e4s-cray-sles" ] e4s-cray-sles-build: From 654d6f13978f59cda1ea311730c544f964eefd52 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 16 Sep 2024 13:38:13 -0500 Subject: [PATCH 158/687] qt: add v5.15.15 (#46405) --- var/spack/repos/builtin/packages/qt/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index cc5fd528fef5f7..442edd5d294946 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -32,6 +32,7 @@ class Qt(Package): license("LGPL-3.0-only") + version("5.15.15", sha256="b423c30fe3ace7402e5301afbb464febfb3da33d6282a37a665be1e51502335e") version("5.15.14", sha256="fdd3a4f197d2c800ee0085c721f4bef60951cbda9e9c46e525d1412f74264ed7") version("5.15.13", sha256="9550ec8fc758d3d8d9090e261329700ddcd712e2dda97e5fcfeabfac22bea2ca") version("5.15.12", sha256="93f2c0889ee2e9cdf30c170d353c3f829de5f29ba21c119167dee5995e48ccce") From 0d86ecf122e81b2198d3d23a25b4f03f665f13c5 Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Mon, 16 Sep 2024 14:40:39 -0400 Subject: [PATCH 159/687] arborx: add 1.7 (#46392) --- .../repos/builtin/packages/arborx/package.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/arborx/package.py b/var/spack/repos/builtin/packages/arborx/package.py index a4c1b7249c514d..b5fc91a175d542 100644 --- a/var/spack/repos/builtin/packages/arborx/package.py +++ b/var/spack/repos/builtin/packages/arborx/package.py @@ -23,6 +23,7 @@ class Arborx(CMakePackage, CudaPackage, ROCmPackage): license("BSD-3-Clause") version("master", branch="master") + version("1.7", sha256="e3d9a57a1d7c1ad62f6bbb43fd29a366506f3a16cbbe801c04d10f5fb0dec201") version("1.6", sha256="c2230de185d62f1999d36c6b8b92825f19ab9fbf30bdae90595cab04e76561a4") version("1.5", sha256="c26f23c17e749ccf3e2d353a68969aa54d31b8e720dbfdbc2cef16c5d8477e9e") version("1.4.1", sha256="2ca828ef6615859654b233a7df17017e7cfd904982b80026ec7409eb46b77a95") @@ -74,9 +75,10 @@ class Arborx(CMakePackage, CudaPackage, ROCmPackage): depends_on("kokkos@3.1.00:", when="~trilinos") depends_on("kokkos@3.4.00:", when="@1.2~trilinos") depends_on("kokkos@3.6.00:", when="@1.3~trilinos") - depends_on("kokkos@3.7.01:", when="@1.4:~trilinos") - depends_on("kokkos@4.0.00:", when="@1.5:~trilinos") - depends_on("kokkos@4.1.00:", when="@1.6:~trilinos") + depends_on("kokkos@3.7.01:", when="@1.4:1.4.1~trilinos") + depends_on("kokkos@4.0.00:", when="@1.5~trilinos") + depends_on("kokkos@4.1.00:", when="@1.6~trilinos") + depends_on("kokkos@4.2.00:", when="@1.7:~trilinos") for backend in kokkos_backends: depends_on("kokkos+%s" % backend.lower(), when="~trilinos+%s" % backend.lower()) @@ -102,9 +104,10 @@ class Arborx(CMakePackage, CudaPackage, ROCmPackage): depends_on("trilinos+openmp", when="+trilinos+openmp") depends_on("trilinos@13.2.0:", when="@1.2+trilinos") depends_on("trilinos@13.4.0:", when="@1.3+trilinos") - depends_on("trilinos@14.0.0:", when="@1.4:+trilinos") - depends_on("trilinos@14.2.0:", when="@1.5:+trilinos") - depends_on("trilinos@14.4.0:", when="@1.6:+trilinos") + depends_on("trilinos@14.0.0:", when="@1.4:1.4.1+trilinos") + depends_on("trilinos@14.2.0:", when="@1.5+trilinos") + depends_on("trilinos@14.4.0:", when="@1.6+trilinos") + depends_on("trilinos@15.1.0:", when="@1.7:+trilinos") patch("trilinos14.0-kokkos-major-version.patch", when="@1.4+trilinos ^trilinos@14.0.0") conflicts("~serial", when="+trilinos") From a9a23f45651380c769ddcf72fee9a770b0b82cb8 Mon Sep 17 00:00:00 2001 From: Teague Sterling Date: Mon, 16 Sep 2024 11:42:27 -0700 Subject: [PATCH 160/687] duckdb: add v1.1.0, deprecate v0.10.0 (#46391) * duckdb: add v1.0.0, v0.10.3 * Adding issue reference * duckdb: add v1.1.0 --------- Signed-off-by: Teague Sterling --- var/spack/repos/builtin/packages/duckdb/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/duckdb/package.py b/var/spack/repos/builtin/packages/duckdb/package.py index 44249692dd1981..f43b3fb435de46 100644 --- a/var/spack/repos/builtin/packages/duckdb/package.py +++ b/var/spack/repos/builtin/packages/duckdb/package.py @@ -18,10 +18,15 @@ class Duckdb(MakefilePackage): maintainers("glentner", "teaguesterling") version("master", branch="master") + version("1.1.0", sha256="d9be2c6d3a5ebe2b3d33044fb2cb535bb0bd972a27ae38c4de5e1b4caa4bf68d") version("1.0.0", sha256="04e472e646f5cadd0a3f877a143610674b0d2bcf9f4102203ac3c3d02f1c5f26") version("0.10.3", sha256="7855587b3491dd488993287caee28720bee43ae28e92e8f41ea4631e9afcbf88") version("0.10.2", sha256="662a0ba5c35d678ab6870db8f65ffa1c72e6096ad525a35b41b275139684cea6") - version("0.10.0", sha256="5a925b8607d00a97c1a3ffe6df05c0a62a4df063abd022ada82ac1e917792013") + version( + "0.10.0", + sha256="5a925b8607d00a97c1a3ffe6df05c0a62a4df063abd022ada82ac1e917792013", + deprecated=True, + ) version( "0.9.2", sha256="afff7bd925a98dc2af4039b8ab2159b0705cbf5e0ee05d97f7bb8dce5f880dc2", From 2b70f8367c88e6c2a7ed3ce4768533a6d9b09d95 Mon Sep 17 00:00:00 2001 From: David Collins Date: Mon, 16 Sep 2024 12:44:27 -0600 Subject: [PATCH 161/687] Use the correct variable in configure() in bash package.py (#46384) --- var/spack/repos/builtin/packages/bash/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/bash/package.py b/var/spack/repos/builtin/packages/bash/package.py index 1aa02c1f7a56fb..4af7b56e98c2e9 100644 --- a/var/spack/repos/builtin/packages/bash/package.py +++ b/var/spack/repos/builtin/packages/bash/package.py @@ -205,7 +205,7 @@ def configure_args(self): args.append("--without-libiconv-prefix") # bash malloc relies on sbrk which fails intentionally in musl if spec.satisfies("^[virtuals=libc] musl"): - options.append("--without-bash-malloc") + args.append("--without-bash-malloc") return args def check(self): From 8bc897cee13328301ad4bd748a1cbb55a35bcdd5 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Mon, 16 Sep 2024 14:00:26 -0500 Subject: [PATCH 162/687] hipfft: update @master dependency wrt rocfft (#46376) * add master branch to rocfft and ensure its dependency on that branch for hip and rocm-cmake * ensure hipfft@master uses rocm-cmake@master --- var/spack/repos/builtin/packages/hipfft/package.py | 1 + var/spack/repos/builtin/packages/rocfft/package.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/hipfft/package.py b/var/spack/repos/builtin/packages/hipfft/package.py index ec06a50214ef7f..890fabab897946 100644 --- a/var/spack/repos/builtin/packages/hipfft/package.py +++ b/var/spack/repos/builtin/packages/hipfft/package.py @@ -83,6 +83,7 @@ class Hipfft(CMakePackage, CudaPackage, ROCmPackage): "6.1.1", "6.1.2", "6.2.0", + "master", ]: depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") depends_on(f"rocfft@{ver}", when=f"+rocm @{ver}") diff --git a/var/spack/repos/builtin/packages/rocfft/package.py b/var/spack/repos/builtin/packages/rocfft/package.py index 552b00c3817414..a42735f6dec277 100644 --- a/var/spack/repos/builtin/packages/rocfft/package.py +++ b/var/spack/repos/builtin/packages/rocfft/package.py @@ -20,6 +20,7 @@ class Rocfft(CMakePackage): libraries = ["librocfft"] license("MIT") + version("master", branch="master") version("6.2.0", sha256="c9886ec2c713c502dcde4f5fed3d6e1a7dd019023fb07e82d3b622e66c6f2c36") version("6.1.2", sha256="6f54609b0ecb8ceae8b7acd4c8692514c2c2dbaf0f8b199fe990fd4711428193") version("6.1.1", sha256="d517a931d49a1e59df4e494ab2b68e301fe7ebf39723863985567467f111111c") @@ -88,6 +89,7 @@ class Rocfft(CMakePackage): "6.1.1", "6.1.2", "6.2.0", + "master", ]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"rocm-cmake@{ver}:", type="build", when=f"@{ver}") From fcc28d72e82b9724166f3868b513a597d3ae2257 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Mon, 16 Sep 2024 15:02:22 -0400 Subject: [PATCH 163/687] [py-httpx] Dependency fixes and simplifications (#46367) --- .../repos/builtin/packages/py-httpx/package.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-httpx/package.py b/var/spack/repos/builtin/packages/py-httpx/package.py index 7ec617183517c2..37be8063c45923 100644 --- a/var/spack/repos/builtin/packages/py-httpx/package.py +++ b/var/spack/repos/builtin/packages/py-httpx/package.py @@ -24,7 +24,7 @@ class PyHttpx(PythonPackage): variant("http2", default=False, when="@0.15.2:", description="Enable http2 support") - depends_on("python@3.8", when="@0.27:", type=("build", "run")) + depends_on("python@3.8:", when="@0.27:", type=("build", "run")) depends_on("py-setuptools", when="@:0.22", type="build") depends_on("py-hatchling", when="@0.23:", type="build") depends_on("py-hatch-fancy-pypi-readme", when="@0.23:", type="build") @@ -32,7 +32,7 @@ class PyHttpx(PythonPackage): with default_args(type=("build", "run")): depends_on("py-certifi") - depends_on("py-httpcore@0.11.0:0.11", when="@0.15.2") + depends_on("py-httpcore@0.11", when="@0.15.2") depends_on("py-httpcore@0.14.5:0.14", when="@0.22") depends_on("py-httpcore@0.15:0.16", when="@0.23") depends_on("py-httpcore@1", when="@0.27:") @@ -40,19 +40,19 @@ class PyHttpx(PythonPackage): depends_on("py-anyio", when="@0.27:") depends_on("py-idna", when="@0.27:") - depends_on("py-sniffio@1.0:1", when="@0.11.1") + depends_on("py-sniffio@1", when="@0.11.1") depends_on("py-sniffio", when="@0.15.2:") - depends_on("py-h2@3.0:3", when="@0.11.1") - depends_on("py-h2@3.0:3", when="@0.15.2+http2") - depends_on("py-h2@3.0:4", when="@0.22.0:+http2") + depends_on("py-h2@3", when="@0.11.1") + depends_on("py-h2@3", when="@0.15.2+http2") + depends_on("py-h2@3:4", when="@0.22.0:+http2") # Historical dependencies depends_on("py-hstspreload", when="@0.11.1") - depends_on("py-chardet@3.0:3", when="@0.11.1") + depends_on("py-chardet@3", when="@0.11.1") depends_on("py-h11@0.8:0.9", when="@0.11.1") - depends_on("py-idna@2.0:2", when="@0.11.1") - depends_on("py-urllib3@1.0:1", when="@0.11.1") + depends_on("py-idna@2", when="@0.11.1") + depends_on("py-urllib3@1", when="@0.11.1") depends_on("py-charset-normalizer", when="@0.22") depends_on("py-rfc3986@1.3:1", when="@0.11.1") From 9c222aee67906ba620754e3fcf840be9cd62e0f8 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 16 Sep 2024 14:03:39 -0500 Subject: [PATCH 164/687] libedit: add v3.1-20240517, v3.1-20240808 (#46366) --- var/spack/repos/builtin/packages/libedit/package.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/libedit/package.py b/var/spack/repos/builtin/packages/libedit/package.py index 5a85f50e334f4f..98ecb9251b8ce2 100644 --- a/var/spack/repos/builtin/packages/libedit/package.py +++ b/var/spack/repos/builtin/packages/libedit/package.py @@ -12,8 +12,14 @@ class Libedit(AutotoolsPackage): homepage = "https://thrysoee.dk/editline/" url = "https://thrysoee.dk/editline/libedit-20170329-3.1.tar.gz" - license("BSD-3-Clause") + license("BSD-3-Clause", checked_by="wdconinc") + version( + "3.1-20240808", sha256="5f0573349d77c4a48967191cdd6634dd7aa5f6398c6a57fe037cc02696d6099f" + ) + version( + "3.1-20240517", sha256="3a489097bb4115495f3bd85ae782852b7097c556d9500088d74b6fa38dbd12ff" + ) version( "3.1-20230828", sha256="4ee8182b6e569290e7d1f44f0f78dac8716b35f656b76528f699c69c98814dad" ) @@ -33,7 +39,7 @@ class Libedit(AutotoolsPackage): "3.1-20150325", sha256="c88a5e4af83c5f40dda8455886ac98923a9c33125699742603a88a0253fcc8c5" ) - depends_on("c", type="build") # generated + depends_on("c", type="build") depends_on("pkgconfig", type="build") depends_on("ncurses") From bba66f9dae61106874bdd3d6e3cf589fa0400896 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 16 Sep 2024 14:09:47 -0500 Subject: [PATCH 165/687] libxslt: add through v1.1.42 (now at gnome.org) (#46364) * libxslt: add through v1.1.42 (now at gnome.org) * libxslt: add v1.1.35 (apparently forgotten) --- .../repos/builtin/packages/libxslt/package.py | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/libxslt/package.py b/var/spack/repos/builtin/packages/libxslt/package.py index aeb2e1b0808de8..10736251a936bb 100644 --- a/var/spack/repos/builtin/packages/libxslt/package.py +++ b/var/spack/repos/builtin/packages/libxslt/package.py @@ -13,18 +13,30 @@ class Libxslt(AutotoolsPackage): implements most of the EXSLT set of processor-portable extensions functions and some of Saxon's evaluate and expressions extensions.""" - homepage = "http://www.xmlsoft.org/XSLT/index.html" - url = "http://xmlsoft.org/sources/libxslt-1.1.32.tar.gz" - - license("X11") - + homepage = "https://gitlab.gnome.org/GNOME/libxslt/-/wikis/home" + url = "https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.34.tar.xz" + git = "https://gitlab.gnome.org/GNOME/libxslt" + list_url = "https://download.gnome.org/sources/libxslt/" + list_depth = 1 + + license("X11", checked_by="wdconinc") + + version("1.1.42", sha256="85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb") + version("1.1.41", sha256="3ad392af91115b7740f7b50d228cc1c5fc13afc1da7f16cb0213917a37f71bda") + version("1.1.40", sha256="194715db023035f65fb566402f2ad2b5eab4c29d541f511305c40b29b1f48d13") + version("1.1.39", sha256="2a20ad621148339b0759c4d4e96719362dee64c9a096dbba625ba053846349f0") + version("1.1.38", sha256="1f32450425819a09acaff2ab7a5a7f8a2ec7956e505d7beeb45e843d0e1ecab1") + version("1.1.37", sha256="3a4b27dc8027ccd6146725950336f1ec520928f320f144eb5fa7990ae6123ab4") + version("1.1.36", sha256="12848f0a4408f65b530d3962cd9ff670b6ae796191cfeff37522b5772de8dc8e") + version("1.1.35", sha256="8247f33e9a872c6ac859aa45018bc4c4d00b97e2feac9eebc10c93ce1f34dd79") + version("1.1.34", sha256="98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7f93f7f") version("1.1.33", sha256="8e36605144409df979cab43d835002f63988f3dc94d5d3537c12796db90e38c8") version("1.1.32", sha256="526ecd0abaf4a7789041622c3950c0e7f2c4c8835471515fd77eec684a355460") version("1.1.29", sha256="b5976e3857837e7617b29f2249ebb5eeac34e249208d31f1fbf7a6ba7a4090ce") version("1.1.28", sha256="5fc7151a57b89c03d7b825df5a0fae0a8d5f05674c0e7cf2937ecec4d54a028c") version("1.1.26", sha256="55dd52b42861f8a02989d701ef716d6280bfa02971e967c285016f99c66e3db1") - depends_on("c", type="build") # generated + depends_on("c", type="build") variant("crypto", default=True, description="Build libexslt with crypto support") variant("python", default=False, description="Build Python bindings") @@ -40,6 +52,12 @@ class Libxslt(AutotoolsPackage): depends_on("python+shared", when="+python") extends("python", when="+python") + def url_for_version(self, v): + if v > Version("1.1.34"): + return f"https://download.gnome.org/sources/libxslt/{v.up_to(2)}/libxslt-{v}.tar.xz" + else: + return f"http://xmlsoft.org/sources/libxslt-{v}.tar.gz" + def configure_args(self): args = [] From 0cb4db950fc0ba9af7b9b2004ddf3a4922a8e7bd Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 16 Sep 2024 14:13:24 -0500 Subject: [PATCH 166/687] nghttp2: add v1.62.1, v1.63.0 (#46358) --- var/spack/repos/builtin/packages/nghttp2/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/nghttp2/package.py b/var/spack/repos/builtin/packages/nghttp2/package.py index 28c02713ece46e..e49b0f73193d5e 100644 --- a/var/spack/repos/builtin/packages/nghttp2/package.py +++ b/var/spack/repos/builtin/packages/nghttp2/package.py @@ -15,6 +15,8 @@ class Nghttp2(AutotoolsPackage): license("MIT") + version("1.63.0", sha256="9318a2cc00238f5dd6546212109fb833f977661321a2087f03034e25444d3dbb") + version("1.62.1", sha256="d0b0b9d00500ee4aa3bfcac00145d3b1ef372fd301c35bff96cf019c739db1b4") version("1.62.0", sha256="482e41a46381d10adbdfdd44c1942ed5fd1a419e0ab6f4a5ff5b61468fe6f00d") version("1.61.0", sha256="aa7594c846e56a22fbf3d6e260e472268808d3b49d5e0ed339f589e9cc9d484c") version("1.57.0", sha256="1e3258453784d3b7e6cc48d0be087b168f8360b5d588c66bfeda05d07ad39ffd") @@ -48,4 +50,5 @@ def configure_args(self): "--with-mruby=no", "--with-neverbleed=no", "--with-boost=no", + "--with-wolfssl=no", ] From 176b7f88548433cb67e01f06a611794acb2615ae Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 16 Sep 2024 13:15:02 -0600 Subject: [PATCH 167/687] lammps-example-plugin: add new versions, fix bug (#46331) --- .../packages/lammps-example-plugin/package.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/lammps-example-plugin/package.py b/var/spack/repos/builtin/packages/lammps-example-plugin/package.py index e82a8d4a471f12..4233b0da2b3c0f 100644 --- a/var/spack/repos/builtin/packages/lammps-example-plugin/package.py +++ b/var/spack/repos/builtin/packages/lammps-example-plugin/package.py @@ -26,6 +26,11 @@ class LammpsExamplePlugin(CMakePackage): # marked deprecated=True # * patch releases older than a stable release should be marked deprecated=True version("develop", branch="develop") + version( + "20240829", + sha256="6112e0cc352c3140a4874c7f74db3c0c8e30134024164509ecf3772b305fde2e", + preferred=True, + ) version("20240627", sha256="2174a99d266279823a8c57629ee1c21ec357816aefd85f964d9f859fe9222aa5") version("20240417", sha256="158b288725c251fd8b30dbcf61749e0d6a042807da92af865a7d3c413efdd8ea") version( @@ -38,9 +43,10 @@ class LammpsExamplePlugin(CMakePackage): ) version("20231121", sha256="704d8a990874a425bcdfe0245faf13d712231ba23f014a3ebc27bc14398856f1") version( - "20230802.3", - sha256="6666e28cb90d3ff01cbbda6c81bdb85cf436bbb41604a87f2ab2fa559caa8510", - preferred=True, + "20230802.4", sha256="6eed007cc24cda80b5dd43372b2ad4268b3982bb612669742c8c336b79137b5b" + ) + version( + "20230802.3", sha256="6666e28cb90d3ff01cbbda6c81bdb85cf436bbb41604a87f2ab2fa559caa8510" ) depends_on("cxx", type="build") @@ -59,7 +65,7 @@ def url_for_version(self, version): update, ) - depends_on("lammps+plugin+lib") + depends_on("lammps+plugin+lib+openmp-package") root_cmakelists_dir = "examples/plugins" @@ -67,7 +73,7 @@ def patch(self): with open("examples/plugins/CMakeLists.txt", "a") as f: print("include(GNUInstallDirs)", file=f) print( - "install(TARGETS morse2plugin nve2plugin helloplugin zero2plugin morse2plugin" + "install(TARGETS morse2plugin nve2plugin helloplugin zero2plugin morse2plugin " "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/lammps/plugins)", file=f, ) From b1905186a621d8f2b2afe13921d30fd056b19aeb Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Mon, 16 Sep 2024 14:53:00 -0500 Subject: [PATCH 168/687] kokkos, kokkos-kernels, kokkos-nvcc-wrapper: add v4.4.01 (#46377) * kokkos, kokkos-kernels, kokkos-nvcc-wrapper: add v4.4.01 * trilinos: update @[master,develop] dependency on kokkos ==> Error: InstallError: For Trilinos@[master,develop], ^kokkos version in spec must match version in Trilinos source code. Specify ^kokkos@4.4.01 for trilinos@[master,develop] instead of ^kokkos@4.4.00. --- var/spack/repos/builtin/packages/kokkos-kernels/package.py | 2 ++ var/spack/repos/builtin/packages/kokkos-nvcc-wrapper/package.py | 1 + var/spack/repos/builtin/packages/kokkos/package.py | 1 + var/spack/repos/builtin/packages/trilinos/package.py | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/kokkos-kernels/package.py b/var/spack/repos/builtin/packages/kokkos-kernels/package.py index e4af48534f5fb8..e28ad8be8281e8 100644 --- a/var/spack/repos/builtin/packages/kokkos-kernels/package.py +++ b/var/spack/repos/builtin/packages/kokkos-kernels/package.py @@ -25,6 +25,7 @@ class KokkosKernels(CMakePackage, CudaPackage): # openssl sha256 kokkos-kernels-x.y.z.tar.gz version("develop", branch="develop") version("master", branch="master") + version("4.4.01", sha256="9f741449f5ace5a7d8a5a81194ff2108e5525d16f08fcd9bb6c9bb4853d7720d") version("4.4.00", sha256="6559871c091eb5bcff53bae5a0f04f2298971d1aa1b2c135bd5a2dae3f9376a2") version("4.3.01", sha256="749553a6ea715ba1e56fa0b13b42866bb9880dba7a94e343eadf40d08c68fab8") version("4.3.00", sha256="03c3226ee97dbca4fa56fe69bc4eefa0673e23c37f2741943d9362424a63950e") @@ -52,6 +53,7 @@ class KokkosKernels(CMakePackage, CudaPackage): depends_on("kokkos") depends_on("kokkos@master", when="@master") depends_on("kokkos@develop", when="@develop") + depends_on("kokkos@4.4.01", when="@4.4.01") depends_on("kokkos@4.4.00", when="@4.4.00") depends_on("kokkos@4.3.01", when="@4.3.01") depends_on("kokkos@4.3.00", when="@4.3.00") diff --git a/var/spack/repos/builtin/packages/kokkos-nvcc-wrapper/package.py b/var/spack/repos/builtin/packages/kokkos-nvcc-wrapper/package.py index 3768fcff0673aa..ae8aca3945b592 100644 --- a/var/spack/repos/builtin/packages/kokkos-nvcc-wrapper/package.py +++ b/var/spack/repos/builtin/packages/kokkos-nvcc-wrapper/package.py @@ -21,6 +21,7 @@ class KokkosNvccWrapper(Package): license("BSD-3-Clause") + version("4.4.01", sha256="3f7096d17eaaa4004c7497ac082bf1ae3ff47b5104149e54af021a89414c3682") version("4.4.00", sha256="c638980cb62c34969b8c85b73e68327a2cb64f763dd33e5241f5fd437170205a") version("4.3.01", sha256="5998b7c732664d6b5e219ccc445cd3077f0e3968b4be480c29cd194b4f45ec70") version("4.3.00", sha256="53cf30d3b44dade51d48efefdaee7a6cf109a091b702a443a2eda63992e5fe0d") diff --git a/var/spack/repos/builtin/packages/kokkos/package.py b/var/spack/repos/builtin/packages/kokkos/package.py index 5229561ffcc6b9..20d6c944747856 100644 --- a/var/spack/repos/builtin/packages/kokkos/package.py +++ b/var/spack/repos/builtin/packages/kokkos/package.py @@ -27,6 +27,7 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage): version("master", branch="master") version("develop", branch="develop") + version("4.4.01", sha256="3f7096d17eaaa4004c7497ac082bf1ae3ff47b5104149e54af021a89414c3682") version("4.4.00", sha256="c638980cb62c34969b8c85b73e68327a2cb64f763dd33e5241f5fd437170205a") version("4.3.01", sha256="5998b7c732664d6b5e219ccc445cd3077f0e3968b4be480c29cd194b4f45ec70") version("4.3.00", sha256="53cf30d3b44dade51d48efefdaee7a6cf109a091b702a443a2eda63992e5fe0d") diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 877c2edc07a2a3..c5c6d44d1be5b7 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -403,7 +403,7 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): # ###################### Dependencies ########################## # External Kokkos - depends_on("kokkos@4.4.00", when="@master: +kokkos") + depends_on("kokkos@4.4.01", when="@master: +kokkos") depends_on("kokkos@4.3.01", when="@16.0.0 +kokkos") depends_on("kokkos@4.2.01", when="@15.1.0:15.1.1 +kokkos") depends_on("kokkos@4.1.00", when="@14.4.0:15.0.0 +kokkos") From 930e71177144c7f7c1b7ff6013a298db8a5eafad Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 16 Sep 2024 19:18:21 -0700 Subject: [PATCH 169/687] coverage: only upload to codecov once (#46385) Historically, every PR, push, etc. to Spack generates a bunch of jobs, each of which uploads its coverage report to codecov independently. This means that we get annoying partial coverage numbers when only a few of the jobs have finished, and frequently codecov is bad at understanding when to merge reports for a given PR. The numbers of the site can be weird as a result. This restructures our coverage handling so that we do all the merging ourselves and upload exactly one report per GitHub actions workflow. In practice, that means that every push to every PR will get exactly one coverage report and exactly one coverage number reported. I think this will at least partially restore peoples' faith in what codecov is telling them, and it might even make codecov handle Spack a bit better, since this reduces the report burden by ~7x. - [x] test and audit jobs now upload artifacts for coverage - [x] add a new job that downloads artifacts and merges coverage reports together - [x] set `paths` section of `pyproject.toml` so that cross-platform clone locations are merged - [x] upload to codecov once, at the end of the workflow Signed-off-by: Todd Gamblin --- .github/workflows/audit.yaml | 17 +++++------ .github/workflows/ci.yaml | 24 +++++++++++++++- .github/workflows/unit_tests.yaml | 47 ++++++++++++++++--------------- pyproject.toml | 8 ++++++ 4 files changed, 65 insertions(+), 31 deletions(-) diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml index 69f1781f5370d5..caf0096d577f88 100644 --- a/.github/workflows/audit.yaml +++ b/.github/workflows/audit.yaml @@ -40,6 +40,8 @@ jobs: run: | python -m pip install --upgrade pywin32 - name: Package audits (with coverage) + env: + COVERAGE_FILE: coverage/.coverage-audits-${{ matrix.system.os }} if: ${{ inputs.with_coverage == 'true' && runner.os != 'Windows' }} run: | . share/spack/setup-env.sh @@ -47,27 +49,26 @@ jobs: coverage run $(which spack) audit configs coverage run $(which spack) -d audit externals coverage combine - coverage xml - name: Package audits (without coverage) if: ${{ inputs.with_coverage == 'false' && runner.os != 'Windows' }} run: | - . share/spack/setup-env.sh + . share/spack/setup-env.sh spack -d audit packages spack -d audit configs spack -d audit externals - name: Package audits (without coverage) if: ${{ runner.os == 'Windows' }} run: | - . share/spack/setup-env.sh + . share/spack/setup-env.sh spack -d audit packages ./share/spack/qa/validate_last_exit.ps1 spack -d audit configs ./share/spack/qa/validate_last_exit.ps1 spack -d audit externals ./share/spack/qa/validate_last_exit.ps1 - - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 - if: ${{ inputs.with_coverage == 'true' }} + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 + if: ${{ inputs.with_coverage == 'true' && runner.os != 'Windows' }} with: - flags: unittests,audits - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + name: coverage-audits-${{ matrix.system.os }} + path: coverage + include-hidden-files: true diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 96fb38eb649cfe..20f004cf41c164 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -84,8 +84,30 @@ jobs: needs: [ prechecks, changes ] uses: ./.github/workflows/unit_tests.yaml secrets: inherit + upload-coverage: + needs: [ unit-tests, prechecks ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + fetch-depth: 0 + - name: Download coverage files + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + with: + pattern: coverage-* + path: coverage + merge-multiple: true + - run: pip install --upgrade coverage + - run: ls -la coverage + - run: coverage combine -a coverage/.coverage* + - run: coverage xml + - name: "Upload coverage" + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true all: - needs: [ unit-tests, bootstrap ] + needs: [ upload-coverage, bootstrap ] runs-on: ubuntu-latest steps: - name: Success diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 719dcdc4473fb2..93f7de36d2ba33 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -76,14 +76,15 @@ jobs: SPACK_PYTHON: python SPACK_TEST_PARALLEL: 2 COVERAGE: true + COVERAGE_FILE: coverage/.coverage-${{ matrix.os }}-python${{ matrix.python-version }} UNIT_TEST_COVERAGE: ${{ matrix.python-version == '3.11' }} run: | share/spack/qa/run-unit-tests - - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 with: - flags: unittests,linux,${{ matrix.concretizer }} - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + name: coverage-${{ matrix.os }}-python${{ matrix.python-version }} + path: coverage + include-hidden-files: true # Test shell integration shell: runs-on: ubuntu-latest @@ -112,11 +113,11 @@ jobs: COVERAGE: true run: | share/spack/qa/run-shell-tests - - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 with: - flags: shelltests,linux - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + name: coverage-shell + path: coverage + include-hidden-files: true # Test RHEL8 UBI with platform Python. This job is run # only on PRs modifying core Spack @@ -170,13 +171,14 @@ jobs: - name: Run unit tests (full suite with coverage) env: COVERAGE: true + COVERAGE_FILE: coverage/.coverage-clingo-cffi run: | share/spack/qa/run-unit-tests - - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 with: - flags: unittests,linux,clingo - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + name: coverage-clingo-cffi + path: coverage + include-hidden-files: true # Run unit tests on MacOS macos: runs-on: ${{ matrix.os }} @@ -201,6 +203,7 @@ jobs: - name: Run unit tests env: SPACK_TEST_PARALLEL: 4 + COVERAGE_FILE: coverage/.coverage-${{ matrix.os }}-python${{ matrix.python-version }} run: | git --version . .github/workflows/bin/setup_git.sh @@ -209,11 +212,11 @@ jobs: $(which spack) solve zlib common_args=(--dist loadfile --tx '4*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python' -x) $(which spack) unit-test --verbose --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml "${common_args[@]}" - - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 with: - flags: unittests,macos - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + name: coverage-${{ matrix.os }}-python${{ matrix.python-version }} + path: coverage + include-hidden-files: true # Run unit tests on Windows windows: defaults: @@ -235,13 +238,13 @@ jobs: run: | ./.github/workflows/bin/setup_git.ps1 - name: Unit Test + env: + COVERAGE_FILE: coverage/.coverage-windows run: | spack unit-test -x --verbose --cov --cov-config=pyproject.toml ./share/spack/qa/validate_last_exit.ps1 - coverage combine -a - coverage xml - - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 with: - flags: unittests,windows - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + name: coverage-windows + path: coverage + include-hidden-files: true diff --git a/pyproject.toml b/pyproject.toml index 06aec6fc43a913..d74b54270e9999 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -212,6 +212,14 @@ exclude_lines = [ ] ignore_errors = true +[tool.coverage.paths] +source = [ + ".", + "/Users/runner/work/spack/spack", + "/System/Volumes/Data/home/runner/work/spack/spack", + "D:\\a\\spack\\spack", +] + [tool.coverage.html] directory = "htmlcov" From 673565aefe79f4c8c4aec8ab61fb07c57c2a7ced Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 17 Sep 2024 07:45:59 +0200 Subject: [PATCH 170/687] imports: automate missing imports (#46410) --- lib/spack/spack/audit.py | 2 + lib/spack/spack/bootstrap/config.py | 1 + lib/spack/spack/bootstrap/environment.py | 2 + lib/spack/spack/build_environment.py | 20 +++------ lib/spack/spack/build_systems/_checks.py | 6 +-- lib/spack/spack/build_systems/autotools.py | 9 ++-- lib/spack/spack/build_systems/cmake.py | 3 +- lib/spack/spack/build_systems/compiler.py | 1 + lib/spack/spack/build_systems/intel.py | 3 +- lib/spack/spack/build_systems/oneapi.py | 2 +- lib/spack/spack/build_systems/python.py | 2 + lib/spack/spack/builder.py | 8 ++-- lib/spack/spack/ci.py | 1 + lib/spack/spack/cmd/__init__.py | 2 +- lib/spack/spack/cmd/arch.py | 1 + lib/spack/spack/cmd/bootstrap.py | 1 + lib/spack/spack/cmd/change.py | 1 + lib/spack/spack/cmd/clean.py | 1 + lib/spack/spack/cmd/commands.py | 1 + lib/spack/spack/cmd/common/confirmation.py | 1 + lib/spack/spack/cmd/config.py | 6 ++- lib/spack/spack/cmd/debug.py | 2 + lib/spack/spack/cmd/dev_build.py | 2 + lib/spack/spack/cmd/env.py | 1 + lib/spack/spack/cmd/external.py | 1 + lib/spack/spack/cmd/find.py | 2 + lib/spack/spack/cmd/info.py | 1 + lib/spack/spack/cmd/install.py | 7 ++- lib/spack/spack/cmd/load.py | 1 + lib/spack/spack/cmd/modules/__init__.py | 5 ++- lib/spack/spack/cmd/python.py | 4 +- lib/spack/spack/cmd/solve.py | 2 + lib/spack/spack/cmd/spec.py | 1 + lib/spack/spack/cmd/tags.py | 1 + lib/spack/spack/cmd/test.py | 2 + lib/spack/spack/cmd/tutorial.py | 1 + lib/spack/spack/cmd/undevelop.py | 1 + lib/spack/spack/cmd/unit_test.py | 2 + lib/spack/spack/cmd/unload.py | 2 + lib/spack/spack/cmd/verify.py | 1 + lib/spack/spack/config.py | 43 +++++++++--------- lib/spack/spack/detection/common.py | 2 + lib/spack/spack/detection/path.py | 1 + lib/spack/spack/directory_layout.py | 2 + lib/spack/spack/environment/environment.py | 3 ++ lib/spack/spack/error.py | 45 +++++++++++++++++++ lib/spack/spack/extensions.py | 1 + lib/spack/spack/fetch_strategy.py | 2 +- lib/spack/spack/graph.py | 1 + lib/spack/spack/install_test.py | 4 +- lib/spack/spack/installer.py | 42 +++++++---------- lib/spack/spack/main.py | 6 +++ lib/spack/spack/mirror.py | 1 + lib/spack/spack/modules/common.py | 1 + lib/spack/spack/package.py | 9 ++-- lib/spack/spack/package_base.py | 20 +++------ lib/spack/spack/package_prefs.py | 2 +- lib/spack/spack/parser.py | 5 +-- lib/spack/spack/relocate.py | 17 ++++--- lib/spack/spack/repo.py | 5 ++- lib/spack/spack/reporters/cdash.py | 2 + lib/spack/spack/rewiring.py | 1 + lib/spack/spack/schema/__init__.py | 4 +- lib/spack/spack/schema/config.py | 1 + lib/spack/spack/schema/view.py | 1 + lib/spack/spack/solver/asp.py | 6 ++- lib/spack/spack/spec.py | 1 + lib/spack/spack/store.py | 1 + lib/spack/spack/tag.py | 3 ++ lib/spack/spack/target.py | 1 + lib/spack/spack/test/bindist.py | 4 ++ lib/spack/spack/test/bootstrap.py | 1 + lib/spack/spack/test/build_environment.py | 1 + lib/spack/spack/test/build_systems.py | 5 ++- lib/spack/spack/test/builder.py | 3 ++ lib/spack/spack/test/buildtask.py | 3 +- lib/spack/spack/test/ci.py | 1 + lib/spack/spack/test/cmd/bootstrap.py | 1 + lib/spack/spack/test/cmd/checksum.py | 4 +- lib/spack/spack/test/cmd/clean.py | 1 + lib/spack/spack/test/cmd/commands.py | 1 + lib/spack/spack/test/cmd/compiler.py | 1 + lib/spack/spack/test/cmd/create.py | 1 + lib/spack/spack/test/cmd/debug.py | 1 + lib/spack/spack/test/cmd/deprecate.py | 1 + lib/spack/spack/test/cmd/dev_build.py | 1 + lib/spack/spack/test/cmd/develop.py | 4 ++ lib/spack/spack/test/cmd/diff.py | 2 + lib/spack/spack/test/cmd/env.py | 10 ++++- lib/spack/spack/test/cmd/external.py | 2 + lib/spack/spack/test/cmd/find.py | 1 + lib/spack/spack/test/cmd/install.py | 10 +++-- lib/spack/spack/test/cmd/is_git_repo.py | 2 + lib/spack/spack/test/cmd/list.py | 1 + lib/spack/spack/test/cmd/location.py | 1 + lib/spack/spack/test/cmd/logs.py | 3 ++ lib/spack/spack/test/cmd/mirror.py | 3 ++ lib/spack/spack/test/cmd/module.py | 2 + lib/spack/spack/test/cmd/pkg.py | 1 + lib/spack/spack/test/cmd/spec.py | 3 +- lib/spack/spack/test/cmd/style.py | 1 + lib/spack/spack/test/compilers/basics.py | 1 + lib/spack/spack/test/concretize.py | 3 ++ lib/spack/spack/test/concretize_errors.py | 1 + .../spack/test/concretize_preferences.py | 6 ++- .../spack/test/concretize_requirements.py | 3 +- lib/spack/spack/test/config.py | 11 +++-- lib/spack/spack/test/conftest.py | 4 ++ lib/spack/spack/test/container/images.py | 1 + lib/spack/spack/test/cray_manifest.py | 2 + lib/spack/spack/test/database.py | 2 + lib/spack/spack/test/detection.py | 2 + lib/spack/spack/test/directory_layout.py | 3 ++ lib/spack/spack/test/env.py | 2 + lib/spack/spack/test/git_fetch.py | 3 ++ lib/spack/spack/test/install.py | 5 ++- lib/spack/spack/test/installer.py | 28 +++++++----- lib/spack/spack/test/modules/common.py | 7 ++- lib/spack/spack/test/modules/conftest.py | 2 + lib/spack/spack/test/modules/lmod.py | 3 ++ lib/spack/spack/test/multimethod.py | 1 + lib/spack/spack/test/package_class.py | 5 ++- lib/spack/spack/test/packages.py | 7 ++- lib/spack/spack/test/packaging.py | 3 ++ lib/spack/spack/test/patch.py | 3 ++ lib/spack/spack/test/relocate.py | 1 + lib/spack/spack/test/sbang.py | 1 + lib/spack/spack/test/spec_dag.py | 4 +- lib/spack/spack/test/spec_semantics.py | 6 +++ lib/spack/spack/test/spec_syntax.py | 3 ++ lib/spack/spack/test/stage.py | 1 + lib/spack/spack/test/tag.py | 1 + lib/spack/spack/test/test_suite.py | 2 + lib/spack/spack/test/url_fetch.py | 2 + lib/spack/spack/test/util/executable.py | 1 + lib/spack/spack/test/versions.py | 1 + 136 files changed, 383 insertions(+), 170 deletions(-) diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index d682cc6d587580..486e3c3d65d54b 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -51,7 +51,9 @@ def _search_duplicate_compilers(error_cls): import llnl.util.lang +import spack.builder import spack.config +import spack.fetch_strategy import spack.patch import spack.repo import spack.spec diff --git a/lib/spack/spack/bootstrap/config.py b/lib/spack/spack/bootstrap/config.py index 51edeccc25db4c..1781b3cc7e9ce3 100644 --- a/lib/spack/spack/bootstrap/config.py +++ b/lib/spack/spack/bootstrap/config.py @@ -14,6 +14,7 @@ import spack.compilers import spack.config import spack.environment +import spack.modules import spack.paths import spack.platforms import spack.repo diff --git a/lib/spack/spack/bootstrap/environment.py b/lib/spack/spack/bootstrap/environment.py index ac8db642bf6986..39c8aa2fa5cbc5 100644 --- a/lib/spack/spack/bootstrap/environment.py +++ b/lib/spack/spack/bootstrap/environment.py @@ -14,7 +14,9 @@ from llnl.util import tty import spack.environment +import spack.spec import spack.tengine +import spack.util.path from ._common import _root_spec from .config import root_path, spec_for_current_python, store_path diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 3dfda841011b13..296fdd4aff0df1 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -53,6 +53,7 @@ from llnl.util.tty.color import cescape, colorize from llnl.util.tty.log import MultiProcessFd +import spack.build_systems._checks import spack.build_systems.cmake import spack.build_systems.meson import spack.build_systems.python @@ -62,6 +63,7 @@ import spack.deptypes as dt import spack.error import spack.main +import spack.multimethod import spack.package_base import spack.paths import spack.platforms @@ -73,9 +75,8 @@ import spack.util.executable from spack import traverse from spack.context import Context -from spack.error import NoHeadersError, NoLibrariesError +from spack.error import InstallError, NoHeadersError, NoLibrariesError from spack.install_test import spack_install_test_log -from spack.installer import InstallError from spack.util.cpus import determine_number_of_jobs from spack.util.environment import ( SYSTEM_DIR_CASE_ENTRY, @@ -1135,7 +1136,7 @@ def _setup_pkg_and_run( return_value = function(pkg, kwargs) write_pipe.send(return_value) - except StopPhase as e: + except spack.error.StopPhase as e: # Do not create a full ChildError from this, it's not an error # it's a control statement. write_pipe.send(e) @@ -1296,7 +1297,7 @@ def exitcode_msg(p): p.join() # If returns a StopPhase, raise it - if isinstance(child_result, StopPhase): + if isinstance(child_result, spack.error.StopPhase): # do not print raise child_result @@ -1505,17 +1506,6 @@ def _make_child_error(msg, module, name, traceback, log, log_type, context): return ChildError(msg, module, name, traceback, log, log_type, context) -class StopPhase(spack.error.SpackError): - """Pickle-able exception to control stopped builds.""" - - def __reduce__(self): - return _make_stop_phase, (self.message, self.long_message) - - -def _make_stop_phase(msg, long_msg): - return StopPhase(msg, long_msg) - - def write_log_summary(out, log_type, log, last=None): errors, warnings = parse_log_events(log) nerr = len(errors) diff --git a/lib/spack/spack/build_systems/_checks.py b/lib/spack/spack/build_systems/_checks.py index dfda043fad08ef..e15409fc38d80d 100644 --- a/lib/spack/spack/build_systems/_checks.py +++ b/lib/spack/spack/build_systems/_checks.py @@ -8,7 +8,7 @@ import llnl.util.lang import spack.builder -import spack.installer +import spack.error import spack.relocate import spack.spec import spack.store @@ -34,7 +34,7 @@ def check_paths(path_list, filetype, predicate): if not predicate(abs_path): msg = "Install failed for {0}. No such {1} in prefix: {2}" msg = msg.format(pkg.name, filetype, path) - raise spack.installer.InstallError(msg) + raise spack.error.InstallError(msg) check_paths(pkg.sanity_check_is_file, "file", os.path.isfile) check_paths(pkg.sanity_check_is_dir, "directory", os.path.isdir) @@ -42,7 +42,7 @@ def check_paths(path_list, filetype, predicate): ignore_file = llnl.util.lang.match_predicate(spack.store.STORE.layout.hidden_file_regexes) if all(map(ignore_file, os.listdir(pkg.prefix))): msg = "Install failed for {0}. Nothing was installed!" - raise spack.installer.InstallError(msg.format(pkg.name)) + raise spack.error.InstallError(msg.format(pkg.name)) def apply_macos_rpath_fixups(builder: spack.builder.Builder): diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index b9b9ee2f2e139b..d5ddcea11a54d0 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -13,6 +13,7 @@ import spack.build_environment import spack.builder +import spack.error import spack.package_base from spack.directives import build_system, conflicts, depends_on from spack.multimethod import when @@ -248,7 +249,7 @@ def runs_ok(script_abs_path): # An external gnuconfig may not not have a prefix. if gnuconfig_dir is None: - raise spack.build_environment.InstallError( + raise spack.error.InstallError( "Spack could not find substitutes for GNU config files because no " "prefix is available for the `gnuconfig` package. Make sure you set a " "prefix path instead of modules for external `gnuconfig`." @@ -268,7 +269,7 @@ def runs_ok(script_abs_path): msg += ( " or the `gnuconfig` package prefix is misconfigured as" " an external package" ) - raise spack.build_environment.InstallError(msg) + raise spack.error.InstallError(msg) # Filter working substitutes candidates = [f for f in candidates if runs_ok(f)] @@ -293,9 +294,7 @@ def runs_ok(script_abs_path): and set the prefix to the directory containing the `config.guess` and `config.sub` files. """ - raise spack.build_environment.InstallError( - msg.format(", ".join(to_be_found), self.name) - ) + raise spack.error.InstallError(msg.format(", ".join(to_be_found), self.name)) # Copy the good files over the bad ones for abs_path in to_be_patched: diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index d638a3e50b6685..dc833a10a6fd83 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -15,6 +15,7 @@ import spack.build_environment import spack.builder import spack.deptypes as dt +import spack.error import spack.package_base from spack.directives import build_system, conflicts, depends_on, variant from spack.multimethod import when @@ -344,7 +345,7 @@ def std_args(pkg, generator=None): msg = "Invalid CMake generator: '{0}'\n".format(generator) msg += "CMakePackage currently supports the following " msg += "primary generators: '{0}'".format("', '".join(valid_primary_generators)) - raise spack.package_base.InstallError(msg) + raise spack.error.InstallError(msg) try: build_type = pkg.spec.variants["build_type"].value diff --git a/lib/spack/spack/build_systems/compiler.py b/lib/spack/spack/build_systems/compiler.py index d441b57b2e88c4..65a85ecddff87e 100644 --- a/lib/spack/spack/build_systems/compiler.py +++ b/lib/spack/spack/build_systems/compiler.py @@ -14,6 +14,7 @@ import spack.compiler import spack.package_base +import spack.util.executable # Local "type" for type hints Path = Union[str, pathlib.Path] diff --git a/lib/spack/spack/build_systems/intel.py b/lib/spack/spack/build_systems/intel.py index 5695a9dbeb32f9..9f82bae14d39b0 100644 --- a/lib/spack/spack/build_systems/intel.py +++ b/lib/spack/spack/build_systems/intel.py @@ -22,9 +22,10 @@ install, ) +import spack.builder import spack.error from spack.build_environment import dso_suffix -from spack.package_base import InstallError +from spack.error import InstallError from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable from spack.util.prefix import Prefix diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py index a0c8d4fc47f6b0..6d60a7ae4f329e 100644 --- a/lib/spack/spack/build_systems/oneapi.py +++ b/lib/spack/spack/build_systems/oneapi.py @@ -15,7 +15,7 @@ import spack.util.path from spack.build_environment import dso_suffix from spack.directives import conflicts, license, redistribute, variant -from spack.package_base import InstallError +from spack.error import InstallError from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index bd0c57520c2bb7..e589ac94eff1e9 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -24,6 +24,8 @@ import spack.detection import spack.multimethod import spack.package_base +import spack.platforms +import spack.repo import spack.spec import spack.store from spack.directives import build_system, depends_on, extends diff --git a/lib/spack/spack/builder.py b/lib/spack/spack/builder.py index 7590016c3326cf..eaeb82b17cffaf 100644 --- a/lib/spack/spack/builder.py +++ b/lib/spack/spack/builder.py @@ -10,7 +10,7 @@ from llnl.util import lang -import spack.build_environment +import spack.error import spack.multimethod #: Builder classes, as registered by the "builder" decorator @@ -461,15 +461,13 @@ def _on_phase_start(self, instance): # If a phase has a matching stop_before_phase attribute, # stop the installation process raising a StopPhase if getattr(instance, "stop_before_phase", None) == self.name: - raise spack.build_environment.StopPhase( - "Stopping before '{0}' phase".format(self.name) - ) + raise spack.error.StopPhase("Stopping before '{0}' phase".format(self.name)) def _on_phase_exit(self, instance): # If a phase has a matching last_phase attribute, # stop the installation process raising a StopPhase if getattr(instance, "last_phase", None) == self.name: - raise spack.build_environment.StopPhase("Stopping at '{0}' phase".format(self.name)) + raise spack.error.StopPhase("Stopping at '{0}' phase".format(self.name)) def copy(self): return copy.deepcopy(self) diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index 2420bf4df78d5c..9772d05f360135 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -31,6 +31,7 @@ import spack import spack.binary_distribution as bindist +import spack.concretize import spack.config as cfg import spack.environment as ev import spack.main diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index 362dcb8d936593..c481e931312988 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -17,7 +17,7 @@ from llnl.util.tty.colify import colify from llnl.util.tty.color import colorize -import spack.config +import spack.config # breaks a cycle. import spack.environment as ev import spack.error import spack.extensions diff --git a/lib/spack/spack/cmd/arch.py b/lib/spack/spack/cmd/arch.py index 56f597d778d1d4..163478414863a7 100644 --- a/lib/spack/spack/cmd/arch.py +++ b/lib/spack/spack/cmd/arch.py @@ -11,6 +11,7 @@ import llnl.util.tty.color as color import spack.platforms +import spack.spec description = "print architecture information about this machine" section = "system" diff --git a/lib/spack/spack/cmd/bootstrap.py b/lib/spack/spack/cmd/bootstrap.py index ffc46152780a9b..8704f2c7a411e9 100644 --- a/lib/spack/spack/cmd/bootstrap.py +++ b/lib/spack/spack/cmd/bootstrap.py @@ -20,6 +20,7 @@ import spack.spec import spack.stage import spack.util.path +import spack.util.spack_yaml from spack.cmd.common import arguments description = "manage bootstrap configuration" diff --git a/lib/spack/spack/cmd/change.py b/lib/spack/spack/cmd/change.py index 9807d5cc55786c..d2c8d9ae5d7dbb 100644 --- a/lib/spack/spack/cmd/change.py +++ b/lib/spack/spack/cmd/change.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import spack.cmd +import spack.spec from spack.cmd.common import arguments description = "change an existing spec in an environment" diff --git a/lib/spack/spack/cmd/clean.py b/lib/spack/spack/cmd/clean.py index 4a8d238dbd1d06..0b8fb6d6bbf6f2 100644 --- a/lib/spack/spack/cmd/clean.py +++ b/lib/spack/spack/cmd/clean.py @@ -11,6 +11,7 @@ import llnl.util.tty as tty import spack.caches +import spack.cmd import spack.config import spack.stage import spack.store diff --git a/lib/spack/spack/cmd/commands.py b/lib/spack/spack/cmd/commands.py index a6616061ed726a..875d34ee3531cf 100644 --- a/lib/spack/spack/cmd/commands.py +++ b/lib/spack/spack/cmd/commands.py @@ -17,6 +17,7 @@ from llnl.util.tty.colify import colify import spack.cmd +import spack.config import spack.main import spack.paths import spack.platforms diff --git a/lib/spack/spack/cmd/common/confirmation.py b/lib/spack/spack/cmd/common/confirmation.py index 8033e776b9ba07..7e805b196cbf72 100644 --- a/lib/spack/spack/cmd/common/confirmation.py +++ b/lib/spack/spack/cmd/common/confirmation.py @@ -9,6 +9,7 @@ import llnl.util.tty as tty import spack.cmd +import spack.spec display_args = {"long": True, "show_flags": False, "variants": False, "indent": 4} diff --git a/lib/spack/spack/cmd/config.py b/lib/spack/spack/cmd/config.py index fdecc0156eeac0..5c2a02f042273f 100644 --- a/lib/spack/spack/cmd/config.py +++ b/lib/spack/spack/cmd/config.py @@ -13,7 +13,9 @@ import spack.config import spack.environment as ev +import spack.error import spack.schema.env +import spack.spec import spack.store import spack.util.spack_yaml as syaml from spack.cmd.common import arguments @@ -254,7 +256,7 @@ def config_remove(args): existing.pop(value, None) else: # This should be impossible to reach - raise spack.config.ConfigError("Config has nested non-dict values") + raise spack.error.ConfigError("Config has nested non-dict values") spack.config.set(path, existing, scope) @@ -338,7 +340,7 @@ def _config_change(config_path, match_spec_str=None): if not changed: existing_requirements = spack.config.get(key_path) if isinstance(existing_requirements, str): - raise spack.config.ConfigError( + raise spack.error.ConfigError( "'config change' needs to append a requirement," " but existing require: config is not a list" ) diff --git a/lib/spack/spack/cmd/debug.py b/lib/spack/spack/cmd/debug.py index a920784e545ffe..02c22c70fd325f 100644 --- a/lib/spack/spack/cmd/debug.py +++ b/lib/spack/spack/cmd/debug.py @@ -16,6 +16,8 @@ import spack import spack.paths import spack.platforms +import spack.spec +import spack.store import spack.util.git from spack.util.executable import which diff --git a/lib/spack/spack/cmd/dev_build.py b/lib/spack/spack/cmd/dev_build.py index 0a8dc493098420..b289d07dc98072 100644 --- a/lib/spack/spack/cmd/dev_build.py +++ b/lib/spack/spack/cmd/dev_build.py @@ -8,7 +8,9 @@ import llnl.util.tty as tty +import spack.build_environment import spack.cmd +import spack.cmd.common.arguments import spack.config import spack.repo from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index 5494773c2f40a9..fcdc719cc1cbd7 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -25,6 +25,7 @@ import spack.config import spack.environment as ev import spack.environment.depfile as depfile +import spack.environment.environment import spack.environment.shell import spack.tengine from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/external.py b/lib/spack/spack/cmd/external.py index 2c0d26edc259df..ca32035cd77eec 100644 --- a/lib/spack/spack/cmd/external.py +++ b/lib/spack/spack/cmd/external.py @@ -18,6 +18,7 @@ import spack.cray_manifest as cray_manifest import spack.detection import spack.error +import spack.package_base import spack.repo import spack.spec from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/find.py b/lib/spack/spack/cmd/find.py index 3674cae4cfb7d8..2f25683c5ece6b 100644 --- a/lib/spack/spack/cmd/find.py +++ b/lib/spack/spack/cmd/find.py @@ -11,8 +11,10 @@ import llnl.util.tty.color as color import spack.cmd as cmd +import spack.config import spack.environment as ev import spack.repo +import spack.spec import spack.store from spack.cmd.common import arguments from spack.database import InstallStatuses diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py index a57667705287ab..5ea99caa3a6810 100644 --- a/lib/spack/spack/cmd/info.py +++ b/lib/spack/spack/cmd/info.py @@ -16,6 +16,7 @@ import spack.install_test import spack.repo import spack.spec +import spack.variant import spack.version from spack.cmd.common import arguments from spack.package_base import preferred_version diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index c262d569bc2f14..27b2ededcdd0bf 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -13,7 +13,6 @@ from llnl.string import plural from llnl.util import lang, tty -import spack.build_environment import spack.cmd import spack.config import spack.environment as ev @@ -22,7 +21,7 @@ import spack.spec import spack.store from spack.cmd.common import arguments -from spack.error import SpackError +from spack.error import InstallError, SpackError from spack.installer import PackageInstaller description = "build and install packages" @@ -285,7 +284,7 @@ def require_user_confirmation_for_overwrite(concrete_specs, args): tty.die("Reinstallation aborted.") -def _dump_log_on_error(e: spack.build_environment.InstallError): +def _dump_log_on_error(e: InstallError): e.print_context() assert e.pkg, "Expected InstallError to include the associated package" if not os.path.exists(e.pkg.log_path): @@ -350,7 +349,7 @@ def reporter_factory(specs): install_with_active_env(env, args, install_kwargs, reporter_factory) else: install_without_active_env(args, install_kwargs, reporter_factory) - except spack.build_environment.InstallError as e: + except InstallError as e: if args.show_log_on_error: _dump_log_on_error(e) raise diff --git a/lib/spack/spack/cmd/load.py b/lib/spack/spack/cmd/load.py index a868494a32cb5a..d88d4b771f10c9 100644 --- a/lib/spack/spack/cmd/load.py +++ b/lib/spack/spack/cmd/load.py @@ -6,6 +6,7 @@ import sys import spack.cmd +import spack.cmd.common import spack.environment as ev import spack.store import spack.user_environment as uenv diff --git a/lib/spack/spack/cmd/modules/__init__.py b/lib/spack/spack/cmd/modules/__init__.py index 1cb04189b9278a..4cf940ca17e889 100644 --- a/lib/spack/spack/cmd/modules/__init__.py +++ b/lib/spack/spack/cmd/modules/__init__.py @@ -15,6 +15,7 @@ import spack.cmd import spack.config +import spack.error import spack.modules import spack.modules.common import spack.repo @@ -124,13 +125,13 @@ def check_module_set_name(name): names = [k for k in modules if k != "prefix_inspections"] if not names: - raise spack.config.ConfigError( + raise spack.error.ConfigError( f"Module set configuration is missing. Cannot use module set '{name}'" ) pretty_names = "', '".join(names) - raise spack.config.ConfigError( + raise spack.error.ConfigError( f"Cannot use invalid module set '{name}'.", f"Valid module set names are: '{pretty_names}'.", ) diff --git a/lib/spack/spack/cmd/python.py b/lib/spack/spack/cmd/python.py index a4f177fa38263e..6f96234642970f 100644 --- a/lib/spack/spack/cmd/python.py +++ b/lib/spack/spack/cmd/python.py @@ -78,8 +78,8 @@ def python(parser, args, unknown_args): # Run user choice of interpreter if args.python_interpreter == "ipython": - return spack.cmd.python.ipython_interpreter(args) - return spack.cmd.python.python_interpreter(args) + return ipython_interpreter(args) + return python_interpreter(args) def ipython_interpreter(args): diff --git a/lib/spack/spack/cmd/solve.py b/lib/spack/spack/cmd/solve.py index 47d733fe63fcdf..f5a9c09c3d395c 100644 --- a/lib/spack/spack/cmd/solve.py +++ b/lib/spack/spack/cmd/solve.py @@ -12,10 +12,12 @@ import spack import spack.cmd +import spack.cmd.common.arguments import spack.config import spack.environment import spack.hash_types as ht import spack.solver.asp as asp +import spack.spec from spack.cmd.common import arguments description = "concretize a specs using an ASP solver" diff --git a/lib/spack/spack/cmd/spec.py b/lib/spack/spack/cmd/spec.py index ae08e1f9779143..e5cc951d695d40 100644 --- a/lib/spack/spack/cmd/spec.py +++ b/lib/spack/spack/cmd/spec.py @@ -14,6 +14,7 @@ import spack.hash_types as ht import spack.spec import spack.store +import spack.traverse from spack.cmd.common import arguments description = "show what would be installed, given a spec" diff --git a/lib/spack/spack/cmd/tags.py b/lib/spack/spack/cmd/tags.py index 736b3062c59163..e43740abc72656 100644 --- a/lib/spack/spack/cmd/tags.py +++ b/lib/spack/spack/cmd/tags.py @@ -9,6 +9,7 @@ import llnl.util.tty as tty import llnl.util.tty.colify as colify +import spack.environment import spack.repo import spack.tag diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py index 4eedb0d37078e6..d3d45dbe463cc7 100644 --- a/lib/spack/spack/cmd/test.py +++ b/lib/spack/spack/cmd/test.py @@ -15,10 +15,12 @@ from llnl.util.tty import colify import spack.cmd +import spack.config import spack.environment as ev import spack.install_test import spack.repo import spack.report +import spack.store from spack.cmd.common import arguments description = "run spack's tests for an install" diff --git a/lib/spack/spack/cmd/tutorial.py b/lib/spack/spack/cmd/tutorial.py index 3dd7746f81b214..478ca52b7f565b 100644 --- a/lib/spack/spack/cmd/tutorial.py +++ b/lib/spack/spack/cmd/tutorial.py @@ -10,6 +10,7 @@ from llnl.util.filesystem import working_dir import spack +import spack.cmd import spack.config import spack.paths import spack.util.git diff --git a/lib/spack/spack/cmd/undevelop.py b/lib/spack/spack/cmd/undevelop.py index 539ddb850d0d8a..a4c6371ae591ca 100644 --- a/lib/spack/spack/cmd/undevelop.py +++ b/lib/spack/spack/cmd/undevelop.py @@ -6,6 +6,7 @@ import llnl.util.tty as tty import spack.cmd +import spack.config from spack.cmd.common import arguments description = "remove specs from an environment" diff --git a/lib/spack/spack/cmd/unit_test.py b/lib/spack/spack/cmd/unit_test.py index c46012d5dc86d3..4717c9ee9bd26b 100644 --- a/lib/spack/spack/cmd/unit_test.py +++ b/lib/spack/spack/cmd/unit_test.py @@ -10,6 +10,8 @@ import re import sys +import spack.extensions + try: import pytest except ImportError: diff --git a/lib/spack/spack/cmd/unload.py b/lib/spack/spack/cmd/unload.py index a6ea80e5820a48..f937ebd3138b6c 100644 --- a/lib/spack/spack/cmd/unload.py +++ b/lib/spack/spack/cmd/unload.py @@ -7,7 +7,9 @@ import sys import spack.cmd +import spack.cmd.common import spack.error +import spack.store import spack.user_environment as uenv from spack.cmd.common import arguments diff --git a/lib/spack/spack/cmd/verify.py b/lib/spack/spack/cmd/verify.py index 383e9e046baaaf..57b30788324d61 100644 --- a/lib/spack/spack/cmd/verify.py +++ b/lib/spack/spack/cmd/verify.py @@ -6,6 +6,7 @@ import llnl.util.tty as tty +import spack.cmd import spack.environment as ev import spack.store import spack.verify diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 82962d36fb2d71..34dd133d973442 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -39,6 +39,7 @@ from llnl.util import filesystem, lang, tty +import spack.error import spack.paths import spack.platforms import spack.schema @@ -48,17 +49,21 @@ import spack.schema.compilers import spack.schema.concretizer import spack.schema.config +import spack.schema.definitions +import spack.schema.develop import spack.schema.env import spack.schema.mirrors import spack.schema.modules import spack.schema.packages import spack.schema.repos import spack.schema.upstreams +import spack.schema.view +import spack.spec # Hacked yaml for configuration files preserves line numbers. import spack.util.spack_yaml as syaml import spack.util.web as web_util -from spack.error import SpackError +from spack.error import SpecSyntaxError from spack.util.cpus import cpus_available #: Dict from section names -> schema for that section @@ -165,7 +170,7 @@ def get_section(self, section: str) -> Optional[YamlConfigDict]: def _write_section(self, section: str) -> None: if not self.writable: - raise ConfigError(f"Cannot write to immutable scope {self}") + raise spack.error.ConfigError(f"Cannot write to immutable scope {self}") filename = self.get_section_filename(section) data = self.get_section(section) @@ -277,7 +282,7 @@ def get_section(self, section: str) -> Optional[YamlConfigDict]: def _write_section(self, section: str) -> None: if not self.writable: - raise ConfigError(f"Cannot write to immutable scope {self}") + raise spack.error.ConfigError(f"Cannot write to immutable scope {self}") data_to_write: Optional[YamlConfigDict] = self._raw_data # If there is no existing data, this section SingleFileScope has never @@ -705,7 +710,7 @@ def print_section(self, section: str, blame: bool = False, *, scope=None) -> Non data[section] = self.get_config(section, scope=scope) syaml.dump_config(data, stream=sys.stdout, default_flow_style=False, blame=blame) except (syaml.SpackYAMLError, OSError) as e: - raise ConfigError(f"cannot read '{section}' configuration") from e + raise spack.error.ConfigError(f"cannot read '{section}' configuration") from e @contextlib.contextmanager @@ -807,7 +812,7 @@ def _add_command_line_scopes( _add_platform_scope(cfg, name, path, writable=False) continue else: - raise ConfigError(f"Invalid configuration scope: {path}") + raise spack.error.ConfigError(f"Invalid configuration scope: {path}") for scope in manifest.env_config_scopes: scope.name = f"{name}:{scope.name}" @@ -1019,7 +1024,7 @@ def change_or_add( if found: update_fn(section) - spack.config.set(section_name, section, scope=scope) + CONFIG.set(section_name, section, scope=scope) return # If no scope meets the criteria specified by ``find_fn``, @@ -1032,14 +1037,14 @@ def change_or_add( break if found: - spack.config.set(section_name, section, scope=scope) + CONFIG.set(section_name, section, scope=scope) return # If no scopes define any config for the named section, then # modify the highest-priority scope. scope, section = configs_by_section[0] update_fn(section) - spack.config.set(section_name, section, scope=scope) + CONFIG.set(section_name, section, scope=scope) def update_all(section_name: str, change_fn: Callable[[str], bool]) -> None: @@ -1051,7 +1056,7 @@ def update_all(section_name: str, change_fn: Callable[[str], bool]) -> None: for scope, section in configs_by_section: modified = change_fn(section) if modified: - spack.config.set(section_name, section, scope=scope) + CONFIG.set(section_name, section, scope=scope) def _validate_section_name(section: str) -> None: @@ -1225,7 +1230,7 @@ def get_valid_type(path): return types[schema_type]() else: return type(None) - raise ConfigError(f"Cannot determine valid type for path '{path}'.") + raise spack.error.ConfigError(f"Cannot determine valid type for path '{path}'.") def remove_yaml(dest, source): @@ -1268,7 +1273,7 @@ def they_are(t): unmerge = sk in dest old_dest_value = dest.pop(sk, None) - if unmerge and not spack.config._override(sk): + if unmerge and not _override(sk): dest[sk] = remove_yaml(old_dest_value, sv) return dest @@ -1718,27 +1723,23 @@ def parse_spec_from_yaml_string(string: str) -> "spack.spec.Spec": try: spec = spack.spec.Spec(string) return spec - except spack.parser.SpecSyntaxError as e: - mark = spack.config.get_mark_from_yaml_data(string) + except SpecSyntaxError as e: + mark = get_mark_from_yaml_data(string) if mark: msg = f"{mark.name}:{mark.line + 1}: {str(e)}" - raise spack.parser.SpecSyntaxError(msg) from e + raise SpecSyntaxError(msg) from e raise e -class ConfigError(SpackError): - """Superclass for all Spack config related errors.""" - - -class ConfigSectionError(ConfigError): +class ConfigSectionError(spack.error.ConfigError): """Error for referring to a bad config section name in a configuration.""" -class ConfigFileError(ConfigError): +class ConfigFileError(spack.error.ConfigError): """Issue reading or accessing a configuration file.""" -class ConfigFormatError(ConfigError): +class ConfigFormatError(spack.error.ConfigError): """Raised when a configuration format does not match its schema.""" def __init__( diff --git a/lib/spack/spack/detection/common.py b/lib/spack/spack/detection/common.py index addcd1797dce5a..1b16aa6ccd434b 100644 --- a/lib/spack/spack/detection/common.py +++ b/lib/spack/spack/detection/common.py @@ -25,8 +25,10 @@ import llnl.util.tty import spack.config +import spack.error import spack.operating_systems.windows_os as winOs import spack.spec +import spack.util.environment import spack.util.spack_yaml import spack.util.windows_registry diff --git a/lib/spack/spack/detection/path.py b/lib/spack/spack/detection/path.py index ec94b71f141f95..3588d96115cfdf 100644 --- a/lib/spack/spack/detection/path.py +++ b/lib/spack/spack/detection/path.py @@ -18,6 +18,7 @@ import llnl.util.lang import llnl.util.tty +import spack.spec import spack.util.elf as elf_utils import spack.util.environment import spack.util.environment as environment diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 7b715d14d3e4dd..19f5582bce4aac 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -16,7 +16,9 @@ import spack.config import spack.hash_types as ht +import spack.projections import spack.spec +import spack.store import spack.util.spack_json as sjson from spack.error import SpackError diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 727fd7f234f7e0..1d2ea86c9d494b 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -30,13 +30,16 @@ import spack.concretize import spack.config import spack.deptypes as dt +import spack.environment import spack.error import spack.filesystem_view as fsv import spack.hash_types as ht import spack.paths import spack.repo import spack.schema.env +import spack.schema.merged import spack.spec +import spack.spec_list import spack.store import spack.user_environment as uenv import spack.util.cpus diff --git a/lib/spack/spack/error.py b/lib/spack/spack/error.py index ea37d5787b9766..edb4b9e89fb262 100644 --- a/lib/spack/spack/error.py +++ b/lib/spack/spack/error.py @@ -144,3 +144,48 @@ class PatchDirectiveError(SpackError): class PatchLookupError(NoSuchPatchError): """Raised when a patch file cannot be located from sha256.""" + + +class SpecSyntaxError(Exception): + """Base class for Spec syntax errors""" + + +class PackageError(SpackError): + """Raised when something is wrong with a package definition.""" + + def __init__(self, message, long_msg=None): + super().__init__(message, long_msg) + + +class NoURLError(PackageError): + """Raised when someone tries to build a URL for a package with no URLs.""" + + def __init__(self, cls): + super().__init__("Package %s has no version with a URL." % cls.__name__) + + +class InstallError(SpackError): + """Raised when something goes wrong during install or uninstall. + + The error can be annotated with a ``pkg`` attribute to allow the + caller to get the package for which the exception was raised. + """ + + def __init__(self, message, long_msg=None, pkg=None): + super().__init__(message, long_msg) + self.pkg = pkg + + +class ConfigError(SpackError): + """Superclass for all Spack config related errors.""" + + +class StopPhase(SpackError): + """Pickle-able exception to control stopped builds.""" + + def __reduce__(self): + return _make_stop_phase, (self.message, self.long_message) + + +def _make_stop_phase(msg, long_msg): + return StopPhase(msg, long_msg) diff --git a/lib/spack/spack/extensions.py b/lib/spack/spack/extensions.py index a561c50ecf5f84..e13e3f17d42a0a 100644 --- a/lib/spack/spack/extensions.py +++ b/lib/spack/spack/extensions.py @@ -17,6 +17,7 @@ import llnl.util.lang +import spack.cmd import spack.config import spack.error import spack.util.path diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index a4e8fcc2030320..54e8a80b8af96a 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -1541,7 +1541,7 @@ def _extrapolate(pkg, version): """Create a fetcher from an extrapolated URL for this version.""" try: return URLFetchStrategy(url=pkg.url_for_version(version), fetch_options=pkg.fetch_options) - except spack.package_base.NoURLError: + except spack.error.NoURLError: raise ExtrapolationError( f"Can't extrapolate a URL for version {version} because " f"package {pkg.name} defines no URLs" diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py index 684a6061fb2038..f4ac437df92b38 100644 --- a/lib/spack/spack/graph.py +++ b/lib/spack/spack/graph.py @@ -46,6 +46,7 @@ import spack.repo import spack.spec import spack.tengine +import spack.traverse def find(seq, predicate): diff --git a/lib/spack/spack/install_test.py b/lib/spack/spack/install_test.py index f0b62523d1d701..9bd171f017bf71 100644 --- a/lib/spack/spack/install_test.py +++ b/lib/spack/spack/install_test.py @@ -33,7 +33,7 @@ import spack.util.executable import spack.util.path import spack.util.spack_json as sjson -from spack.installer import InstallError +from spack.error import InstallError from spack.spec import Spec from spack.util.prefix import Prefix @@ -119,7 +119,7 @@ def cache_extra_test_sources(pkg: Pb, srcs: ListOrStringType): location(s) under the install testing directory. Raises: - spack.installer.InstallError: if any of the source paths are absolute + spack.error.InstallError: if any of the source paths are absolute or do not exist under the build stage """ diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index 42325e22f73108..fd46b9006d0639 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -889,7 +889,7 @@ def __init__( # ensure priority queue invariants when tasks are "removed" from the # queue. if status == STATUS_REMOVED: - raise InstallError( + raise spack.error.InstallError( f"Cannot create a build task for {self.pkg_id} with status '{status}'", pkg=pkg ) @@ -1160,7 +1160,7 @@ def _check_deps_status(self, request: BuildRequest) -> None: if spack.store.STORE.failure_tracker.has_failed(dep): action = "'spack install' the dependency" msg = f"{dep_id} is marked as an install failure: {action}" - raise InstallError(err.format(request.pkg_id, msg), pkg=dep_pkg) + raise spack.error.InstallError(err.format(request.pkg_id, msg), pkg=dep_pkg) # Attempt to get a read lock to ensure another process does not # uninstall the dependency while the requested spec is being @@ -1168,7 +1168,7 @@ def _check_deps_status(self, request: BuildRequest) -> None: ltype, lock = self._ensure_locked("read", dep_pkg) if lock is None: msg = f"{dep_id} is write locked by another process" - raise InstallError(err.format(request.pkg_id, msg), pkg=request.pkg) + raise spack.error.InstallError(err.format(request.pkg_id, msg), pkg=request.pkg) # Flag external and upstream packages as being installed if dep_pkg.spec.external or dep_pkg.spec.installed_upstream: @@ -1220,7 +1220,7 @@ def _prepare_for_install(self, task: BuildTask) -> None: if not installed_in_db: # Ensure there is no other installed spec with the same prefix dir if spack.store.STORE.db.is_occupied_install_prefix(task.pkg.spec.prefix): - raise InstallError( + raise spack.error.InstallError( f"Install prefix collision for {task.pkg_id}", long_msg=f"Prefix directory {task.pkg.spec.prefix} already " "used by another installed spec.", @@ -1488,7 +1488,9 @@ def _install_task(self, task: BuildTask, install_status: InstallStatus) -> None: self._update_installed(task) return elif cache_only: - raise InstallError("No binary found when cache-only was specified", pkg=pkg) + raise spack.error.InstallError( + "No binary found when cache-only was specified", pkg=pkg + ) else: tty.msg(f"No binary for {pkg_id} found: installing from source") @@ -1515,7 +1517,7 @@ def _install_task(self, task: BuildTask, install_status: InstallStatus) -> None: # the database, so that we don't need to re-read from file. spack.store.STORE.db.add(pkg.spec, explicit=explicit) - except spack.build_environment.StopPhase as e: + except spack.error.StopPhase as e: # A StopPhase exception means that do_install was asked to # stop early from clients, and is not an error at this point pid = f"{self.pid}: " if tty.show_pid() else "" @@ -1848,7 +1850,7 @@ def install(self) -> None: tty.warn(f"{pkg_id} does NOT actually have any uninstalled deps left") dep_str = "dependencies" if task.priority > 1 else "dependency" - raise InstallError( + raise spack.error.InstallError( f"Cannot proceed with {pkg_id}: {task.priority} uninstalled " f"{dep_str}: {','.join(task.uninstalled_deps)}", pkg=pkg, @@ -1870,7 +1872,7 @@ def install(self) -> None: self._update_failed(task) if self.fail_fast: - raise InstallError(fail_fast_err, pkg=pkg) + raise spack.error.InstallError(fail_fast_err, pkg=pkg) continue @@ -1999,7 +2001,7 @@ def install(self) -> None: ) # Terminate if requested to do so on the first failure. if self.fail_fast: - raise InstallError(f"{fail_fast_err}: {str(exc)}", pkg=pkg) + raise spack.error.InstallError(f"{fail_fast_err}: {str(exc)}", pkg=pkg) # Terminate when a single build request has failed, or summarize errors later. if task.is_build_request: @@ -2051,7 +2053,7 @@ def install(self) -> None: f"missing package ({ids[0]}) from {', '.join(ids)}" ) - raise InstallError( + raise spack.error.InstallError( "Installation request failed. Refer to reported errors for failing package(s).", pkg=pkg, ) @@ -2317,33 +2319,21 @@ def install(self): raise e.inner_exception -class InstallError(spack.error.SpackError): - """Raised when something goes wrong during install or uninstall. - - The error can be annotated with a ``pkg`` attribute to allow the - caller to get the package for which the exception was raised. - """ - - def __init__(self, message, long_msg=None, pkg=None): - super().__init__(message, long_msg) - self.pkg = pkg - - -class BadInstallPhase(InstallError): +class BadInstallPhase(spack.error.InstallError): """Raised for an install phase option is not allowed for a package.""" def __init__(self, pkg_name, phase): super().__init__(f"'{phase}' is not a valid phase for package {pkg_name}") -class ExternalPackageError(InstallError): +class ExternalPackageError(spack.error.InstallError): """Raised by install() when a package is only for external use.""" -class InstallLockError(InstallError): +class InstallLockError(spack.error.InstallError): """Raised during install when something goes wrong with package locking.""" -class UpstreamPackageError(InstallError): +class UpstreamPackageError(spack.error.InstallError): """Raised during install when something goes wrong with an upstream package.""" diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index db5d45034cc995..eb15789c76992d 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -9,6 +9,8 @@ after the system path is set up. """ import argparse + +# import spack.modules.common import inspect import io import operator @@ -36,6 +38,7 @@ import spack.cmd import spack.config import spack.environment as ev +import spack.error import spack.modules import spack.paths import spack.platforms @@ -44,6 +47,7 @@ import spack.store import spack.util.debug import spack.util.environment +import spack.util.lock from spack.error import SpackError #: names of profile statistics @@ -763,6 +767,8 @@ def print_setup_info(*info): This is in ``main.py`` to make it fast; the setup scripts need to invoke spack in login scripts, and it needs to be quick. """ + import spack.modules.common + shell = "csh" if "csh" in info else "sh" def shell_set(var, value): diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py index 02ddeae42a9f27..8caa27213735a4 100644 --- a/lib/spack/spack/mirror.py +++ b/lib/spack/spack/mirror.py @@ -29,6 +29,7 @@ import spack.config import spack.error import spack.fetch_strategy +import spack.mirror import spack.oci.image import spack.repo import spack.spec diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index e4f7a197f3386c..cf81bcaba55fc7 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -46,6 +46,7 @@ import spack.deptypes as dt import spack.environment import spack.error +import spack.modules import spack.paths import spack.projections as proj import spack.repo diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 99135b48343289..d2a00f9941865c 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -11,6 +11,8 @@ from os import chdir, environ, getcwd, makedirs, mkdir, remove, removedirs from shutil import move, rmtree +from spack.error import InstallError + # Emulate some shell commands for convenience env = environ cd = chdir @@ -84,12 +86,7 @@ install_test_root, test_part, ) -from spack.installer import ( - ExternalPackageError, - InstallError, - InstallLockError, - UpstreamPackageError, -) +from spack.installer import ExternalPackageError, InstallLockError, UpstreamPackageError from spack.mixins import filter_compiler_wrappers from spack.multimethod import default_args, when from spack.package_base import ( diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index 382d0b25f7aa8e..e2c7069ef85c43 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -33,6 +33,8 @@ from llnl.util.lang import classproperty, memoized from llnl.util.link_tree import LinkTree +import spack.build_environment +import spack.builder import spack.compilers import spack.config import spack.dependency @@ -50,8 +52,10 @@ import spack.store import spack.url import spack.util.environment +import spack.util.executable import spack.util.path import spack.util.web +from spack.error import InstallError, NoURLError, PackageError from spack.filesystem_view import YamlFilesystemView from spack.install_test import ( PackageTest, @@ -61,7 +65,7 @@ cache_extra_test_sources, install_test_root, ) -from spack.installer import InstallError, PackageInstaller +from spack.installer import PackageInstaller from spack.solver.version_order import concretization_version_order from spack.stage import DevelopStage, ResourceStage, Stage, StageComposite, compute_stage_name from spack.util.executable import ProcessError, which @@ -2581,20 +2585,6 @@ def __init__(self, spec, dependents): self.dependents = dependents -class PackageError(spack.error.SpackError): - """Raised when something is wrong with a package definition.""" - - def __init__(self, message, long_msg=None): - super().__init__(message, long_msg) - - -class NoURLError(PackageError): - """Raised when someone tries to build a URL for a package with no URLs.""" - - def __init__(self, cls): - super().__init__("Package %s has no version with a URL." % cls.__name__) - - class InvalidPackageOpError(PackageError): """Raised when someone tries perform an invalid operation on a package.""" diff --git a/lib/spack/spack/package_prefs.py b/lib/spack/spack/package_prefs.py index 2c8644e0b2e8bb..f655fbb8852732 100644 --- a/lib/spack/spack/package_prefs.py +++ b/lib/spack/spack/package_prefs.py @@ -9,7 +9,7 @@ import spack.error import spack.repo import spack.spec -from spack.config import ConfigError +from spack.error import ConfigError from spack.version import Version _lesser_spec_types = {"compiler": spack.spec.CompilerSpec, "version": Version} diff --git a/lib/spack/spack/parser.py b/lib/spack/spack/parser.py index 097af992832a0c..23739b6841ce0a 100644 --- a/lib/spack/spack/parser.py +++ b/lib/spack/spack/parser.py @@ -70,6 +70,7 @@ import spack.error import spack.spec import spack.version +from spack.error import SpecSyntaxError IS_WINDOWS = sys.platform == "win32" #: Valid name for specs and variants. Here we are not using @@ -600,10 +601,6 @@ def parse_one_or_raise( return result -class SpecSyntaxError(Exception): - """Base class for Spec syntax errors""" - - class SpecTokenizationError(SpecSyntaxError): """Syntax error in a spec string""" diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py index c376a261a63d80..764c51a8192f49 100644 --- a/lib/spack/spack/relocate.py +++ b/lib/spack/spack/relocate.py @@ -6,6 +6,7 @@ import itertools import os import re +import sys from collections import OrderedDict from typing import List, Optional @@ -17,7 +18,7 @@ from llnl.util.lang import memoized from llnl.util.symlink import readlink, symlink -import spack.platforms +import spack.error import spack.store import spack.util.elf as elf import spack.util.executable as executable @@ -25,8 +26,6 @@ from .relocate_text import BinaryFilePrefixReplacer, TextFilePrefixReplacer -is_macos = str(spack.platforms.real_host()) == "darwin" - class InstallRootStringError(spack.error.SpackError): def __init__(self, file_path, root_path): @@ -49,7 +48,7 @@ def _patchelf() -> Optional[executable.Executable]: """Return the full path to the patchelf binary, if available, else None.""" import spack.bootstrap - if is_macos: + if sys.platform == "darwin": return None with spack.bootstrap.ensure_bootstrap_configuration(): @@ -416,7 +415,7 @@ def relocate_macho_binaries( # normalized paths rel_to_orig = macho_make_paths_normal(orig_path_name, rpaths, deps, idpath) # replace the relativized paths with normalized paths - if is_macos: + if sys.platform == "darwin": modify_macho_object(path_name, rpaths, deps, idpath, rel_to_orig) else: modify_object_macholib(path_name, rel_to_orig) @@ -427,7 +426,7 @@ def relocate_macho_binaries( rpaths, deps, idpath, old_layout_root, prefix_to_prefix ) # replace the old paths with new paths - if is_macos: + if sys.platform == "darwin": modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths) else: modify_object_macholib(path_name, paths_to_paths) @@ -438,7 +437,7 @@ def relocate_macho_binaries( path_name, new_layout_root, rpaths, deps, idpath ) # replace the new paths with relativized paths in the new prefix - if is_macos: + if sys.platform == "darwin": modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths) else: modify_object_macholib(path_name, paths_to_paths) @@ -450,7 +449,7 @@ def relocate_macho_binaries( rpaths, deps, idpath, old_layout_root, prefix_to_prefix ) # replace the old paths with new paths - if is_macos: + if sys.platform == "darwin": modify_macho_object(path_name, rpaths, deps, idpath, paths_to_paths) else: modify_object_macholib(path_name, paths_to_paths) @@ -572,7 +571,7 @@ def make_macho_binaries_relative(cur_path_names, orig_path_names, old_layout_roo """ Replace old RPATHs with paths relative to old_dir in binary files """ - if not is_macos: + if not sys.platform == "darwin": return for cur_path, orig_path in zip(cur_path_names, orig_path_names): diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py index fd1609df8301d4..b916c3baef8674 100644 --- a/lib/spack/spack/repo.py +++ b/lib/spack/spack/repo.py @@ -39,6 +39,7 @@ import spack.error import spack.patch import spack.provider_index +import spack.repo import spack.spec import spack.tag import spack.util.git @@ -1522,8 +1523,10 @@ def add_package(self, name, dependencies=None): Both "dep_type" and "condition" can default to ``None`` in which case ``spack.dependency.default_deptype`` and ``spack.spec.Spec()`` are used. """ + import spack.tengine # avoid circular import + dependencies = dependencies or [] - context = {"cls_name": spack.util.naming.mod_to_class(name), "dependencies": dependencies} + context = {"cls_name": nm.mod_to_class(name), "dependencies": dependencies} template = spack.tengine.make_environment().get_template("mock-repository/package.pyt") text = template.render(context) package_py = self.recipe_filename(name) diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py index 2ecfacb60bd006..d2da8bbed2a403 100644 --- a/lib/spack/spack/reporters/cdash.py +++ b/lib/spack/spack/reporters/cdash.py @@ -22,6 +22,8 @@ import spack import spack.paths import spack.platforms +import spack.spec +import spack.tengine import spack.util.git from spack.error import SpackError from spack.util.crypto import checksum diff --git a/lib/spack/spack/rewiring.py b/lib/spack/spack/rewiring.py index f2a01cd6d1a22d..bffd085619d011 100644 --- a/lib/spack/spack/rewiring.py +++ b/lib/spack/spack/rewiring.py @@ -14,6 +14,7 @@ import spack.binary_distribution as bindist import spack.error import spack.hooks +import spack.platforms import spack.relocate as relocate import spack.store diff --git a/lib/spack/spack/schema/__init__.py b/lib/spack/spack/schema/__init__.py index 5ccb7dd709c998..8c04ebdaac490d 100644 --- a/lib/spack/spack/schema/__init__.py +++ b/lib/spack/spack/schema/__init__.py @@ -8,6 +8,8 @@ import llnl.util.lang +from spack.error import SpecSyntaxError + class DeprecationMessage(typing.NamedTuple): message: str @@ -31,7 +33,7 @@ def _validate_spec(validator, is_spec, instance, schema): for spec_str in instance: try: spack.parser.parse(spec_str) - except spack.parser.SpecSyntaxError as e: + except SpecSyntaxError as e: yield jsonschema.ValidationError(str(e)) def _deprecated_properties(validator, deprecated, instance, schema): diff --git a/lib/spack/spack/schema/config.py b/lib/spack/spack/schema/config.py index 72590d8e82cfc2..e1072a501bb91e 100644 --- a/lib/spack/spack/schema/config.py +++ b/lib/spack/spack/schema/config.py @@ -11,6 +11,7 @@ from llnl.util.lang import union_dicts +import spack.config import spack.schema.projections #: Properties for inclusion in other schemas diff --git a/lib/spack/spack/schema/view.py b/lib/spack/spack/schema/view.py index 6c24501ba9d2ce..d3e983167f0c34 100644 --- a/lib/spack/spack/schema/view.py +++ b/lib/spack/spack/schema/view.py @@ -11,6 +11,7 @@ from typing import Any, Dict import spack.schema +import spack.schema.projections projections_scheme = spack.schema.projections.properties["projections"] diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 9b694d3850521e..3b98117c1c296e 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -27,7 +27,9 @@ import spack import spack.binary_distribution +import spack.bootstrap.core import spack.compilers +import spack.concretize import spack.config import spack.config as sc import spack.deptypes as dt @@ -2166,7 +2168,7 @@ def define_package_versions_and_validate_preferences( matches = [x for x in self.possible_versions[pkg_name] if x.satisfies(v)] matches.sort(reverse=True) if not matches: - raise spack.config.ConfigError( + raise spack.error.ConfigError( f"Preference for version {v} does not match any known " f"version of {pkg_name} (in its package.py or any external)" ) @@ -2796,7 +2798,7 @@ def validate_and_define_versions_from_requirements( # not throw an error, which is just so that users know they need to change # their config, instead of getting a hard to decipher concretization error. if not any(x for x in self.possible_versions[name] if x.satisfies(versions)): - raise spack.config.ConfigError( + raise spack.error.ConfigError( f"Version requirement {versions} on {pkg_name} for {name} " f"cannot match any known version from package.py or externals" ) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 1e23ebc63f2d30..492841f81a2e84 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2016,6 +2016,7 @@ def process_hash_bit_prefix(self, bits): def _lookup_hash(self): """Lookup just one spec with an abstract hash, returning a spec from the the environment, store, or finally, binary caches.""" + import spack.binary_distribution import spack.environment active_env = spack.environment.active_environment() diff --git a/lib/spack/spack/store.py b/lib/spack/spack/store.py index 62a5b5c4fb7980..31369531d550ce 100644 --- a/lib/spack/spack/store.py +++ b/lib/spack/spack/store.py @@ -33,6 +33,7 @@ import spack.error import spack.paths import spack.spec +import spack.store import spack.util.path #: default installation root, relative to the Spack install path diff --git a/lib/spack/spack/tag.py b/lib/spack/spack/tag.py index 559af56f0c8f21..fd2b252d8353d8 100644 --- a/lib/spack/spack/tag.py +++ b/lib/spack/spack/tag.py @@ -8,11 +8,14 @@ from collections.abc import Mapping import spack.error +import spack.repo import spack.util.spack_json as sjson def _get_installed_package_names(): """Returns names of packages installed in the active environment.""" + import spack.environment + specs = spack.environment.installed_specs() return [spec.name for spec in specs] diff --git a/lib/spack/spack/target.py b/lib/spack/spack/target.py index 8d0943c28aeb86..4a781968653897 100644 --- a/lib/spack/spack/target.py +++ b/lib/spack/spack/target.py @@ -11,6 +11,7 @@ import spack.compiler import spack.compilers import spack.spec +import spack.util.executable import spack.util.spack_yaml as syaml diff --git a/lib/spack/spack/test/bindist.py b/lib/spack/spack/test/bindist.py index a418ef360ac0ac..57a810e8cdbddc 100644 --- a/lib/spack/spack/test/bindist.py +++ b/lib/spack/spack/test/bindist.py @@ -27,11 +27,15 @@ import spack.binary_distribution as bindist import spack.caches +import spack.compilers import spack.config import spack.fetch_strategy import spack.hooks.sbang as sbang import spack.main import spack.mirror +import spack.paths +import spack.spec +import spack.stage import spack.store import spack.util.gpg import spack.util.spack_yaml as syaml diff --git a/lib/spack/spack/test/bootstrap.py b/lib/spack/spack/test/bootstrap.py index f0d11d41247e4b..603fe90fadafdf 100644 --- a/lib/spack/spack/test/bootstrap.py +++ b/lib/spack/spack/test/bootstrap.py @@ -9,6 +9,7 @@ import spack.bootstrap.config import spack.bootstrap.core import spack.compilers +import spack.config import spack.environment import spack.store import spack.util.path diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 3ae41acc9cecee..38d34fc1e81f14 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -16,6 +16,7 @@ import spack.config import spack.deptypes as dt import spack.package_base +import spack.paths import spack.spec import spack.util.spack_yaml as syaml from spack.build_environment import UseMode, _static_to_shared_library, dso_suffix diff --git a/lib/spack/spack/test/build_systems.py b/lib/spack/spack/test/build_systems.py index f224982e1a6924..a28742488a9a81 100644 --- a/lib/spack/spack/test/build_systems.py +++ b/lib/spack/spack/test/build_systems.py @@ -16,7 +16,10 @@ import spack.build_systems.autotools import spack.build_systems.cmake import spack.environment +import spack.error +import spack.paths import spack.platforms +import spack.platforms.test from spack.build_environment import ChildError, setup_package from spack.spec import Spec from spack.util.executable import which @@ -265,7 +268,7 @@ def test_cmake_std_args(self, default_mock_concretization): def test_cmake_bad_generator(self, default_mock_concretization): s = default_mock_concretization("cmake-client") - with pytest.raises(spack.package_base.InstallError): + with pytest.raises(spack.error.InstallError): spack.build_systems.cmake.CMakeBuilder.std_args( s.package, generator="Yellow Sticky Notes" ) diff --git a/lib/spack/spack/test/builder.py b/lib/spack/spack/test/builder.py index 4bd128c3bfb31b..ab611dbaec68c5 100644 --- a/lib/spack/spack/test/builder.py +++ b/lib/spack/spack/test/builder.py @@ -8,7 +8,10 @@ from llnl.util.filesystem import touch +import spack.builder import spack.paths +import spack.repo +import spack.spec @pytest.fixture() diff --git a/lib/spack/spack/test/buildtask.py b/lib/spack/spack/test/buildtask.py index 569bfc56d888d1..61def432c068f7 100644 --- a/lib/spack/spack/test/buildtask.py +++ b/lib/spack/spack/test/buildtask.py @@ -5,6 +5,7 @@ import pytest +import spack.error import spack.installer as inst import spack.repo import spack.spec @@ -25,7 +26,7 @@ def test_build_task_errors(install_mockery): inst.BuildTask(spec.package, None, False, 0, 0, 0, set()) request = inst.BuildRequest(spec.package, {}) - with pytest.raises(inst.InstallError, match="Cannot create a build task"): + with pytest.raises(spack.error.InstallError, match="Cannot create a build task"): inst.BuildTask(spec.package, request, False, 0, 0, inst.STATUS_REMOVED, set()) diff --git a/lib/spack/spack/test/ci.py b/lib/spack/spack/test/ci.py index 6742e02c74809e..0c9a10814a20c8 100644 --- a/lib/spack/spack/test/ci.py +++ b/lib/spack/spack/test/ci.py @@ -13,6 +13,7 @@ import spack.environment as ev import spack.error import spack.paths as spack_paths +import spack.spec import spack.util.git diff --git a/lib/spack/spack/test/cmd/bootstrap.py b/lib/spack/spack/test/cmd/bootstrap.py index 7797aec31c7850..888f823c55b4fa 100644 --- a/lib/spack/spack/test/cmd/bootstrap.py +++ b/lib/spack/spack/test/cmd/bootstrap.py @@ -15,6 +15,7 @@ import spack.environment as ev import spack.main import spack.mirror +import spack.spec _bootstrap = spack.main.SpackCommand("bootstrap") diff --git a/lib/spack/spack/test/cmd/checksum.py b/lib/spack/spack/test/cmd/checksum.py index ad63c40ff8ec44..6c20caff887853 100644 --- a/lib/spack/spack/test/cmd/checksum.py +++ b/lib/spack/spack/test/cmd/checksum.py @@ -8,8 +8,8 @@ import pytest import spack.cmd.checksum +import spack.error import spack.package_base -import spack.parser import spack.repo import spack.spec import spack.stage @@ -304,7 +304,7 @@ def test_checksum_deprecated_version(mock_packages, can_fetch_versions): def test_checksum_url(mock_packages, config): pkg_cls = spack.repo.PATH.get_pkg_class("zlib") - with pytest.raises(spack.parser.SpecSyntaxError): + with pytest.raises(spack.error.SpecSyntaxError): spack_checksum(f"{pkg_cls.url}") diff --git a/lib/spack/spack/test/cmd/clean.py b/lib/spack/spack/test/cmd/clean.py index 4c3586833398ce..8b671e495ee008 100644 --- a/lib/spack/spack/test/cmd/clean.py +++ b/lib/spack/spack/test/cmd/clean.py @@ -14,6 +14,7 @@ import spack.environment as ev import spack.main import spack.package_base +import spack.spec import spack.stage import spack.store diff --git a/lib/spack/spack/test/cmd/commands.py b/lib/spack/spack/test/cmd/commands.py index b7cc59e1153edf..c0c781cb899324 100644 --- a/lib/spack/spack/test/cmd/commands.py +++ b/lib/spack/spack/test/cmd/commands.py @@ -10,6 +10,7 @@ import pytest import spack.cmd +import spack.cmd.commands import spack.main import spack.paths from spack.cmd.commands import _dest_to_fish_complete, _positional_to_subroutine diff --git a/lib/spack/spack/test/cmd/compiler.py b/lib/spack/spack/test/cmd/compiler.py index 2638aa79264335..431cdfd78786ad 100644 --- a/lib/spack/spack/test/cmd/compiler.py +++ b/lib/spack/spack/test/cmd/compiler.py @@ -10,6 +10,7 @@ import spack.cmd.compiler import spack.compilers +import spack.config import spack.main import spack.spec import spack.util.pattern diff --git a/lib/spack/spack/test/cmd/create.py b/lib/spack/spack/test/cmd/create.py index 13967adb52b2d8..03dc5ec0e646fa 100644 --- a/lib/spack/spack/test/cmd/create.py +++ b/lib/spack/spack/test/cmd/create.py @@ -9,6 +9,7 @@ import pytest import spack.cmd.create +import spack.url from spack.main import SpackCommand from spack.url import UndetectableNameError from spack.util.executable import which diff --git a/lib/spack/spack/test/cmd/debug.py b/lib/spack/spack/test/cmd/debug.py index 2cff3b29c63c58..49f739b5435dfb 100644 --- a/lib/spack/spack/test/cmd/debug.py +++ b/lib/spack/spack/test/cmd/debug.py @@ -11,6 +11,7 @@ import spack import spack.platforms +import spack.spec from spack.main import SpackCommand from spack.util.executable import which diff --git a/lib/spack/spack/test/cmd/deprecate.py b/lib/spack/spack/test/cmd/deprecate.py index 8306bea023e6a9..867b1cf2e1aff0 100644 --- a/lib/spack/spack/test/cmd/deprecate.py +++ b/lib/spack/spack/test/cmd/deprecate.py @@ -5,6 +5,7 @@ import pytest +import spack.spec import spack.store from spack.database import InstallStatuses from spack.main import SpackCommand diff --git a/lib/spack/spack/test/cmd/dev_build.py b/lib/spack/spack/test/cmd/dev_build.py index 8545a9dc5290da..c335ea0ccfd098 100644 --- a/lib/spack/spack/test/cmd/dev_build.py +++ b/lib/spack/spack/test/cmd/dev_build.py @@ -11,6 +11,7 @@ import spack.environment as ev import spack.error +import spack.repo import spack.spec import spack.store from spack.main import SpackCommand diff --git a/lib/spack/spack/test/cmd/develop.py b/lib/spack/spack/test/cmd/develop.py index 440a008a3c7383..202e165165c4c4 100644 --- a/lib/spack/spack/test/cmd/develop.py +++ b/lib/spack/spack/test/cmd/develop.py @@ -11,7 +11,11 @@ import spack.config import spack.environment as ev +import spack.package_base import spack.spec +import spack.stage +import spack.util.git +import spack.util.path from spack.main import SpackCommand add = SpackCommand("add") diff --git a/lib/spack/spack/test/cmd/diff.py b/lib/spack/spack/test/cmd/diff.py index 322b33b3d4eed4..e352ce1352bcc1 100644 --- a/lib/spack/spack/test/cmd/diff.py +++ b/lib/spack/spack/test/cmd/diff.py @@ -7,6 +7,8 @@ import spack.cmd.diff import spack.main +import spack.repo +import spack.spec import spack.util.spack_json as sjson from spack.test.conftest import create_test_repo diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index e841b1c84555e6..336cf25c8c062a 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -24,11 +24,17 @@ import spack.environment.environment import spack.environment.shell import spack.error +import spack.main import spack.modules +import spack.modules.tcl import spack.package_base import spack.paths import spack.repo +import spack.solver.asp +import spack.spec +import spack.stage import spack.store +import spack.util.environment import spack.util.spack_json as sjson import spack.util.spack_yaml from spack.cmd.env import _env_create @@ -1160,7 +1166,7 @@ def test_config_change_new(mutable_mock_env_path, tmp_path, mock_packages, mutab ) with ev.Environment(tmp_path): assert spack.spec.Spec("mpich").concretized().satisfies("@3.0.3") - with pytest.raises(spack.config.ConfigError, match="not a list"): + with pytest.raises(spack.error.ConfigError, match="not a list"): config("change", "packages:mpich:require:~debug") @@ -1188,7 +1194,7 @@ def test_env_with_included_config_missing_file(tmpdir, mutable_empty_config): with spack_yaml.open("w") as f: f.write("spack:\n include:\n - {0}\n".format(missing_file.strpath)) - with pytest.raises(spack.config.ConfigError, match="missing include path"): + with pytest.raises(spack.error.ConfigError, match="missing include path"): ev.Environment(tmpdir.strpath) diff --git a/lib/spack/spack/test/cmd/external.py b/lib/spack/spack/test/cmd/external.py index a186552987c3ad..684520bea292c5 100644 --- a/lib/spack/spack/test/cmd/external.py +++ b/lib/spack/spack/test/cmd/external.py @@ -12,6 +12,8 @@ import spack import spack.cmd.external +import spack.config +import spack.cray_manifest import spack.detection import spack.detection.path import spack.repo diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py index 59370b0d845c9a..fa8299f2abb450 100644 --- a/lib/spack/spack/test/cmd/find.py +++ b/lib/spack/spack/test/cmd/find.py @@ -14,6 +14,7 @@ import spack.cmd as cmd import spack.cmd.find import spack.environment as ev +import spack.store import spack.user_environment as uenv from spack.main import SpackCommand from spack.spec import Spec diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 748c162db79a5e..da853661653fdb 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -17,16 +17,18 @@ import llnl.util.filesystem as fs import llnl.util.tty as tty +import spack.build_environment import spack.cmd.common.arguments import spack.cmd.install import spack.config import spack.environment as ev +import spack.error import spack.hash_types as ht +import spack.installer import spack.package_base import spack.store -from spack.error import SpackError +from spack.error import SpackError, SpecSyntaxError from spack.main import SpackCommand -from spack.parser import SpecSyntaxError from spack.spec import Spec install = SpackCommand("install") @@ -420,7 +422,7 @@ def test_junit_output_with_failures(tmpdir, exc_typename, msg): @pytest.mark.parametrize( "exc_typename,expected_exc,msg", [ - ("RuntimeError", spack.installer.InstallError, "something weird happened"), + ("RuntimeError", spack.error.InstallError, "something weird happened"), ("KeyboardInterrupt", KeyboardInterrupt, "Ctrl-C strikes again"), ], ) @@ -704,7 +706,7 @@ def test_install_only_package(tmpdir, mock_fetch, install_mockery, capfd): with capfd.disabled(): try: install("--only", "package", "dependent-install") - except spack.installer.InstallError as e: + except spack.error.InstallError as e: msg = str(e) assert "Cannot proceed with dependent-install" in msg diff --git a/lib/spack/spack/test/cmd/is_git_repo.py b/lib/spack/spack/test/cmd/is_git_repo.py index 087f69e0282f02..3dabc8623a2082 100644 --- a/lib/spack/spack/test/cmd/is_git_repo.py +++ b/lib/spack/spack/test/cmd/is_git_repo.py @@ -11,6 +11,8 @@ from llnl.util.filesystem import mkdirp, working_dir import spack +import spack.cmd +import spack.fetch_strategy from spack.version import ver diff --git a/lib/spack/spack/test/cmd/list.py b/lib/spack/spack/test/cmd/list.py index 4a925046738995..23903107f67bf8 100644 --- a/lib/spack/spack/test/cmd/list.py +++ b/lib/spack/spack/test/cmd/list.py @@ -7,6 +7,7 @@ import sys from textwrap import dedent +import spack.paths import spack.repo from spack.main import SpackCommand diff --git a/lib/spack/spack/test/cmd/location.py b/lib/spack/spack/test/cmd/location.py index 9e42a03b021828..25fa02a6b084ac 100644 --- a/lib/spack/spack/test/cmd/location.py +++ b/lib/spack/spack/test/cmd/location.py @@ -11,6 +11,7 @@ import spack.environment as ev import spack.paths +import spack.spec import spack.stage from spack.main import SpackCommand, SpackCommandError diff --git a/lib/spack/spack/test/cmd/logs.py b/lib/spack/spack/test/cmd/logs.py index 0691549be585f1..b668cd449cbb55 100644 --- a/lib/spack/spack/test/cmd/logs.py +++ b/lib/spack/spack/test/cmd/logs.py @@ -13,6 +13,9 @@ import pytest import spack +import spack.cmd.logs +import spack.main +import spack.spec from spack.main import SpackCommand logs = SpackCommand("logs") diff --git a/lib/spack/spack/test/cmd/mirror.py b/lib/spack/spack/test/cmd/mirror.py index c1e24a9825ea55..2a67bc2e1432ed 100644 --- a/lib/spack/spack/test/cmd/mirror.py +++ b/lib/spack/spack/test/cmd/mirror.py @@ -10,8 +10,11 @@ import spack.cmd.mirror import spack.config import spack.environment as ev +import spack.error +import spack.mirror import spack.spec import spack.util.url as url_util +import spack.version from spack.main import SpackCommand, SpackCommandError mirror = SpackCommand("mirror") diff --git a/lib/spack/spack/test/cmd/module.py b/lib/spack/spack/test/cmd/module.py index 4b460eb90aead9..e16c8edecbb08d 100644 --- a/lib/spack/spack/test/cmd/module.py +++ b/lib/spack/spack/test/cmd/module.py @@ -11,6 +11,8 @@ import spack.config import spack.main import spack.modules +import spack.modules.lmod +import spack.repo import spack.spec import spack.store diff --git a/lib/spack/spack/test/cmd/pkg.py b/lib/spack/spack/test/cmd/pkg.py index c6db5693c786aa..bbe5b61462d3d8 100644 --- a/lib/spack/spack/test/cmd/pkg.py +++ b/lib/spack/spack/test/cmd/pkg.py @@ -12,6 +12,7 @@ import spack.cmd.pkg import spack.main +import spack.paths import spack.repo import spack.util.file_cache diff --git a/lib/spack/spack/test/cmd/spec.py b/lib/spack/spack/test/cmd/spec.py index 9512f31c2a6ab4..a57c40ec926823 100644 --- a/lib/spack/spack/test/cmd/spec.py +++ b/lib/spack/spack/test/cmd/spec.py @@ -9,7 +9,6 @@ import spack.environment as ev import spack.error -import spack.parser import spack.spec import spack.store from spack.main import SpackCommand, SpackCommandError @@ -142,7 +141,7 @@ def test_spec_returncode(): def test_spec_parse_error(): - with pytest.raises(spack.parser.SpecSyntaxError) as e: + with pytest.raises(spack.error.SpecSyntaxError) as e: spec("1.15:") # make sure the error is formatted properly diff --git a/lib/spack/spack/test/cmd/style.py b/lib/spack/spack/test/cmd/style.py index 7444c970c1916e..208e31f8a2fa5f 100644 --- a/lib/spack/spack/test/cmd/style.py +++ b/lib/spack/spack/test/cmd/style.py @@ -11,6 +11,7 @@ from llnl.util.filesystem import FileFilter +import spack.cmd.style import spack.main import spack.paths import spack.repo diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py index 59edeaea151739..ca12ad6030a001 100644 --- a/lib/spack/spack/test/compilers/basics.py +++ b/lib/spack/spack/test/compilers/basics.py @@ -12,6 +12,7 @@ import spack.compiler import spack.compilers +import spack.config import spack.spec import spack.util.module_cmd from spack.compiler import Compiler diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index e362cc27ff01e2..7aaa2bc7f549c1 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -22,10 +22,13 @@ import spack.detection import spack.error import spack.hash_types as ht +import spack.paths import spack.platforms +import spack.platforms.test import spack.repo import spack.solver.asp import spack.solver.version_order +import spack.spec import spack.store import spack.util.file_cache import spack.variant as vt diff --git a/lib/spack/spack/test/concretize_errors.py b/lib/spack/spack/test/concretize_errors.py index 0b3cf10933b8d8..0cb7a533c1df24 100644 --- a/lib/spack/spack/test/concretize_errors.py +++ b/lib/spack/spack/test/concretize_errors.py @@ -5,6 +5,7 @@ import pytest +import spack.config import spack.solver.asp import spack.spec diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py index 1a411407740037..faf7b07fc097b1 100644 --- a/lib/spack/spack/test/concretize_preferences.py +++ b/lib/spack/spack/test/concretize_preferences.py @@ -11,8 +11,10 @@ import spack.config import spack.package_prefs import spack.repo +import spack.spec +import spack.util.module_cmd import spack.util.spack_yaml as syaml -from spack.config import ConfigError +from spack.error import ConfigError from spack.spec import CompilerSpec, Spec from spack.version import Version @@ -227,7 +229,7 @@ def test_preferred_undefined_raises(self): """Preference should not specify an undefined version""" update_packages("python", "version", ["3.5.0.1"]) spec = Spec("python") - with pytest.raises(spack.config.ConfigError): + with pytest.raises(ConfigError): spec.concretize() def test_preferred_truncated(self): diff --git a/lib/spack/spack/test/concretize_requirements.py b/lib/spack/spack/test/concretize_requirements.py index 420db9fa9de92c..aef8d0ed5ca0c3 100644 --- a/lib/spack/spack/test/concretize_requirements.py +++ b/lib/spack/spack/test/concretize_requirements.py @@ -11,6 +11,7 @@ import spack.error import spack.package_base import spack.repo +import spack.solver.asp import spack.util.spack_yaml as syaml import spack.version from spack.solver.asp import InternalConcretizerError, UnsatisfiableSpecError @@ -70,7 +71,7 @@ def test_require_undefined_version(concretize_scope, test_repo): require: "@1.2" """ update_packages_config(conf_str) - with pytest.raises(spack.config.ConfigError): + with pytest.raises(spack.error.ConfigError): Spec("x").concretize() diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py index abe9f9121bf290..ddf21ffb051f43 100644 --- a/lib/spack/spack/test/config.py +++ b/lib/spack/spack/test/config.py @@ -18,14 +18,17 @@ import spack.config import spack.directory_layout import spack.environment as ev +import spack.error import spack.package_base import spack.paths +import spack.platforms import spack.repo import spack.schema.compilers import spack.schema.config import spack.schema.env import spack.schema.mirrors import spack.schema.repos +import spack.spec import spack.store import spack.util.path as spack_path import spack.util.spack_yaml as syaml @@ -310,7 +313,7 @@ def test_add_config_path_with_enumerated_type(mutable_config): spack.config.add("config:flags:keep_werror:specific") assert spack.config.get("config")["flags"]["keep_werror"] == "specific" - with pytest.raises(spack.config.ConfigError): + with pytest.raises(spack.error.ConfigError): spack.config.add("config:flags:keep_werror:foo") @@ -869,10 +872,10 @@ def test_bad_command_line_scopes(tmp_path, config): file_path.write_text("") - with pytest.raises(spack.config.ConfigError): + with pytest.raises(spack.error.ConfigError): spack.config._add_command_line_scopes(cfg, [str(file_path)]) - with pytest.raises(spack.config.ConfigError): + with pytest.raises(spack.error.ConfigError): spack.config._add_command_line_scopes(cfg, [str(non_existing_path)]) @@ -990,7 +993,7 @@ def test_immutable_scope(tmpdir): data = scope.get_section("config") assert data["config"]["install_tree"] == {"root": "dummy_tree_value"} - with pytest.raises(spack.config.ConfigError): + with pytest.raises(spack.error.ConfigError): scope._write_section("config") diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index b8cec8611d43bb..607844265fff5b 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -38,17 +38,21 @@ import spack.compiler import spack.compilers import spack.config +import spack.directives import spack.environment as ev import spack.error +import spack.modules.common import spack.package_base import spack.paths import spack.platforms import spack.repo import spack.solver.asp +import spack.spec import spack.stage import spack.store import spack.subprocess_context import spack.util.executable +import spack.util.file_cache import spack.util.git import spack.util.gpg import spack.util.parallel diff --git a/lib/spack/spack/test/container/images.py b/lib/spack/spack/test/container/images.py index faac9d0c8e8747..1e5e9e0d70b279 100644 --- a/lib/spack/spack/test/container/images.py +++ b/lib/spack/spack/test/container/images.py @@ -7,6 +7,7 @@ import pytest import spack.container +import spack.container.images @pytest.mark.parametrize( diff --git a/lib/spack/spack/test/cray_manifest.py b/lib/spack/spack/test/cray_manifest.py index dd5bd3e4a64b35..2a11b79a11422f 100644 --- a/lib/spack/spack/test/cray_manifest.py +++ b/lib/spack/spack/test/cray_manifest.py @@ -19,6 +19,8 @@ import spack.cmd.external import spack.compilers import spack.cray_manifest as cray_manifest +import spack.platforms +import spack.platforms.test import spack.solver.asp import spack.spec import spack.store diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index 5e8e5abbc85954..e34c85a78825c7 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -13,6 +13,8 @@ import pytest +import spack.subprocess_context + try: import uuid diff --git a/lib/spack/spack/test/detection.py b/lib/spack/spack/test/detection.py index 3fbc52fcbd91c9..f699308287623d 100644 --- a/lib/spack/spack/test/detection.py +++ b/lib/spack/spack/test/detection.py @@ -4,7 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import collections +import spack.config import spack.detection +import spack.detection.common import spack.spec diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py index da51de415ea412..169c6a9c5e85d9 100644 --- a/lib/spack/spack/test/directory_layout.py +++ b/lib/spack/spack/test/directory_layout.py @@ -14,8 +14,11 @@ from llnl.path import path_to_os_path +import spack.hash_types import spack.paths import spack.repo +import spack.spec +import spack.util.file_cache from spack.directory_layout import DirectoryLayout, InvalidDirectoryLayoutParametersError from spack.spec import Spec diff --git a/lib/spack/spack/test/env.py b/lib/spack/spack/test/env.py index b239301680ae30..682540361fde1a 100644 --- a/lib/spack/spack/test/env.py +++ b/lib/spack/spack/test/env.py @@ -11,7 +11,9 @@ import llnl.util.filesystem as fs +import spack.config import spack.environment as ev +import spack.solver.asp import spack.spec from spack.environment.environment import ( EnvironmentManifestFile, diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py index eb2e03db078966..54ac9d8a1be726 100644 --- a/lib/spack/spack/test/git_fetch.py +++ b/lib/spack/spack/test/git_fetch.py @@ -12,6 +12,9 @@ from llnl.util.filesystem import mkdirp, touch, working_dir import spack.config +import spack.error +import spack.fetch_strategy +import spack.platforms import spack.repo from spack.fetch_strategy import GitFetchStrategy from spack.spec import Spec diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py index 4159296886b036..ba7084960add1f 100644 --- a/lib/spack/spack/test/install.py +++ b/lib/spack/spack/test/install.py @@ -11,17 +11,20 @@ import llnl.util.filesystem as fs +import spack.build_environment import spack.config import spack.database import spack.error +import spack.installer import spack.mirror +import spack.package_base import spack.patch import spack.repo import spack.store import spack.util.spack_json as sjson from spack import binary_distribution +from spack.error import InstallError from spack.package_base import ( - InstallError, PackageBase, PackageStillNeededError, _spack_build_envfile, diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 8d7669f544a2be..25dcafb64d537c 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -19,6 +19,8 @@ import spack.binary_distribution import spack.database import spack.deptypes as dt +import spack.error +import spack.hooks import spack.installer as inst import spack.package_base import spack.package_prefs as prefs @@ -135,7 +137,9 @@ def test_install_from_cache_errors(install_mockery): assert spec.concrete # Check with cache-only - with pytest.raises(inst.InstallError, match="No binary found when cache-only was specified"): + with pytest.raises( + spack.error.InstallError, match="No binary found when cache-only was specified" + ): spec.package.do_install(package_cache_only=True, dependencies_cache_only=True) assert not spec.package.installed_from_binary_cache @@ -581,7 +585,7 @@ def test_check_deps_status_install_failure(install_mockery): installer = create_installer(["pkg-a"], {}) request = installer.build_requests[0] - with pytest.raises(inst.InstallError, match="install failure"): + with pytest.raises(spack.error.InstallError, match="install failure"): installer._check_deps_status(request) @@ -592,7 +596,7 @@ def test_check_deps_status_write_locked(install_mockery, monkeypatch): # Ensure the lock is not acquired monkeypatch.setattr(inst.PackageInstaller, "_ensure_locked", _not_locked) - with pytest.raises(inst.InstallError, match="write locked by another"): + with pytest.raises(spack.error.InstallError, match="write locked by another"): installer._check_deps_status(request) @@ -799,7 +803,7 @@ def test_install_uninstalled_deps(install_mockery, monkeypatch, capsys): monkeypatch.setattr(inst.PackageInstaller, "_update_failed", _noop) msg = "Cannot proceed with dependent-install" - with pytest.raises(inst.InstallError, match=msg): + with pytest.raises(spack.error.InstallError, match=msg): installer.install() out = str(capsys.readouterr()) @@ -813,7 +817,7 @@ def test_install_failed(install_mockery, monkeypatch, capsys): # Make sure the package is identified as failed monkeypatch.setattr(spack.database.FailureTracker, "has_failed", _true) - with pytest.raises(inst.InstallError, match="request failed"): + with pytest.raises(spack.error.InstallError, match="request failed"): installer.install() out = str(capsys.readouterr()) @@ -828,7 +832,7 @@ def test_install_failed_not_fast(install_mockery, monkeypatch, capsys): # Make sure the package is identified as failed monkeypatch.setattr(spack.database.FailureTracker, "has_failed", _true) - with pytest.raises(inst.InstallError, match="request failed"): + with pytest.raises(spack.error.InstallError, match="request failed"): installer.install() out = str(capsys.readouterr()) @@ -904,7 +908,7 @@ def _install(installer, task, install_status, **kwargs): # Raise a KeyboardInterrupt error to trigger early termination monkeypatch.setattr(inst.PackageInstaller, "_install_task", _install) - with pytest.raises(inst.InstallError, match="Installation request failed"): + with pytest.raises(spack.error.InstallError, match="Installation request failed"): installer.install() assert "pkg-a" in installer.installed # ensure the the second spec installed @@ -922,7 +926,7 @@ def test_install_fail_fast_on_detect(install_mockery, monkeypatch, capsys): # This will prevent b from installing, which will cause the build of c to be skipped. monkeypatch.setattr(spack.database.FailureTracker, "has_failed", _true) - with pytest.raises(inst.InstallError, match="after first install failure"): + with pytest.raises(spack.error.InstallError, match="after first install failure"): installer.install() assert b_id in installer.failed, "Expected b to be marked as failed" @@ -950,7 +954,7 @@ def test_install_fail_fast_on_except(install_mockery, monkeypatch, capsys): spack.package_base.PackageBase, "do_patch", _test_install_fail_fast_on_except_patch ) - with pytest.raises(inst.InstallError, match="mock patch failure"): + with pytest.raises(spack.error.InstallError, match="mock patch failure"): installer.install() out = str(capsys.readouterr()) @@ -971,7 +975,7 @@ def _requeued(installer, task, install_status): # Ensure don't continually requeue the task monkeypatch.setattr(inst.PackageInstaller, "_requeue_task", _requeued) - with pytest.raises(inst.InstallError, match="request failed"): + with pytest.raises(spack.error.InstallError, match="request failed"): installer.install() out = capfd.readouterr()[0] @@ -1002,7 +1006,7 @@ def _requeued(installer, task, install_status): # Ensure don't continually requeue the task monkeypatch.setattr(inst.PackageInstaller, "_requeue_task", _requeued) - with pytest.raises(inst.InstallError, match="request failed"): + with pytest.raises(spack.error.InstallError, match="request failed"): installer.install() assert b_pkg_id not in installer.installed @@ -1038,7 +1042,7 @@ def _requeued(installer, task, install_status): installer = create_installer(["pkg-b"], {}) - with pytest.raises(inst.InstallError, match="request failed"): + with pytest.raises(spack.error.InstallError, match="request failed"): installer.install() assert "b" not in installer.installed diff --git a/lib/spack/spack/test/modules/common.py b/lib/spack/spack/test/modules/common.py index 694f3f65380523..49f63f6c3b68ac 100644 --- a/lib/spack/spack/test/modules/common.py +++ b/lib/spack/spack/test/modules/common.py @@ -12,8 +12,11 @@ import spack.cmd.modules import spack.config import spack.error +import spack.modules.common import spack.modules.tcl import spack.package_base +import spack.package_prefs +import spack.repo import spack.spec from spack.modules.common import UpstreamModuleIndex from spack.spec import Spec @@ -215,8 +218,8 @@ def test_check_module_set_name(mutable_config): # Invalid module set names msg = "Valid module set names are" - with pytest.raises(spack.config.ConfigError, match=msg): + with pytest.raises(spack.error.ConfigError, match=msg): spack.cmd.modules.check_module_set_name("prefix_inspections") - with pytest.raises(spack.config.ConfigError, match=msg): + with pytest.raises(spack.error.ConfigError, match=msg): spack.cmd.modules.check_module_set_name("third") diff --git a/lib/spack/spack/test/modules/conftest.py b/lib/spack/spack/test/modules/conftest.py index 8869d60d8d9a85..5a2e0ceaed1c72 100644 --- a/lib/spack/spack/test/modules/conftest.py +++ b/lib/spack/spack/test/modules/conftest.py @@ -6,6 +6,8 @@ import pytest +import spack.modules.lmod +import spack.modules.tcl import spack.spec diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py index 43ee11ec492c3f..a985cb1b7e0f71 100644 --- a/lib/spack/spack/test/modules/lmod.py +++ b/lib/spack/spack/test/modules/lmod.py @@ -9,10 +9,13 @@ import archspec.cpu +import spack.config import spack.environment as ev import spack.main +import spack.modules.common import spack.modules.lmod import spack.spec +import spack.util.environment mpich_spec_string = "mpich@3.0.4" mpileaks_spec_string = "mpileaks" diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py index 974985d5b880a6..7e5231ee936263 100644 --- a/lib/spack/spack/test/multimethod.py +++ b/lib/spack/spack/test/multimethod.py @@ -7,6 +7,7 @@ import pytest +import spack.config import spack.platforms import spack.spec from spack.multimethod import NoSuchMethodError diff --git a/lib/spack/spack/test/package_class.py b/lib/spack/spack/test/package_class.py index 1a44c19fb73362..5a61d90d336168 100644 --- a/lib/spack/spack/test/package_class.py +++ b/lib/spack/spack/test/package_class.py @@ -17,13 +17,16 @@ import llnl.util.filesystem as fs +import spack.compilers +import spack.config import spack.deptypes as dt +import spack.error import spack.install_test import spack.package_base import spack.repo import spack.spec from spack.build_systems.generic import Package -from spack.installer import InstallError +from spack.error import InstallError @pytest.fixture(scope="module") diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py index 4f16fb71e83abe..692f9d84cbedf1 100644 --- a/lib/spack/spack/test/packages.py +++ b/lib/spack/spack/test/packages.py @@ -7,8 +7,11 @@ import pytest +import spack.build_environment import spack.directives +import spack.error import spack.fetch_strategy +import spack.package_base import spack.repo from spack.paths import mock_packages_path from spack.spec import Spec @@ -127,10 +130,10 @@ def test_urls_for_versions(mock_packages, config): def test_url_for_version_with_no_urls(mock_packages, config): spec = Spec("git-test") pkg_cls = spack.repo.PATH.get_pkg_class(spec.name) - with pytest.raises(spack.package_base.NoURLError): + with pytest.raises(spack.error.NoURLError): pkg_cls(spec).url_for_version("1.0") - with pytest.raises(spack.package_base.NoURLError): + with pytest.raises(spack.error.NoURLError): pkg_cls(spec).url_for_version("1.1") diff --git a/lib/spack/spack/test/packaging.py b/lib/spack/spack/test/packaging.py index 9fb7e3b1527a8c..f616cb47a786e0 100644 --- a/lib/spack/spack/test/packaging.py +++ b/lib/spack/spack/test/packaging.py @@ -21,9 +21,12 @@ import spack.binary_distribution as bindist import spack.cmd.buildcache as buildcache +import spack.config import spack.error import spack.fetch_strategy +import spack.mirror import spack.package_base +import spack.stage import spack.util.gpg import spack.util.url as url_util from spack.fetch_strategy import URLFetchStrategy diff --git a/lib/spack/spack/test/patch.py b/lib/spack/spack/test/patch.py index 8c8ea24227fb74..4b5f31b904a64b 100644 --- a/lib/spack/spack/test/patch.py +++ b/lib/spack/spack/test/patch.py @@ -14,9 +14,12 @@ from llnl.util.filesystem import mkdirp, touch, working_dir import spack.error +import spack.fetch_strategy import spack.patch import spack.paths import spack.repo +import spack.spec +import spack.stage import spack.util.url as url_util from spack.spec import Spec from spack.stage import Stage diff --git a/lib/spack/spack/test/relocate.py b/lib/spack/spack/test/relocate.py index 31c206264acc9e..bceddbe7286014 100644 --- a/lib/spack/spack/test/relocate.py +++ b/lib/spack/spack/test/relocate.py @@ -12,6 +12,7 @@ import spack.platforms import spack.relocate import spack.relocate_text as relocate_text +import spack.repo import spack.util.executable pytestmark = pytest.mark.not_on_windows("Tests fail on Windows") diff --git a/lib/spack/spack/test/sbang.py b/lib/spack/spack/test/sbang.py index 24cc098d697e0a..d3c5ef2da46772 100644 --- a/lib/spack/spack/test/sbang.py +++ b/lib/spack/spack/test/sbang.py @@ -17,6 +17,7 @@ import llnl.util.filesystem as fs +import spack.config import spack.hooks.sbang as sbang import spack.store import spack.util.spack_yaml as syaml diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py index e0ecfce90a7d8a..0d1fe4abcfccfb 100644 --- a/lib/spack/spack/test/spec_dag.py +++ b/lib/spack/spack/test/spec_dag.py @@ -9,9 +9,9 @@ import spack.deptypes as dt import spack.error -import spack.parser import spack.repo import spack.util.hash as hashutil +import spack.version from spack.dependency import Dependency from spack.spec import Spec @@ -741,7 +741,7 @@ def test_canonical_deptype(self): def test_invalid_literal_spec(self): # Can't give type 'build' to a top-level spec - with pytest.raises(spack.parser.SpecSyntaxError): + with pytest.raises(spack.error.SpecSyntaxError): Spec.from_literal({"foo:build": None}) # Can't use more than one ':' separator diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index 0f3b58e4862799..a7f4383bc6fa68 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -9,6 +9,12 @@ import spack.directives import spack.error +import spack.parser +import spack.paths +import spack.solver.asp +import spack.spec +import spack.store +import spack.variant from spack.error import SpecError, UnsatisfiableSpecError from spack.spec import ( ArchSpec, diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index 33bb9bdf7b38d9..7a1bd3b3cd7eea 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -9,8 +9,11 @@ import pytest +import spack.binary_distribution import spack.cmd +import spack.parser import spack.platforms.test +import spack.repo import spack.spec from spack.parser import ( UNIX_FILENAME, diff --git a/lib/spack/spack/test/stage.py b/lib/spack/spack/test/stage.py index 63cd20eb2aa796..36a9e2eef25361 100644 --- a/lib/spack/spack/test/stage.py +++ b/lib/spack/spack/test/stage.py @@ -17,6 +17,7 @@ from llnl.util.filesystem import getuid, mkdirp, partition_path, touch, working_dir from llnl.util.symlink import readlink +import spack.config import spack.error import spack.fetch_strategy import spack.stage diff --git a/lib/spack/spack/test/tag.py b/lib/spack/spack/test/tag.py index 1d493d3a791c66..e429b9f4578e2f 100644 --- a/lib/spack/spack/test/tag.py +++ b/lib/spack/spack/test/tag.py @@ -7,6 +7,7 @@ import pytest +import spack.repo import spack.tag from spack.main import SpackCommand diff --git a/lib/spack/spack/test/test_suite.py b/lib/spack/spack/test/test_suite.py index 708c4788be76e4..60a54e7171bba2 100644 --- a/lib/spack/spack/test/test_suite.py +++ b/lib/spack/spack/test/test_suite.py @@ -10,8 +10,10 @@ from llnl.util.filesystem import join_path, mkdirp, touch +import spack.config import spack.install_test import spack.spec +import spack.util.executable from spack.install_test import TestStatus from spack.util.executable import which diff --git a/lib/spack/spack/test/url_fetch.py b/lib/spack/spack/test/url_fetch.py index ff7e4a142e84c0..f103244a1067de 100644 --- a/lib/spack/spack/test/url_fetch.py +++ b/lib/spack/spack/test/url_fetch.py @@ -17,9 +17,11 @@ import spack.config import spack.error import spack.fetch_strategy as fs +import spack.url import spack.util.crypto as crypto import spack.util.executable import spack.util.web as web_util +import spack.version from spack.spec import Spec from spack.stage import Stage from spack.util.executable import which diff --git a/lib/spack/spack/test/util/executable.py b/lib/spack/spack/test/util/executable.py index d854ec426e2ddc..9b0536eba9510c 100644 --- a/lib/spack/spack/test/util/executable.py +++ b/lib/spack/spack/test/util/executable.py @@ -12,6 +12,7 @@ import llnl.util.filesystem as fs import spack +import spack.main import spack.util.executable as ex from spack.hooks.sbang import filter_shebangs_in_directory diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py index bc97fe46677088..734ba4ca4a40f8 100644 --- a/lib/spack/spack/test/versions.py +++ b/lib/spack/spack/test/versions.py @@ -16,6 +16,7 @@ import spack.package_base import spack.spec +import spack.version from spack.version import ( EmptyRangeError, GitVersion, From 623c5a4d2491a0d6781154abc6d8886e771f7f4e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 17 Sep 2024 14:43:03 +0200 Subject: [PATCH 171/687] package_base.py: do not depend on spack.environment (#46424) --- lib/spack/spack/package_base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index e2c7069ef85c43..c539cf1e0e1ba4 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -40,7 +40,6 @@ import spack.dependency import spack.deptypes as dt import spack.directives -import spack.environment import spack.error import spack.fetch_strategy as fs import spack.hooks @@ -1700,8 +1699,7 @@ def content_hash(self, content=None): # should this attempt to download the source and set one? This # probably only happens for source repositories which are # referenced by branch name rather than tag or commit ID. - env = spack.environment.active_environment() - from_local_sources = env and env.is_develop(self.spec) + from_local_sources = "dev_path" in self.spec.variants if self.has_code and not self.spec.external and not from_local_sources: message = "Missing a source id for {s.name}@{s.version}" tty.debug(message.format(s=self)) From 3ded2fc9c53cc5dc684e49da25f4517bb687f3f5 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 17 Sep 2024 17:06:00 +0200 Subject: [PATCH 172/687] untangle spack.config / spack.util.cpus & spack.spec (#46427) --- lib/spack/spack/build_environment.py | 3 +- lib/spack/spack/build_systems/racket.py | 2 +- lib/spack/spack/config.py | 46 +++++++++++-------- lib/spack/spack/environment/environment.py | 2 +- lib/spack/spack/package.py | 2 +- lib/spack/spack/solver/asp.py | 31 +++++++++++-- lib/spack/spack/test/build_environment.py | 13 +++--- lib/spack/spack/util/cpus.py | 36 --------------- lib/spack/spack/util/parallel.py | 2 +- .../repos/builtin/packages/amdlibm/package.py | 1 - 10 files changed, 65 insertions(+), 73 deletions(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 296fdd4aff0df1..bf8ac6c1ea1dec 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -77,7 +77,6 @@ from spack.context import Context from spack.error import InstallError, NoHeadersError, NoLibrariesError from spack.install_test import spack_install_test_log -from spack.util.cpus import determine_number_of_jobs from spack.util.environment import ( SYSTEM_DIR_CASE_ENTRY, EnvironmentModifications, @@ -559,7 +558,7 @@ def set_package_py_globals(pkg, context: Context = Context.BUILD): module.std_meson_args = spack.build_systems.meson.MesonBuilder.std_args(pkg) module.std_pip_args = spack.build_systems.python.PythonPipBuilder.std_args(pkg) - jobs = determine_number_of_jobs(parallel=pkg.parallel) + jobs = spack.config.determine_number_of_jobs(parallel=pkg.parallel) module.make_jobs = jobs # TODO: make these build deps that can be installed if not found. diff --git a/lib/spack/spack/build_systems/racket.py b/lib/spack/spack/build_systems/racket.py index facac62032cf54..7e48f8b370f0b3 100644 --- a/lib/spack/spack/build_systems/racket.py +++ b/lib/spack/spack/build_systems/racket.py @@ -11,9 +11,9 @@ import spack.builder from spack.build_environment import SPACK_NO_PARALLEL_MAKE +from spack.config import determine_number_of_jobs from spack.directives import build_system, extends, maintainers from spack.package_base import PackageBase -from spack.util.cpus import determine_number_of_jobs from spack.util.environment import env_flag from spack.util.executable import Executable, ProcessError diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 34dd133d973442..94f8e4ff04ea6d 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -58,12 +58,10 @@ import spack.schema.repos import spack.schema.upstreams import spack.schema.view -import spack.spec # Hacked yaml for configuration files preserves line numbers. import spack.util.spack_yaml as syaml import spack.util.web as web_util -from spack.error import SpecSyntaxError from spack.util.cpus import cpus_available #: Dict from section names -> schema for that section @@ -1710,25 +1708,37 @@ def get_mark_from_yaml_data(obj): return mark -def parse_spec_from_yaml_string(string: str) -> "spack.spec.Spec": - """Parse a spec from YAML and add file/line info to errors, if it's available. - - Parse a ``Spec`` from the supplied string, but also intercept any syntax errors and - add file/line information for debugging using file/line annotations from the string. +def determine_number_of_jobs( + *, + parallel: bool = False, + max_cpus: int = cpus_available(), + config: Optional[Configuration] = None, +) -> int: + """ + Packages that require sequential builds need 1 job. Otherwise we use the + number of jobs set on the command line. If not set, then we use the config + defaults (which is usually set through the builtin config scope), but we + cap to the number of CPUs available to avoid oversubscription. + + Parameters: + parallel: true when package supports parallel builds + max_cpus: maximum number of CPUs to use (defaults to cpus_available()) + config: configuration object (defaults to global config) + """ + if not parallel: + return 1 - Arguments: - string: a string representing a ``Spec`` from config YAML. + cfg = config or CONFIG - """ + # Command line overrides all try: - spec = spack.spec.Spec(string) - return spec - except SpecSyntaxError as e: - mark = get_mark_from_yaml_data(string) - if mark: - msg = f"{mark.name}:{mark.line + 1}: {str(e)}" - raise SpecSyntaxError(msg) from e - raise e + command_line = cfg.get("config:build_jobs", default=None, scope="command_line") + if command_line is not None: + return command_line + except ValueError: + pass + + return min(max_cpus, cfg.get("config:build_jobs", 16)) class ConfigSectionError(spack.error.ConfigError): diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 1d2ea86c9d494b..2a22a76abe5dd0 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -1648,7 +1648,7 @@ def _concretize_separately(self, tests=False): # Solve the environment in parallel on Linux start = time.time() - num_procs = min(len(args), spack.util.cpus.determine_number_of_jobs(parallel=True)) + num_procs = min(len(args), spack.config.determine_number_of_jobs(parallel=True)) # TODO: support parallel concretization on macOS and Windows msg = "Starting concretization" diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index d2a00f9941865c..c8de3c21585cd5 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -75,6 +75,7 @@ from spack.build_systems.waf import WafPackage from spack.build_systems.xorg import XorgPackage from spack.builder import run_after, run_before +from spack.config import determine_number_of_jobs from spack.deptypes import ALL_TYPES as all_deptypes from spack.directives import * from spack.install_test import ( @@ -99,7 +100,6 @@ on_package_attributes, ) from spack.spec import InvalidSpecDetected, Spec -from spack.util.cpus import determine_number_of_jobs from spack.util.executable import * from spack.util.filesystem import file_command, fix_darwin_install_name, mime_type from spack.variant import ( diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 3b98117c1c296e..62557d311a3307 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -31,7 +31,6 @@ import spack.compilers import spack.concretize import spack.config -import spack.config as sc import spack.deptypes as dt import spack.environment as ev import spack.error @@ -49,6 +48,8 @@ import spack.version as vn import spack.version.git_ref_lookup from spack import traverse +from spack.config import get_mark_from_yaml_data +from spack.error import SpecSyntaxError from .core import ( AspFunction, @@ -2923,6 +2924,26 @@ def value(self) -> str: return "".join(self.asp_problem) +def parse_spec_from_yaml_string(string: str) -> "spack.spec.Spec": + """Parse a spec from YAML and add file/line info to errors, if it's available. + + Parse a ``Spec`` from the supplied string, but also intercept any syntax errors and + add file/line information for debugging using file/line annotations from the string. + + Arguments: + string: a string representing a ``Spec`` from config YAML. + + """ + try: + return spack.spec.Spec(string) + except SpecSyntaxError as e: + mark = get_mark_from_yaml_data(string) + if mark: + msg = f"{mark.name}:{mark.line + 1}: {str(e)}" + raise SpecSyntaxError(msg) from e + raise e + + class RequirementParser: """Parses requirements from package.py files and configuration, and returns rules.""" @@ -3008,11 +3029,11 @@ def rules_from_conflict(self, pkg: "spack.package_base.PackageBase") -> List[Req def _parse_prefer_conflict_item(self, item): # The item is either a string or an object with at least a "spec" attribute if isinstance(item, str): - spec = sc.parse_spec_from_yaml_string(item) + spec = parse_spec_from_yaml_string(item) condition = spack.spec.Spec() message = None else: - spec = sc.parse_spec_from_yaml_string(item["spec"]) + spec = parse_spec_from_yaml_string(item["spec"]) condition = spack.spec.Spec(item.get("when")) message = item.get("message") return spec, condition, message @@ -3053,10 +3074,10 @@ def _rules_from_requirements( # validate specs from YAML first, and fail with line numbers if parsing fails. constraints = [ - sc.parse_spec_from_yaml_string(constraint) for constraint in constraints + parse_spec_from_yaml_string(constraint) for constraint in constraints ] when_str = requirement.get("when") - when = sc.parse_spec_from_yaml_string(when_str) if when_str else spack.spec.Spec() + when = parse_spec_from_yaml_string(when_str) if when_str else spack.spec.Spec() constraints = [ x diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 38d34fc1e81f14..8d7a09ab7ec6b9 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -22,7 +22,6 @@ from spack.build_environment import UseMode, _static_to_shared_library, dso_suffix from spack.context import Context from spack.paths import build_env_path -from spack.util.cpus import determine_number_of_jobs from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable @@ -483,7 +482,7 @@ def test_parallel_false_is_not_propagating(default_mock_concretization): assert s["pkg-a"].package.module.make_jobs == 1 spack.build_environment.set_package_py_globals(s["pkg-b"].package, context=Context.BUILD) - assert s["pkg-b"].package.module.make_jobs == spack.build_environment.determine_number_of_jobs( + assert s["pkg-b"].package.module.make_jobs == spack.config.determine_number_of_jobs( parallel=s["pkg-b"].package.parallel ) @@ -516,7 +515,7 @@ def test_setting_dtags_based_on_config(config_setting, expected_flag, config, mo def test_build_jobs_sequential_is_sequential(): assert ( - determine_number_of_jobs( + spack.config.determine_number_of_jobs( parallel=False, max_cpus=8, config=spack.config.Configuration( @@ -530,7 +529,7 @@ def test_build_jobs_sequential_is_sequential(): def test_build_jobs_command_line_overrides(): assert ( - determine_number_of_jobs( + spack.config.determine_number_of_jobs( parallel=True, max_cpus=1, config=spack.config.Configuration( @@ -541,7 +540,7 @@ def test_build_jobs_command_line_overrides(): == 10 ) assert ( - determine_number_of_jobs( + spack.config.determine_number_of_jobs( parallel=True, max_cpus=100, config=spack.config.Configuration( @@ -555,7 +554,7 @@ def test_build_jobs_command_line_overrides(): def test_build_jobs_defaults(): assert ( - determine_number_of_jobs( + spack.config.determine_number_of_jobs( parallel=True, max_cpus=10, config=spack.config.Configuration( @@ -565,7 +564,7 @@ def test_build_jobs_defaults(): == 1 ) assert ( - determine_number_of_jobs( + spack.config.determine_number_of_jobs( parallel=True, max_cpus=10, config=spack.config.Configuration( diff --git a/lib/spack/spack/util/cpus.py b/lib/spack/spack/util/cpus.py index 9c98656830d338..5cf09c3e822479 100644 --- a/lib/spack/spack/util/cpus.py +++ b/lib/spack/spack/util/cpus.py @@ -5,9 +5,6 @@ import multiprocessing import os -from typing import Optional - -import spack.config def cpus_available(): @@ -21,36 +18,3 @@ def cpus_available(): return len(os.sched_getaffinity(0)) # novermin except Exception: return multiprocessing.cpu_count() - - -def determine_number_of_jobs( - *, - parallel: bool = False, - max_cpus: int = cpus_available(), - config: Optional["spack.config.Configuration"] = None, -) -> int: - """ - Packages that require sequential builds need 1 job. Otherwise we use the - number of jobs set on the command line. If not set, then we use the config - defaults (which is usually set through the builtin config scope), but we - cap to the number of CPUs available to avoid oversubscription. - - Parameters: - parallel: true when package supports parallel builds - max_cpus: maximum number of CPUs to use (defaults to cpus_available()) - config: configuration object (defaults to global config) - """ - if not parallel: - return 1 - - cfg = config or spack.config.CONFIG - - # Command line overrides all - try: - command_line = cfg.get("config:build_jobs", default=None, scope="command_line") - if command_line is not None: - return command_line - except ValueError: - pass - - return min(max_cpus, cfg.get("config:build_jobs", 16)) diff --git a/lib/spack/spack/util/parallel.py b/lib/spack/spack/util/parallel.py index 28c55b7d1e5ee2..9bbdf5dd7a35ef 100644 --- a/lib/spack/spack/util/parallel.py +++ b/lib/spack/spack/util/parallel.py @@ -9,7 +9,7 @@ import traceback from typing import Optional -from spack.util.cpus import determine_number_of_jobs +from spack.config import determine_number_of_jobs class ErrorFromWorker: diff --git a/var/spack/repos/builtin/packages/amdlibm/package.py b/var/spack/repos/builtin/packages/amdlibm/package.py index 00fb03d94e270c..4ec7cd850c7d6b 100644 --- a/var/spack/repos/builtin/packages/amdlibm/package.py +++ b/var/spack/repos/builtin/packages/amdlibm/package.py @@ -8,7 +8,6 @@ from llnl.util import tty from spack.package import * -from spack.util.cpus import determine_number_of_jobs class Amdlibm(SConsPackage): From aa6651fe27dda47c69042c06b5d56ffdb9d582e0 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 17 Sep 2024 17:06:16 +0200 Subject: [PATCH 173/687] drop main dep from build_environment/subprocess_context (#46426) --- lib/spack/spack/build_environment.py | 3 +-- lib/spack/spack/main.py | 14 +------------- lib/spack/spack/paths.py | 13 +++++++++++++ lib/spack/spack/subprocess_context.py | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index bf8ac6c1ea1dec..26eb0e79f68e03 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -62,7 +62,6 @@ import spack.config import spack.deptypes as dt import spack.error -import spack.main import spack.multimethod import spack.package_base import spack.paths @@ -451,7 +450,7 @@ def set_wrapper_variables(pkg, env): env.set(SPACK_DEBUG, "TRUE") env.set(SPACK_SHORT_SPEC, pkg.spec.short_spec) env.set(SPACK_DEBUG_LOG_ID, pkg.spec.format("{name}-{hash:7}")) - env.set(SPACK_DEBUG_LOG_DIR, spack.main.spack_working_dir) + env.set(SPACK_DEBUG_LOG_DIR, spack.paths.spack_working_dir) if spack.config.get("config:ccache"): # Enable ccache in the compiler wrapper diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index eb15789c76992d..c0bb3d33552776 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -100,24 +100,12 @@ #: Properties that commands are required to set. required_command_properties = ["level", "section", "description"] -#: Recorded directory where spack command was originally invoked -spack_working_dir = None spack_ld_library_path = os.environ.get("LD_LIBRARY_PATH", "") #: Whether to print backtraces on error SHOW_BACKTRACE = False -def set_working_dir(): - """Change the working directory to getcwd, or spack prefix if no cwd.""" - global spack_working_dir - try: - spack_working_dir = os.getcwd() - except OSError: - os.chdir(spack.paths.prefix) - spack_working_dir = spack.paths.prefix - - def add_all_commands(parser): """Add all spack subcommands to the parser.""" for cmd in spack.cmd.all_commands(): @@ -998,7 +986,7 @@ def finish_parse_and_run(parser, cmd_name, main_args, env_format_error): raise env_format_error # many operations will fail without a working directory. - set_working_dir() + spack.paths.set_working_dir() # now we can actually execute the command. if main_args.spack_profile or main_args.sorted_profile: diff --git a/lib/spack/spack/paths.py b/lib/spack/spack/paths.py index aa642764215117..84583cd552f531 100644 --- a/lib/spack/spack/paths.py +++ b/lib/spack/spack/paths.py @@ -136,3 +136,16 @@ def _get_system_config_path(): #: System configuration location system_config_path = _get_system_config_path() + +#: Recorded directory where spack command was originally invoked +spack_working_dir = None + + +def set_working_dir(): + """Change the working directory to getcwd, or spack prefix if no cwd.""" + global spack_working_dir + try: + spack_working_dir = os.getcwd() + except OSError: + os.chdir(prefix) + spack_working_dir = prefix diff --git a/lib/spack/spack/subprocess_context.py b/lib/spack/spack/subprocess_context.py index f96e530e971992..c823e657036fad 100644 --- a/lib/spack/spack/subprocess_context.py +++ b/lib/spack/spack/subprocess_context.py @@ -22,7 +22,7 @@ import spack.config import spack.environment -import spack.main +import spack.paths import spack.platforms import spack.repo import spack.store @@ -72,12 +72,12 @@ def __init__(self, pkg): else: self.pkg = pkg self.env = spack.environment.active_environment() - self.spack_working_dir = spack.main.spack_working_dir + self.spack_working_dir = spack.paths.spack_working_dir self.test_state = TestState() def restore(self): self.test_state.restore() - spack.main.spack_working_dir = self.spack_working_dir + spack.paths.spack_working_dir = self.spack_working_dir env = pickle.load(self.serialized_env) if _SERIALIZE else self.env if env: spack.environment.activate(env) From 1768b923f1af724ffaff4f49b8bd38e608291ddd Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 17 Sep 2024 17:07:26 +0200 Subject: [PATCH 174/687] cloud_pipelines/.gitlab-ci.yml: run spack arch (#46437) --- share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index 9bee896586eb90..f0f0a0b681a15d 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -181,6 +181,7 @@ default: - cat /proc/loadavg || true - cat /proc/meminfo | grep 'MemTotal\|MemFree' || true - . "./share/spack/setup-env.sh" + - spack arch after_script: - cat /proc/loadavg || true - cat /proc/meminfo | grep 'MemTotal\|MemFree' || true From 98180022195394817f1765081d993177eb1f5ad4 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 17 Sep 2024 09:59:05 -0700 Subject: [PATCH 175/687] variants: Unify metadata dictionaries to index by `when` (#44425) Continuing the work started in #40326, his changes the structure of Variant metadata on Packages from a single variant definition per name with a list of `when` specs: ``` name: (Variant, [when_spec, ...]) ``` to a Variant definition per `when_spec` per name: ``` when_spec: { name: Variant } ``` With this change, everything on a package *except* versions is keyed by `when` spec. This: 1. makes things consistent, in that conditional things are (nearly) all modeled in the same way; and 2. fixes an issue where we would lose information about multiple variant definitions in a package (see #38302). We can now have, e.g., different defaults for the same variant in different versions of a package. Some notes: 1. This required some pretty deep changes to the solver. Previously, the solver's job was to select value(s) for a single variant definition per name per package. Now, the solver needs to: a. Determine which variant definition should be used for a given node, which can depend on the node's version, compiler, target, other variants, etc. b. Select valid value(s) for variants for each node based on the selected variant definition. When multiple variant definitions are enabled via their `when=` clause, we will always prefer the *last* matching definition, by declaration order in packages. This is implemented by adding a `precedence` to each variant at definition time, and we ensure they are added to the solver in order of precedence. This has the effect that variant definitions from derived classes are preferred over definitions from superclasses, and the last definition within the same class sticks. This matches python semantics. Some examples: ```python class ROCmPackage(PackageBase): variant("amdgpu_target", ..., when="+rocm") class Hipblas(ROCmPackage): variant("amdgpu_target", ...) ``` The global variant in `hipblas` will always supersede the `when="+rocm"` variant in `ROCmPackage`. If `hipblas`'s variant was also conditional on `+rocm` (as it probably should be), we would again filter out the definition from `ROCmPackage` because it could never be activated. If you instead have: ```python class ROCmPackage(PackageBase): variant("amdgpu_target", ..., when="+rocm") class Hipblas(ROCmPackage): variant("amdgpu_target", ..., when="+rocm+foo") ``` The variant on `hipblas` will win for `+rocm+foo` but the one on `ROCmPackage` will win with `rocm~foo`. So, *if* we can statically determine if a variant is overridden, we filter it out. This isn't strictly necessary, as the solver can handle many definitions fine, but this reduces the complexity of the problem instance presented to `clingo`, and simplifies output in `spack info` for derived packages. e.g., `spack info hipblas` now shows only one definition of `amdgpu_target` where before it showed two, one of which would never be used. 2. Nearly all access to the `variants` dictionary on packages has been refactored to use the following class methods on `PackageBase`: * `variant_names(cls) -> List[str]`: get all variant names for a package * `has_variant(cls, name) -> bool`: whether a package has a variant with a given name * `variant_definitions(cls, name: str) -> List[Tuple[Spec, Variant]]`: all definitions of variant `name` that are possible, along with their `when` specs. * `variant_items() -> `: iterate over `pkg.variants.items()`, with impossible variants filtered out. Consolidating to these methods seems to simplify the code a lot. 3. The solver does a lot more validation on variant values at setup time now. In particular, it checks whether a variant value on a spec is valid given the other constraints on that spec. This allowed us to remove the crufty logic in `update_variant_validate`, which was needed because we previously didn't *know* after a solve which variant definition had been used. Now, variant values from solves are constructed strictly based on which variant definition was selected -- no more heuristics. 4. The same prevalidation can now be done in package audits, and you can run: ``` spack audit packages --strict-variants ``` This turns up around 18 different places where a variant specification isn't valid given the conditions on variant definitions in packages. I haven't fixed those here but will open a separate PR to iterate on them. I plan to make strict checking the defaults once all existing package issues are resolved. It's not clear to me that strict checking should be the default for the prevalidation done at solve time. There are a few other changes here that might be of interest: 1. The `generator` variant in `CMakePackage` is now only defined when `build_system=cmake`. 2. `spack info` has been updated to support the new metadata layout. 3. split out variant propagation into its own `.lp` file in the `solver` code. 4. Add better typing and clean up code for variant types in `variant.py`. 5. Add tests for new variant behavior. --- lib/spack/spack/audit.py | 140 +++--- lib/spack/spack/build_systems/autotools.py | 23 +- lib/spack/spack/build_systems/cached_cmake.py | 2 +- lib/spack/spack/build_systems/cmake.py | 3 +- lib/spack/spack/cmd/config.py | 6 +- lib/spack/spack/cmd/info.py | 51 +-- lib/spack/spack/cray_manifest.py | 2 +- lib/spack/spack/directives.py | 24 +- lib/spack/spack/package_base.py | 110 ++++- lib/spack/spack/package_prefs.py | 10 +- lib/spack/spack/solver/asp.py | 358 ++++++++------- lib/spack/spack/solver/concretize.lp | 219 +++++---- lib/spack/spack/solver/display.lp | 4 +- lib/spack/spack/solver/error_messages.lp | 18 +- lib/spack/spack/spec.py | 106 +++-- lib/spack/spack/test/concretize.py | 8 +- lib/spack/spack/test/spec_semantics.py | 26 +- lib/spack/spack/test/variant.py | 224 +++++++++- lib/spack/spack/variant.py | 421 +++++++++++------- .../variant-values-override/package.py | 12 + .../packages/variant-values/package.py | 23 + 21 files changed, 1157 insertions(+), 633 deletions(-) create mode 100644 var/spack/repos/builtin.mock/packages/variant-values-override/package.py create mode 100644 var/spack/repos/builtin.mock/packages/variant-values/package.py diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 486e3c3d65d54b..6b441c69656077 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -282,7 +282,7 @@ def _avoid_mismatched_variants(error_cls): pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) for variant in current_spec.variants.values(): # Variant does not exist at all - if variant.name not in pkg_cls.variants: + if variant.name not in pkg_cls.variant_names(): summary = ( f"Setting a preference for the '{pkg_name}' package to the " f"non-existing variant '{variant.name}'" @@ -291,9 +291,8 @@ def _avoid_mismatched_variants(error_cls): continue # Variant cannot accept this value - s = spack.spec.Spec(pkg_name) try: - s.update_variant_validate(variant.name, variant.value) + spack.variant.prevalidate_variant_value(pkg_cls, variant, strict=True) except Exception: summary = ( f"Setting the variant '{variant.name}' of the '{pkg_name}' package " @@ -663,9 +662,15 @@ def _ensure_env_methods_are_ported_to_builders(pkgs, error_cls): errors = [] for pkg_name in pkgs: pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) - buildsystem_variant, _ = pkg_cls.variants["build_system"] - buildsystem_names = [getattr(x, "value", x) for x in buildsystem_variant.values] - builder_cls_names = [spack.builder.BUILDER_CLS[x].__name__ for x in buildsystem_names] + + # values are either Value objects (for conditional values) or the values themselves + build_system_names = set( + v.value if isinstance(v, spack.variant.Value) else v + for _, variant in pkg_cls.variant_definitions("build_system") + for v in variant.values + ) + builder_cls_names = [spack.builder.BUILDER_CLS[x].__name__ for x in build_system_names] + module = pkg_cls.module has_builders_in_package_py = any( getattr(module, name, False) for name in builder_cls_names @@ -932,20 +937,22 @@ def check_virtual_with_variants(spec, msg): # check variants dependency_variants = dep.spec.variants - for name, value in dependency_variants.items(): + for name, variant in dependency_variants.items(): try: - v, _ = dependency_pkg_cls.variants[name] - v.validate_or_raise(value, pkg_cls=dependency_pkg_cls) + spack.variant.prevalidate_variant_value( + dependency_pkg_cls, variant, dep.spec, strict=True + ) except Exception as e: summary = ( f"{pkg_name}: wrong variant used for dependency in 'depends_on()'" ) + error_msg = str(e) if isinstance(e, KeyError): error_msg = ( f"variant {str(e).strip()} does not exist in package {dep_name}" + f" in package '{dep_name}'" ) - error_msg += f" in package '{dep_name}'" errors.append( error_cls(summary=summary, details=[error_msg, f"in {filename}"]) @@ -957,39 +964,38 @@ def check_virtual_with_variants(spec, msg): @package_directives def _ensure_variant_defaults_are_parsable(pkgs, error_cls): """Ensures that variant defaults are present and parsable from cli""" - errors = [] - for pkg_name in pkgs: - pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) - for variant_name, entry in pkg_cls.variants.items(): - variant, _ = entry - default_is_parsable = ( - # Permitting a default that is an instance on 'int' permits - # to have foo=false or foo=0. Other falsish values are - # not allowed, since they can't be parsed from cli ('foo=') - isinstance(variant.default, int) - or variant.default - ) - if not default_is_parsable: - error_msg = "Variant '{}' of package '{}' has a bad default value" - errors.append(error_cls(error_msg.format(variant_name, pkg_name), [])) - continue - try: - vspec = variant.make_default() - except spack.variant.MultipleValuesInExclusiveVariantError: - error_msg = "Cannot create a default value for the variant '{}' in package '{}'" - errors.append(error_cls(error_msg.format(variant_name, pkg_name), [])) - continue + def check_variant(pkg_cls, variant, vname): + # bool is a subclass of int in python. Permitting a default that is an instance + # of 'int' means both foo=false and foo=0 are accepted. Other falsish values are + # not allowed, since they can't be parsed from CLI ('foo=') + default_is_parsable = isinstance(variant.default, int) or variant.default - try: - variant.validate_or_raise(vspec, pkg_cls=pkg_cls) - except spack.variant.InvalidVariantValueError: - error_msg = ( - "The default value of the variant '{}' in package '{}' failed validation" - ) - question = "Is it among the allowed values?" - errors.append(error_cls(error_msg.format(variant_name, pkg_name), [question])) + if not default_is_parsable: + msg = f"Variant '{vname}' of package '{pkg_cls.name}' has an unparsable default value" + return [error_cls(msg, [])] + + try: + vspec = variant.make_default() + except spack.variant.MultipleValuesInExclusiveVariantError: + msg = f"Can't create default value for variant '{vname}' in package '{pkg_cls.name}'" + return [error_cls(msg, [])] + + try: + variant.validate_or_raise(vspec, pkg_cls.name) + except spack.variant.InvalidVariantValueError: + msg = "Default value of variant '{vname}' in package '{pkg.name}' is invalid" + question = "Is it among the allowed values?" + return [error_cls(msg, [question])] + + return [] + errors = [] + for pkg_name in pkgs: + pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) + for vname in pkg_cls.variant_names(): + for _, variant_def in pkg_cls.variant_definitions(vname): + errors.extend(check_variant(pkg_cls, variant_def, vname)) return errors @@ -999,11 +1005,11 @@ def _ensure_variants_have_descriptions(pkgs, error_cls): errors = [] for pkg_name in pkgs: pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) - for variant_name, entry in pkg_cls.variants.items(): - variant, _ = entry - if not variant.description: - error_msg = "Variant '{}' in package '{}' is missing a description" - errors.append(error_cls(error_msg.format(variant_name, pkg_name), [])) + for name in pkg_cls.variant_names(): + for when, variant in pkg_cls.variant_definitions(name): + if not variant.description: + msg = f"Variant '{name}' in package '{pkg_name}' is missing a description" + errors.append(error_cls(msg, [])) return errors @@ -1060,29 +1066,26 @@ def _version_constraints_are_satisfiable_by_some_version_in_repo(pkgs, error_cls def _analyze_variants_in_directive(pkg, constraint, directive, error_cls): - variant_exceptions = ( - spack.variant.InconsistentValidationError, - spack.variant.MultipleValuesInExclusiveVariantError, - spack.variant.InvalidVariantValueError, - KeyError, - ) errors = [] - for name, v in constraint.variants.items(): - try: - variant, _ = pkg.variants[name] - variant.validate_or_raise(v, pkg_cls=pkg) - except variant_exceptions as e: - summary = pkg.name + ': wrong variant in "{0}" directive' - summary = summary.format(directive) - filename = spack.repo.PATH.filename_for_package_name(pkg.name) - - error_msg = str(e).strip() - if isinstance(e, KeyError): - error_msg = "the variant {0} does not exist".format(error_msg) + variant_names = pkg.variant_names() + summary = f"{pkg.name}: wrong variant in '{directive}' directive" + filename = spack.repo.PATH.filename_for_package_name(pkg.name) - err = error_cls(summary=summary, details=[error_msg, "in " + filename]) + for name, v in constraint.variants.items(): + if name not in variant_names: + msg = f"variant {name} does not exist in {pkg.name}" + errors.append(error_cls(summary=summary, details=[msg, f"in {filename}"])) + continue - errors.append(err) + try: + spack.variant.prevalidate_variant_value(pkg, v, constraint, strict=True) + except ( + spack.variant.InconsistentValidationError, + spack.variant.MultipleValuesInExclusiveVariantError, + spack.variant.InvalidVariantValueError, + ) as e: + msg = str(e).strip() + errors.append(error_cls(summary=summary, details=[msg, f"in {filename}"])) return errors @@ -1120,9 +1123,10 @@ def _extracts_errors(triggers, summary): for dname in dnames ) - for vname, (variant, triggers) in pkg_cls.variants.items(): - summary = f"{pkg_name}: wrong 'when=' condition for the '{vname}' variant" - errors.extend(_extracts_errors(triggers, summary)) + for when, variants_by_name in pkg_cls.variants.items(): + for vname, variant in variants_by_name.items(): + summary = f"{pkg_name}: wrong 'when=' condition for the '{vname}' variant" + errors.extend(_extracts_errors([when], summary)) for when, providers, details in _error_items(pkg_cls.provided): errors.extend( diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index d5ddcea11a54d0..47911271fef860 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -687,9 +687,8 @@ def _activate_or_not( variant = variant or name - # Defensively look that the name passed as argument is among - # variants - if variant not in self.pkg.variants: + # Defensively look that the name passed as argument is among variants + if not self.pkg.has_variant(variant): msg = '"{0}" is not a variant of "{1}"' raise KeyError(msg.format(variant, self.pkg.name)) @@ -698,27 +697,19 @@ def _activate_or_not( # Create a list of pairs. Each pair includes a configuration # option and whether or not that option is activated - variant_desc, _ = self.pkg.variants[variant] - if set(variant_desc.values) == set((True, False)): + vdef = self.pkg.get_variant(variant) + if set(vdef.values) == set((True, False)): # BoolValuedVariant carry information about a single option. # Nonetheless, for uniformity of treatment we'll package them # in an iterable of one element. - condition = "+{name}".format(name=variant) - options = [(name, condition in spec)] + options = [(name, f"+{variant}" in spec)] else: - condition = "{variant}={value}" # "feature_values" is used to track values which correspond to # features which can be enabled or disabled as understood by the # package's build system. It excludes values which have special # meanings and do not correspond to features (e.g. "none") - feature_values = ( - getattr(variant_desc.values, "feature_values", None) or variant_desc.values - ) - - options = [ - (value, condition.format(variant=variant, value=value) in spec) - for value in feature_values - ] + feature_values = getattr(vdef.values, "feature_values", None) or vdef.values + options = [(value, f"{variant}={value}" in spec) for value in feature_values] # For each allowed value in the list of values for option_value, activated in options: diff --git a/lib/spack/spack/build_systems/cached_cmake.py b/lib/spack/spack/build_systems/cached_cmake.py index aff54d7559e746..37069437040428 100644 --- a/lib/spack/spack/build_systems/cached_cmake.py +++ b/lib/spack/spack/build_systems/cached_cmake.py @@ -89,7 +89,7 @@ def define_cmake_cache_from_variant(self, cmake_var, variant=None, comment=""): if variant is None: variant = cmake_var.lower() - if variant not in self.pkg.variants: + if not self.pkg.has_variant(variant): raise KeyError('"{0}" is not a variant of "{1}"'.format(variant, self.pkg.name)) if variant not in self.pkg.spec.variants: diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index dc833a10a6fd83..93d3485ae0882a 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -146,6 +146,7 @@ def _values(x): default=default, values=_values, description="the build system generator to use", + when="build_system=cmake", ) for x in not_used: conflicts(f"generator={x}") @@ -505,7 +506,7 @@ def define_from_variant(self, cmake_var, variant=None): if variant is None: variant = cmake_var.lower() - if variant not in self.pkg.variants: + if not self.pkg.has_variant(variant): raise KeyError('"{0}" is not a variant of "{1}"'.format(variant, self.pkg.name)) if variant not in self.pkg.spec.variants: diff --git a/lib/spack/spack/cmd/config.py b/lib/spack/spack/cmd/config.py index 5c2a02f042273f..aef2d7a54120f2 100644 --- a/lib/spack/spack/cmd/config.py +++ b/lib/spack/spack/cmd/config.py @@ -536,11 +536,11 @@ def config_prefer_upstream(args): # Get and list all the variants that differ from the default. variants = [] for var_name, variant in spec.variants.items(): - if var_name in ["patches"] or var_name not in spec.package.variants: + if var_name in ["patches"] or not spec.package.has_variant(var_name): continue - variant_desc, _ = spec.package.variants[var_name] - if variant.value != variant_desc.default: + vdef = spec.package.get_variant(var_name) + if variant.value != vdef.default: variants.append(str(variant)) variants.sort() variants = " ".join(variants) diff --git a/lib/spack/spack/cmd/info.py b/lib/spack/spack/cmd/info.py index 5ea99caa3a6810..a7cdf608a208e0 100644 --- a/lib/spack/spack/cmd/info.py +++ b/lib/spack/spack/cmd/info.py @@ -334,26 +334,6 @@ def _fmt_variant(variant, max_name_default_len, indent, when=None, out=None): out.write("\n") -def _variants_by_name_when(pkg): - """Adaptor to get variants keyed by { name: { when: { [Variant...] } }.""" - # TODO: replace with pkg.variants_by_name(when=True) when unified directive dicts are merged. - variants = {} - for name, (variant, whens) in sorted(pkg.variants.items()): - for when in whens: - variants.setdefault(name, {}).setdefault(when, []).append(variant) - return variants - - -def _variants_by_when_name(pkg): - """Adaptor to get variants keyed by { when: { name: Variant } }""" - # TODO: replace with pkg.variants when unified directive dicts are merged. - variants = {} - for name, (variant, whens) in pkg.variants.items(): - for when in whens: - variants.setdefault(when, {})[name] = variant - return variants - - def _print_variants_header(pkg): """output variants""" @@ -364,32 +344,22 @@ def _print_variants_header(pkg): color.cprint("") color.cprint(section_title("Variants:")) - variants_by_name = _variants_by_name_when(pkg) - # Calculate the max length of the "name [default]" part of the variant display # This lets us know where to print variant values. max_name_default_len = max( color.clen(_fmt_name_and_default(variant)) - for name, when_variants in variants_by_name.items() - for variants in when_variants.values() - for variant in variants + for name in pkg.variant_names() + for _, variant in pkg.variant_definitions(name) ) - return max_name_default_len, variants_by_name - - -def _unconstrained_ver_first(item): - """sort key that puts specs with open version ranges first""" - spec, _ = item - return (spack.version.any_version not in spec.versions, spec) + return max_name_default_len def print_variants_grouped_by_when(pkg): - max_name_default_len, _ = _print_variants_header(pkg) + max_name_default_len = _print_variants_header(pkg) indent = 4 - variants = _variants_by_when_name(pkg) - for when, variants_by_name in sorted(variants.items(), key=_unconstrained_ver_first): + for when, variants_by_name in pkg.variant_items(): padded_values = max_name_default_len + 4 start_indent = indent @@ -407,15 +377,14 @@ def print_variants_grouped_by_when(pkg): def print_variants_by_name(pkg): - max_name_default_len, variants_by_name = _print_variants_header(pkg) + max_name_default_len = _print_variants_header(pkg) max_name_default_len += 4 indent = 4 - for name, when_variants in variants_by_name.items(): - for when, variants in sorted(when_variants.items(), key=_unconstrained_ver_first): - for variant in variants: - _fmt_variant(variant, max_name_default_len, indent, when, out=sys.stdout) - sys.stdout.write("\n") + for name in pkg.variant_names(): + for when, variant in pkg.variant_definitions(name): + _fmt_variant(variant, max_name_default_len, indent, when, out=sys.stdout) + sys.stdout.write("\n") def print_variants(pkg, args): diff --git a/lib/spack/spack/cray_manifest.py b/lib/spack/spack/cray_manifest.py index f71cf272b62b8d..41767bdf0649fa 100644 --- a/lib/spack/spack/cray_manifest.py +++ b/lib/spack/spack/cray_manifest.py @@ -132,7 +132,7 @@ def spec_from_entry(entry): variant_strs = list() for name, value in entry["parameters"].items(): # TODO: also ensure that the variant value is valid? - if not (name in pkg_cls.variants): + if not pkg_cls.has_variant(name): tty.debug( "Omitting variant {0} for entry {1}/{2}".format( name, entry["name"], entry["hash"][:7] diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index 7119339d5a319f..8f9e43bf8bfbba 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -78,7 +78,6 @@ class OpenMpi(Package): "redistribute", ] - _patch_order_index = 0 @@ -674,22 +673,25 @@ def _raise_default_not_set(pkg): def _execute_variant(pkg): when_spec = _make_when_spec(when) - when_specs = [when_spec] if not re.match(spack.spec.IDENTIFIER_RE, name): directive = "variant" msg = "Invalid variant name in {0}: '{1}'" raise DirectiveError(directive, msg.format(pkg.name, name)) - if name in pkg.variants: - # We accumulate when specs, but replace the rest of the variant - # with the newer values - _, orig_when = pkg.variants[name] - when_specs += orig_when - - pkg.variants[name] = ( - spack.variant.Variant(name, default, description, values, multi, validator, sticky), - when_specs, + # variants are stored by condition then by name (so only the last variant of a + # given name takes precedence *per condition*). + # NOTE: variant defaults and values can conflict if when conditions overlap. + variants_by_name = pkg.variants.setdefault(when_spec, {}) + variants_by_name[name] = spack.variant.Variant( + name=name, + default=default, + description=description, + values=values, + multi=multi, + validator=validator, + sticky=sticky, + precedence=pkg.num_variant_definitions(), ) return _execute_variant diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index c539cf1e0e1ba4..5be23ff124eaa0 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -451,10 +451,11 @@ def _by_name( else: all_by_name.setdefault(name, []).append(value) + # this needs to preserve the insertion order of whens return dict(sorted(all_by_name.items())) -def _names(when_indexed_dictionary): +def _names(when_indexed_dictionary: WhenDict) -> List[str]: """Get sorted names from dicts keyed by when/name.""" all_names = set() for when, by_name in when_indexed_dictionary.items(): @@ -464,6 +465,45 @@ def _names(when_indexed_dictionary): return sorted(all_names) +WhenVariantList = List[Tuple["spack.spec.Spec", "spack.variant.Variant"]] + + +def _remove_overridden_vdefs(variant_defs: WhenVariantList) -> None: + """Remove variant defs from the list if their when specs are satisfied by later ones. + + Any such variant definitions are *always* overridden by their successor, as it will + match everything the predecessor matches, and the solver will prefer it because of + its higher precedence. + + We can just remove these defs from variant definitions and avoid putting them in the + solver. This is also useful for, e.g., `spack info`, where we don't want to show a + variant from a superclass if it is always overridden by a variant defined in a + subclass. + + Example:: + + class ROCmPackage: + variant("amdgpu_target", ..., when="+rocm") + + class Hipblas: + variant("amdgpu_target", ...) + + The subclass definition *always* overrides the superclass definition here, but they + have different when specs and the subclass def won't just replace the one in the + superclass. In this situation, the subclass should *probably* also have + ``when="+rocm"``, but we can't guarantee that will always happen when a vdef is + overridden. So we use this method to remove any overrides we can know statically. + + """ + i = 0 + while i < len(variant_defs): + when, vdef = variant_defs[i] + if any(when.satisfies(successor) for successor, _ in variant_defs[i + 1 :]): + del variant_defs[i] + else: + i += 1 + + class RedistributionMixin: """Logic for determining whether a Package is source/binary redistributable. @@ -596,7 +636,7 @@ class PackageBase(WindowsRPath, PackageViewMixin, RedistributionMixin, metaclass provided: Dict["spack.spec.Spec", Set["spack.spec.Spec"]] provided_together: Dict["spack.spec.Spec", List[Set[str]]] patches: Dict["spack.spec.Spec", List["spack.patch.Patch"]] - variants: Dict[str, Tuple["spack.variant.Variant", "spack.spec.Spec"]] + variants: Dict["spack.spec.Spec", Dict[str, "spack.variant.Variant"]] languages: Dict["spack.spec.Spec", Set[str]] #: By default, packages are not virtual @@ -750,6 +790,72 @@ def dependency_names(cls): def dependencies_by_name(cls, when: bool = False): return _by_name(cls.dependencies, when=when) + # Accessors for variants + # External code workingw with Variants should go through the methods below + + @classmethod + def variant_names(cls) -> List[str]: + return _names(cls.variants) + + @classmethod + def has_variant(cls, name) -> bool: + return any(name in dictionary for dictionary in cls.variants.values()) + + @classmethod + def num_variant_definitions(cls) -> int: + """Total number of variant definitions in this class so far.""" + return sum(len(variants_by_name) for variants_by_name in cls.variants.values()) + + @classmethod + def variant_definitions(cls, name: str) -> WhenVariantList: + """Iterator over (when_spec, Variant) for all variant definitions for a particular name.""" + # construct a list of defs sorted by precedence + defs: WhenVariantList = [] + for when, variants_by_name in cls.variants.items(): + variant_def = variants_by_name.get(name) + if variant_def: + defs.append((when, variant_def)) + + # With multiple definitions, ensure precedence order and simplify overrides + if len(defs) > 1: + defs.sort(key=lambda v: v[1].precedence) + _remove_overridden_vdefs(defs) + + return defs + + @classmethod + def variant_items( + cls, + ) -> Iterable[Tuple["spack.spec.Spec", Dict[str, "spack.variant.Variant"]]]: + """Iterate over ``cls.variants.items()`` with overridden definitions removed.""" + # Note: This is quadratic in the average number of variant definitions per name. + # That is likely close to linear in practice, as there are few variants with + # multiple definitions (but it matters when they are there). + exclude = { + name: [id(vdef) for _, vdef in cls.variant_definitions(name)] + for name in cls.variant_names() + } + + for when, variants_by_name in cls.variants.items(): + filtered_variants_by_name = { + name: vdef for name, vdef in variants_by_name.items() if id(vdef) in exclude[name] + } + + if filtered_variants_by_name: + yield when, filtered_variants_by_name + + def get_variant(self, name: str) -> "spack.variant.Variant": + """Get the highest precedence variant definition matching this package's spec. + + Arguments: + name: name of the variant definition to get + """ + try: + highest_to_lowest = reversed(self.variant_definitions(name)) + return next(vdef for when, vdef in highest_to_lowest if self.spec.satisfies(when)) + except StopIteration: + raise ValueError(f"No variant '{name}' on spec: {self.spec}") + @classmethod def possible_dependencies( cls, diff --git a/lib/spack/spack/package_prefs.py b/lib/spack/spack/package_prefs.py index f655fbb8852732..0204e156f11fb1 100644 --- a/lib/spack/spack/package_prefs.py +++ b/lib/spack/spack/package_prefs.py @@ -149,10 +149,12 @@ def preferred_variants(cls, pkg_name): # Only return variants that are actually supported by the package pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) - spec = spack.spec.Spec("%s %s" % (pkg_name, variants)) - return dict( - (name, variant) for name, variant in spec.variants.items() if name in pkg_cls.variants - ) + spec = spack.spec.Spec(f"{pkg_name} {variants}") + return { + name: variant + for name, variant in spec.variants.items() + if name in pkg_cls.variant_names() + } def is_spec_buildable(spec): diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 62557d311a3307..d8d052f3113e5d 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -44,7 +44,7 @@ import spack.util.libc import spack.util.path import spack.util.timer -import spack.variant +import spack.variant as vt import spack.version as vn import spack.version.git_ref_lookup from spack import traverse @@ -127,8 +127,14 @@ def __str__(self): @contextmanager -def spec_with_name(spec, name): +def named_spec( + spec: Optional["spack.spec.Spec"], name: Optional[str] +) -> Iterator[Optional["spack.spec.Spec"]]: """Context manager to temporarily set the name of a spec""" + if spec is None or name is None: + yield spec + return + old_name = spec.name spec.name = name try: @@ -1128,6 +1134,7 @@ def __init__(self, tests: bool = False): self.default_targets: List = [] self.compiler_version_constraints: Set = set() self.post_facts: List = [] + self.variant_ids_by_def_id: Dict[int, int] = {} self.reusable_and_possible: ConcreteSpecsByHash = ConcreteSpecsByHash() @@ -1218,7 +1225,7 @@ def target_ranges(self, spec, single_target_fn): def conflict_rules(self, pkg): for when_spec, conflict_specs in pkg.conflicts.items(): when_spec_msg = "conflict constraint %s" % str(when_spec) - when_spec_id = self.condition(when_spec, name=pkg.name, msg=when_spec_msg) + when_spec_id = self.condition(when_spec, required_name=pkg.name, msg=when_spec_msg) for conflict_spec, conflict_msg in conflict_specs: conflict_spec = spack.spec.Spec(conflict_spec) @@ -1234,7 +1241,9 @@ def conflict_rules(self, pkg): spec_for_msg = spack.spec.Spec(pkg.name) conflict_spec_msg = f"conflict is triggered when {str(spec_for_msg)}" conflict_spec_id = self.condition( - conflict_spec, name=conflict_spec.name or pkg.name, msg=conflict_spec_msg + conflict_spec, + required_name=conflict_spec.name or pkg.name, + msg=conflict_spec_msg, ) self.gen.fact( fn.pkg_fact( @@ -1248,7 +1257,7 @@ def package_languages(self, pkg): condition_msg = f"{pkg.name} needs the {', '.join(sorted(languages))} language" if when_spec != spack.spec.Spec(): condition_msg += f" when {when_spec}" - condition_id = self.condition(when_spec, name=pkg.name, msg=condition_msg) + condition_id = self.condition(when_spec, required_name=pkg.name, msg=condition_msg) for language in sorted(languages): self.gen.fact(fn.pkg_fact(pkg.name, fn.language(condition_id, language))) self.gen.newline() @@ -1363,96 +1372,116 @@ def effect_rules(self): self.gen.newline() self._effect_cache.clear() - def variant_rules(self, pkg): - for name, entry in sorted(pkg.variants.items()): - variant, when = entry + def define_variant( + self, + pkg: "Type[spack.package_base.PackageBase]", + name: str, + when: spack.spec.Spec, + variant_def: vt.Variant, + ): + pkg_fact = lambda f: self.gen.fact(fn.pkg_fact(pkg.name, f)) - if spack.spec.Spec() in when: - # unconditional variant - self.gen.fact(fn.pkg_fact(pkg.name, fn.variant(name))) - else: - # conditional variant - for w in when: - msg = "%s has variant %s" % (pkg.name, name) - if str(w): - msg += " when %s" % w - - cond_id = self.condition(w, name=pkg.name, msg=msg) - self.gen.fact(fn.pkg_fact(pkg.name, fn.conditional_variant(cond_id, name))) - - single_value = not variant.multi - if single_value: - self.gen.fact(fn.pkg_fact(pkg.name, fn.variant_single_value(name))) - self.gen.fact( - fn.pkg_fact( - pkg.name, fn.variant_default_value_from_package_py(name, variant.default) - ) + # Every variant id has a unique definition (conditional or unconditional), and + # higher variant id definitions take precedence when variants intersect. + vid = next(self._id_counter) + + # used to find a variant id from its variant definition (for variant values on specs) + self.variant_ids_by_def_id[id(variant_def)] = vid + + if when == spack.spec.Spec(): + # unconditional variant + pkg_fact(fn.variant_definition(name, vid)) + else: + # conditional variant + msg = f"Package {pkg.name} has variant '{name}' when {when}" + cond_id = self.condition(when, required_name=pkg.name, msg=msg) + pkg_fact(fn.variant_condition(name, vid, cond_id)) + + # record type so we can construct the variant when we read it back in + self.gen.fact(fn.variant_type(vid, variant_def.variant_type.value)) + + if variant_def.sticky: + pkg_fact(fn.variant_sticky(vid)) + + # define defaults for this variant definition + defaults = variant_def.make_default().value if variant_def.multi else [variant_def.default] + for val in sorted(defaults): + pkg_fact(fn.variant_default_value_from_package_py(vid, val)) + + # define possible values for this variant definition + values = variant_def.values + if values is None: + values = [] + + elif isinstance(values, vt.DisjointSetsOfValues): + union = set() + for sid, s in enumerate(values.sets): + for value in s: + pkg_fact(fn.variant_value_from_disjoint_sets(vid, value, sid)) + union.update(s) + values = union + + # ensure that every variant has at least one possible value. + if not values: + values = [variant_def.default] + + for value in sorted(values): + pkg_fact(fn.variant_possible_value(vid, value)) + + # when=True means unconditional, so no need for conditional values + if getattr(value, "when", True) is True: + continue + + # now we have to handle conditional values + quoted_value = spack.parser.quote_if_needed(str(value)) + vstring = f"{name}={quoted_value}" + variant_has_value = spack.spec.Spec(vstring) + + if value.when: + # the conditional value is always "possible", but it imposes its when condition as + # a constraint if the conditional value is taken. This may seem backwards, but it + # ensures that the conditional can only occur when its condition holds. + self.condition( + required_spec=variant_has_value, + imposed_spec=value.when, + required_name=pkg.name, + imposed_name=pkg.name, + msg=f"{pkg.name} variant {name} has value '{quoted_value}' when {value.when}", ) else: - spec_variant = variant.make_default() - defaults = spec_variant.value - for val in sorted(defaults): - self.gen.fact( - fn.pkg_fact(pkg.name, fn.variant_default_value_from_package_py(name, val)) - ) + # We know the value is never allowed statically (when was false), but we can't just + # ignore it b/c it could come in as a possible value and we need a good error msg. + # So, it's a conflict -- if the value is somehow used, it'll trigger an error. + trigger_id = self.condition( + variant_has_value, + required_name=pkg.name, + msg=f"invalid variant value: {vstring}", + ) + constraint_id = self.condition( + spack.spec.Spec(), + required_name=pkg.name, + msg="empty (total) conflict constraint", + ) + msg = f"variant value {vstring} is conditionally disabled" + pkg_fact(fn.conflict(trigger_id, constraint_id, msg)) - values = variant.values - if values is None: - values = [] - elif isinstance(values, spack.variant.DisjointSetsOfValues): - union = set() - # Encode the disjoint sets in the logic program - for sid, s in enumerate(values.sets): - for value in s: - self.gen.fact( - fn.pkg_fact( - pkg.name, fn.variant_value_from_disjoint_sets(name, value, sid) - ) - ) - union.update(s) - values = union - - # make sure that every variant has at least one possible value - if not values: - values = [variant.default] - - for value in sorted(values): - if getattr(value, "when", True) is not True: # when=True means unconditional - condition_spec = spack.spec.Spec("{0}={1}".format(name, value)) - if value.when is False: - # This value is a conflict - # Cannot just prevent listing it as a possible value because it could - # also come in as a possible value from the command line - trigger_id = self.condition( - condition_spec, - name=pkg.name, - msg="invalid variant value {0}={1}".format(name, value), - ) - constraint_id = self.condition( - spack.spec.Spec(), - name=pkg.name, - msg="empty (total) conflict constraint", - ) - msg = "variant {0}={1} is conditionally disabled".format(name, value) - self.gen.fact( - fn.pkg_fact(pkg.name, fn.conflict(trigger_id, constraint_id, msg)) - ) - else: - imposed = spack.spec.Spec(value.when) - imposed.name = pkg.name - - self.condition( - required_spec=condition_spec, - imposed_spec=imposed, - name=pkg.name, - msg="%s variant %s value %s when %s" % (pkg.name, name, value, when), - ) - self.gen.fact(fn.pkg_fact(pkg.name, fn.variant_possible_value(name, value))) + self.gen.newline() - if variant.sticky: - self.gen.fact(fn.pkg_fact(pkg.name, fn.variant_sticky(name))) + def define_auto_variant(self, name: str, multi: bool): + self.gen.h3(f"Special variant: {name}") + vid = next(self._id_counter) + self.gen.fact(fn.auto_variant(name, vid)) + self.gen.fact( + fn.variant_type( + vid, vt.VariantType.MULTI.value if multi else vt.VariantType.SINGLE.value + ) + ) - self.gen.newline() + def variant_rules(self, pkg: "Type[spack.package_base.PackageBase]"): + for name in pkg.variant_names(): + self.gen.h3(f"Variant {name} in package {pkg.name}") + for when, variant_def in pkg.variant_definitions(name): + self.define_variant(pkg, name, when, variant_def) def _get_condition_id( self, @@ -1490,7 +1519,9 @@ def condition( self, required_spec: spack.spec.Spec, imposed_spec: Optional[spack.spec.Spec] = None, - name: Optional[str] = None, + *, + required_name: Optional[str] = None, + imposed_name: Optional[str] = None, msg: Optional[str] = None, context: Optional[ConditionContext] = None, ): @@ -1499,22 +1530,30 @@ def condition( Arguments: required_spec: the constraints that triggers this condition imposed_spec: the constraints that are imposed when this condition is triggered - name: name for `required_spec` (required if required_spec is anonymous, ignored if not) + required_name: name for ``required_spec`` + (required if required_spec is anonymous, ignored if not) + imposed_name: name for ``imposed_spec`` + (required if imposed_spec is anonymous, ignored if not) msg: description of the condition context: if provided, indicates how to modify the clause-sets for the required/imposed specs based on the type of constraint they are generated for (e.g. `depends_on`) Returns: int: id of the condition created by this function """ - name = required_spec.name or name - if not name: + required_name = required_spec.name or required_name + if not required_name: raise ValueError(f"Must provide a name for anonymous condition: '{required_spec}'") if not context: context = ConditionContext() context.transform_imposed = remove_node - with spec_with_name(required_spec, name): + if imposed_spec: + imposed_name = imposed_spec.name or imposed_name + if not imposed_name: + raise ValueError(f"Must provide a name for imposed constraint: '{imposed_spec}'") + + with named_spec(required_spec, required_name), named_spec(imposed_spec, imposed_name): # Check if we can emit the requirements before updating the condition ID counter. # In this way, if a condition can't be emitted but the exception is handled in the # caller, we won't emit partial facts. @@ -1562,7 +1601,7 @@ def package_provider_rules(self, pkg): continue msg = f"{pkg.name} provides {vpkg} when {when}" - condition_id = self.condition(when, vpkg, pkg.name, msg) + condition_id = self.condition(when, vpkg, required_name=pkg.name, msg=msg) self.gen.fact( fn.pkg_fact(when.name, fn.provider_condition(condition_id, vpkg.name)) ) @@ -1570,7 +1609,7 @@ def package_provider_rules(self, pkg): for when, sets_of_virtuals in pkg.provided_together.items(): condition_id = self.condition( - when, name=pkg.name, msg="Virtuals are provided together" + when, required_name=pkg.name, msg="Virtuals are provided together" ) for set_id, virtuals_together in enumerate(sets_of_virtuals): for name in virtuals_together: @@ -1622,7 +1661,7 @@ def dependency_holds(input_spec, requirements): context.transform_required = track_dependencies context.transform_imposed = dependency_holds - self.condition(cond, dep.spec, name=pkg.name, msg=msg, context=context) + self.condition(cond, dep.spec, required_name=pkg.name, msg=msg, context=context) self.gen.newline() @@ -1671,7 +1710,9 @@ def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]): if rule.condition != spack.spec.Spec(): msg = f"condition to activate requirement {requirement_grp_id}" try: - main_condition_id = self.condition(rule.condition, name=pkg_name, msg=msg) + main_condition_id = self.condition( + rule.condition, required_name=pkg_name, msg=msg + ) except Exception as e: if rule.kind != RequirementKind.DEFAULT: raise RuntimeError( @@ -1712,7 +1753,7 @@ def emit_facts_from_requirement_rules(self, rules: List[RequirementRule]): member_id = self.condition( required_spec=when_spec, imposed_spec=spec, - name=pkg_name, + required_name=pkg_name, msg=f"{input_spec} is a requirement for package {pkg_name}", context=context, ) @@ -1765,8 +1806,8 @@ def external_packages(self): if pkg_name == "all": continue - # This package does not appear in any repository - if pkg_name not in spack.repo.PATH: + # package isn't a possible dependency and can't be in the solution + if pkg_name not in self.pkgs: continue # This package is not among possible dependencies @@ -1846,23 +1887,19 @@ def preferred_variants(self, pkg_name): for variant_name in sorted(preferred_variants): variant = preferred_variants[variant_name] - values = variant.value - - if not isinstance(values, tuple): - values = (values,) # perform validation of the variant and values - spec = spack.spec.Spec(pkg_name) try: - spec.update_variant_validate(variant_name, values) - except (spack.variant.InvalidVariantValueError, KeyError, ValueError) as e: + variant_defs = vt.prevalidate_variant_value(self.pkg_class(pkg_name), variant) + except (vt.InvalidVariantValueError, KeyError, ValueError) as e: tty.debug( f"[SETUP]: rejected {str(variant)} as a preference for {pkg_name}: {str(e)}" ) continue - for value in values: - self.variant_values_from_specs.add((pkg_name, variant.name, value)) + for value in variant.value_as_tuple: + for variant_def in variant_defs: + self.variant_values_from_specs.add((pkg_name, id(variant_def), value)) self.gen.fact( fn.variant_default_value_from_packages_yaml(pkg_name, variant.name, value) ) @@ -1968,38 +2005,28 @@ def _spec_clauses( # variants for vname, variant in sorted(spec.variants.items()): - values = variant.value - if not isinstance(values, (list, tuple)): - values = [values] + # TODO: variant="*" means 'variant is defined to something', which used to + # be meaningless in concretization, as all variants had to be defined. But + # now that variants can be conditional, it should force a variant to exist. + if variant.value == ("*",): + continue - for value in values: - # * is meaningless for concretization -- just for matching - if value == "*": - continue + for value in variant.value_as_tuple: + # ensure that the value *can* be valid for the spec + if spec.name and not spec.concrete and not spec.virtual: + variant_defs = vt.prevalidate_variant_value( + self.pkg_class(spec.name), variant, spec + ) - # validate variant value only if spec not concrete - if not spec.concrete: - if not spec.virtual and vname not in spack.variant.reserved_names: - pkg_cls = self.pkg_class(spec.name) - try: - variant_def, _ = pkg_cls.variants[vname] - except KeyError: - msg = 'variant "{0}" not found in package "{1}"' - raise RuntimeError(msg.format(vname, spec.name)) - else: - variant_def.validate_or_raise( - variant, spack.repo.PATH.get_pkg_class(spec.name) - ) + # Record that that this is a valid possible value. Accounts for + # int/str/etc., where valid values can't be listed in the package + for variant_def in variant_defs: + self.variant_values_from_specs.add((spec.name, id(variant_def), value)) clauses.append(f.variant_value(spec.name, vname, value)) if variant.propagate: clauses.append(f.propagate(spec.name, fn.variant_value(vname, value))) - # Tell the concretizer that this is a possible value for the - # variant, to account for things like int/str values where we - # can't enumerate the valid values - self.variant_values_from_specs.add((spec.name, vname, value)) - # compiler and compiler version if spec.compiler: clauses.append(f.node_compiler(spec.name, spec.compiler.name)) @@ -2467,15 +2494,15 @@ def _all_targets_satisfiying(single_constraint): def define_variant_values(self): """Validate variant values from the command line. - Also add valid variant values from the command line to the - possible values for a variant. + Add valid variant values from the command line to the possible values for + variant definitions. """ - # Tell the concretizer about possible values from specs we saw in - # spec_clauses(). We might want to order these facts by pkg and name - # if we are debugging. - for pkg, variant, value in self.variant_values_from_specs: - self.gen.fact(fn.pkg_fact(pkg, fn.variant_possible_value(variant, value))) + # Tell the concretizer about possible values from specs seen in spec_clauses(). + # We might want to order these facts by pkg and name if we are debugging. + for pkg_name, variant_def_id, value in self.variant_values_from_specs: + vid = self.variant_ids_by_def_id[variant_def_id] + self.gen.fact(fn.pkg_fact(pkg_name, fn.variant_possible_value(vid, value))) def register_concrete_spec(self, spec, possible): # tell the solver about any installed packages that could @@ -2644,6 +2671,10 @@ def setup( self.gen.h2("Package preferences: %s" % pkg) self.preferred_variants(pkg) + self.gen.h1("Special variants") + self.define_auto_variant("dev_path", multi=False) + self.define_auto_variant("patches", multi=True) + self.gen.h1("Develop specs") # Inject dev_path from environment for ds in dev_specs: @@ -2917,6 +2948,9 @@ def h1(self, header: str) -> None: def h2(self, header: str) -> None: self.title(header, "-") + def h3(self, header: str): + self.asp_problem.append(f"% {header}\n") + def newline(self): self.asp_problem.append("\n") @@ -3466,15 +3500,19 @@ def make_node(*, pkg: str) -> NodeArgument: """ return NodeArgument(id="0", pkg=pkg) - def __init__(self, specs, hash_lookup=None): - self._specs = {} + def __init__( + self, specs: List[spack.spec.Spec], *, hash_lookup: Optional[ConcreteSpecsByHash] = None + ): + self._specs: Dict[NodeArgument, spack.spec.Spec] = {} self._result = None self._command_line_specs = specs - self._flag_sources = collections.defaultdict(lambda: set()) + self._flag_sources: Dict[Tuple[NodeArgument, str], Set[str]] = collections.defaultdict( + lambda: set() + ) # Pass in as arguments reusable specs and plug them in # from this dictionary during reconstruction - self._hash_lookup = hash_lookup or {} + self._hash_lookup = hash_lookup or ConcreteSpecsByHash() def hash(self, node, h): if node not in self._specs: @@ -3505,21 +3543,17 @@ def node_os(self, node, os): def node_target(self, node, target): self._arch(node).target = target - def variant_value(self, node, name, value): - # FIXME: is there a way not to special case 'dev_path' everywhere? - if name == "dev_path": - self._specs[node].variants.setdefault( - name, spack.variant.SingleValuedVariant(name, value) - ) - return - - if name == "patches": - self._specs[node].variants.setdefault( - name, spack.variant.MultiValuedVariant(name, value) + def variant_selected(self, node, name, value, variant_type, variant_id): + spec = self._specs[node] + variant = spec.variants.get(name) + if not variant: + spec.variants[name] = vt.VariantType(variant_type).variant_class(name, value) + else: + assert variant_type == vt.VariantType.MULTI.value, ( + f"Can't have multiple values for single-valued variant: " + f"{node}, {name}, {value}, {variant_type}, {variant_id}" ) - return - - self._specs[node].update_variant_validate(name, value) + variant.append(value) def version(self, node, version): self._specs[node].versions = vn.VersionList([vn.Version(version)]) @@ -3680,7 +3714,7 @@ def deprecated(self, node: NodeArgument, version: str) -> None: tty.warn(f'using "{node.pkg}@{version}" which is a deprecated version') @staticmethod - def sort_fn(function_tuple): + def sort_fn(function_tuple) -> Tuple[int, int]: """Ensure attributes are evaluated in the correct order. hash attributes are handled first, since they imply entire concrete specs @@ -3799,7 +3833,7 @@ def _develop_specs_from_env(spec, env): assert spec.variants["dev_path"].value == path, error_msg else: - spec.variants.setdefault("dev_path", spack.variant.SingleValuedVariant("dev_path", path)) + spec.variants.setdefault("dev_path", vt.SingleValuedVariant("dev_path", path)) assert spec.satisfies(dev_info["spec"]) diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 44e9e213be9ae3..2195cd6b08b4d1 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -819,58 +819,132 @@ error(10, Message) :- %----------------------------------------------------------------------------- % Variant semantics %----------------------------------------------------------------------------- -% a variant is a variant of a package if it is a variant under some condition -% and that condition holds -node_has_variant(node(NodeID, Package), Variant) :- - pkg_fact(Package, conditional_variant(ID, Variant)), - condition_holds(ID, node(NodeID, Package)). +% Packages define potentially several definitions for each variant, and depending +% on their attibutes, duplicate nodes for the same package may use different +% definitions. So the variant logic has several jobs: +% A. Associate a variant definition with a node, by VariantID +% B. Associate defaults and attributes (sticky, etc.) for the selected variant ID with the node. +% C. Once these rules are established for a node, select variant value(s) based on them. + +% A: Selecting a variant definition + +% Variant definitions come from package facts in two ways: +% 1. unconditional variants are always defined on all nodes for a given package +variant_definition(node(NodeID, Package), Name, VariantID) :- + pkg_fact(Package, variant_definition(Name, VariantID)), + attr("node", node(NodeID, Package)). + +% 2. conditional variants are only defined if the conditions hold for the node +variant_definition(node(NodeID, Package), Name, VariantID) :- + pkg_fact(Package, variant_condition(Name, VariantID, ConditionID)), + condition_holds(ConditionID, node(NodeID, Package)). + +% If there are any definitions for a variant on a node, the variant is "defined". +variant_defined(PackageNode, Name) :- variant_definition(PackageNode, Name, _). + +% We must select one definition for each defined variant on a node. +1 { + node_has_variant(PackageNode, Name, VariantID) : variant_definition(PackageNode, Name, VariantID) +} 1 :- + variant_defined(PackageNode, Name). + +% Solver must pick the variant definition with the highest id. When conditions hold +% for two or more variant definitions, this prefers the last one defined. +:- node_has_variant(node(NodeID, Package), Name, SelectedVariantID), + variant_definition(node(NodeID, Package), Name, VariantID), + VariantID > SelectedVariantID. + +% B: Associating applicable package rules with nodes -node_has_variant(node(ID, Package), Variant) :- - pkg_fact(Package, variant(Variant)), - attr("node", node(ID, Package)). +% The default value for a variant in a package is what is prescribed: +% 1. On the command line +% 2. In packages.yaml (if there's no command line settings) +% 3. In the package.py file (if there are no settings in packages.yaml and the command line) + +% -- Associate the definition's default values with the node +% note that the package.py variant defaults are associated with a particular definition, but +% packages.yaml and CLI are associated with just the variant name. +% Also, settings specified on the CLI apply to all duplicates, but always have +% `min_dupe_id` as their node id. +variant_default_value(node(NodeID, Package), VariantName, Value) :- + node_has_variant(node(NodeID, Package), VariantName, VariantID), + pkg_fact(Package, variant_default_value_from_package_py(VariantID, Value)), + not variant_default_value_from_packages_yaml(Package, VariantName, _), + not attr("variant_default_value_from_cli", node(min_dupe_id, Package), VariantName, _). + +variant_default_value(node(NodeID, Package), VariantName, Value) :- + node_has_variant(node(NodeID, Package), VariantName, _), + variant_default_value_from_packages_yaml(Package, VariantName, Value), + not attr("variant_default_value_from_cli", node(min_dupe_id, Package), VariantName, _). + +variant_default_value(node(NodeID, Package), VariantName, Value) :- + node_has_variant(node(NodeID, Package), VariantName, _), + attr("variant_default_value_from_cli", node(min_dupe_id, Package), VariantName, Value). + +% -- Associate the definition's possible values with the node +variant_possible_value(node(NodeID, Package), VariantName, Value) :- + node_has_variant(node(NodeID, Package), VariantName, VariantID), + pkg_fact(Package, variant_possible_value(VariantID, Value)). + +variant_value_from_disjoint_sets(node(NodeID, Package), VariantName, Value1, Set1) :- + node_has_variant(node(NodeID, Package), VariantName, VariantID), + pkg_fact(Package, variant_value_from_disjoint_sets(VariantID, Value1, Set1)). + +% -- Associate definition's arity with the node +variant_single_value(node(NodeID, Package), VariantName) :- + node_has_variant(node(NodeID, Package), VariantName, VariantID), + not variant_type(VariantID, "multi"). + +% C: Determining variant values on each node + +% if a variant is sticky, but not set, its value is the default value +attr("variant_selected", node(ID, Package), Variant, Value, VariantType, VariantID) :- + node_has_variant(node(ID, Package), Variant, VariantID), + variant_default_value(node(ID, Package), Variant, Value), + pkg_fact(Package, variant_sticky(VariantID)), + variant_type(VariantID, VariantType), + not attr("variant_set", node(ID, Package), Variant), + build(node(ID, Package)). + +% we can choose variant values from all the possible values for the node +{ + attr("variant_selected", node(ID, Package), Variant, Value, VariantType, VariantID) + : variant_possible_value(node(ID, Package), Variant, Value) +} :- + attr("node", node(ID, Package)), + node_has_variant(node(ID, Package), Variant, VariantID), + variant_type(VariantID, VariantType), + build(node(ID, Package)). + +% variant_selected is only needed for reconstruction on the python side, so we can ignore it here +attr("variant_value", PackageNode, Variant, Value) :- + attr("variant_selected", PackageNode, Variant, Value, VariantType, VariantID). % a variant cannot be set if it is not a variant on the package error(100, "Cannot set variant '{0}' for package '{1}' because the variant condition cannot be satisfied for the given spec", Variant, Package) - :- attr("variant_set", node(X, Package), Variant), - not node_has_variant(node(X, Package), Variant), - build(node(X, Package)). + :- attr("variant_set", node(ID, Package), Variant), + not node_has_variant(node(ID, Package), Variant, _), + build(node(ID, Package)). % a variant cannot take on a value if it is not a variant of the package error(100, "Cannot set variant '{0}' for package '{1}' because the variant condition cannot be satisfied for the given spec", Variant, Package) - :- attr("variant_value", node(X, Package), Variant, _), - not node_has_variant(node(X, Package), Variant), - build(node(X, Package)). - -% if a variant is sticky and not set its value is the default value -attr("variant_value", node(ID, Package), Variant, Value) :- - node_has_variant(node(ID, Package), Variant), - not attr("variant_set", node(ID, Package), Variant), - pkg_fact(Package, variant_sticky(Variant)), - variant_default_value(Package, Variant, Value), - build(node(ID, Package)). + :- attr("variant_value", node(ID, Package), Variant, _), + not node_has_variant(node(ID, Package), Variant, _), + build(node(ID, Package)). % at most one variant value for single-valued variants. -{ - attr("variant_value", node(ID, Package), Variant, Value) - : pkg_fact(Package, variant_possible_value(Variant, Value)) -} - :- attr("node", node(ID, Package)), - node_has_variant(node(ID, Package), Variant), - build(node(ID, Package)). - - error(100, "'{0}' required multiple values for single-valued variant '{1}'", Package, Variant) :- attr("node", node(ID, Package)), - node_has_variant(node(ID, Package), Variant), - pkg_fact(Package, variant_single_value(Variant)), + node_has_variant(node(ID, Package), Variant, _), + variant_single_value(node(ID, Package), Variant), build(node(ID, Package)), 2 { attr("variant_value", node(ID, Package), Variant, Value) }. error(100, "No valid value for variant '{1}' of package '{0}'", Package, Variant) - :- attr("node", node(X, Package)), - node_has_variant(node(X, Package), Variant), - build(node(X, Package)), - not attr("variant_value", node(X, Package), Variant, _). + :- attr("node", node(ID, Package)), + node_has_variant(node(ID, Package), Variant, _), + build(node(ID, Package)), + not attr("variant_value", node(ID, Package), Variant, _). % if a variant is set to anything, it is considered 'set'. attr("variant_set", PackageNode, Variant) :- attr("variant_set", PackageNode, Variant, _). @@ -880,17 +954,16 @@ attr("variant_set", PackageNode, Variant) :- attr("variant_set", PackageNode, Va % have been built w/different variants from older/different package versions. error(10, "'Spec({1}={2})' is not a valid value for '{0}' variant '{1}'", Package, Variant, Value) :- attr("variant_value", node(ID, Package), Variant, Value), - not pkg_fact(Package, variant_possible_value(Variant, Value)), + not variant_possible_value(node(ID, Package), Variant, Value), build(node(ID, Package)). -% Some multi valued variants accept multiple values from disjoint sets. -% Ensure that we respect that constraint and we don't pick values from more -% than one set at once +% Some multi valued variants accept multiple values from disjoint sets. Ensure that we +% respect that constraint and we don't pick values from more than one set at once error(100, "{0} variant '{1}' cannot have values '{2}' and '{3}' as they come from disjoint value sets", Package, Variant, Value1, Value2) :- attr("variant_value", node(ID, Package), Variant, Value1), attr("variant_value", node(ID, Package), Variant, Value2), - pkg_fact(Package, variant_value_from_disjoint_sets(Variant, Value1, Set1)), - pkg_fact(Package, variant_value_from_disjoint_sets(Variant, Value2, Set2)), + variant_value_from_disjoint_sets(node(ID, Package), Variant, Value1, Set1), + variant_value_from_disjoint_sets(node(ID, Package), Variant, Value2, Set2), Set1 < Set2, % see[1] build(node(ID, Package)). @@ -902,7 +975,7 @@ error(100, "{0} variant '{1}' cannot have values '{2}' and '{3}' as they come fr % specified in an external, we score it as if it was a default value. variant_not_default(node(ID, Package), Variant, Value) :- attr("variant_value", node(ID, Package), Variant, Value), - not variant_default_value(Package, Variant, Value), + not variant_default_value(node(ID, Package), Variant, Value), % variants set explicitly on the CLI don't count as non-default not attr("variant_set", node(ID, Package), Variant, Value), % variant values forced by propagation don't count as non-default @@ -913,11 +986,10 @@ variant_not_default(node(ID, Package), Variant, Value) not external_with_variant_set(node(ID, Package), Variant, Value), attr("node", node(ID, Package)). - % A default variant value that is not used variant_default_not_used(node(ID, Package), Variant, Value) - :- variant_default_value(Package, Variant, Value), - node_has_variant(node(ID, Package), Variant), + :- variant_default_value(node(ID, Package), Variant, Value), + node_has_variant(node(ID, Package), Variant, _), not attr("variant_value", node(ID, Package), Variant, Value), not propagate(node(ID, Package), variant_value(Variant, _)), attr("node", node(ID, Package)). @@ -931,25 +1003,6 @@ external_with_variant_set(node(NodeID, Package), Variant, Value) external(node(NodeID, Package)), attr("node", node(NodeID, Package)). -% The default value for a variant in a package is what is prescribed: -% -% 1. On the command line -% 2. In packages.yaml (if there's no command line settings) -% 3. In the package.py file (if there are no settings in -% packages.yaml and the command line) -% -variant_default_value(Package, Variant, Value) - :- pkg_fact(Package, variant_default_value_from_package_py(Variant, Value)), - not variant_default_value_from_packages_yaml(Package, Variant, _), - not attr("variant_default_value_from_cli", node(min_dupe_id, Package), Variant, _). - -variant_default_value(Package, Variant, Value) - :- variant_default_value_from_packages_yaml(Package, Variant, Value), - not attr("variant_default_value_from_cli", node(min_dupe_id, Package), Variant, _). - -variant_default_value(Package, Variant, Value) :- - attr("variant_default_value_from_cli", node(min_dupe_id, Package), Variant, Value). - % Treat 'none' in a special way - it cannot be combined with other % values even if the variant is multi-valued error(100, "{0} variant '{1}' cannot have values '{2}' and 'none'", Package, Variant, Value) @@ -958,23 +1011,26 @@ error(100, "{0} variant '{1}' cannot have values '{2}' and 'none'", Package, Var Value != "none", build(node(X, Package)). -% patches and dev_path are special variants -- they don't have to be -% declared in the package, so we just allow them to spring into existence -% when assigned a value. -auto_variant("dev_path"). -auto_variant("patches"). +% -- Auto variants +% These don't have to be declared in the package. We allow them to spring into +% existence when assigned a value. +variant_possible_value(PackageNode, Variant, Value) + :- attr("variant_set", PackageNode, Variant, Value), auto_variant(Variant, _). -node_has_variant(PackageNode, Variant) - :- attr("variant_set", PackageNode, Variant, _), auto_variant(Variant). +node_has_variant(PackageNode, Variant, VariantID) + :- attr("variant_set", PackageNode, Variant, _), auto_variant(Variant, VariantID). -pkg_fact(Package, variant_single_value("dev_path")) - :- attr("variant_set", node(ID, Package), "dev_path", _). +variant_single_value(PackageNode, Variant) + :- node_has_variant(PackageNode, Variant, VariantID), + auto_variant(Variant, VariantID), + not variant_type(VariantID, "multi"). % suppress warnings about this atom being unset. It's only set if some % spec or some package sets it, and without this, clingo will give % warnings like 'info: atom does not occur in any rule head'. #defined variant_default_value/3. #defined variant_default_value_from_packages_yaml/3. +#defined variant_default_value_from_package_py/3. %----------------------------------------------------------------------------- % Propagation semantics @@ -1004,11 +1060,12 @@ propagate(ChildNode, PropagatedAttribute, edge_types(DepType1, DepType2)) :- %---- % If a variant is propagated, and can be accepted, set its value -attr("variant_value", node(ID, Package), Variant, Value) :- - propagate(node(ID, Package), variant_value(Variant, Value)), - node_has_variant(node(ID, Package), Variant), - pkg_fact(Package, variant_possible_value(Variant, Value)), - not attr("variant_set", node(ID, Package), Variant). +attr("variant_selected", PackageNode, Variant, Value, VariantType, VariantID) :- + propagate(PackageNode, variant_value(Variant, Value)), + node_has_variant(PackageNode, Variant, VariantID), + variant_type(VariantID, VariantType), + variant_possible_value(PackageNode, Variant, Value), + not attr("variant_set", PackageNode, Variant). % If a variant is propagated, we cannot have extraneous values variant_is_propagated(PackageNode, Variant) :- @@ -1017,7 +1074,7 @@ variant_is_propagated(PackageNode, Variant) :- not attr("variant_set", PackageNode, Variant). :- variant_is_propagated(PackageNode, Variant), - attr("variant_value", PackageNode, Variant, Value), + attr("variant_selected", PackageNode, Variant, Value, _, _), not propagate(PackageNode, variant_value(Variant, Value)). %---- diff --git a/lib/spack/spack/solver/display.lp b/lib/spack/spack/solver/display.lp index fb3b2c41dfce2c..675a9d17d278ee 100644 --- a/lib/spack/spack/solver/display.lp +++ b/lib/spack/spack/solver/display.lp @@ -14,6 +14,7 @@ #show attr/3. #show attr/4. #show attr/5. +#show attr/6. % names of optimization criteria #show opt_criterion/2. @@ -39,7 +40,7 @@ #show condition_requirement/4. #show condition_requirement/5. #show condition_requirement/6. -#show node_has_variant/2. +#show node_has_variant/3. #show build/1. #show external/1. #show external_version/3. @@ -49,5 +50,6 @@ #show condition_nodes/3. #show trigger_node/3. #show imposed_nodes/3. +#show variant_single_value/2. % debug diff --git a/lib/spack/spack/solver/error_messages.lp b/lib/spack/spack/solver/error_messages.lp index 79a9b4b7eb8aaa..7bc9ed2e93ce85 100644 --- a/lib/spack/spack/solver/error_messages.lp +++ b/lib/spack/spack/solver/error_messages.lp @@ -5,6 +5,10 @@ %============================================================================= % This logic program adds detailed error messages to Spack's concretizer +% +% Note that functions used in rule bodies here need to have a corresponding +% #show line in display.lp, otherwise they won't be passed through to the +% error solve. %============================================================================= #program error_messages. @@ -113,12 +117,11 @@ error(0, "Cannot find a valid provider for virtual {0}", Virtual, startcauses, C pkg_fact(TriggerPkg, condition_effect(Cause, EID)), condition_holds(Cause, node(CID, TriggerPkg)). - % At most one variant value for single-valued variants error(0, "'{0}' required multiple values for single-valued variant '{1}'\n Requested 'Spec({1}={2})' and 'Spec({1}={3})'", Package, Variant, Value1, Value2, startcauses, Cause1, X, Cause2, X) :- attr("node", node(X, Package)), - node_has_variant(node(X, Package), Variant), - pkg_fact(Package, variant_single_value(Variant)), + node_has_variant(node(X, Package), Variant, VariantID), + variant_single_value(node(X, Package), Variant), build(node(X, Package)), attr("variant_value", node(X, Package), Variant, Value1), imposed_constraint(EID1, "variant_set", Package, Variant, Value1), @@ -216,6 +219,11 @@ error(0, Msg, startcauses, TriggerID, ID1, ConstraintID, ID2) #defined error/4. #defined error/5. #defined error/6. +#defined error/7. +#defined error/8. +#defined error/9. +#defined error/10. +#defined error/11. #defined attr/2. #defined attr/3. #defined attr/4. @@ -225,6 +233,7 @@ error(0, Msg, startcauses, TriggerID, ID1, ConstraintID, ID2) #defined imposed_constraint/4. #defined imposed_constraint/5. #defined imposed_constraint/6. +#defined condition_cause/4. #defined condition_requirement/3. #defined condition_requirement/4. #defined condition_requirement/5. @@ -234,6 +243,7 @@ error(0, Msg, startcauses, TriggerID, ID1, ConstraintID, ID2) #defined external/1. #defined trigger_and_effect/3. #defined build/1. -#defined node_has_variant/2. +#defined node_has_variant/3. #defined provider/2. #defined external_version/3. +#defined variant_single_value/2. diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 492841f81a2e84..28e11d68b80a2d 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2367,14 +2367,16 @@ def override(init_spec, change_spec): package_cls = spack.repo.PATH.get_pkg_class(new_spec.name) if change_spec.versions and not change_spec.versions == vn.any_version: new_spec.versions = change_spec.versions - for variant, value in change_spec.variants.items(): - if variant in package_cls.variants: - if variant in new_spec.variants: + + for vname, value in change_spec.variants.items(): + if vname in package_cls.variant_names(): + if vname in new_spec.variants: new_spec.variants.substitute(value) else: - new_spec.variants[variant] = value + new_spec.variants[vname] = value else: - raise ValueError("{0} is not a variant of {1}".format(variant, new_spec.name)) + raise ValueError("{0} is not a variant of {1}".format(vname, new_spec.name)) + if change_spec.compiler: new_spec.compiler = change_spec.compiler if change_spec.compiler_flags: @@ -2962,48 +2964,14 @@ def ensure_valid_variants(spec): return pkg_cls = spec.package_class - pkg_variants = pkg_cls.variants + pkg_variants = pkg_cls.variant_names() # reserved names are variants that may be set on any package # but are not necessarily recorded by the package's class not_existing = set(spec.variants) - (set(pkg_variants) | set(vt.reserved_names)) if not_existing: - raise vt.UnknownVariantError(spec, not_existing) - - def update_variant_validate(self, variant_name, values): - """If it is not already there, adds the variant named - `variant_name` to the spec `spec` based on the definition - contained in the package metadata. Validates the variant and - values before returning. - - Used to add values to a variant without being sensitive to the - variant being single or multi-valued. If the variant already - exists on the spec it is assumed to be multi-valued and the - values are appended. - - Args: - variant_name: the name of the variant to add or append to - values: the value or values (as a tuple) to add/append - to the variant - """ - if not isinstance(values, tuple): - values = (values,) - - pkg_variant, _ = self.package_class.variants[variant_name] - - for value in values: - if self.variants.get(variant_name): - msg = ( - f"cannot append the new value '{value}' to the single-valued " - f"variant '{self.variants[variant_name]}'" - ) - assert pkg_variant.multi, msg - self.variants[variant_name].append(value) - else: - variant = pkg_variant.make_variant(value) - self.variants[variant_name] = variant - - pkg_cls = spack.repo.PATH.get_pkg_class(self.name) - pkg_variant.validate_or_raise(self.variants[variant_name], pkg_cls) + raise vt.UnknownVariantError( + f"No such variant {not_existing} for spec: '{spec}'", list(not_existing) + ) def constrain(self, other, deps=True): """Intersect self with other in-place. Return True if self changed, False otherwise. @@ -4447,7 +4415,9 @@ def concrete(self): Returns: bool: True or False """ - return self.spec._concrete or all(v in self for v in self.spec.package_class.variants) + return self.spec._concrete or all( + v in self for v in self.spec.package_class.variant_names() + ) def copy(self) -> "VariantMap": clone = VariantMap(self.spec) @@ -4485,7 +4455,7 @@ def __str__(self): def substitute_abstract_variants(spec: Spec): """Uses the information in `spec.package` to turn any variant that needs - it into a SingleValuedVariant. + it into a SingleValuedVariant or BoolValuedVariant. This method is best effort. All variants that can be substituted will be substituted before any error is raised. @@ -4493,26 +4463,45 @@ def substitute_abstract_variants(spec: Spec): Args: spec: spec on which to operate the substitution """ - # This method needs to be best effort so that it works in matrix exlusion + # This method needs to be best effort so that it works in matrix exclusion # in $spack/lib/spack/spack/spec_list.py - failed = [] + unknown = [] for name, v in spec.variants.items(): if name == "dev_path": spec.variants.substitute(vt.SingleValuedVariant(name, v._original_value)) continue elif name in vt.reserved_names: continue - elif name not in spec.package_class.variants: - failed.append(name) + + variant_defs = spec.package_class.variant_definitions(name) + valid_defs = [] + for when, vdef in variant_defs: + if when.intersects(spec): + valid_defs.append(vdef) + + if not valid_defs: + if name not in spec.package_class.variant_names(): + unknown.append(name) + else: + whens = [str(when) for when, _ in variant_defs] + raise InvalidVariantForSpecError(v.name, f"({', '.join(whens)})", spec) + continue + + pkg_variant, *rest = valid_defs + if rest: continue - pkg_variant, _ = spec.package_class.variants[name] + new_variant = pkg_variant.make_variant(v._original_value) - pkg_variant.validate_or_raise(new_variant, spec.package_class) + pkg_variant.validate_or_raise(new_variant, spec.name) spec.variants.substitute(new_variant) - # Raise all errors at once - if failed: - raise vt.UnknownVariantError(spec, failed) + if unknown: + variants = llnl.string.plural(len(unknown), "variant") + raise vt.UnknownVariantError( + f"Tried to set {variants} {llnl.string.comma_and(unknown)}. " + f"{spec.name} has no such {variants}", + unknown_variants=unknown, + ) def parse_with_version_concrete(spec_like: Union[str, Spec], compiler: bool = False): @@ -4942,6 +4931,15 @@ def long_message(self): ) +class InvalidVariantForSpecError(spack.error.SpecError): + """Raised when an invalid conditional variant is specified.""" + + def __init__(self, variant, when, spec): + msg = f"Invalid variant {variant} for spec {spec}.\n" + msg += f"{variant} is only available for {spec.name} when satisfying one of {when}." + super().__init__(msg) + + class UnsupportedPropagationError(spack.error.SpecError): """Raised when propagation (==) is used with reserved variant names.""" diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 7aaa2bc7f549c1..ef004272a777eb 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -53,7 +53,7 @@ def check_spec(abstract, concrete): cflag = concrete.compiler_flags[flag] assert set(aflag) <= set(cflag) - for name in spack.repo.PATH.get_pkg_class(abstract.name).variants: + for name in spack.repo.PATH.get_pkg_class(abstract.name).variant_names(): assert name in concrete.variants for flag in concrete.compiler_flags.valid_compiler_flags(): @@ -931,7 +931,9 @@ def test_conditional_variants(self, spec_str, expected, unexpected): ], ) def test_conditional_variants_fail(self, bad_spec): - with pytest.raises((spack.error.UnsatisfiableSpecError, vt.InvalidVariantForSpecError)): + with pytest.raises( + (spack.error.UnsatisfiableSpecError, spack.spec.InvalidVariantForSpecError) + ): _ = Spec("conditional-variant-pkg" + bad_spec).concretized() @pytest.mark.parametrize( @@ -1374,7 +1376,7 @@ def test_concretization_of_test_dependencies(self): ) def test_error_message_for_inconsistent_variants(self, spec_str): s = Spec(spec_str) - with pytest.raises(RuntimeError, match="not found in package"): + with pytest.raises(vt.UnknownVariantError): s.concretize() @pytest.mark.regression("22533") diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index a7f4383bc6fa68..d6e7e168aff219 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -234,6 +234,16 @@ class TestSpecSemantics: 'libelf cflags="-O3" cppflags="-Wall"', 'libelf cflags="-O3" cppflags="-Wall"', ), + ( + "libelf patches=ba5e334fe247335f3a116decfb5284100791dc302b5571ff5e664d8f9a6806c2", + "libelf patches=ba5e3", # constrain by a patch sha256 prefix + # TODO: the result below is not ideal. Prefix satisfies() works for patches, but + # constrain() isn't similarly special-cased to do the same thing + ( + "libelf patches=ba5e3," + "ba5e334fe247335f3a116decfb5284100791dc302b5571ff5e664d8f9a6806c2" + ), + ), ], ) def test_abstract_specs_can_constrain_each_other(self, lhs, rhs, expected): @@ -1076,7 +1086,7 @@ def test_target_constraints(self, spec, constraint, expected_result): @pytest.mark.regression("13124") def test_error_message_unknown_variant(self): s = Spec("mpileaks +unknown") - with pytest.raises(UnknownVariantError, match=r"package has no such"): + with pytest.raises(UnknownVariantError): s.concretize() @pytest.mark.regression("18527") @@ -1115,6 +1125,20 @@ def test_spec_override(self): assert new_spec.compiler_flags["cflags"] == ["-O2"] assert new_spec.compiler_flags["cxxflags"] == ["-O1"] + def test_spec_override_with_nonexisting_variant(self): + init_spec = Spec("pkg-a foo=baz foobar=baz cflags=-O3 cxxflags=-O1") + change_spec = Spec("pkg-a baz=fee") + with pytest.raises(ValueError): + Spec.override(init_spec, change_spec) + + def test_spec_override_with_variant_not_in_init_spec(self): + init_spec = Spec("pkg-a foo=baz foobar=baz cflags=-O3 cxxflags=-O1") + change_spec = Spec("pkg-a +bvv ~lorem_ipsum") + new_spec = Spec.override(init_spec, change_spec) + new_spec.concretize() + assert "+bvv" in new_spec + assert "~lorem_ipsum" in new_spec + @pytest.mark.parametrize( "spec_str,specs_in_dag", [ diff --git a/lib/spack/spack/test/variant.py b/lib/spack/spack/test/variant.py index d44aacee5eae32..c4c439b86f8991 100644 --- a/lib/spack/spack/test/variant.py +++ b/lib/spack/spack/test/variant.py @@ -7,9 +7,12 @@ import pytest import spack.error +import spack.repo +import spack.spec import spack.variant -from spack.spec import VariantMap +from spack.spec import Spec, VariantMap from spack.variant import ( + AbstractVariant, BoolValuedVariant, DuplicateVariantError, InconsistentValidationError, @@ -541,7 +544,7 @@ def test_validation(self): ) # Valid vspec, shouldn't raise vspec = a.make_variant("bar") - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") # Multiple values are not allowed with pytest.raises(MultipleValuesInExclusiveVariantError): @@ -550,16 +553,16 @@ def test_validation(self): # Inconsistent vspec vspec.name = "FOO" with pytest.raises(InconsistentValidationError): - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") # Valid multi-value vspec a.multi = True vspec = a.make_variant("bar,baz") - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") # Add an invalid value vspec.value = "bar,baz,barbaz" with pytest.raises(InvalidVariantValueError): - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") def test_callable_validator(self): def validator(x): @@ -570,12 +573,12 @@ def validator(x): a = Variant("foo", default=1024, description="", values=validator, multi=False) vspec = a.make_default() - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") vspec.value = 2056 - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") vspec.value = "foo" with pytest.raises(InvalidVariantValueError): - a.validate_or_raise(vspec) + a.validate_or_raise(vspec, "test-package") def test_representation(self): a = Variant( @@ -583,11 +586,22 @@ def test_representation(self): ) assert a.allowed_values == "bar, baz, foobar" + def test_str(self): + string = str( + Variant( + "foo", default="", description="", values=("bar", "baz", "foobar"), multi=False + ) + ) + assert "'foo'" in string + assert "default=''" in string + assert "description=''" in string + assert "values=('foo', 'bar', 'baz') in string" + class TestVariantMapTest: - def test_invalid_values(self): + def test_invalid_values(self) -> None: # Value with invalid type - a = VariantMap(None) + a = VariantMap(Spec()) with pytest.raises(TypeError): a["foo"] = 2 @@ -606,17 +620,17 @@ def test_invalid_values(self): with pytest.raises(KeyError): a["bar"] = MultiValuedVariant("foo", "bar") - def test_set_item(self): + def test_set_item(self) -> None: # Check that all the three types of variants are accepted - a = VariantMap(None) + a = VariantMap(Spec()) a["foo"] = BoolValuedVariant("foo", True) a["bar"] = SingleValuedVariant("bar", "baz") a["foobar"] = MultiValuedVariant("foobar", "a, b, c, d, e") - def test_substitute(self): + def test_substitute(self) -> None: # Check substitution of a key that exists - a = VariantMap(None) + a = VariantMap(Spec()) a["foo"] = BoolValuedVariant("foo", True) a.substitute(SingleValuedVariant("foo", "bar")) @@ -625,15 +639,15 @@ def test_substitute(self): with pytest.raises(KeyError): a.substitute(BoolValuedVariant("bar", True)) - def test_satisfies_and_constrain(self): + def test_satisfies_and_constrain(self) -> None: # foo=bar foobar=fee feebar=foo - a = VariantMap(None) + a = VariantMap(Spec()) a["foo"] = MultiValuedVariant("foo", "bar") a["foobar"] = SingleValuedVariant("foobar", "fee") a["feebar"] = SingleValuedVariant("feebar", "foo") # foo=bar,baz foobar=fee shared=True - b = VariantMap(None) + b = VariantMap(Spec()) b["foo"] = MultiValuedVariant("foo", "bar, baz") b["foobar"] = SingleValuedVariant("foobar", "fee") b["shared"] = BoolValuedVariant("shared", True) @@ -645,7 +659,7 @@ def test_satisfies_and_constrain(self): assert not b.satisfies(a) # foo=bar,baz foobar=fee feebar=foo shared=True - c = VariantMap(None) + c = VariantMap(Spec()) c["foo"] = MultiValuedVariant("foo", "bar, baz") c["foobar"] = SingleValuedVariant("foobar", "fee") c["feebar"] = SingleValuedVariant("feebar", "foo") @@ -654,8 +668,8 @@ def test_satisfies_and_constrain(self): assert a.constrain(b) assert a == c - def test_copy(self): - a = VariantMap(None) + def test_copy(self) -> None: + a = VariantMap(Spec()) a["foo"] = BoolValuedVariant("foo", True) a["bar"] = SingleValuedVariant("bar", "baz") a["foobar"] = MultiValuedVariant("foobar", "a, b, c, d, e") @@ -663,14 +677,31 @@ def test_copy(self): c = a.copy() assert a == c - def test_str(self): - c = VariantMap(None) + def test_str(self) -> None: + c = VariantMap(Spec()) c["foo"] = MultiValuedVariant("foo", "bar, baz") c["foobar"] = SingleValuedVariant("foobar", "fee") c["feebar"] = SingleValuedVariant("feebar", "foo") c["shared"] = BoolValuedVariant("shared", True) assert str(c) == "+shared feebar=foo foo=bar,baz foobar=fee" + def test_concrete(self, mock_packages, config) -> None: + spec = Spec("pkg-a") + vm = VariantMap(spec) + assert not vm.concrete + + # concrete if associated spec is concrete + spec.concretize() + assert vm.concrete + + # concrete if all variants are present (even if spec not concrete) + spec._mark_concrete(False) + assert spec.variants.concrete + + # remove a variant to test the condition + del spec.variants["foo"] + assert not spec.variants.concrete + def test_disjoint_set_initialization_errors(): # Constructing from non-disjoint sets should raise an exception @@ -765,9 +796,154 @@ def test_wild_card_valued_variants_equivalent_to_str(): several_arbitrary_values = ("doe", "re", "mi") # "*" case wild_output = wild_var.make_variant(several_arbitrary_values) - wild_var.validate_or_raise(wild_output) + wild_var.validate_or_raise(wild_output, "test-package") # str case str_output = str_var.make_variant(several_arbitrary_values) - str_var.validate_or_raise(str_output) + str_var.validate_or_raise(str_output, "test-package") # equivalence each instance already validated assert str_output.value == wild_output.value + + +def test_variant_definitions(mock_packages): + pkg = spack.repo.PATH.get_pkg_class("variant-values") + + # two variant names + assert len(pkg.variant_names()) == 2 + assert "build_system" in pkg.variant_names() + assert "v" in pkg.variant_names() + + # this name doesn't exist + assert len(pkg.variant_definitions("no-such-variant")) == 0 + + # there are 4 definitions but one is completely shadowed by another + assert len(pkg.variants) == 4 + + # variant_items ignores the shadowed definition + assert len(list(pkg.variant_items())) == 3 + + # variant_definitions also ignores the shadowed definition + defs = [vdef for _, vdef in pkg.variant_definitions("v")] + assert len(defs) == 2 + assert defs[0].default == "foo" + assert defs[0].values == ("foo",) + + assert defs[1].default == "bar" + assert defs[1].values == ("foo", "bar") + + +@pytest.mark.parametrize( + "pkg_name,value,spec,def_ids", + [ + ("variant-values", "foo", "", [0, 1]), + ("variant-values", "bar", "", [1]), + ("variant-values", "foo", "@1.0", [0]), + ("variant-values", "foo", "@2.0", [1]), + ("variant-values", "foo", "@3.0", [1]), + ("variant-values", "foo", "@4.0", []), + ("variant-values", "bar", "@2.0", [1]), + ("variant-values", "bar", "@3.0", [1]), + ("variant-values", "bar", "@4.0", []), + # now with a global override + ("variant-values-override", "bar", "", [0]), + ("variant-values-override", "bar", "@1.0", [0]), + ("variant-values-override", "bar", "@2.0", [0]), + ("variant-values-override", "bar", "@3.0", [0]), + ("variant-values-override", "bar", "@4.0", [0]), + ("variant-values-override", "baz", "", [0]), + ("variant-values-override", "baz", "@2.0", [0]), + ("variant-values-override", "baz", "@3.0", [0]), + ("variant-values-override", "baz", "@4.0", [0]), + ], +) +def test_prevalidate_variant_value(mock_packages, pkg_name, value, spec, def_ids): + pkg = spack.repo.PATH.get_pkg_class(pkg_name) + + all_defs = [vdef for _, vdef in pkg.variant_definitions("v")] + + valid_defs = spack.variant.prevalidate_variant_value( + pkg, SingleValuedVariant("v", value), spack.spec.Spec(spec) + ) + assert len(valid_defs) == len(def_ids) + + for vdef, i in zip(valid_defs, def_ids): + assert vdef is all_defs[i] + + +@pytest.mark.parametrize( + "pkg_name,value,spec", + [ + ("variant-values", "baz", ""), + ("variant-values", "bar", "@1.0"), + ("variant-values", "bar", "@4.0"), + ("variant-values", "baz", "@3.0"), + ("variant-values", "baz", "@4.0"), + # and with override + ("variant-values-override", "foo", ""), + ("variant-values-override", "foo", "@1.0"), + ("variant-values-override", "foo", "@2.0"), + ("variant-values-override", "foo", "@3.0"), + ("variant-values-override", "foo", "@4.0"), + ], +) +def test_strict_invalid_variant_values(mock_packages, pkg_name, value, spec): + pkg = spack.repo.PATH.get_pkg_class(pkg_name) + + with pytest.raises(spack.variant.InvalidVariantValueError): + spack.variant.prevalidate_variant_value( + pkg, SingleValuedVariant("v", value), spack.spec.Spec(spec), strict=True + ) + + +@pytest.mark.parametrize( + "pkg_name,spec,satisfies,def_id", + [ + ("variant-values", "@1.0", "v=foo", 0), + ("variant-values", "@2.0", "v=bar", 1), + ("variant-values", "@3.0", "v=bar", 1), + ("variant-values-override", "@1.0", "v=baz", 0), + ("variant-values-override", "@2.0", "v=baz", 0), + ("variant-values-override", "@3.0", "v=baz", 0), + ], +) +def test_concretize_variant_default_with_multiple_defs( + mock_packages, config, pkg_name, spec, satisfies, def_id +): + pkg = spack.repo.PATH.get_pkg_class(pkg_name) + pkg_defs = [vdef for _, vdef in pkg.variant_definitions("v")] + + spec = spack.spec.Spec(f"{pkg_name}{spec}").concretized() + assert spec.satisfies(satisfies) + assert spec.package.get_variant("v") is pkg_defs[def_id] + + +@pytest.mark.parametrize( + "spec,variant_name,after", + [ + # dev_path is a special case + ("foo dev_path=/path/to/source", "dev_path", SingleValuedVariant), + # reserved name: won't be touched + ("foo patches=2349dc44", "patches", AbstractVariant), + # simple case -- one definition applies + ("variant-values@1.0 v=foo", "v", SingleValuedVariant), + # simple, but with bool valued variant + ("pkg-a bvv=true", "bvv", BoolValuedVariant), + # variant doesn't exist at version + ("variant-values@4.0 v=bar", "v", spack.spec.InvalidVariantForSpecError), + # multiple definitions, so not yet knowable + ("variant-values@2.0 v=bar", "v", AbstractVariant), + ], +) +def test_substitute_abstract_variants(mock_packages, spec, variant_name, after): + spec = Spec(spec) + + # all variants start out as AbstractVariant + assert isinstance(spec.variants[variant_name], AbstractVariant) + + if issubclass(after, Exception): + # if we're checking for an error, use pytest.raises + with pytest.raises(after): + spack.spec.substitute_abstract_variants(spec) + else: + # ensure that the type of the variant on the spec has been narrowed (or not) + spack.spec.substitute_abstract_variants(spec) + assert isinstance(spec.variants[variant_name], after) diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py index 83f3ecca8312dd..e0ef7c0e30ae65 100644 --- a/lib/spack/spack/variant.py +++ b/lib/spack/spack/variant.py @@ -7,17 +7,20 @@ variants both in packages and in specs. """ import collections.abc +import enum import functools import inspect import itertools import re +from typing import Any, Callable, Collection, Iterable, List, Optional, Tuple, Type, Union import llnl.util.lang as lang import llnl.util.tty.color -from llnl.string import comma_or import spack.error as error import spack.parser +import spack.repo +import spack.spec #: These are variant names used by Spack internally; packages can't use them reserved_names = [ @@ -35,36 +38,68 @@ special_variant_values = [None, "none", "*"] +class VariantType(enum.Enum): + """Enum representing the three concrete variant types.""" + + MULTI = "multi" + BOOL = "bool" + SINGLE = "single" + + @property + def variant_class(self) -> Type: + if self is self.MULTI: + return MultiValuedVariant + elif self is self.BOOL: + return BoolValuedVariant + else: + return SingleValuedVariant + + class Variant: - """Represents a variant in a package, as declared in the - variant directive. + """Represents a variant definition, created by the ``variant()`` directive. + + There can be multiple definitions of the same variant, and they are given precedence + by order of appearance in the package. Later definitions have higher precedence. + Similarly, definitions in derived classes have higher precedence than those in their + superclasses. + """ + name: str + default: Any + description: str + values: Optional[Collection] #: if None, valid values are defined only by validators + multi: bool + single_value_validator: Callable + group_validator: Optional[Callable] + sticky: bool + precedence: int + def __init__( self, - name, - default, - description, - values=(True, False), - multi=False, - validator=None, - sticky=False, + name: str, + *, + default: Any, + description: str, + values: Union[Collection, Callable] = (True, False), + multi: bool = False, + validator: Optional[Callable] = None, + sticky: bool = False, + precedence: int = 0, ): """Initialize a package variant. Args: - name (str): name of the variant - default (str): default value for the variant in case - nothing has been specified - description (str): purpose of the variant - values (sequence): sequence of allowed values or a callable - accepting a single value as argument and returning True if the - value is good, False otherwise - multi (bool): whether multiple CSV are allowed - validator (callable): optional callable used to enforce - additional logic on the set of values being validated - sticky (bool): if true the variant is set to the default value at - concretization time + name: name of the variant + default: default value for the variant, used when nothing is explicitly specified + description: purpose of the variant + values: sequence of allowed values or a callable accepting a single value as argument + and returning True if the value is good, False otherwise + multi: whether multiple values are allowed + validator: optional callable that can be used to perform additional validation + sticky: if true the variant is set to the default value at concretization time + precedence: int indicating precedence of this variant definition in the solve + (definition with highest precedence is used when multiple definitions are possible) """ self.name = name self.default = default @@ -73,7 +108,7 @@ def __init__( self.values = None if values == "*": # wildcard is a special case to make it easy to say any value is ok - self.single_value_validator = lambda x: True + self.single_value_validator = lambda v: True elif isinstance(values, type): # supplying a type means any value *of that type* @@ -92,21 +127,22 @@ def isa_type(v): self.single_value_validator = values else: # Otherwise, assume values is the set of allowed explicit values - self.values = _flatten(values) - self.single_value_validator = lambda x: x in tuple(self.values) + values = _flatten(values) + self.values = values + self.single_value_validator = lambda v: v in values self.multi = multi self.group_validator = validator self.sticky = sticky + self.precedence = precedence - def validate_or_raise(self, vspec, pkg_cls=None): + def validate_or_raise(self, vspec: "AbstractVariant", pkg_name: str): """Validate a variant spec against this package variant. Raises an exception if any error is found. Args: - vspec (Variant): instance to be validated - pkg_cls (spack.package_base.PackageBase): the package class - that required the validation, if available + vspec: variant spec to be validated + pkg_name: the name of the package class that required this validation (for errors) Raises: InconsistentValidationError: if ``vspec.name != self.name`` @@ -121,25 +157,23 @@ def validate_or_raise(self, vspec, pkg_cls=None): if self.name != vspec.name: raise InconsistentValidationError(vspec, self) - # Check the values of the variant spec - value = vspec.value - if isinstance(vspec.value, (bool, str)): - value = (vspec.value,) - # If the value is exclusive there must be at most one + value = vspec.value_as_tuple if not self.multi and len(value) != 1: - raise MultipleValuesInExclusiveVariantError(vspec, pkg_cls) + raise MultipleValuesInExclusiveVariantError(vspec, pkg_name) # Check and record the values that are not allowed - not_allowed_values = [ - x for x in value if x != "*" and self.single_value_validator(x) is False - ] - if not_allowed_values: - raise InvalidVariantValueError(self, not_allowed_values, pkg_cls) + invalid_vals = ", ".join( + f"'{v}'" for v in value if v != "*" and self.single_value_validator(v) is False + ) + if invalid_vals: + raise InvalidVariantValueError( + f"invalid values for variant '{self.name}' in package {pkg_name}: {invalid_vals}\n" + ) # Validate the group of values if needed if self.group_validator is not None and value != ("*",): - self.group_validator(pkg_cls.name, self.name, value) + self.group_validator(pkg_name, self.name, value) @property def allowed_values(self): @@ -168,7 +202,7 @@ def make_default(self): """ return self.make_variant(self.default) - def make_variant(self, value): + def make_variant(self, value) -> "AbstractVariant": """Factory that creates a variant holding the value passed as a parameter. @@ -179,30 +213,31 @@ def make_variant(self, value): MultiValuedVariant or SingleValuedVariant or BoolValuedVariant: instance of the proper variant """ - return self.variant_cls(self.name, value) + return self.variant_type.variant_class(self.name, value) @property - def variant_cls(self): - """Proper variant class to be used for this configuration.""" + def variant_type(self) -> VariantType: + """String representation of the type of this variant (single/multi/bool)""" if self.multi: - return MultiValuedVariant + return VariantType.MULTI elif self.values == (True, False): - return BoolValuedVariant - return SingleValuedVariant + return VariantType.BOOL + else: + return VariantType.SINGLE - def __eq__(self, other): + def __str__(self): return ( - self.name == other.name - and self.default == other.default - and self.values == other.values - and self.multi == other.multi - and self.single_value_validator == other.single_value_validator - and self.group_validator == other.group_validator + f"Variant('{self.name}', " + f"default='{self.default}', " + f"description='{self.description}', " + f"values={self.values}, " + f"multi={self.multi}, " + f"single_value_validator={self.single_value_validator}, " + f"group_validator={self.group_validator}, " + f"sticky={self.sticky}, " + f"precedence={self.precedence})" ) - def __ne__(self, other): - return not self == other - def implicit_variant_conversion(method): """Converts other to type(self) and calls method(self, other) @@ -225,12 +260,12 @@ def convert(self, other): return convert -def _flatten(values): +def _flatten(values) -> Collection: """Flatten instances of _ConditionalVariantValues for internal representation""" if isinstance(values, DisjointSetsOfValues): return values - flattened = [] + flattened: List = [] for item in values: if isinstance(item, _ConditionalVariantValues): flattened.extend(item) @@ -241,6 +276,13 @@ def _flatten(values): return tuple(flattened) +#: Type for value of a variant +ValueType = Union[str, bool, Tuple[Union[str, bool], ...]] + +#: Type of variant value when output for JSON, YAML, etc. +SerializedValueType = Union[str, bool, List[Union[str, bool]]] + + @lang.lazy_lexicographic_ordering class AbstractVariant: """A variant that has not yet decided who it wants to be. It behaves like @@ -253,20 +295,20 @@ class AbstractVariant: values. """ - def __init__(self, name, value, propagate=False): + name: str + propagate: bool + _value: ValueType + _original_value: Any + + def __init__(self, name: str, value: Any, propagate: bool = False): self.name = name self.propagate = propagate - # Stores 'value' after a bit of massaging - # done by the property setter - self._value = None - self._original_value = None - # Invokes property setter self.value = value @staticmethod - def from_node_dict(name, value): + def from_node_dict(name: str, value: Union[str, List[str]]) -> "AbstractVariant": """Reconstruct a variant from a node dict.""" if isinstance(value, list): # read multi-value variants in and be faithful to the YAML @@ -280,16 +322,26 @@ def from_node_dict(name, value): return SingleValuedVariant(name, value) - def yaml_entry(self): + def yaml_entry(self) -> Tuple[str, SerializedValueType]: """Returns a key, value tuple suitable to be an entry in a yaml dict. Returns: tuple: (name, value_representation) """ - return self.name, list(self.value) + return self.name, list(self.value_as_tuple) + + @property + def value_as_tuple(self) -> Tuple[Union[bool, str], ...]: + """Getter for self.value that always returns a Tuple (even for single valued variants). + + This makes it easy to iterate over possible values. + """ + if isinstance(self._value, (bool, str)): + return (self._value,) + return self._value @property - def value(self): + def value(self) -> ValueType: """Returns a tuple of strings containing the values stored in the variant. @@ -299,10 +351,10 @@ def value(self): return self._value @value.setter - def value(self, value): + def value(self, value: ValueType) -> None: self._value_setter(value) - def _value_setter(self, value): + def _value_setter(self, value: ValueType) -> None: # Store the original value self._original_value = value @@ -310,7 +362,7 @@ def _value_setter(self, value): # Store a tuple of CSV string representations # Tuple is necessary here instead of list because the # values need to be hashed - value = re.split(r"\s*,\s*", str(value)) + value = tuple(re.split(r"\s*,\s*", str(value))) for val in special_variant_values: if val in value and len(value) > 1: @@ -323,16 +375,11 @@ def _value_setter(self, value): # to a set self._value = tuple(sorted(set(value))) - def _cmp_iter(self): + def _cmp_iter(self) -> Iterable: yield self.name + yield from (str(v) for v in self.value_as_tuple) - value = self._value - if not isinstance(value, tuple): - value = (value,) - value = tuple(str(x) for x in value) - yield value - - def copy(self): + def copy(self) -> "AbstractVariant": """Returns an instance of a variant equivalent to self Returns: @@ -346,7 +393,7 @@ def copy(self): return type(self)(self.name, self._original_value, self.propagate) @implicit_variant_conversion - def satisfies(self, other): + def satisfies(self, other: "AbstractVariant") -> bool: """Returns true if ``other.name == self.name``, because any value that other holds and is not in self yet **could** be added. @@ -360,13 +407,13 @@ def satisfies(self, other): # (`foo=bar` will never satisfy `baz=bar`) return other.name == self.name - def intersects(self, other): + def intersects(self, other: "AbstractVariant") -> bool: """Returns True if there are variant matching both self and other, False otherwise.""" if isinstance(other, (SingleValuedVariant, BoolValuedVariant)): return other.intersects(self) return other.name == self.name - def compatible(self, other): + def compatible(self, other: "AbstractVariant") -> bool: """Returns True if self and other are compatible, False otherwise. As there is no semantic check, two VariantSpec are compatible if @@ -383,7 +430,7 @@ def compatible(self, other): return self.intersects(other) @implicit_variant_conversion - def constrain(self, other): + def constrain(self, other: "AbstractVariant") -> bool: """Modify self to match all the constraints for other if both instances are multi-valued. Returns True if self changed, False otherwise. @@ -399,23 +446,23 @@ def constrain(self, other): old_value = self.value - values = list(sorted(set(self.value + other.value))) + values = list(sorted(set(self.value_as_tuple + other.value_as_tuple))) # If we constraint wildcard by another value, just take value if "*" in values and len(values) > 1: values.remove("*") - self.value = ",".join(values) + self._value_setter(",".join(str(v) for v in values)) return old_value != self.value - def __contains__(self, item): - return item in self._value + def __contains__(self, item: Union[str, bool]) -> bool: + return item in self.value_as_tuple - def __repr__(self): + def __repr__(self) -> str: return f"{type(self).__name__}({repr(self.name)}, {repr(self._original_value)})" - def __str__(self): + def __str__(self) -> str: delim = "==" if self.propagate else "=" - values = spack.parser.quote_if_needed(",".join(str(v) for v in self.value)) + values = spack.parser.quote_if_needed(",".join(str(v) for v in self.value_as_tuple)) return f"{self.name}{delim}{values}" @@ -423,7 +470,7 @@ class MultiValuedVariant(AbstractVariant): """A variant that can hold multiple values at once.""" @implicit_variant_conversion - def satisfies(self, other): + def satisfies(self, other: AbstractVariant) -> bool: """Returns true if ``other.name == self.name`` and ``other.value`` is a strict subset of self. Does not try to validate. @@ -443,22 +490,25 @@ def satisfies(self, other): # allow prefix find on patches if self.name == "patches": - return all(any(w.startswith(v) for w in self.value) for v in other.value) + return all( + any(str(w).startswith(str(v)) for w in self.value_as_tuple) + for v in other.value_as_tuple + ) # Otherwise we want all the values in `other` to be also in `self` - return all(v in self.value for v in other.value) + return all(v in self for v in other.value_as_tuple) - def append(self, value): + def append(self, value: Union[str, bool]) -> None: """Add another value to this multi-valued variant.""" - self._value = tuple(sorted((value,) + self._value)) - self._original_value = ",".join(self._value) + self._value = tuple(sorted((value,) + self.value_as_tuple)) + self._original_value = ",".join(str(v) for v in self._value) - def __str__(self): + def __str__(self) -> str: # Special-case patches to not print the full 64 character sha256 if self.name == "patches": - values_str = ",".join(x[:7] for x in self.value) + values_str = ",".join(str(x)[:7] for x in self.value_as_tuple) else: - values_str = ",".join(str(x) for x in self.value) + values_str = ",".join(str(x) for x in self.value_as_tuple) delim = "==" if self.propagate else "=" return f"{self.name}{delim}{spack.parser.quote_if_needed(values_str)}" @@ -467,35 +517,33 @@ def __str__(self): class SingleValuedVariant(AbstractVariant): """A variant that can hold multiple values, but one at a time.""" - def _value_setter(self, value): + def _value_setter(self, value: ValueType) -> None: # Treat the value as a multi-valued variant super()._value_setter(value) # Then check if there's only a single value - if len(self._value) != 1: - raise MultipleValuesInExclusiveVariantError(self, None) - self._value = str(self._value[0]) + values = self.value_as_tuple + if len(values) != 1: + raise MultipleValuesInExclusiveVariantError(self) - def __str__(self): - delim = "==" if self.propagate else "=" - return f"{self.name}{delim}{spack.parser.quote_if_needed(self.value)}" + self._value = values[0] @implicit_variant_conversion - def satisfies(self, other): + def satisfies(self, other: "AbstractVariant") -> bool: abstract_sat = super().satisfies(other) return abstract_sat and ( self.value == other.value or other.value == "*" or self.value == "*" ) - def intersects(self, other): + def intersects(self, other: "AbstractVariant") -> bool: return self.satisfies(other) - def compatible(self, other): + def compatible(self, other: "AbstractVariant") -> bool: return self.satisfies(other) @implicit_variant_conversion - def constrain(self, other): + def constrain(self, other: "AbstractVariant") -> bool: if self.name != other.name: raise ValueError("variants must have the same name") @@ -510,12 +558,17 @@ def constrain(self, other): raise UnsatisfiableVariantSpecError(other.value, self.value) return False - def __contains__(self, item): + def __contains__(self, item: ValueType) -> bool: return item == self.value - def yaml_entry(self): + def yaml_entry(self) -> Tuple[str, SerializedValueType]: + assert isinstance(self.value, (bool, str)) return self.name, self.value + def __str__(self) -> str: + delim = "==" if self.propagate else "=" + return f"{self.name}{delim}{spack.parser.quote_if_needed(str(self.value))}" + class BoolValuedVariant(SingleValuedVariant): """A variant that can hold either True or False. @@ -523,7 +576,7 @@ class BoolValuedVariant(SingleValuedVariant): BoolValuedVariant can also hold the value '*', for coerced comparisons between ``foo=*`` and ``+foo`` or ``~foo``.""" - def _value_setter(self, value): + def _value_setter(self, value: ValueType) -> None: # Check the string representation of the value and turn # it to a boolean if str(value).upper() == "TRUE": @@ -540,13 +593,14 @@ def _value_setter(self, value): msg += "a value that does not represent a bool" raise ValueError(msg.format(self.name)) - def __contains__(self, item): + def __contains__(self, item: ValueType) -> bool: return item is self.value - def __str__(self): + def __str__(self) -> str: + sigil = "+" if self.value else "~" if self.propagate: - return "{0}{1}".format("++" if self.value else "~~", self.name) - return "{0}{1}".format("+" if self.value else "~", self.name) + sigil *= 2 + return f"{sigil}{self.name}" # The class below inherit from Sequence to disguise as a tuple and comply @@ -720,12 +774,15 @@ def disjoint_sets(*sets): class Value: """Conditional value that might be used in variants.""" - def __init__(self, value, when): + value: Any + when: Optional["spack.spec.Spec"] # optional b/c we need to know about disabled values + + def __init__(self, value: Any, when: Optional["spack.spec.Spec"]): self.value = value self.when = when def __repr__(self): - return "Value({0.value}, when={0.when})".format(self) + return f"Value({self.value}, when={self.when})" def __str__(self): return str(self.value) @@ -745,15 +802,92 @@ def __lt__(self, other): return self.value < other.value +def prevalidate_variant_value( + pkg_cls: "Type[spack.package_base.PackageBase]", + variant: AbstractVariant, + spec: Optional["spack.spec.Spec"] = None, + strict: bool = False, +) -> List[Variant]: + """Do as much validation of a variant value as is possible before concretization. + + This checks that the variant value is valid for *some* definition of the variant, and + it raises if we know *before* concretization that the value cannot occur. On success + it returns the variant definitions for which the variant is valid. + + Arguments: + pkg_cls: package in which variant is (potentially multiply) defined + variant: variant spec with value to validate + spec: optionally restrict validation only to variants defined for this spec + strict: if True, raise an exception if no variant definition is valid for any + constraint on the spec. + + Return: + list of variant definitions that will accept the given value. List will be empty + only if the variant is a reserved variant. + """ + # don't validate wildcards or variants with reserved names + if variant.value == ("*",) or variant.name in reserved_names: + return [] + + # raise if there is no definition at all + if not pkg_cls.has_variant(variant.name): + raise UnknownVariantError( + f"No such variant '{variant.name}' in package {pkg_cls.name}", [variant.name] + ) + + # do as much prevalidation as we can -- check only those + # variants whose when constraint intersects this spec + errors = [] + possible_definitions = [] + valid_definitions = [] + + for when, pkg_variant_def in pkg_cls.variant_definitions(variant.name): + if spec and not spec.intersects(when): + continue + possible_definitions.append(pkg_variant_def) + + try: + pkg_variant_def.validate_or_raise(variant, pkg_cls.name) + valid_definitions.append(pkg_variant_def) + except spack.error.SpecError as e: + errors.append(e) + + # value is valid for at least one definition -- return them all + if valid_definitions: + return valid_definitions + + # no when spec intersected, so no possible definition for the variant in this configuration + if strict and not possible_definitions: + when_clause = f" when {spec}" if spec else "" + raise InvalidVariantValueError( + f"variant '{variant.name}' does not exist for '{pkg_cls.name}'{when_clause}" + ) + + # There are only no errors if we're not strict and there are no possible_definitions. + # We are strict for audits but not for specs on the CLI or elsewhere. Being strict + # in these cases would violate our rule of being able to *talk* about any configuration, + # regardless of what the package.py currently says. + if not errors: + return [] + + # if there is just one error, raise the specific error + if len(errors) == 1: + raise errors[0] + + # otherwise combine all the errors and raise them together + raise InvalidVariantValueError( + "multiple variant issues:", "\n".join(e.message for e in errors) + ) + + class _ConditionalVariantValues(lang.TypedMutableSequence): """A list, just with a different type""" -def conditional(*values, **kwargs): +def conditional(*values: List[Any], when: Optional["spack.directives.WhenType"] = None): """Conditional values that can be used in variant declarations.""" - if len(kwargs) != 1 and "when" not in kwargs: - raise ValueError('conditional statement expects a "when=" parameter only') - when = kwargs["when"] + # _make_when_spec returns None when the condition is statically false. + when = spack.directives._make_when_spec(when) return _ConditionalVariantValues([Value(x, when=when) for x in values]) @@ -764,15 +898,9 @@ class DuplicateVariantError(error.SpecError): class UnknownVariantError(error.SpecError): """Raised when an unknown variant occurs in a spec.""" - def __init__(self, spec, variants): - self.unknown_variants = variants - variant_str = "variant" if len(variants) == 1 else "variants" - msg = ( - 'trying to set {0} "{1}" in package "{2}", but the package' - " has no such {0} [happened when validating '{3}']" - ) - msg = msg.format(variant_str, comma_or(variants), spec.name, spec.root) + def __init__(self, msg: str, unknown_variants: List[str]): super().__init__(msg) + self.unknown_variants = unknown_variants class InconsistentValidationError(error.SpecError): @@ -788,11 +916,10 @@ class MultipleValuesInExclusiveVariantError(error.SpecError, ValueError): only one. """ - def __init__(self, variant, pkg): - msg = 'multiple values are not allowed for variant "{0.name}"{1}' - pkg_info = "" - if pkg is not None: - pkg_info = ' in package "{0}"'.format(pkg.name) + def __init__(self, variant: AbstractVariant, pkg_name: Optional[str] = None): + pkg_info = "" if pkg_name is None else f" in package '{pkg_name}'" + msg = f"multiple values are not allowed for variant '{variant.name}'{pkg_info}" + super().__init__(msg.format(variant, pkg_info)) @@ -801,23 +928,7 @@ class InvalidVariantValueCombinationError(error.SpecError): class InvalidVariantValueError(error.SpecError): - """Raised when a valid variant has at least an invalid value.""" - - def __init__(self, variant, invalid_values, pkg): - msg = 'invalid values for variant "{0.name}"{2}: {1}\n' - pkg_info = "" - if pkg is not None: - pkg_info = ' in package "{0}"'.format(pkg.name) - super().__init__(msg.format(variant, invalid_values, pkg_info)) - - -class InvalidVariantForSpecError(error.SpecError): - """Raised when an invalid conditional variant is specified.""" - - def __init__(self, variant, when, spec): - msg = "Invalid variant {0} for spec {1}.\n" - msg += "{0} is only available for {1.name} when satisfying one of {2}." - super().__init__(msg.format(variant, spec, when)) + """Raised when variants have invalid values.""" class UnsatisfiableVariantSpecError(error.UnsatisfiableSpecError): diff --git a/var/spack/repos/builtin.mock/packages/variant-values-override/package.py b/var/spack/repos/builtin.mock/packages/variant-values-override/package.py new file mode 100644 index 00000000000000..253ae3829ebecf --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/variant-values-override/package.py @@ -0,0 +1,12 @@ +# Copyright 2013-2024 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 * +from spack.pkg.builtin.mock.variant_values import VariantValues + + +class VariantValuesOverride(VariantValues): + """Test variant value validation with multiple definitions.""" + + variant("v", default="baz", values=["bar", "baz"]) diff --git a/var/spack/repos/builtin.mock/packages/variant-values/package.py b/var/spack/repos/builtin.mock/packages/variant-values/package.py new file mode 100644 index 00000000000000..533cb186f5edb0 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/variant-values/package.py @@ -0,0 +1,23 @@ +# Copyright 2013-2024 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 VariantValues(Package): + """Test variant value validation with multiple definitions.""" + + homepage = "https://www.example.org" + url = "https://example.org/files/v3.4/cmake-3.4.3.tar.gz" + + version("1.0", md5="4cb3ff35b2472aae70f542116d616e63") + version("2.0", md5="b2472aae70f542116d616e634cb3ff35") + version("3.0", md5="d616e634cb3ff35b2472aae70f542116") + + variant("v", default="foo", values=["foo"], when="@1.0") + + variant("v", default="foo", values=["foo", "bar"], when="@2.0") + + # this overrides the prior definition entirely + variant("v", default="bar", values=["foo", "bar"], when="@2.0:3.0") From 6df831ef00bec38d7f5f0cf5d1fb0c53e4573aa0 Mon Sep 17 00:00:00 2001 From: "Auriane R." <48684432+aurianer@users.noreply.github.com> Date: Tue, 17 Sep 2024 19:39:22 +0200 Subject: [PATCH 176/687] Replace `if ... in spec` with `spec.satisfies` in h* and i* packages (#46387) * Replace if ... in spec with spec.satisfies in h* packages * Replace if ... in spec with spec.satisfies in i* packages --- .../repos/builtin/packages/h5hut/package.py | 8 ++-- .../repos/builtin/packages/h5utils/package.py | 6 +-- .../repos/builtin/packages/h5z-zfp/package.py | 4 +- .../repos/builtin/packages/halide/package.py | 2 +- .../builtin/packages/hdf-eos2/package.py | 8 ++-- .../builtin/packages/hdf-eos5/package.py | 4 +- .../repos/builtin/packages/hdf/package.py | 12 +++--- .../repos/builtin/packages/hdf5/package.py | 12 +++--- .../repos/builtin/packages/heasoft/package.py | 4 +- .../repos/builtin/packages/heffte/package.py | 6 +-- .../repos/builtin/packages/helics/package.py | 16 ++++--- .../builtin/packages/hh-suite/package.py | 2 +- .../builtin/packages/highfive/package.py | 4 +- .../repos/builtin/packages/hiop/package.py | 12 +++--- .../repos/builtin/packages/hip/package.py | 10 ++--- .../repos/builtin/packages/hipsycl/package.py | 10 ++--- .../repos/builtin/packages/hiredis/package.py | 16 ++++--- .../repos/builtin/packages/hmmer/package.py | 4 +- .../repos/builtin/packages/homer/package.py | 2 +- .../builtin/packages/hoomd-blue/package.py | 6 +-- .../repos/builtin/packages/hpcc/package.py | 2 +- .../repos/builtin/packages/hpccg/package.py | 4 +- .../repos/builtin/packages/hpcg/package.py | 2 +- .../builtin/packages/hpctoolkit/package.py | 42 +++++++++---------- .../repos/builtin/packages/hpgmg/package.py | 10 ++--- .../repos/builtin/packages/hpl/package.py | 10 ++--- .../builtin/packages/hpx-kokkos/package.py | 2 +- .../repos/builtin/packages/hpx/package.py | 10 ++--- .../repos/builtin/packages/hpx5/package.py | 22 +++++----- .../repos/builtin/packages/hwloc/package.py | 6 +-- .../builtin/packages/hydrogen/package.py | 42 +++++++++++-------- .../repos/builtin/packages/hypar/package.py | 8 ++-- .../builtin/packages/hypre-cmake/package.py | 6 +-- .../repos/builtin/packages/hypre/package.py | 6 +-- .../packages/ibm-databroker/package.py | 2 +- .../repos/builtin/packages/icedtea/package.py | 4 +- .../repos/builtin/packages/icon/package.py | 20 ++++----- .../repos/builtin/packages/igraph/package.py | 2 +- .../repos/builtin/packages/igv/package.py | 2 +- .../builtin/packages/infernal/package.py | 2 +- .../builtin/packages/intel-llvm/package.py | 2 +- .../packages/intel-mpi-benchmarks/package.py | 30 ++++++------- .../packages/intel-oneapi-mpi/package.py | 10 ++--- .../builtin/packages/intel-tbb/package.py | 2 +- .../builtin/packages/intel-xed/package.py | 10 ++--- .../repos/builtin/packages/ior/package.py | 6 +-- .../repos/builtin/packages/ipm/package.py | 14 +++---- .../repos/builtin/packages/ipopt/package.py | 8 ++-- .../repos/builtin/packages/iq-tree/package.py | 6 +-- .../repos/builtin/packages/itensor/package.py | 6 +-- 50 files changed, 231 insertions(+), 215 deletions(-) diff --git a/var/spack/repos/builtin/packages/h5hut/package.py b/var/spack/repos/builtin/packages/h5hut/package.py index cfef678975db2f..d400a3cef4f941 100644 --- a/var/spack/repos/builtin/packages/h5hut/package.py +++ b/var/spack/repos/builtin/packages/h5hut/package.py @@ -43,7 +43,7 @@ class H5hut(AutotoolsPackage): def validate(self): """Checks if Fortran compiler is available.""" - if "+fortran" in self.spec and not self.compiler.fc: + if self.spec.satisfies("+fortran") and not self.compiler.fc: raise RuntimeError("Cannot build Fortran variant without a Fortran compiler.") def flag_handler(self, name, flags): @@ -59,10 +59,10 @@ def configure_args(self): spec = self.spec config_args = ["--enable-shared"] - if "+fortran" in spec: + if spec.satisfies("+fortran"): config_args.append("--enable-fortran") - if "+mpi" in spec: + if spec.satisfies("+mpi"): config_args.extend( [ "--enable-parallel", @@ -71,7 +71,7 @@ def configure_args(self): ] ) - if "+fortran" in spec: + if spec.satisfies("+fortran"): config_args.append("FC={0}".format(spec["mpi"].mpifc)) return config_args diff --git a/var/spack/repos/builtin/packages/h5utils/package.py b/var/spack/repos/builtin/packages/h5utils/package.py index 7818d5bfb50817..10e4a2802dee88 100644 --- a/var/spack/repos/builtin/packages/h5utils/package.py +++ b/var/spack/repos/builtin/packages/h5utils/package.py @@ -47,17 +47,17 @@ def configure_args(self): spec = self.spec args = [] - if "+vis5d" in spec: + if spec.satisfies("+vis5d"): args.append(f"--with-v5d={spec['vis5d'].prefix}") else: args.append("--without-v5d") - if "+octave" in spec: + if spec.satisfies("+octave"): args.append("--with-octave") else: args.append("--without-octave") - if "+hdf" in spec: + if spec.satisfies("+hdf"): args.append("--with-hdf4") else: args.append("--without-hdf4") diff --git a/var/spack/repos/builtin/packages/h5z-zfp/package.py b/var/spack/repos/builtin/packages/h5z-zfp/package.py index 237137b7c8e6bf..f1979dd6ae84f7 100644 --- a/var/spack/repos/builtin/packages/h5z-zfp/package.py +++ b/var/spack/repos/builtin/packages/h5z-zfp/package.py @@ -34,7 +34,7 @@ class H5zZfp(CMakePackage): def make_defs(self): cc = spack_cc fc = spack_fc - if "^hdf5+mpi" in self.spec: + if self.spec.satisfies("^hdf5+mpi"): cc = self.spec["mpi"].mpicc fc = self.spec["mpi"].mpifc make_defs = [ @@ -44,7 +44,7 @@ def make_defs(self): "ZFP_HOME=%s" % self.spec["zfp"].prefix, ] - if "+fortran" in self.spec and fc: + if self.spec.satisfies("+fortran") and fc: make_defs += ["FC=%s" % fc] else: make_defs += ["FC="] diff --git a/var/spack/repos/builtin/packages/halide/package.py b/var/spack/repos/builtin/packages/halide/package.py index 565ec5d16be7c7..df6832bf914140 100644 --- a/var/spack/repos/builtin/packages/halide/package.py +++ b/var/spack/repos/builtin/packages/halide/package.py @@ -118,7 +118,7 @@ def cmake_args(self): for target in llvm_targets: args += [self.define("TARGET_{0}".format(target[0]), target[1])] - if "+python" in spec: + if spec.satisfies("+python"): args += [ self.define("PYBIND11_USE_FETCHCONTENT", False), self.define("Halide_INSTALL_PYTHONDIR", python_platlib), diff --git a/var/spack/repos/builtin/packages/hdf-eos2/package.py b/var/spack/repos/builtin/packages/hdf-eos2/package.py index 1b41abbf6509dc..aae0b559cf34f1 100644 --- a/var/spack/repos/builtin/packages/hdf-eos2/package.py +++ b/var/spack/repos/builtin/packages/hdf-eos2/package.py @@ -71,7 +71,7 @@ class HdfEos2(AutotoolsPackage): # Build dependencies depends_on("hdf") # Because hdf always depends on zlib and jpeg in spack, the tests below in configure_args - # (if "jpeg" in self.spec:) always returns true and hdf-eos2 wants zlib and jpeg, too. + # (if self.spec.satisfies("^jpeg"):) always returns true and hdf-eos2 wants zlib and jpeg, too. depends_on("zlib-api") depends_on("jpeg") depends_on("szip", when="^hdf +szip") @@ -151,15 +151,15 @@ def configure_args(self): # Provide config args for dependencies extra_args.append("--with-hdf4={0}".format(self.spec["hdf"].prefix)) - if "jpeg" in self.spec: + if self.spec.satisfies("^jpeg"): # Allow handling whatever provider of jpeg are using tmp = self.spec["jpeg"].libs.directories if tmp: tmp = tmp[0] extra_args.append("--with-jpeg={0}".format(tmp)) - if "szip" in self.spec: + if self.spec.satisfies("^szip"): extra_args.append("--with-szlib={0}".format(self.spec["szip"].prefix)) - if "zlib" in self.spec: + if self.spec.satisfies("^zlib"): extra_args.append("--with-zlib={0}".format(self.spec["zlib-api"].prefix)) return extra_args diff --git a/var/spack/repos/builtin/packages/hdf-eos5/package.py b/var/spack/repos/builtin/packages/hdf-eos5/package.py index d459ccb0f235e8..2af16da1ca108a 100644 --- a/var/spack/repos/builtin/packages/hdf-eos5/package.py +++ b/var/spack/repos/builtin/packages/hdf-eos5/package.py @@ -107,9 +107,9 @@ def configure_args(self): # Provide config args for dependencies extra_args.append("--with-hdf5={0}".format(self.spec["hdf5"].prefix)) - if "szip" in self.spec: + if self.spec.satisfies("^szip"): extra_args.append("--with-szlib={0}".format(self.spec["szip"].prefix)) - if "zlib-api" in self.spec: + if self.spec.satisfies("^zlib-api"): extra_args.append("--with-zlib={0}".format(self.spec["zlib-api"].prefix)) return extra_args diff --git a/var/spack/repos/builtin/packages/hdf/package.py b/var/spack/repos/builtin/packages/hdf/package.py index 6fea882e220fa0..85acc3dbb3ec6d 100644 --- a/var/spack/repos/builtin/packages/hdf/package.py +++ b/var/spack/repos/builtin/packages/hdf/package.py @@ -121,7 +121,7 @@ def libs(self): elif "static" in query_parameters: shared = False else: - shared = "+shared" in self.spec + shared = self.spec.satisfies("+shared") libs = find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) @@ -134,15 +134,15 @@ def libs(self): if not shared and "transitive" in query_parameters: libs += self.spec["jpeg:transitive"].libs libs += self.spec["zlib:transitive"].libs - if "+szip" in self.spec: + if self.spec.satisfies("+szip"): libs += self.spec["szip:transitive"].libs - if "+external-xdr" in self.spec and self.spec["rpc"].name == "libtirpc": + if self.spec.satisfies("+external-xdr") and self.spec["rpc"].name == "libtirpc": libs += self.spec["rpc:transitive"].libs return libs def flag_handler(self, name, flags): - if "+pic" in self.spec: + if self.spec.satisfies("+pic"): if name == "cflags": flags.append(self.compiler.cc_pic_flag) elif name == "fflags": @@ -175,12 +175,12 @@ def configure_args(self): config_args += self.enable_or_disable("fortran") config_args += self.enable_or_disable("java") - if "+szip" in self.spec: + if self.spec.satisfies("+szip"): config_args.append("--with-szlib=%s" % self.spec["szip"].prefix) else: config_args.append("--without-szlib") - if "~external-xdr" in self.spec: + if self.spec.satisfies("~external-xdr"): config_args.append("--enable-hdf4-xdr") elif self.spec["rpc"].name == "libtirpc": # We should not specify '--disable-hdf4-xdr' due to a bug in the diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 8a8c1a207c3c00..112e1acb52a530 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -326,7 +326,7 @@ def flag_handler(self, name, flags): if spec.satisfies("@:1.8.12+fortran~shared"): cmake_flags.append(self.compiler.fc_pic_flag) elif name == "ldlibs": - if "+fortran %fj" in spec: + if spec.satisfies("+fortran %fj"): cmake_flags.extend(["-lfj90i", "-lfj90f", "-lfjsrcinfo", "-lelf"]) return flags, None, (cmake_flags or None) @@ -344,7 +344,7 @@ def libs(self): """ query_parameters = self.spec.last_query.extra_parameters - shared = "+shared" in self.spec + shared = self.spec.satisfies("+shared") # This map contains a translation from query_parameters # to the libraries needed @@ -485,7 +485,7 @@ def setup_run_environment(self, env): @run_before("cmake") def fortran_check(self): - if "+fortran" in self.spec and not self.compiler.fc: + if self.spec.satisfies("+fortran") and not self.compiler.fc: msg = "cannot build a Fortran variant without a Fortran compiler" raise RuntimeError(msg) @@ -532,7 +532,7 @@ def cmake_args(self): # MSMPI does not provide compiler wrappers # and pointing these variables at the MSVC compilers # breaks CMake's mpi detection for MSMPI. - if "+mpi" in spec and "msmpi" not in spec: + if spec.satisfies("+mpi") and "msmpi" not in spec: args.extend( [ "-DMPI_CXX_COMPILER:PATH=%s" % spec["mpi"].mpicxx, @@ -540,7 +540,7 @@ def cmake_args(self): ] ) - if "+fortran" in spec: + if spec.satisfies("+fortran"): args.extend(["-DMPI_Fortran_COMPILER:PATH=%s" % spec["mpi"].mpifc]) # work-around for https://github.com/HDFGroup/hdf5/issues/1320 @@ -618,7 +618,7 @@ def fix_package_config(self): def link_debug_libs(self): # When build_type is Debug, the hdf5 build appends _debug to all library names. # Dependents of hdf5 (netcdf-c etc.) can't handle those, thus make symlinks. - if "build_type=Debug" in self.spec: + if self.spec.satisfies("build_type=Debug"): libs = find(self.prefix.lib, "libhdf5*_debug.*", recursive=False) with working_dir(self.prefix.lib): for lib in libs: diff --git a/var/spack/repos/builtin/packages/heasoft/package.py b/var/spack/repos/builtin/packages/heasoft/package.py index eaa0135ebf3093..72db8410e61944 100644 --- a/var/spack/repos/builtin/packages/heasoft/package.py +++ b/var/spack/repos/builtin/packages/heasoft/package.py @@ -93,7 +93,7 @@ def patch(self): join_path("tcltk", "BUILD_DIR", "hd_config_info"), ) - if "+X" in self.spec: + if self.spec.satisfies("+X"): filter_file( r"(\s+XDIR => ).*", r"\1'{0}',".format(self.spec["libx11"].libs.directories[0]), @@ -109,7 +109,7 @@ def configure_args(self): config_args += self.enable_or_disable("x", variant="X") - if "+X" in self.spec: + if self.spec.satisfies("+X"): config_args.extend( [ "--x-includes={0}".format(self.spec["libx11"].headers.directories[0]), diff --git a/var/spack/repos/builtin/packages/heffte/package.py b/var/spack/repos/builtin/packages/heffte/package.py index a397f95f740b8c..7ad6c880435f5c 100644 --- a/var/spack/repos/builtin/packages/heffte/package.py +++ b/var/spack/repos/builtin/packages/heffte/package.py @@ -100,7 +100,7 @@ def cmake_args(self): self.define_from_variant("Heffte_ENABLE_PYTHON", "python"), ] - if "+cuda" in self.spec and self.spec.satisfies("@:2.3.0"): + if self.spec.satisfies("+cuda") and self.spec.satisfies("@:2.3.0"): cuda_arch = self.spec.variants["cuda_arch"].value if len(cuda_arch) > 0 or cuda_arch[0] != "none": nvcc_flags = "" @@ -111,7 +111,7 @@ def cmake_args(self): archs = ";".join(cuda_arch) args.append("-DCMAKE_CUDA_ARCHITECTURES=%s" % archs) - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): args.append("-DCMAKE_CXX_COMPILER={0}".format(self.spec["hip"].hipcc)) rocm_arch = self.spec.variants["amdgpu_target"].value @@ -143,7 +143,7 @@ def test_make_test(self): options = [cmake_dir] options.append(self.define("Heffte_DIR", self.spec.prefix.lib.cmake.Heffte)) - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): # path name is 'hsa-runtime64' but python cannot have '-' in variable name hsa_runtime = join_path(self.spec["hsa-rocr-dev"].prefix.lib.cmake, "hsa-runtime64") options.extend( diff --git a/var/spack/repos/builtin/packages/helics/package.py b/var/spack/repos/builtin/packages/helics/package.py index 3f3da4d106fd1c..072e746c861705 100644 --- a/var/spack/repos/builtin/packages/helics/package.py +++ b/var/spack/repos/builtin/packages/helics/package.py @@ -142,7 +142,9 @@ def cmake_args(self): # HELICS shared library options args.append( - "-DHELICS_DISABLE_C_SHARED_LIB={0}".format("OFF" if "+c_shared" in spec else "ON") + "-DHELICS_DISABLE_C_SHARED_LIB={0}".format( + "OFF" if spec.satisfies("+c_shared") else "ON" + ) ) args.append(from_variant("HELICS_BUILD_CXX_SHARED_LIB", "cxx_shared")) @@ -150,13 +152,17 @@ def cmake_args(self): args.append(from_variant("HELICS_BUILD_APP_EXECUTABLES", "apps")) args.append(from_variant("HELICS_BUILD_APP_LIBRARY", "apps_lib")) args.append( - "-DHELICS_DISABLE_WEBSERVER={0}".format("OFF" if "+webserver" in spec else "ON") + "-DHELICS_DISABLE_WEBSERVER={0}".format( + "OFF" if spec.satisfies("+webserver") else "ON" + ) ) args.append(from_variant("HELICS_BUILD_BENCHMARKS", "benchmarks")) # Extra HELICS library dependencies - args.append("-DHELICS_DISABLE_BOOST={0}".format("OFF" if "+boost" in spec else "ON")) - args.append("-DHELICS_DISABLE_ASIO={0}".format("OFF" if "+asio" in spec else "ON")) + args.append( + "-DHELICS_DISABLE_BOOST={0}".format("OFF" if spec.satisfies("+boost") else "ON") + ) + args.append("-DHELICS_DISABLE_ASIO={0}".format("OFF" if spec.satisfies("+asio") else "ON")) # Encryption args.append(from_variant("HELICS_ENABLE_ENCRYPTION", "encryption")) @@ -178,5 +184,5 @@ def cmake_args(self): def setup_run_environment(self, env): spec = self.spec - if "+python" in spec: + if spec.satisfies("+python"): env.prepend_path("PYTHONPATH", self.prefix.python) diff --git a/var/spack/repos/builtin/packages/hh-suite/package.py b/var/spack/repos/builtin/packages/hh-suite/package.py index 4735ddd9f42e72..66496a89811bb2 100644 --- a/var/spack/repos/builtin/packages/hh-suite/package.py +++ b/var/spack/repos/builtin/packages/hh-suite/package.py @@ -37,7 +37,7 @@ class HhSuite(CMakePackage): def build_args(self, spec, prefix): args = [] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): args.append("-DCHECK_MPI=1") else: args.append("-DCHECK_MPI=0") diff --git a/var/spack/repos/builtin/packages/highfive/package.py b/var/spack/repos/builtin/packages/highfive/package.py index c871e27dbd5bea..34266ca7d9c34a 100644 --- a/var/spack/repos/builtin/packages/highfive/package.py +++ b/var/spack/repos/builtin/packages/highfive/package.py @@ -58,8 +58,8 @@ class Highfive(CMakePackage): def cmake_args(self): args = [ - "-DUSE_BOOST:Bool={0}".format("+boost" in self.spec), - "-DHIGHFIVE_PARALLEL_HDF5:Bool={0}".format("+mpi" in self.spec), + "-DUSE_BOOST:Bool={0}".format(self.spec.satisfies("+boost")), + "-DHIGHFIVE_PARALLEL_HDF5:Bool={0}".format(self.spec.satisfies("+mpi")), "-DHIGHFIVE_UNIT_TESTS:Bool=false", "-DHIGHFIVE_EXAMPLES:Bool=false", ] diff --git a/var/spack/repos/builtin/packages/hiop/package.py b/var/spack/repos/builtin/packages/hiop/package.py index 2495796d9be73f..bd61dcf98feecc 100644 --- a/var/spack/repos/builtin/packages/hiop/package.py +++ b/var/spack/repos/builtin/packages/hiop/package.py @@ -178,7 +178,7 @@ def cmake_args(self): args = [] spec = self.spec - use_gpu = "+cuda" in spec or "+rocm" in spec + use_gpu = spec.satisfies("+cuda") or spec.satisfies("+rocm") if use_gpu: args.extend( @@ -218,7 +218,7 @@ def cmake_args(self): # args.append( # self.define('HIOP_CTEST_LAUNCH_COMMAND', 'srun -t 10:00')) - if "+mpi" in spec: + if spec.satisfies("+mpi"): args.extend( [ self.define("MPI_HOME", spec["mpi"].prefix), @@ -237,7 +237,7 @@ def cmake_args(self): # self.define('MPI_Fortran_LINK_FLAGS', # '-L/path/to/libfabric/lib64/ -lfabric')) - if "+cuda" in spec: + if spec.satisfies("+cuda"): cuda_arch_list = spec.variants["cuda_arch"].value if cuda_arch_list[0] != "none": args.append(self.define("CMAKE_CUDA_ARCHITECTURES", cuda_arch_list)) @@ -250,7 +250,7 @@ def cmake_args(self): # args.append( # self.define('HIP_CLANG_INCLUDE_PATH', # '/opt/rocm-X.Y.Z/llvm/lib/clang/14.0.0/include/')) - if "+rocm" in spec: + if spec.satisfies("+rocm"): args.append(self.define("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) rocm_arch_list = spec.variants["amdgpu_target"].value @@ -258,7 +258,7 @@ def cmake_args(self): args.append(self.define("GPU_TARGETS", rocm_arch_list)) args.append(self.define("AMDGPU_TARGETS", rocm_arch_list)) - if "+kron" in spec: + if spec.satisfies("+kron"): args.append(self.define("HIOP_UMFPACK_DIR", spec["suite-sparse"].prefix)) # Unconditionally disable strumpack, even when +sparse. This may be @@ -266,7 +266,7 @@ def cmake_args(self): # fully supported in spack at the moment. args.append(self.define("HIOP_USE_STRUMPACK", False)) - if "+sparse" in spec: + if spec.satisfies("+sparse"): args.append(self.define("HIOP_COINHSL_DIR", spec["coinhsl"].prefix)) return args diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py index 3bc5367b0670d6..ea72bdb4bbe9d0 100644 --- a/var/spack/repos/builtin/packages/hip/package.py +++ b/var/spack/repos/builtin/packages/hip/package.py @@ -577,19 +577,19 @@ def cmake_args(self): args.append(self.define("HIP_COMMON_DIR", self.stage.source_path)) args.append(self.define("HIP_CATCH_TEST", "OFF")) - if "@:5.5" in self.spec: + if self.spec.satisfies("@:5.5"): args.append(self.define("ROCCLR_PATH", self.stage.source_path + "rocclr")) args.append(self.define("AMD_OPENCL_PATH", self.stage.source_path + "opencl")) - if "@5.3.0:" in self.spec: + if self.spec.satisfies("@5.3.0:"): args.append("-DCMAKE_INSTALL_LIBDIR=lib") - if "@5.6.0:" in self.spec: + if self.spec.satisfies("@5.6.0:"): args.append(self.define("ROCCLR_PATH", self.stage.source_path + "/clr/rocclr")) args.append(self.define("AMD_OPENCL_PATH", self.stage.source_path + "/clr/opencl")) args.append(self.define("CLR_BUILD_HIP", True)), args.append(self.define("CLR_BUILD_OCL", False)), - if "@5.6:5.7" in self.spec: + if self.spec.satisfies("@5.6:5.7"): args.append(self.define("HIPCC_BIN_DIR", self.stage.source_path + "/hipcc/bin")), - if "@6.0:" in self.spec: + if self.spec.satisfies("@6.0:"): args.append(self.define("HIPCC_BIN_DIR", self.spec["hipcc"].prefix.bin)), return args diff --git a/var/spack/repos/builtin/packages/hipsycl/package.py b/var/spack/repos/builtin/packages/hipsycl/package.py index 1a17760aac23ed..f21a96e8058c5a 100644 --- a/var/spack/repos/builtin/packages/hipsycl/package.py +++ b/var/spack/repos/builtin/packages/hipsycl/package.py @@ -77,8 +77,8 @@ def cmake_args(self): spec = self.spec args = [ "-DWITH_CPU_BACKEND:Bool=TRUE", - "-DWITH_ROCM_BACKEND:Bool={0}".format("TRUE" if "+rocm" in spec else "FALSE"), - "-DWITH_CUDA_BACKEND:Bool={0}".format("TRUE" if "+cuda" in spec else "FALSE"), + "-DWITH_ROCM_BACKEND:Bool={0}".format("TRUE" if spec.satisfies("+rocm") else "FALSE"), + "-DWITH_CUDA_BACKEND:Bool={0}".format("TRUE" if spec.satisfies("+cuda") else "FALSE"), # prevent hipSYCL's cmake to look for other LLVM installations # if the specified one isn't compatible "-DDISABLE_LLVM_VERSION_CHECK:Bool=TRUE", @@ -116,9 +116,9 @@ def cmake_args(self): ) args.append("-DCLANG_EXECUTABLE_PATH:String={0}".format(llvm_clang_bin)) # explicit CUDA toolkit - if "+cuda" in spec: + if spec.satisfies("+cuda"): args.append("-DCUDA_TOOLKIT_ROOT_DIR:String={0}".format(spec["cuda"].prefix)) - if "+rocm" in spec: + if spec.satisfies("+rocm"): args.append("-DWITH_ACCELERATED_CPU:STRING=OFF") args.append("-DROCM_PATH:STRING={0}".format(os.environ.get("ROCM_PATH"))) if self.spec.satisfies("@24.02.0:"): @@ -161,7 +161,7 @@ def adjust_core_config(config): # the libc++.so and libc++abi.so dyn linked to the sycl # ptx backend rpaths = set() - if "~rocm" in spec: + if spec.satisfies("~rocm"): so_paths = filesystem.find_libraries( "libc++", self.spec["llvm"].prefix, shared=True, recursive=True ) diff --git a/var/spack/repos/builtin/packages/hiredis/package.py b/var/spack/repos/builtin/packages/hiredis/package.py index be1d469c8900f7..39eb4aaa5b81f4 100644 --- a/var/spack/repos/builtin/packages/hiredis/package.py +++ b/var/spack/repos/builtin/packages/hiredis/package.py @@ -46,13 +46,17 @@ class Hiredis(MakefilePackage, CMakePackage): class MakefileBuilder(spack.build_systems.makefile.MakefileBuilder): @property def build_targets(self): - use_ssl = 1 if "+ssl" in self.spec else 0 - run_test_async = 1 if "+test_async" in self.spec else 0 + use_ssl = 1 if self.spec.satisfies("+ssl") else 0 + run_test_async = 1 if self.spec.satisfies("+test_async") else 0 return ["USE_SSL={0}".format(use_ssl), "TEST_ASYNC={0}".format(run_test_async)] def install(self, pkg, spec, prefix): make("PREFIX={0}".format(prefix), "install") - if "+test" in self.spec or "+test_async" in self.spec or "+test_ssl" in self.spec: + if ( + self.spec.satisfies("+test") + or self.spec.satisfies("+test_async") + or self.spec.satisfies("+test_ssl") + ): make("PREFIX={0}".format(prefix), "test") @run_after("install") @@ -63,9 +67,9 @@ def darwin_fix(self): class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): def cmake_args(self): - build_test = not ("+test" in self.spec) - ssl_test = ("+test_ssl" in self.spec) and ("+test" in self.spec) - async_test = ("+test_async" in self.spec) and ("+test" in self.spec) + build_test = not self.spec.satisfies("+test") + ssl_test = self.spec.satisfies("+test_ssl") and self.spec.satisfies("+test") + async_test = self.spec.satisfies("+test_async") and self.spec.satisfies("+test") args = [ self.define_from_variant("ENABLE_SSL", "ssl"), diff --git a/var/spack/repos/builtin/packages/hmmer/package.py b/var/spack/repos/builtin/packages/hmmer/package.py index 9a35cd76ecef05..8e12b522873802 100644 --- a/var/spack/repos/builtin/packages/hmmer/package.py +++ b/var/spack/repos/builtin/packages/hmmer/package.py @@ -41,10 +41,10 @@ class Hmmer(Package): def install(self, spec, prefix): configure_args = ["--prefix={0}".format(prefix)] - if "+gsl" in self.spec: + if self.spec.satisfies("+gsl"): configure_args.extend(["--with-gsl", "LIBS=-lgsl -lgslcblas"]) - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): configure_args.append("--enable-mpi") configure(*configure_args) diff --git a/var/spack/repos/builtin/packages/homer/package.py b/var/spack/repos/builtin/packages/homer/package.py index 7ee7b7fbdc7b34..17a3b7e13e645f 100644 --- a/var/spack/repos/builtin/packages/homer/package.py +++ b/var/spack/repos/builtin/packages/homer/package.py @@ -50,5 +50,5 @@ def install(self, spec, prefix): perl("configureHomer.pl", "-local") # download extra data if requested - if "+data" in spec: + if spec.satisfies("+data"): perl("configureHomer.pl", "-install", "-all") diff --git a/var/spack/repos/builtin/packages/hoomd-blue/package.py b/var/spack/repos/builtin/packages/hoomd-blue/package.py index e5e3a96fa7cf1d..b58222cb1cd524 100644 --- a/var/spack/repos/builtin/packages/hoomd-blue/package.py +++ b/var/spack/repos/builtin/packages/hoomd-blue/package.py @@ -71,14 +71,14 @@ def cmake_args(self): cmake_args = ["-DCMAKE_INSTALL_PREFIX={0}".format(python_platlib)] # MPI support - if "+mpi" in spec: + if spec.satisfies("+mpi"): os.environ["MPI_HOME"] = spec["mpi"].prefix cmake_args.append("-DENABLE_MPI=ON") else: cmake_args.append("-DENABLE_MPI=OFF") # CUDA support - if "+cuda" in spec: + if spec.satisfies("+cuda"): cmake_args.append("-DENABLE_CUDA=ON") else: cmake_args.append("-DENABLE_CUDA=OFF") @@ -95,7 +95,7 @@ def cmake_args(self): cmake_args.append("-DENABLE_MPI_CUDA=OFF") # Documentation - if "+doc" in spec: + if spec.satisfies("+doc"): cmake_args.append("-DENABLE_DOXYGEN=ON") else: cmake_args.append("-DENABLE_DOXYGEN=OFF") diff --git a/var/spack/repos/builtin/packages/hpcc/package.py b/var/spack/repos/builtin/packages/hpcc/package.py index 0a6c77863f9a53..448342602412fc 100644 --- a/var/spack/repos/builtin/packages/hpcc/package.py +++ b/var/spack/repos/builtin/packages/hpcc/package.py @@ -85,7 +85,7 @@ class Hpcc(MakefilePackage): } def patch(self): - if "fftw" in self.spec: + if self.spec.satisfies("^fftw"): # spack's fftw2 prefix headers with floating point type filter_file(r"^\s*#include ", "#include ", "FFT/wrapfftw.h") filter_file( diff --git a/var/spack/repos/builtin/packages/hpccg/package.py b/var/spack/repos/builtin/packages/hpccg/package.py index 676bf9764d0781..86244d74aa4299 100644 --- a/var/spack/repos/builtin/packages/hpccg/package.py +++ b/var/spack/repos/builtin/packages/hpccg/package.py @@ -31,7 +31,7 @@ class Hpccg(MakefilePackage): def build_targets(self): targets = [] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): targets.append("CXX={0}".format(self.spec["mpi"].mpicxx)) targets.append("LINKER={0}".format(self.spec["mpi"].mpicxx)) targets.append("USE_MPI=-DUSING_MPI") @@ -39,7 +39,7 @@ def build_targets(self): targets.append("CXX=c++") targets.append("LINKER=c++") - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): targets.append("USE_OMP=-DUSING_OMP") targets.append("OMP_FLAGS={0}".format(self.compiler.openmp_flag)) diff --git a/var/spack/repos/builtin/packages/hpcg/package.py b/var/spack/repos/builtin/packages/hpcg/package.py index 52da05d90699a1..9e0affb3b804b7 100644 --- a/var/spack/repos/builtin/packages/hpcg/package.py +++ b/var/spack/repos/builtin/packages/hpcg/package.py @@ -76,7 +76,7 @@ def configure(self, spec, prefix): CXXFLAGS += " -Rpass=loop-vectorize" CXXFLAGS += " -Rpass-missed=loop-vectorize" CXXFLAGS += " -Rpass-analysis=loop-vectorize " - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): CXXFLAGS += self.compiler.openmp_flag config = [ # Shell diff --git a/var/spack/repos/builtin/packages/hpctoolkit/package.py b/var/spack/repos/builtin/packages/hpctoolkit/package.py index 0c6d77b65f3db6..ebcabeee0330f1 100644 --- a/var/spack/repos/builtin/packages/hpctoolkit/package.py +++ b/var/spack/repos/builtin/packages/hpctoolkit/package.py @@ -263,7 +263,7 @@ def setup_run_environment(self, env): env.prepend_path("MANPATH", spec.prefix.share.man) env.prepend_path("CPATH", spec.prefix.include) env.prepend_path("LD_LIBRARY_PATH", spec.prefix.lib.hpctoolkit) - if "+viewer" in spec: + if spec.satisfies("+viewer"): env.prepend_path("PATH", spec["hpcviewer"].prefix.bin) env.prepend_path("MANPATH", spec["hpcviewer"].prefix.share.man) @@ -329,18 +329,18 @@ def configure_args(self): if spec.satisfies("@2022.10:"): args.append("--with-yaml-cpp=%s" % spec["yaml-cpp"].prefix) - if "+cuda" in spec: + if spec.satisfies("+cuda"): args.append("--with-cuda=%s" % spec["cuda"].prefix) - if "+level_zero" in spec: + if spec.satisfies("+level_zero"): args.append("--with-level0=%s" % spec["oneapi-level-zero"].prefix) # gtpin requires level_zero - if "+gtpin" in spec: + if spec.satisfies("+gtpin"): args.append("--with-gtpin=%s" % spec["intel-gtpin"].prefix) args.append("--with-igc=%s" % spec["oneapi-igc"].prefix) - if "+opencl" in spec: + if spec.satisfies("+opencl"): args.append("--with-opencl=%s" % spec["opencl-c-headers"].prefix) if spec.satisfies("+rocm"): @@ -399,17 +399,17 @@ def meson_args(self): spec = self.spec args = [ - "-Dhpcprof_mpi=" + ("enabled" if "+mpi" in spec else "disabled"), - "-Dpython=" + ("enabled" if "+python" in spec else "disabled"), - "-Dpapi=" + ("enabled" if "+papi" in spec else "disabled"), - "-Dopencl=" + ("enabled" if "+opencl" in spec else "disabled"), - "-Dcuda=" + ("enabled" if "+cuda" in spec else "disabled"), - "-Drocm=" + ("enabled" if "+rocm" in spec else "disabled"), - "-Dlevel0=" + ("enabled" if "+level_zero" in spec else "disabled"), - "-Dgtpin=" + ("enabled" if "+gtpin" in spec else "disabled"), + "-Dhpcprof_mpi=" + ("enabled" if spec.satisfies("+mpi") else "disabled"), + "-Dpython=" + ("enabled" if spec.satisfies("+python") else "disabled"), + "-Dpapi=" + ("enabled" if spec.satisfies("+papi") else "disabled"), + "-Dopencl=" + ("enabled" if spec.satisfies("+opencl") else "disabled"), + "-Dcuda=" + ("enabled" if spec.satisfies("+cuda") else "disabled"), + "-Drocm=" + ("enabled" if spec.satisfies("+rocm") else "disabled"), + "-Dlevel0=" + ("enabled" if spec.satisfies("+level_zero") else "disabled"), + "-Dgtpin=" + ("enabled" if spec.satisfies("+gtpin") else "disabled"), ] - if "@:2024.01" in spec: + if spec.satisfies("@:2024.01"): args.append(f"--native-file={self.gen_prefix_file()}") return args @@ -444,29 +444,29 @@ def gen_prefix_file(self): cfg["properties"]["prefix_yaml_cpp"] = f"'''{spec['yaml-cpp'].prefix}'''" - if "+cuda" in spec: + if spec.satisfies("+cuda"): cfg["properties"]["prefix_cuda"] = f"'''{spec['cuda'].prefix}'''" - if "+level_zero" in spec: + if spec.satisfies("+level_zero"): cfg["properties"]["prefix_level0"] = f"'''{spec['oneapi-level-zero'].prefix}'''" - if "+gtpin" in spec: + if spec.satisfies("+gtpin"): cfg["properties"]["prefix_gtpin"] = f"'''{spec['intel-gtpin'].prefix}'''" cfg["properties"]["prefix_igc"] = f"'''{spec['oneapi-igc'].prefix}'''" - if "+opencl" in spec: + if spec.satisfies("+opencl"): cfg["properties"]["prefix_opencl"] = f"'''{spec['opencl-c-headers'].prefix}'''" - if "+rocm" in spec: + if spec.satisfies("+rocm"): cfg["properties"]["prefix_rocm_hip"] = f"'''{spec['hip'].prefix}'''" cfg["properties"]["prefix_rocm_hsa"] = f"'''{spec['hsa-rocr-dev'].prefix}'''" cfg["properties"]["prefix_rocm_tracer"] = f"'''{spec['roctracer-dev'].prefix}'''" cfg["properties"]["prefix_rocm_profiler"] = f"'''{spec['rocprofiler-dev'].prefix}'''" - if "+python" in spec: + if spec.satisfies("+python"): cfg["binaries"]["python"] = f"'''{spec['python'].command}'''" - if "+mpi" in spec: + if spec.satisfies("+mpi"): cfg["binaries"]["mpicxx"] = f"'''{spec['mpi'].mpicxx}'''" native_fd, native_path = tempfile.mkstemp( diff --git a/var/spack/repos/builtin/packages/hpgmg/package.py b/var/spack/repos/builtin/packages/hpgmg/package.py index 8045f7297362aa..cd37b5a70289ba 100644 --- a/var/spack/repos/builtin/packages/hpgmg/package.py +++ b/var/spack/repos/builtin/packages/hpgmg/package.py @@ -52,24 +52,24 @@ class Hpgmg(MakefilePackage): def configure_args(self): args = [] - if "+fe" in self.spec and not ("@0.3" in self.spec): + if self.spec.satisfies("+fe") and not self.spec.satisfies("@0.3"): args.append("--fe") - if "fv=serial" in self.spec: + if self.spec.satisfies("fv=serial"): args.append("--no-fv-mpi") - if "mpi" in self.spec: + if self.spec.satisfies("^mpi"): args.append("--CC={0}".format(self.spec["mpi"].mpicc)) cflags = [] - if "fv=none" in self.spec: + if self.spec.satisfies("fv=none"): args.append("--no-fv") else: # Apple's Clang doesn't support OpenMP if not self.spec.satisfies("%apple-clang"): cflags.append(self.compiler.openmp_flag) - if "+debug" in self.spec: + if self.spec.satisfies("+debug"): cflags.append("-g") else: cflags.append("-O3") diff --git a/var/spack/repos/builtin/packages/hpl/package.py b/var/spack/repos/builtin/packages/hpl/package.py index 184fe6c2b7e298..b57692b0504721 100644 --- a/var/spack/repos/builtin/packages/hpl/package.py +++ b/var/spack/repos/builtin/packages/hpl/package.py @@ -50,7 +50,7 @@ def configure(self, spec, prefix): config = [] # OpenMP support - if "+openmp" in spec: + if spec.satisfies("+openmp"): config.append("OMP_DEFS = {0}".format(self.compiler.openmp_flag)) config.extend( @@ -106,7 +106,7 @@ def configure_args(self): filter_file(r"^libs10=.*", "libs10=%s" % self.spec["blas"].libs.ld_flags, "configure") cflags, ldflags = ["-O3"], [] - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): cflags.append(self.compiler.openmp_flag) if ( @@ -116,10 +116,10 @@ def configure_args(self): ): ldflags.append(self.spec["blas"].libs.ld_flags) - if "%aocc" in self.spec: - if "%aocc@3:" in self.spec: + if self.spec.satisfies("%aocc"): + if self.spec.satisfies("%aocc@3:"): ldflags.extend(["-lamdlibm", "-lm"]) - if "%aocc@4:" in self.spec: + if self.spec.satisfies("%aocc@4:"): ldflags.append("-lamdalloc") if self.spec["blas"].name == "fujitsu-ssl2" and ( diff --git a/var/spack/repos/builtin/packages/hpx-kokkos/package.py b/var/spack/repos/builtin/packages/hpx-kokkos/package.py index f2ea7b1d61a53d..c01af6c03f95f5 100644 --- a/var/spack/repos/builtin/packages/hpx-kokkos/package.py +++ b/var/spack/repos/builtin/packages/hpx-kokkos/package.py @@ -81,7 +81,7 @@ def cmake_args(self): self.define("HPX_KOKKOS_ENABLE_BENCHMARKS", self.run_tests), ] - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): args += [self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)] return args diff --git a/var/spack/repos/builtin/packages/hpx/package.py b/var/spack/repos/builtin/packages/hpx/package.py index 910d20b6b5e2f3..b40de24c0eed2e 100644 --- a/var/spack/repos/builtin/packages/hpx/package.py +++ b/var/spack/repos/builtin/packages/hpx/package.py @@ -241,8 +241,8 @@ def cmake_args(self): self.define_from_variant("HPX_WITH_ASYNC_CUDA", "async_cuda"), self.define("HPX_WITH_TESTS", self.run_tests), self.define("HPX_WITH_NETWORKING", "networking=none" not in spec), - self.define("HPX_WITH_PARCELPORT_TCP", "networking=tcp" in spec), - self.define("HPX_WITH_PARCELPORT_MPI", "networking=mpi" in spec), + self.define("HPX_WITH_PARCELPORT_TCP", spec.satisfies("networking=tcp")), + self.define("HPX_WITH_PARCELPORT_MPI", spec.satisfies("networking=mpi")), self.define( "HPX_WITH_MAX_CPU_COUNT", format_max_cpu_count(spec.variants["max_cpu_count"].value), @@ -260,7 +260,7 @@ def cmake_args(self): args += [self.define("HPX_WITH_UNITY_BUILD", True)] # HIP support requires compiling with hipcc - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): args += [self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)] if self.spec.satisfies("^cmake@3.21.0:3.21.2"): args += [self.define("__skip_rocmclang", True)] @@ -268,13 +268,13 @@ def cmake_args(self): # Instrumentation args += self.instrumentation_args() - if "instrumentation=thread_debug" in spec: + if spec.satisfies("instrumentation=thread_debug"): args += [ self.define("HPX_WITH_THREAD_DEBUG_INFO", True), self.define("HPX_WITH_LOGGING", True), ] - if "instrumentation=apex" in spec: + if spec.satisfies("instrumentation=apex"): args += [ self.define("APEX_WITH_OTF2", True), self.define("OTF2_ROOT", spec["otf2"].prefix), diff --git a/var/spack/repos/builtin/packages/hpx5/package.py b/var/spack/repos/builtin/packages/hpx5/package.py index a0f4cc27c11920..eccb045c21e4ec 100644 --- a/var/spack/repos/builtin/packages/hpx5/package.py +++ b/var/spack/repos/builtin/packages/hpx5/package.py @@ -84,24 +84,24 @@ def configure_args(self): # '--with-papi=papi', # currently disabled in HPX ] - if "+cxx11" in spec: + if spec.satisfies("+cxx11"): args += ["--enable-hpx++"] - if "+debug" in spec: + if spec.satisfies("+debug"): args += ["--enable-debug"] - if "+instrumentation" in spec: + if spec.satisfies("+instrumentation"): args += ["--enable-instrumentation"] - if "+mpi" in spec or "+photon" in spec: + if spec.satisfies("+mpi") or spec.satisfies("+photon"): # photon requires mpi args += ["--enable-mpi"] # Choose pkg-config name for MPI library - if "^openmpi" in spec: + if spec.satisfies("^openmpi"): args += ["--with-mpi=ompi-cxx"] - elif "^mpich" in spec: + elif spec.satisfies("^mpich"): args += ["--with-mpi=mpich"] - elif "^mvapich2" in spec: + elif spec.satisfies("^mvapich2"): args += ["--with-mpi=mvapich2-cxx"] else: args += ["--with-mpi=system"] @@ -110,17 +110,17 @@ def configure_args(self): # if '+metis' in spec: # args += ['--with-metis=???'] - if "+opencl" in spec: + if spec.satisfies("+opencl"): args += ["--enable-opencl"] - if "^pocl" in spec: + if spec.satisfies("^pocl"): args += ["--with-opencl=pocl"] else: args += ["--with-opencl=system"] - if "+photon" in spec: + if spec.satisfies("+photon"): args += ["--enable-photon"] - if "+pic" in spec: + if spec.satisfies("+pic"): args += ["--with-pic"] return args diff --git a/var/spack/repos/builtin/packages/hwloc/package.py b/var/spack/repos/builtin/packages/hwloc/package.py index f7b0581a844aee..ca0cbe58f59a6a 100644 --- a/var/spack/repos/builtin/packages/hwloc/package.py +++ b/var/spack/repos/builtin/packages/hwloc/package.py @@ -178,7 +178,7 @@ def configure_args(self): if "+rocm" not in self.spec: args.append("--disable-rsmi") - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): args.append("--with-rocm={0}".format(self.spec["hip"].prefix)) args.append("--with-rocm-version={0}".format(self.spec["hip"].version)) @@ -192,11 +192,11 @@ def configure_args(self): args.extend(self.enable_or_disable("pci")) args.extend(self.enable_or_disable("libs")) - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): args.append("--with-cuda={0}".format(self.spec["cuda"].prefix)) args.append("--with-cuda-version={0}".format(self.spec["cuda"].version)) - if "+oneapi-level-zero" in self.spec: + if self.spec.satisfies("+oneapi-level-zero"): args.append("--enable-levelzero") return args diff --git a/var/spack/repos/builtin/packages/hydrogen/package.py b/var/spack/repos/builtin/packages/hydrogen/package.py index 582204c140b825..b4116df1c4fd13 100644 --- a/var/spack/repos/builtin/packages/hydrogen/package.py +++ b/var/spack/repos/builtin/packages/hydrogen/package.py @@ -139,7 +139,7 @@ class Hydrogen(CachedCMakePackage, CudaPackage, ROCmPackage): @property def libs(self): - shared = True if "+shared" in self.spec else False + shared = True if self.spec.satisfies("+shared") else False return find_libraries("libHydrogen", root=self.prefix, shared=shared, recursive=True) def cmake_args(self): @@ -175,7 +175,7 @@ def initconfig_compiler_entries(self): # FIXME: Enforce this better in the actual CMake. entries.append(cmake_cache_string("CMAKE_CXX_STANDARD", "17")) - entries.append(cmake_cache_option("BUILD_SHARED_LIBS", "+shared" in spec)) + entries.append(cmake_cache_option("BUILD_SHARED_LIBS", spec.satisfies("+shared"))) entries.append(cmake_cache_option("CMAKE_EXPORT_COMPILE_COMMANDS", True)) entries.append(cmake_cache_option("MPI_ASSUME_NO_BUILTIN_MPI", True)) @@ -200,7 +200,7 @@ def initconfig_hardware_entries(self): spec = self.spec entries = super(Hydrogen, self).initconfig_hardware_entries() - entries.append(cmake_cache_option("Hydrogen_ENABLE_CUDA", "+cuda" in spec)) + entries.append(cmake_cache_option("Hydrogen_ENABLE_CUDA", spec.satisfies("+cuda"))) if spec.satisfies("+cuda"): entries.append(cmake_cache_string("CMAKE_CUDA_STANDARD", "17")) if not spec.satisfies("cuda_arch=none"): @@ -215,7 +215,7 @@ def initconfig_hardware_entries(self): if len(cuda_flags) > 0: entries.append(cmake_cache_string("CMAKE_CUDA_FLAGS", " ".join(cuda_flags))) - entries.append(cmake_cache_option("Hydrogen_ENABLE_ROCM", "+rocm" in spec)) + entries.append(cmake_cache_option("Hydrogen_ENABLE_ROCM", spec.satisfies("+rocm"))) if spec.satisfies("+rocm"): entries.append(cmake_cache_string("CMAKE_HIP_STANDARD", "17")) if not spec.satisfies("amdgpu_target=none"): @@ -233,30 +233,36 @@ def initconfig_package_entries(self): entries = super(Hydrogen, self).initconfig_package_entries() # Basic Hydrogen options - entries.append(cmake_cache_option("Hydrogen_ENABLE_TESTING", "+test" in spec)) + entries.append(cmake_cache_option("Hydrogen_ENABLE_TESTING", spec.satisfies("+test"))) entries.append(cmake_cache_option("Hydrogen_GENERAL_LAPACK_FALLBACK", True)) - entries.append(cmake_cache_option("Hydrogen_USE_64BIT_INTS", "+int64" in spec)) - entries.append(cmake_cache_option("Hydrogen_USE_64BIT_BLAS_INTS", "+int64_blas" in spec)) + entries.append(cmake_cache_option("Hydrogen_USE_64BIT_INTS", spec.satisfies("+int64"))) + entries.append( + cmake_cache_option("Hydrogen_USE_64BIT_BLAS_INTS", spec.satisfies("+int64_blas")) + ) # Advanced dependency options - entries.append(cmake_cache_option("Hydrogen_ENABLE_ALUMINUM", "+al" in spec)) - entries.append(cmake_cache_option("Hydrogen_ENABLE_CUB", "+cub" in spec)) - entries.append(cmake_cache_option("Hydrogen_ENABLE_GPU_FP16", "+cuda +half" in spec)) - entries.append(cmake_cache_option("Hydrogen_ENABLE_HALF", "+half" in spec)) - entries.append(cmake_cache_option("Hydrogen_ENABLE_OPENMP", "+openmp" in spec)) + entries.append(cmake_cache_option("Hydrogen_ENABLE_ALUMINUM", spec.satisfies("+al"))) + entries.append(cmake_cache_option("Hydrogen_ENABLE_CUB", spec.satisfies("+cub"))) + entries.append( + cmake_cache_option("Hydrogen_ENABLE_GPU_FP16", spec.satisfies("+cuda +half")) + ) + entries.append(cmake_cache_option("Hydrogen_ENABLE_HALF", spec.satisfies("+half"))) + entries.append(cmake_cache_option("Hydrogen_ENABLE_OPENMP", spec.satisfies("+openmp"))) entries.append( - cmake_cache_option("Hydrogen_ENABLE_OMP_TASKLOOP", "+omp_taskloops" in spec) + cmake_cache_option("Hydrogen_ENABLE_OMP_TASKLOOP", spec.satisfies("+omp_taskloops")) ) # Note that CUDA/ROCm are handled above. - if "blas=openblas" in spec: - entries.append(cmake_cache_option("Hydrogen_USE_OpenBLAS", "blas=openblas" in spec)) + if spec.satisfies("blas=openblas"): + entries.append( + cmake_cache_option("Hydrogen_USE_OpenBLAS", spec.satisfies("blas=openblas")) + ) # CMAKE_PREFIX_PATH should handle this entries.append(cmake_cache_string("OpenBLAS_DIR", spec["openblas"].prefix)) - elif "blas=mkl" in spec or spec.satisfies("^intel-mkl"): + elif spec.satisfies("blas=mkl") or spec.satisfies("^intel-mkl"): entries.append(cmake_cache_option("Hydrogen_USE_MKL", True)) - elif "blas=essl" in spec or spec.satisfies("^essl"): + elif spec.satisfies("blas=essl") or spec.satisfies("^essl"): entries.append(cmake_cache_string("BLA_VENDOR", "IBMESSL")) # IF IBM ESSL is used it needs help finding the proper LAPACK libraries entries.append( @@ -273,7 +279,7 @@ def initconfig_package_entries(self): % ";".join("-l{0}".format(lib) for lib in self.spec["essl"].libs.names), ) ) - elif "blas=accelerate" in spec: + elif spec.satisfies("blas=accelerate"): entries.append(cmake_cache_option("Hydrogen_USE_ACCELERATE", True)) elif spec.satisfies("^netlib-lapack"): entries.append(cmake_cache_string("BLA_VENDOR", "Generic")) diff --git a/var/spack/repos/builtin/packages/hypar/package.py b/var/spack/repos/builtin/packages/hypar/package.py index 3a1b8780873c21..6236b1b1bac65a 100644 --- a/var/spack/repos/builtin/packages/hypar/package.py +++ b/var/spack/repos/builtin/packages/hypar/package.py @@ -47,18 +47,18 @@ class Hypar(AutotoolsPackage): def configure_args(self): args = [] spec = self.spec - if "+mpi" in spec: + if spec.satisfies("+mpi"): args.append("--with-mpi-dir={0}".format(spec["mpi"].prefix)) else: args.append("--enable-serial") - if "+openmp" in spec: + if spec.satisfies("+openmp"): args.append("--enable-omp") - if "+scalapack" in spec: + if spec.satisfies("+scalapack"): args.append("--enable-scalapack") args.append("--with-blas-dir={0}".format(spec["blas"].prefix)) args.append("--with-lapack-dir={0}".format(spec["lapack"].prefix)) args.append("--with-scalapack-dir={0}".format(spec["scalapack"].prefix)) - if "+fftw" in spec: + if spec.satisfies("+fftw"): args.append("--enable-fftw") args.append("--with-fftw-dir={0}".format(spec["fftw"].prefix)) return args diff --git a/var/spack/repos/builtin/packages/hypre-cmake/package.py b/var/spack/repos/builtin/packages/hypre-cmake/package.py index f794658cf77db4..df5be36f64b4df 100644 --- a/var/spack/repos/builtin/packages/hypre-cmake/package.py +++ b/var/spack/repos/builtin/packages/hypre-cmake/package.py @@ -82,7 +82,7 @@ def cmake_args(self): return args def setup_build_environment(self, env): - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): env.set("CUDA_HOME", self.spec["cuda"].prefix) env.set("CUDA_PATH", self.spec["cuda"].prefix) cuda_arch = self.spec.variants["cuda_arch"].value @@ -90,7 +90,7 @@ def setup_build_environment(self, env): arch_sorted = list(sorted(cuda_arch, reverse=True)) env.set("HYPRE_CUDA_SM", arch_sorted[0]) # In CUDA builds hypre currently doesn't handle flags correctly - env.append_flags("CXXFLAGS", "-O2" if "~debug" in self.spec else "-g") + env.append_flags("CXXFLAGS", "-O2" if self.spec.satisfies("~debug") else "-g") extra_install_tests = join_path("src", "examples") @@ -152,6 +152,6 @@ def libs(self): """Export the hypre library. Sample usage: spec['hypre'].libs.ld_flags """ - is_shared = "+shared" in self.spec + is_shared = self.spec.satisfies("+shared") libs = find_libraries("libHYPRE", root=self.prefix, shared=is_shared, recursive=True) return libs or None diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index ad0659072de0c6..8d734bdc138009 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -329,7 +329,7 @@ def configure_args(self): configure_args.append("--with-magma-lib=%s" % spec["magma"].libs) configure_args.append("--with-magma") - if "+gpu-aware-mpi" in spec: + if spec.satisfies("+gpu-aware-mpi"): configure_args.append("--enable-gpu-aware-mpi") configure_args.extend(self.enable_or_disable("fortran")) @@ -348,7 +348,7 @@ def setup_build_environment(self, env): env.set("CUDA_HOME", spec["cuda"].prefix) env.set("CUDA_PATH", spec["cuda"].prefix) # In CUDA builds hypre currently doesn't handle flags correctly - env.append_flags("CXXFLAGS", "-O2" if "~debug" in spec else "-g") + env.append_flags("CXXFLAGS", "-O2" if spec.satisfies("~debug") else "-g") if spec.satisfies("+rocm"): # As of 2022/04/05, the following are set by 'llvm-amdgpu' and @@ -426,6 +426,6 @@ def libs(self): """Export the hypre library. Sample usage: spec['hypre'].libs.ld_flags """ - is_shared = "+shared" in self.spec + is_shared = self.spec.satisfies("+shared") libs = find_libraries("libHYPRE", root=self.prefix, shared=is_shared, recursive=True) return libs or None diff --git a/var/spack/repos/builtin/packages/ibm-databroker/package.py b/var/spack/repos/builtin/packages/ibm-databroker/package.py index 422a9edf9a205a..8f3b4ed990ac8f 100644 --- a/var/spack/repos/builtin/packages/ibm-databroker/package.py +++ b/var/spack/repos/builtin/packages/ibm-databroker/package.py @@ -47,6 +47,6 @@ class IbmDatabroker(CMakePackage, PythonExtension): def cmake_args(self): args = [] args.append("-DDEFAULT_BE=redis") - if "+python" in self.spec: + if self.spec.satisfies("+python"): args.append("-DPYDBR=1") return args diff --git a/var/spack/repos/builtin/packages/icedtea/package.py b/var/spack/repos/builtin/packages/icedtea/package.py index d98e6c59d53696..9499abc5bfb6e7 100644 --- a/var/spack/repos/builtin/packages/icedtea/package.py +++ b/var/spack/repos/builtin/packages/icedtea/package.py @@ -158,9 +158,9 @@ def configure_args(self): os.environ["POTENTIAL_CC"] = os.environ["CC"] os.environ["WGET"] = self.spec["wget"].command.path args = [] - if "~X" in self.spec: + if self.spec.satisfies("~X"): args.append("--enable-headless") - if "+shenandoah" in self.spec: + if self.spec.satisfies("+shenandoah"): args.append("--with-hotspot-build=shenandoah") args.append("--with-hotspot-src-zip=" + self.stage[9].archive_file) args.append("--with-hotspot-checksum=no") diff --git a/var/spack/repos/builtin/packages/icon/package.py b/var/spack/repos/builtin/packages/icon/package.py index a1ab0d0745c13c..d5066545509456 100644 --- a/var/spack/repos/builtin/packages/icon/package.py +++ b/var/spack/repos/builtin/packages/icon/package.py @@ -144,13 +144,13 @@ def configure_args(self): ]: args += self.enable_or_disable(x) - if "+art" in self.spec: + if self.spec.satisfies("+art"): args.append("--enable-art") libs += self.spec["libxml2"].libs else: args.append("--disable-art") - if "+coupling" in self.spec: + if self.spec.satisfies("+coupling"): args.append("--enable-coupling") libs += self.spec["libfyaml"].libs else: @@ -168,7 +168,7 @@ def configure_args(self): ) libs += self.spec["serialbox:fortran"].libs - if "+grib2" in self.spec: + if self.spec.satisfies("+grib2"): args.append("--enable-grib2") libs += self.spec["eccodes:c"].libs else: @@ -179,7 +179,7 @@ def configure_args(self): libs += self.spec["netcdf-fortran"].libs libs += self.spec["netcdf-c"].libs - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): args.extend( [ "--enable-mpi", @@ -214,7 +214,7 @@ def configure_args(self): flags["ICON_BUNDLED_CFLAGS"].append("-O2") flags["FCFLAGS"].append("-g") flags["ICON_FCFLAGS"].append("-O2") - if "+ocean" in self.spec: + if self.spec.satisfies("+ocean"): flags["ICON_OCEAN_FCFLAGS"].extend(["-O3", "-fno-tree-loop-vectorize"]) args.extend( ["--enable-fcgroup-OCEAN", "ICON_OCEAN_PATH=src/hamocc:src/ocean:src/sea_ice"] @@ -239,10 +239,10 @@ def configure_args(self): ] ) - if "%oneapi+coupling" in self.spec: + if self.spec.satisfies("%oneapi+coupling"): flags["ICON_YAC_CFLAGS"].extend(["-O2", "-fp-model precise"]) - if "+ocean" in self.spec: + if self.spec.satisfies("+ocean"): flags["ICON_OCEAN_FCFLAGS"].extend( ["-O3", "-assume norealloc_lhs", "-reentrancy threaded"] ) @@ -250,10 +250,10 @@ def configure_args(self): ["--enable-fcgroup-OCEAN", "ICON_OCEAN_PATH=src/hamocc:src/ocean:src/sea_ice"] ) - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): flags["ICON_OCEAN_FCFLAGS"].extend(["-DOCE_SOLVE_OMP"]) - if "+ecrad" in self.spec: + if self.spec.satisfies("+ecrad"): flags["ICON_ECRAD_FCFLAGS"].extend(["-qno-opt-dynamic-align", "-no-fma", "-fpe0"]) elif self.compiler.name == "nvhpc": @@ -267,7 +267,7 @@ def configure_args(self): ["-acc=gpu", "-gpu=cc{0}".format(self.nvidia_targets[gpu])] ) - if "%nvhpc@:23.9+coupling" in self.spec: + if self.spec.satisfies("%nvhpc@:23.9+coupling"): args.append("yac_cv_fc_is_contiguous_works=yes") else: diff --git a/var/spack/repos/builtin/packages/igraph/package.py b/var/spack/repos/builtin/packages/igraph/package.py index f201aa97ab6592..c741f316f1c00e 100644 --- a/var/spack/repos/builtin/packages/igraph/package.py +++ b/var/spack/repos/builtin/packages/igraph/package.py @@ -51,7 +51,7 @@ def cmake_args(self): "-DBLA_VENDOR=OpenBLAS", ] - if "+shared" in self.spec: + if self.spec.satisfies("+shared"): args.append("-DBUILD_SHARED_LIBS=ON") else: args.append("-DBUILD_SHARED_LIBS=OFF") diff --git a/var/spack/repos/builtin/packages/igv/package.py b/var/spack/repos/builtin/packages/igv/package.py index 62c4817c9cae9d..ca3d1bc8431485 100644 --- a/var/spack/repos/builtin/packages/igv/package.py +++ b/var/spack/repos/builtin/packages/igv/package.py @@ -34,7 +34,7 @@ def install(self, spec, prefix): mkdirp(prefix.bin) install("igv.args", prefix) files = ["igv.sh", "igv_hidpi.sh"] - if "+igvtools" in spec: + if spec.satisfies("+igvtools"): files.extend(["igvtools", "igvtools_gui", "igvtools_gui_hidpi"]) for f in files: filter_file("^prefix=.*$", "prefix=" + prefix, f) diff --git a/var/spack/repos/builtin/packages/infernal/package.py b/var/spack/repos/builtin/packages/infernal/package.py index a3ac6998c57395..90ef8da99b46e3 100644 --- a/var/spack/repos/builtin/packages/infernal/package.py +++ b/var/spack/repos/builtin/packages/infernal/package.py @@ -30,7 +30,7 @@ class Infernal(AutotoolsPackage): def configure_args(self): args = [] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): args.append("--enable-mpi") else: args.append("--disable-mpi") diff --git a/var/spack/repos/builtin/packages/intel-llvm/package.py b/var/spack/repos/builtin/packages/intel-llvm/package.py index 5c5fbe17d8c1e0..c87b61c5e6ea43 100644 --- a/var/spack/repos/builtin/packages/intel-llvm/package.py +++ b/var/spack/repos/builtin/packages/intel-llvm/package.py @@ -32,7 +32,7 @@ def setup_build_environment(self, env): env.append_flags("CXXFLAGS", self.compiler.cxx11_flag) def setup_run_environment(self, env): - if "+clang" in self.spec: + if self.spec.satisfies("+clang"): env.set("CC", join_path(self.spec.prefix.bin, "clang")) env.set("CXX", join_path(self.spec.prefix.bin, "clang++")) diff --git a/var/spack/repos/builtin/packages/intel-mpi-benchmarks/package.py b/var/spack/repos/builtin/packages/intel-mpi-benchmarks/package.py index 5ef9e675a9450c..1ed9b1ce1517ba 100644 --- a/var/spack/repos/builtin/packages/intel-mpi-benchmarks/package.py +++ b/var/spack/repos/builtin/packages/intel-mpi-benchmarks/package.py @@ -98,25 +98,25 @@ def parallel(self): def build_targets(self): spec = self.spec targets = [] - if "+mpi1" in spec: + if spec.satisfies("+mpi1"): targets.append("MPI1") - if "+ext" in spec: + if spec.satisfies("+ext"): targets.append("EXT") - if "+io" in spec: + if spec.satisfies("+io"): targets.append("IO") - if "+nbc" in spec: + if spec.satisfies("+nbc"): targets.append("NBC") - if "+p2p" in spec: + if spec.satisfies("+p2p"): targets.append("P2P") - if "+rma" in spec: + if spec.satisfies("+rma"): targets.append("RMA") - if "+mt" in spec: + if spec.satisfies("+mt"): targets.append("MT") if spec.satisfies("@2019:"): targets = ["TARGET=" + target for target in targets] - if "+check" in spec: + if spec.satisfies("+check"): targets.append("CPPFLAGS=-DCHECK") return targets @@ -129,17 +129,17 @@ def install(self, spec, prefix): mkdir(prefix.bin) with working_dir(self.build_directory): - if "+mpi1" in spec: + if spec.satisfies("+mpi1"): install("IMB-MPI1", prefix.bin) - if "+ext" in spec: + if spec.satisfies("+ext"): install("IMB-EXT", prefix.bin) - if "+io" in spec: + if spec.satisfies("+io"): install("IMB-IO", prefix.bin) - if "+nbc" in spec: + if spec.satisfies("+nbc"): install("IMB-NBC", prefix.bin) - if "+p2p" in spec: + if spec.satisfies("+p2p"): install("IMB-P2P", prefix.bin) - if "+rma" in spec: + if spec.satisfies("+rma"): install("IMB-RMA", prefix.bin) - if "+mt" in spec: + if spec.satisfies("+mt"): install("IMB-MT", prefix.bin) diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py index 98485a754af905..023af78e4a056d 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py @@ -157,15 +157,15 @@ def component_dir(self): @property def env_script_args(self): - if "+external-libfabric" in self.spec: + if self.spec.satisfies("+external-libfabric"): return ("-i_mpi_ofi_internal=0",) else: return () def wrapper_names(self): - if "+generic-names" in self.spec: + if self.spec.satisfies("+generic-names"): return ["mpicc", "mpicxx", "mpif77", "mpif90", "mpifc"] - elif "+classic-names" in self.spec: + elif self.spec.satisfies("+classic-names"): return ["mpiicc", "mpiicpc", "mpiifort", "mpiifort", "mpiifort"] else: return ["mpiicx", "mpiicpx", "mpiifx", "mpiifx", "mpiifx"] @@ -202,14 +202,14 @@ def setup_dependent_build_environment(self, env, dependent_spec): @property def libs(self): libs = [] - if "+ilp64" in self.spec: + if self.spec.satisfies("+ilp64"): libs += find_libraries("libmpi_ilp64", self.component_prefix.lib.release) libs += find_libraries(["libmpicxx", "libmpifort"], self.component_prefix.lib) libs += find_libraries("libmpi", self.component_prefix.lib.release) libs += find_system_libraries(["libdl", "librt", "libpthread"]) # Find libfabric for libmpi.so - if "+external-libfabric" in self.spec: + if self.spec.satisfies("+external-libfabric"): libs += self.spec["libfabric"].libs else: libs += find_libraries(["libfabric"], self.component_prefix.libfabric.lib) diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py index d3c6e9fef913f2..4598ce164351b3 100644 --- a/var/spack/repos/builtin/packages/intel-tbb/package.py +++ b/var/spack/repos/builtin/packages/intel-tbb/package.py @@ -187,7 +187,7 @@ def url_for_version(self, version): @property def libs(self): - shared = True if "+shared" in self.spec else False + shared = True if self.spec.satisfies("+shared") else False return find_libraries("libtbb*", root=self.prefix, shared=shared, recursive=True) diff --git a/var/spack/repos/builtin/packages/intel-xed/package.py b/var/spack/repos/builtin/packages/intel-xed/package.py index b1ff16d51f0fea..1d1a547d5d984b 100644 --- a/var/spack/repos/builtin/packages/intel-xed/package.py +++ b/var/spack/repos/builtin/packages/intel-xed/package.py @@ -124,11 +124,11 @@ def install(self, spec, prefix): "--no-werror", f"--prefix={prefix}", ) - if "+optimize" in spec: + if spec.satisfies("+optimize"): mfile.add_default_arg("--opt=2") - if "+debug" in spec: + if spec.satisfies("+debug"): mfile.add_default_arg("--debug") - if "+pic" in spec: + if spec.satisfies("+pic"): mfile.add_default_arg( f"--extra-ccflags={self.compiler.cc_pic_flag}", f"--extra-cxxflags={self.compiler.cxx_pic_flag}", @@ -144,11 +144,11 @@ def install(self, spec, prefix): mfile( f"--install-dir={shared_kit}", "--shared", - *(["examples"] if "+examples" in spec else []), + *(["examples"] if spec.satisfies("+examples") else []), "install", ) - if "+examples" in self.spec: + if self.spec.satisfies("+examples"): # Install the example binaries to share/xed/examples install_tree(join_path(shared_kit, "bin"), prefix.share.xed.examples) diff --git a/var/spack/repos/builtin/packages/ior/package.py b/var/spack/repos/builtin/packages/ior/package.py index d8bb3f97e968d8..72e4a62c81ef33 100644 --- a/var/spack/repos/builtin/packages/ior/package.py +++ b/var/spack/repos/builtin/packages/ior/package.py @@ -66,18 +66,18 @@ def configure_args(self): env["CC"] = spec["mpi"].mpicc - if "+hdf5" in spec: + if spec.satisfies("+hdf5"): config_args.append("--with-hdf5") config_args.append("CFLAGS=-D H5_USE_16_API") else: config_args.append("--without-hdf5") - if "+ncmpi" in spec: + if spec.satisfies("+ncmpi"): config_args.append("--with-ncmpi") else: config_args.append("--without-ncmpi") - if "+lustre" in spec: + if spec.satisfies("+lustre"): config_args.append("--with-lustre") else: config_args.append("--without-lustre") diff --git a/var/spack/repos/builtin/packages/ipm/package.py b/var/spack/repos/builtin/packages/ipm/package.py index f522fb7296963c..9eb248ff526f40 100644 --- a/var/spack/repos/builtin/packages/ipm/package.py +++ b/var/spack/repos/builtin/packages/ipm/package.py @@ -79,25 +79,25 @@ def autoreconf(self, spec, prefix): def configure_args(self): args = [] spec = self.spec - if "+papi" in spec: + if spec.satisfies("+papi"): args.append("--with-papi={0}".format(spec["papi"].prefix)) - if "+cuda" in spec: + if spec.satisfies("+cuda"): args.append("--with-cudapath={0}".format(spec["cuda"].prefix)) - if "+libunwind" in spec: + if spec.satisfies("+libunwind"): args.append("--with-libunwind={0}".format(spec["libunwind"].prefix)) - if "+papi_multiplexing" in spec: + if spec.satisfies("+papi_multiplexing"): args.append("--enable-papi-multiplexing") - if "+posixio" in spec: + if spec.satisfies("+posixio"): args.append("--enable-posixio") - if "+pmon" in spec: + if spec.satisfies("+pmon"): args.append("--enable-pmon") - if "+coll_details" in spec: + if spec.satisfies("+coll_details"): args.append("--enable-coll-details") args.extend( diff --git a/var/spack/repos/builtin/packages/ipopt/package.py b/var/spack/repos/builtin/packages/ipopt/package.py index 39f63123bef358..f8dee2e8c31b41 100644 --- a/var/spack/repos/builtin/packages/ipopt/package.py +++ b/var/spack/repos/builtin/packages/ipopt/package.py @@ -93,7 +93,7 @@ def configure_args(self): else: args.extend(["--with-lapack-lflags={0} {1}".format(lapack_lib, blas_lib)]) - if "+mumps" in spec: + if spec.satisfies("+mumps"): mumps_dir = spec["mumps"].prefix mumps_flags = "-ldmumps -lmumps_common -lpord -lmpiseq" mumps_libcmd = "-L%s " % mumps_dir.lib + mumps_flags @@ -113,7 +113,7 @@ def configure_args(self): ] ) - if "coinhsl" in spec: + if spec.satisfies("^coinhsl"): hsl_ld_flags = "-ldl {0}".format(spec["coinhsl"].libs.ld_flags) if spec.satisfies("^coinhsl+blas"): @@ -135,7 +135,7 @@ def configure_args(self): ] ) - if "metis" in spec: + if spec.satisfies("^metis"): if spec.satisfies("@:3.12.13"): args.extend( [ @@ -147,7 +147,7 @@ def configure_args(self): # The IPOPT configure file states that '--enable-debug' implies # '--disable-shared', but adding '--enable-shared' overrides # '--disable-shared' and builds a shared library with debug symbols - if "+debug" in spec: + if spec.satisfies("+debug"): args.append("--enable-debug") else: args.append("--disable-debug") diff --git a/var/spack/repos/builtin/packages/iq-tree/package.py b/var/spack/repos/builtin/packages/iq-tree/package.py index 15ac27772a7b40..25bc11cf593066 100644 --- a/var/spack/repos/builtin/packages/iq-tree/package.py +++ b/var/spack/repos/builtin/packages/iq-tree/package.py @@ -57,13 +57,13 @@ def cmake_args(self): args = [] iqflags = [] - if "+lsd2" in spec: + if spec.satisfies("+lsd2"): args.append("-DUSE_LSD2=ON") - if "+openmp" in spec: + if spec.satisfies("+openmp"): iqflags.append("omp") - if "+mpi" in spec: + if spec.satisfies("+mpi"): iqflags.append("mpi") if not iqflags: diff --git a/var/spack/repos/builtin/packages/itensor/package.py b/var/spack/repos/builtin/packages/itensor/package.py index 4efc48948abc7c..12ba468096a722 100644 --- a/var/spack/repos/builtin/packages/itensor/package.py +++ b/var/spack/repos/builtin/packages/itensor/package.py @@ -92,12 +92,12 @@ def edit(self, spec, prefix): filter_file(r"^BLAS_LAPACK_LIBFLAGS.+", vlib, mf) # 3.HDF5 - if "+hdf5" in spec: + if spec.satisfies("+hdf5"): hdf5p = f"HDF5_PREFIX={spec['hdf5'].prefix.lib}" filter_file("^#HDF5.+", hdf5p, mf) # 4.openmp - if "+openmp" in spec: + if spec.satisfies("+openmp"): filter_file("#ITENSOR_USE_OMP", "ITENSOR_USE_OMP", mf) filter_file("-fopenmp", self.compiler.openmp_flag, mf) @@ -105,7 +105,7 @@ def edit(self, spec, prefix): filter_file(r"^PREFIX.+", f"PREFIX={os.getcwd()}", mf) # 5.shared - if "+shared" in spec: + if spec.satisfies("+shared"): filter_file("ITENSOR_MAKE_DYLIB=0", "ITENSOR_MAKE_DYLIB=1", mf) def install(self, spec, prefix): From 314a3fbe7735cf2b07cceb4e2e1f4c8bca75e100 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 18 Sep 2024 02:54:39 +0200 Subject: [PATCH 177/687] Bump archspec to latest commit (#46445) This should fix an issue with Neoverse XX detection Signed-off-by: Massimiliano Culpo --- lib/spack/external/__init__.py | 2 +- .../external/archspec/json/cpu/microarchitectures.json | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/spack/external/__init__.py b/lib/spack/external/__init__.py index f6f481a6ae47c3..b6a35925d5cc1b 100644 --- a/lib/spack/external/__init__.py +++ b/lib/spack/external/__init__.py @@ -18,7 +18,7 @@ * Homepage: https://pypi.python.org/pypi/archspec * Usage: Labeling, comparison and detection of microarchitectures -* Version: 0.2.5-dev (commit 7e6740012b897ae4a950f0bba7e9726b767e921f) +* Version: 0.2.5-dev (commit cbb1fd5eb397a70d466e5160b393b87b0dbcc78f) astunparse ---------------- diff --git a/lib/spack/external/archspec/json/cpu/microarchitectures.json b/lib/spack/external/archspec/json/cpu/microarchitectures.json index 5e1b2851e80125..bb73dd0195f2d5 100644 --- a/lib/spack/external/archspec/json/cpu/microarchitectures.json +++ b/lib/spack/external/archspec/json/cpu/microarchitectures.json @@ -2844,8 +2844,7 @@ "asimdrdm", "lrcpc", "dcpop", - "asimddp", - "ssbs" + "asimddp" ], "compilers" : { "gcc": [ @@ -2942,7 +2941,6 @@ "uscat", "ilrcpc", "flagm", - "ssbs", "dcpodp", "svei8mm", "svebf16", @@ -3010,7 +3008,7 @@ }, { "versions": "11:", - "flags" : "-march=armv8.4-a+sve+ssbs+fp16+bf16+crypto+i8mm+rng" + "flags" : "-march=armv8.4-a+sve+fp16+bf16+crypto+i8mm+rng" }, { "versions": "12:", @@ -3066,7 +3064,6 @@ "uscat", "ilrcpc", "flagm", - "ssbs", "sb", "dcpodp", "sve2", @@ -3179,7 +3176,6 @@ "uscat", "ilrcpc", "flagm", - "ssbs", "sb", "dcpodp", "sve2", From 28e3295fb04d8d502b2fae7894f1942af86875aa Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 18 Sep 2024 09:07:23 +0200 Subject: [PATCH 178/687] Add GHA for circular imports regressions (#46436) --- .github/workflows/valid-style.yml | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/.github/workflows/valid-style.yml b/.github/workflows/valid-style.yml index feaa64484e3ef2..8bc58efff75f2e 100644 --- a/.github/workflows/valid-style.yml +++ b/.github/workflows/valid-style.yml @@ -87,3 +87,62 @@ jobs: spack -d bootstrap now --dev spack style -t black spack unit-test -V + import-check: + runs-on: ubuntu-latest + steps: + - uses: julia-actions/setup-julia@v2 + with: + version: '1.10' + - uses: julia-actions/cache@v2 + + # PR: use the base of the PR as the old commit + - name: Checkout PR base commit + if: github.event_name == 'pull_request' + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + ref: ${{ github.event.pull_request.base.sha }} + path: old + # not a PR: use the previous commit as the old commit + - name: Checkout previous commit + if: github.event_name != 'pull_request' + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + fetch-depth: 2 + path: old + - name: Checkout previous commit + if: github.event_name != 'pull_request' + run: git -C old reset --hard HEAD^ + + - name: Checkout new commit + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + path: new + - name: Install circular import checker + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + repository: haampie/circular-import-fighter + ref: 555519c6fd5564fd2eb844e7b87e84f4d12602e2 + path: circular-import-fighter + - name: Install dependencies + working-directory: circular-import-fighter + run: make -j dependencies + - name: Import cycles before + working-directory: circular-import-fighter + run: make SPACK_ROOT=../old && cp solution solution.old + - name: Import cycles after + working-directory: circular-import-fighter + run: make clean-graph && make SPACK_ROOT=../new && cp solution solution.new + - name: Compare import cycles + working-directory: circular-import-fighter + run: | + edges_before="$(grep -oP 'edges to delete: \K\d+' solution.old)" + edges_after="$(grep -oP 'edges to delete: \K\d+' solution.new)" + if [ "$edges_after" -gt "$edges_before" ]; then + printf '\033[1;31mImport check failed: %s imports need to be deleted, ' "$edges_after" + printf 'previously this was %s\033[0m\n' "$edges_before" + printf 'Compare \033[1;97m"Import cycles before"\033[0m and ' + printf '\033[1;97m"Import cycles after"\033[0m to see problematic imports.\n' + exit 1 + else + printf '\033[1;32mImport check passed: %s <= %s\033[0m\n' "$edges_after" "$edges_before" + fi From fe5d7881f5a5ec72e2ffbeccc647968dee44214e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 10:34:23 +0200 Subject: [PATCH 179/687] avoid multiprocessing in tests (#46439) - silences a few pytest warnings related to forking in xdist - speeds up a few tests / avoids possible oversubscription in xdist --- lib/spack/spack/detection/path.py | 3 ++- lib/spack/spack/stage.py | 4 ++-- lib/spack/spack/test/conftest.py | 8 +++++--- lib/spack/spack/util/parallel.py | 19 ++++++++++++------- lib/spack/spack/util/web.py | 4 ++-- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/spack/spack/detection/path.py b/lib/spack/spack/detection/path.py index 3588d96115cfdf..7316d9124a7c3c 100644 --- a/lib/spack/spack/detection/path.py +++ b/lib/spack/spack/detection/path.py @@ -23,6 +23,7 @@ import spack.util.environment import spack.util.environment as environment import spack.util.ld_so_conf +import spack.util.parallel from .common import ( WindowsCompilerExternalPaths, @@ -407,7 +408,7 @@ def by_path( result = collections.defaultdict(list) repository = spack.repo.PATH.ensure_unwrapped() - with concurrent.futures.ProcessPoolExecutor(max_workers=max_workers) as executor: + with spack.util.parallel.make_concurrent_executor(max_workers, require_fork=False) as executor: for pkg in packages_to_search: executable_future = executor.submit( executables_finder.find, diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 776b3ce6b94b67..ee3b4e95e549d8 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -2,7 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import concurrent.futures import errno import getpass import glob @@ -40,6 +39,7 @@ import spack.spec import spack.util.crypto import spack.util.lock +import spack.util.parallel import spack.util.path as sup import spack.util.pattern as pattern import spack.util.url as url_util @@ -1132,7 +1132,7 @@ def get_checksums_for_versions( if checksum is not None: version_hashes[version] = checksum - with concurrent.futures.ProcessPoolExecutor(max_workers=concurrency) as executor: + with spack.util.parallel.make_concurrent_executor(concurrency, require_fork=False) as executor: results = [] for url, version in search_arguments: future = executor.submit(_fetch_and_checksum, url, fetch_options, keep_stage) diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 607844265fff5b..2726061cb3ff3f 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -1980,12 +1980,14 @@ def pytest_runtest_setup(item): pytest.skip(*not_on_windows_marker.args) +def _sequential_executor(*args, **kwargs): + return spack.util.parallel.SequentialExecutor() + + @pytest.fixture(autouse=True) def disable_parallel_buildcache_push(monkeypatch): """Disable process pools in tests.""" - monkeypatch.setattr( - spack.util.parallel, "make_concurrent_executor", spack.util.parallel.SequentialExecutor - ) + monkeypatch.setattr(spack.util.parallel, "make_concurrent_executor", _sequential_executor) def _root_path(x, y, *, path): diff --git a/lib/spack/spack/util/parallel.py b/lib/spack/spack/util/parallel.py index 9bbdf5dd7a35ef..b16adb88582156 100644 --- a/lib/spack/spack/util/parallel.py +++ b/lib/spack/spack/util/parallel.py @@ -9,7 +9,7 @@ import traceback from typing import Optional -from spack.config import determine_number_of_jobs +import spack.config class ErrorFromWorker: @@ -98,9 +98,14 @@ def submit(self, fn, *args, **kwargs): return future -def make_concurrent_executor() -> concurrent.futures.Executor: - """Can't use threading because it's unsafe, and can't use spawned processes because of globals. - That leaves only forking.""" - if multiprocessing.get_start_method() == "fork": - return concurrent.futures.ProcessPoolExecutor(determine_number_of_jobs(parallel=True)) - return SequentialExecutor() +def make_concurrent_executor( + jobs: Optional[int] = None, *, require_fork: bool = True +) -> concurrent.futures.Executor: + """Create a concurrent executor. If require_fork is True, then the executor is sequential + if the platform does not enable forking as the default start method. Effectively + require_fork=True makes the executor sequential in the current process on Windows, macOS, and + Linux from Python 3.14+ (which changes defaults)""" + if require_fork and multiprocessing.get_start_method() != "fork": + return SequentialExecutor() + jobs = jobs or spack.config.determine_number_of_jobs(parallel=True) + return concurrent.futures.ProcessPoolExecutor(jobs) diff --git a/lib/spack/spack/util/web.py b/lib/spack/spack/util/web.py index 9a0f1d6e4b6ed5..892b64d333d22e 100644 --- a/lib/spack/spack/util/web.py +++ b/lib/spack/spack/util/web.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import codecs -import concurrent.futures import email.message import errno import json @@ -30,6 +29,7 @@ import spack.config import spack.error import spack.util.executable +import spack.util.parallel import spack.util.path import spack.util.url as url_util @@ -641,7 +641,7 @@ def spider( root = urllib.parse.urlparse(root_str) spider_args.append((root, go_deeper, _visited)) - with concurrent.futures.ProcessPoolExecutor(max_workers=concurrency) as tp: + with spack.util.parallel.make_concurrent_executor(concurrency, require_fork=False) as tp: while current_depth <= depth: tty.debug( f"SPIDER: [depth={current_depth}, max_depth={depth}, urls={len(spider_args)}]" From d0b736607b8ce08c1a44550f20a50439497e3187 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 12:29:56 +0200 Subject: [PATCH 180/687] spack.util.url: fix join breakage in python 3.12.6 (#46453) --- lib/spack/spack/test/util/util_url.py | 208 ++++++++------------------ lib/spack/spack/util/url.py | 194 ++++-------------------- 2 files changed, 84 insertions(+), 318 deletions(-) diff --git a/lib/spack/spack/test/util/util_url.py b/lib/spack/spack/test/util/util_url.py index befaaef1cd0620..0666d7a28fdc73 100644 --- a/lib/spack/spack/test/util/util_url.py +++ b/lib/spack/spack/test/util/util_url.py @@ -8,6 +8,8 @@ import os.path import urllib.parse +import pytest + import spack.util.path import spack.util.url as url_util @@ -45,155 +47,63 @@ def test_relative_path_to_file_url(tmpdir): assert os.path.samefile(roundtrip, path) -def test_url_join_local_paths(): - # Resolve local link against page URL - - # wrong: - assert ( - url_util.join("s3://bucket/index.html", "../other-bucket/document.txt") - == "s3://bucket/other-bucket/document.txt" - ) - - # correct - need to specify resolve_href=True: - assert ( - url_util.join("s3://bucket/index.html", "../other-bucket/document.txt", resolve_href=True) - == "s3://other-bucket/document.txt" - ) - - # same as above: make sure several components are joined together correctly - assert ( - url_util.join( - # with resolve_href=True, first arg is the base url; can not be - # broken up - "s3://bucket/index.html", - # with resolve_href=True, remaining arguments are the components of - # the local href that needs to be resolved - "..", - "other-bucket", - "document.txt", - resolve_href=True, - ) - == "s3://other-bucket/document.txt" - ) - - # Append local path components to prefix URL - - # wrong: - assert ( - url_util.join("https://mirror.spack.io/build_cache", "my-package", resolve_href=True) - == "https://mirror.spack.io/my-package" - ) - - # correct - Need to specify resolve_href=False: - assert ( - url_util.join("https://mirror.spack.io/build_cache", "my-package", resolve_href=False) - == "https://mirror.spack.io/build_cache/my-package" - ) - - # same as above; make sure resolve_href=False is default - assert ( - url_util.join("https://mirror.spack.io/build_cache", "my-package") - == "https://mirror.spack.io/build_cache/my-package" - ) - - # same as above: make sure several components are joined together correctly - assert ( - url_util.join( - # with resolve_href=False, first arg is just a prefix. No - # resolution is done. So, there should be no difference between - # join('/a/b/c', 'd/e'), - # join('/a/b', 'c', 'd/e'), - # join('/a', 'b/c', 'd', 'e'), etc. - "https://mirror.spack.io", - "build_cache", - "my-package", - ) - == "https://mirror.spack.io/build_cache/my-package" - ) - - # For s3:// URLs, the "netloc" (bucket) is considered part of the path. - # Make sure join() can cross bucket boundaries in this case. - args = ["s3://bucket/a/b", "new-bucket", "c"] - assert url_util.join(*args) == "s3://bucket/a/b/new-bucket/c" - - args.insert(1, "..") - assert url_util.join(*args) == "s3://bucket/a/new-bucket/c" - - args.insert(1, "..") - assert url_util.join(*args) == "s3://bucket/new-bucket/c" - - # new-bucket is now the "netloc" (bucket name) - args.insert(1, "..") - assert url_util.join(*args) == "s3://new-bucket/c" - - -def test_url_join_absolute_paths(): - # Handling absolute path components is a little tricky. To this end, we - # distinguish "absolute path components", from the more-familiar concept of - # "absolute paths" as they are understood for local filesystem paths. - # - # - All absolute paths are absolute path components. Joining a URL with - # these components has the effect of completely replacing the path of the - # URL with the absolute path. These components do not specify a URL - # scheme, so the scheme of the URL procuced when joining them depend on - # those provided by components that came before it (file:// assumed if no - # such scheme is provided). - - # For eaxmple: - p = "/path/to/resource" - # ...is an absolute path - - # http:// URL - assert url_util.join("http://example.com/a/b/c", p) == "http://example.com/path/to/resource" - - # s3:// URL - # also notice how the netloc is treated as part of the path for s3:// URLs - assert url_util.join("s3://example.com/a/b/c", p) == "s3://path/to/resource" - - # - URL components that specify a scheme are always absolute path - # components. Joining a base URL with these components effectively - # discards the base URL and "resets" the joining logic starting at the - # component in question and using it as the new base URL. - - # For eaxmple: - p = "http://example.com/path/to" - # ...is an http:// URL - - join_result = url_util.join(p, "resource") - assert join_result == "http://example.com/path/to/resource" - - # works as if everything before the http:// URL was left out - assert url_util.join("literally", "does", "not", "matter", p, "resource") == join_result - - assert url_util.join("file:///a/b/c", "./d") == "file:///a/b/c/d" - - # Finally, resolve_href should have no effect for how absolute path - # components are handled because local hrefs can not be absolute path - # components. - args = [ - "s3://does", - "not", - "matter", - "http://example.com", - "also", - "does", - "not", - "matter", - "/path", - ] - - expected = "http://example.com/path" - assert url_util.join(*args, resolve_href=True) == expected - assert url_util.join(*args, resolve_href=False) == expected - - # resolve_href only matters for the local path components at the end of the - # argument list. - args[-1] = "/path/to/page" - args.extend(("..", "..", "resource")) - - assert url_util.join(*args, resolve_href=True) == "http://example.com/resource" - - assert url_util.join(*args, resolve_href=False) == "http://example.com/path/resource" +@pytest.mark.parametrize("resolve_href", [True, False]) +@pytest.mark.parametrize("scheme", ["http", "s3", "gs", "file"]) +def test_url_join_absolute(scheme, resolve_href): + """Test that joining a URL with an absolute path works the same for schemes we care about, and + whether we work in web browser mode or not.""" + netloc = "" if scheme == "file" else "example.com" + a1 = url_util.join(f"{scheme}://{netloc}/a/b/c", "/d/e/f", resolve_href=resolve_href) + a2 = url_util.join(f"{scheme}://{netloc}/a/b/c", "/d", "e", "f", resolve_href=resolve_href) + assert a1 == a2 == f"{scheme}://{netloc}/d/e/f" + + b1 = url_util.join(f"{scheme}://{netloc}/a", "https://b.com/b", resolve_href=resolve_href) + b2 = url_util.join(f"{scheme}://{netloc}/a", "https://b.com", "b", resolve_href=resolve_href) + assert b1 == b2 == "https://b.com/b" + + +@pytest.mark.parametrize("scheme", ["http", "s3", "gs"]) +def test_url_join_up(scheme): + """Test that the netloc component is preserved when going .. up in the path.""" + a1 = url_util.join(f"{scheme}://netloc/a/b.html", "c", resolve_href=True) + assert a1 == f"{scheme}://netloc/a/c" + b1 = url_util.join(f"{scheme}://netloc/a/b.html", "../c", resolve_href=True) + b2 = url_util.join(f"{scheme}://netloc/a/b.html", "..", "c", resolve_href=True) + assert b1 == b2 == f"{scheme}://netloc/c" + c1 = url_util.join(f"{scheme}://netloc/a/b.html", "../../c", resolve_href=True) + c2 = url_util.join(f"{scheme}://netloc/a/b.html", "..", "..", "c", resolve_href=True) + assert c1 == c2 == f"{scheme}://netloc/c" + + d1 = url_util.join(f"{scheme}://netloc/a/b", "c", resolve_href=False) + assert d1 == f"{scheme}://netloc/a/b/c" + d2 = url_util.join(f"{scheme}://netloc/a/b", "../c", resolve_href=False) + d3 = url_util.join(f"{scheme}://netloc/a/b", "..", "c", resolve_href=False) + assert d2 == d3 == f"{scheme}://netloc/a/c" + e1 = url_util.join(f"{scheme}://netloc/a/b", "../../c", resolve_href=False) + e2 = url_util.join(f"{scheme}://netloc/a/b", "..", "..", "c", resolve_href=False) + assert e1 == e2 == f"{scheme}://netloc/c" + f1 = url_util.join(f"{scheme}://netloc/a/b", "../../../c", resolve_href=False) + f2 = url_util.join(f"{scheme}://netloc/a/b", "..", "..", "..", "c", resolve_href=False) + assert f1 == f2 == f"{scheme}://netloc/c" + + +@pytest.mark.parametrize("scheme", ["http", "https", "ftp", "s3", "gs", "file"]) +def test_url_join_resolve_href(scheme): + """test that `resolve_href=True` behaves like a web browser at the base page, and + `resolve_href=False` behaves like joining paths in a file system at the base directory.""" + # these are equivalent because of the trailing / + netloc = "" if scheme == "file" else "netloc" + a1 = url_util.join(f"{scheme}://{netloc}/my/path/", "other/path", resolve_href=True) + a2 = url_util.join(f"{scheme}://{netloc}/my/path/", "other", "path", resolve_href=True) + assert a1 == a2 == f"{scheme}://{netloc}/my/path/other/path" + b1 = url_util.join(f"{scheme}://{netloc}/my/path", "other/path", resolve_href=False) + b2 = url_util.join(f"{scheme}://{netloc}/my/path", "other", "path", resolve_href=False) + assert b1 == b2 == f"{scheme}://{netloc}/my/path/other/path" + + # this is like a web browser: relative to /my. + c1 = url_util.join(f"{scheme}://{netloc}/my/path", "other/path", resolve_href=True) + c2 = url_util.join(f"{scheme}://{netloc}/my/path", "other", "path", resolve_href=True) + assert c1 == c2 == f"{scheme}://{netloc}/my/other/path" def test_default_download_name(): diff --git a/lib/spack/spack/util/url.py b/lib/spack/spack/util/url.py index 64671f1d95dfff..982e192a4c28e9 100644 --- a/lib/spack/spack/util/url.py +++ b/lib/spack/spack/util/url.py @@ -7,17 +7,13 @@ Utility functions for parsing, formatting, and manipulating URLs. """ -import itertools import os import posixpath import re -import sys import urllib.parse import urllib.request from typing import Optional -from llnl.path import convert_to_posix_path - from spack.util.path import sanitize_filename @@ -29,26 +25,6 @@ def validate_scheme(scheme): return scheme in ("file", "http", "https", "ftp", "s3", "gs", "ssh", "git") -def _split_all(path): - """Split path into its atomic components. - - Returns the shortest list, L, of strings such that posixpath.join(*L) == - path and posixpath.split(element) == ('', element) for every element in L - except possibly the first. This first element may possibly have the value - of '/'. - """ - result = [] - a = path - old_a = None - while a != old_a: - (old_a, (a, b)) = a, posixpath.split(a) - - if a or b: - result.insert(0, b or "/") - - return result - - def local_file_path(url): """Get a local file path from a url. @@ -92,151 +68,31 @@ def format(parsed_url): return parsed_url.geturl() -def join(base_url, path, *extra, **kwargs): - """Joins a base URL with one or more local URL path components - - If resolve_href is True, treat the base URL as though it where the locator - of a web page, and the remaining URL path components as though they formed - a relative URL to be resolved against it (i.e.: as in posixpath.join(...)). - The result is an absolute URL to the resource to which a user's browser - would navigate if they clicked on a link with an "href" attribute equal to - the relative URL. - - If resolve_href is False (default), then the URL path components are joined - as in posixpath.join(). - - Note: file:// URL path components are not canonicalized as part of this - operation. To canonicalize, pass the joined url to format(). - - Examples: - base_url = 's3://bucket/index.html' - body = fetch_body(prefix) - link = get_href(body) # link == '../other-bucket/document.txt' - - # wrong - link is a local URL that needs to be resolved against base_url - spack.util.url.join(base_url, link) - 's3://bucket/other_bucket/document.txt' - - # correct - resolve local URL against base_url - spack.util.url.join(base_url, link, resolve_href=True) - 's3://other_bucket/document.txt' - - prefix = 'https://mirror.spack.io/build_cache' - - # wrong - prefix is just a URL prefix - spack.util.url.join(prefix, 'my-package', resolve_href=True) - 'https://mirror.spack.io/my-package' - - # correct - simply append additional URL path components - spack.util.url.join(prefix, 'my-package', resolve_href=False) # default - 'https://mirror.spack.io/build_cache/my-package' - - # For canonicalizing file:// URLs, take care to explicitly differentiate - # between absolute and relative join components. - """ - paths = [ - (x) if isinstance(x, str) else x.geturl() for x in itertools.chain((base_url, path), extra) - ] - - paths = [convert_to_posix_path(x) for x in paths] - n = len(paths) - last_abs_component = None - scheme = "" - for i in range(n - 1, -1, -1): - obj = urllib.parse.urlparse(paths[i], scheme="", allow_fragments=False) - - scheme = obj.scheme - - # in either case the component is absolute - if scheme or obj.path.startswith("/"): - if not scheme: - # Without a scheme, we have to go back looking for the - # next-last component that specifies a scheme. - for j in range(i - 1, -1, -1): - obj = urllib.parse.urlparse(paths[j], scheme="", allow_fragments=False) - - if obj.scheme: - paths[i] = "{SM}://{NL}{PATH}".format( - SM=obj.scheme, - NL=((obj.netloc + "/") if obj.scheme != "s3" else ""), - PATH=paths[i][1:], - ) - break - - last_abs_component = i - break - - if last_abs_component is not None: - paths = paths[last_abs_component:] - if len(paths) == 1: - result = urllib.parse.urlparse(paths[0], scheme="file", allow_fragments=False) - - # another subtlety: If the last argument to join() is an absolute - # file:// URL component with a relative path, the relative path - # needs to be resolved. - if result.scheme == "file" and result.netloc: - result = urllib.parse.ParseResult( - scheme=result.scheme, - netloc="", - path=posixpath.abspath(result.netloc + result.path), - params=result.params, - query=result.query, - fragment=None, - ) - - return result.geturl() - - return _join(*paths, **kwargs) - - -def _join(base_url, path, *extra, **kwargs): - base_url = urllib.parse.urlparse(base_url) - resolve_href = kwargs.get("resolve_href", False) - - (scheme, netloc, base_path, params, query, _) = base_url - scheme = scheme.lower() - - path_tokens = [ - part - for part in itertools.chain( - _split_all(path), - itertools.chain.from_iterable(_split_all(extra_path) for extra_path in extra), - ) - if part and part != "/" - ] - - base_path_args = ["/fake-root"] - if scheme == "s3": - if netloc: - base_path_args.append(netloc) - - if base_path.startswith("/"): - base_path = base_path[1:] - - base_path_args.append(base_path) - - if resolve_href: - new_base_path, _ = posixpath.split(posixpath.join(*base_path_args)) - base_path_args = [new_base_path] - - base_path_args.extend(path_tokens) - base_path = posixpath.relpath(posixpath.join(*base_path_args), "/fake-root") - - if scheme == "s3": - path_tokens = [part for part in _split_all(base_path) if part and part != "/"] - - if path_tokens: - netloc = path_tokens.pop(0) - base_path = posixpath.join("", *path_tokens) - - if sys.platform == "win32": - base_path = convert_to_posix_path(base_path) - - return format( - urllib.parse.ParseResult( - scheme=scheme, netloc=netloc, path=base_path, params=params, query=query, fragment=None - ) - ) +def join(base: str, *components: str, resolve_href: bool = False, **kwargs) -> str: + """Convenience wrapper around ``urllib.parse.urljoin``, with a few differences: + 1. By default resolve_href=False, which makes the function like os.path.join: for example + https://example.com/a/b + c/d = https://example.com/a/b/c/d. If resolve_href=True, the + behavior is how a browser would resolve the URL: https://example.com/a/c/d. + 2. s3:// and gs:// URLs are joined like http:// URLs. + 3. It accepts multiple components for convenience. Note that components[1:] are treated as + literal path components and appended to components[0] separated by slashes.""" + # Ensure a trailing slash in the path component of the base URL to get os.path.join-like + # behavior instead of web browser behavior. + if not resolve_href: + parsed = urllib.parse.urlparse(base) + if not parsed.path.endswith("/"): + base = parsed._replace(path=f"{parsed.path}/").geturl() + uses_netloc = urllib.parse.uses_netloc + uses_relative = urllib.parse.uses_relative + try: + # NOTE: we temporarily modify urllib internals so s3 and gs schemes are treated like http. + # This is non-portable, and may be forward incompatible with future cpython versions. + urllib.parse.uses_netloc = [*uses_netloc, "s3", "gs"] + urllib.parse.uses_relative = [*uses_relative, "s3", "gs"] + return urllib.parse.urljoin(base, "/".join(components), **kwargs) + finally: + urllib.parse.uses_netloc = uses_netloc + urllib.parse.uses_relative = uses_relative def default_download_filename(url: str) -> str: From 7395656663d21f7c679f64fdee5892f62b96fa6f Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 13:08:05 +0200 Subject: [PATCH 181/687] docs: refer to upstreams.yaml in chain.rst title (#46475) --- lib/spack/docs/chain.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/spack/docs/chain.rst b/lib/spack/docs/chain.rst index bd0241c8bb81fc..46300e6681a1fd 100644 --- a/lib/spack/docs/chain.rst +++ b/lib/spack/docs/chain.rst @@ -5,9 +5,9 @@ .. chain: -============================ -Chaining Spack Installations -============================ +============================================= +Chaining Spack Installations (upstreams.yaml) +============================================= You can point your Spack installation to another installation to use any packages that are installed there. To register the other Spack instance, From b1db22d406e18f95d85f7f4b0c23dfd0aac09a48 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 14:01:33 +0200 Subject: [PATCH 182/687] run-unit-tests: no xdist if coverage (#46480) xdist only slows down unit tests under coverage --- share/spack/qa/run-unit-tests | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/spack/qa/run-unit-tests b/share/spack/qa/run-unit-tests index ca9b0752f1bb68..28e34a71208995 100755 --- a/share/spack/qa/run-unit-tests +++ b/share/spack/qa/run-unit-tests @@ -47,7 +47,7 @@ $coverage_run $(which spack) python -c "import spack.pkg.builtin.mpileaks; repr( # Run unit tests with code coverage #----------------------------------------------------------- # Check if xdist is available -if python -m pytest -VV 2>&1 | grep xdist; then +if [[ "$UNIT_TEST_COVERAGE" != "true" ]] && python -m pytest -VV 2>&1 | grep xdist; then export PYTEST_ADDOPTS="$PYTEST_ADDOPTS --dist loadfile --tx '${SPACK_TEST_PARALLEL:=3}*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python'" fi @@ -61,9 +61,9 @@ fi # where it seems that otherwise the configuration file might not be located by subprocesses # in some, not better specified, cases. if [[ "$UNIT_TEST_COVERAGE" == "true" ]]; then - $(which spack) unit-test -x --verbose --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml + "$(which spack)" unit-test -x --verbose --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml else - $(which spack) unit-test -x --verbose + "$(which spack)" unit-test -x --verbose fi From 586360a8fe191585339a8dd69cc4eff400f6bb0b Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 15:34:12 +0200 Subject: [PATCH 183/687] =?UTF-8?q?Revert=20"For=20"when:"=20and=20install?= =?UTF-8?q?=5Fenvironment.json:=20Support=20fully=20qualified=20hos?= =?UTF-8?q?=E2=80=A6"=20(#46478)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6b0011c8f1293510a784a0eaa0a2a10e03339f16. It caused a major performance penalty in unit test time on macOS (about 30 minutes). --- lib/spack/docs/environments.rst | 5 ++--- lib/spack/spack/spec.py | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/spack/docs/environments.rst b/lib/spack/docs/environments.rst index a8dd75831cac19..86be68d0c51cd3 100644 --- a/lib/spack/docs/environments.rst +++ b/lib/spack/docs/environments.rst @@ -893,9 +893,8 @@ The valid variables for a ``when`` clause are: #. ``env``. The user environment (usually ``os.environ`` in Python). -#. ``hostname``. The hostname of the system. - -#. ``full_hostname``. The fully qualified hostname of the system. +#. ``hostname``. The hostname of the system (if ``hostname`` is an + executable in the user's PATH). ^^^^^^^^^^^^^^^^^^^^^^^^ SpecLists as Constraints diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 28e11d68b80a2d..fb1a05f37c556a 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -4908,7 +4908,6 @@ def get_host_environment() -> Dict[str, Any]: "architecture": arch_spec, "arch_str": str(arch_spec), "hostname": socket.gethostname(), - "full_hostname": socket.getfqdn(), } From 1d18f571ae18cce1d3a5555513c5baef24008e2d Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 16:06:44 +0200 Subject: [PATCH 184/687] url join: fix oci scheme (#46483) * url.py: also special case oci scheme in join * avoid fetching keys from oci mirror --- lib/spack/spack/binary_distribution.py | 3 +++ lib/spack/spack/test/util/util_url.py | 2 +- lib/spack/spack/util/url.py | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index ad236ff056cd1a..baa04f9df6db9d 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -2698,6 +2698,9 @@ def get_keys(install=False, trust=False, force=False, mirrors=None): for mirror in mirror_collection.values(): fetch_url = mirror.fetch_url + # TODO: oci:// does not support signing. + if fetch_url.startswith("oci://"): + continue keys_url = url_util.join( fetch_url, BUILD_CACHE_RELATIVE_PATH, BUILD_CACHE_KEYS_RELATIVE_PATH ) diff --git a/lib/spack/spack/test/util/util_url.py b/lib/spack/spack/test/util/util_url.py index 0666d7a28fdc73..ed34a791528719 100644 --- a/lib/spack/spack/test/util/util_url.py +++ b/lib/spack/spack/test/util/util_url.py @@ -48,7 +48,7 @@ def test_relative_path_to_file_url(tmpdir): @pytest.mark.parametrize("resolve_href", [True, False]) -@pytest.mark.parametrize("scheme", ["http", "s3", "gs", "file"]) +@pytest.mark.parametrize("scheme", ["http", "s3", "gs", "file", "oci"]) def test_url_join_absolute(scheme, resolve_href): """Test that joining a URL with an absolute path works the same for schemes we care about, and whether we work in web browser mode or not.""" diff --git a/lib/spack/spack/util/url.py b/lib/spack/spack/util/url.py index 982e192a4c28e9..9054c7ad3fb9fe 100644 --- a/lib/spack/spack/util/url.py +++ b/lib/spack/spack/util/url.py @@ -73,7 +73,7 @@ def join(base: str, *components: str, resolve_href: bool = False, **kwargs) -> s 1. By default resolve_href=False, which makes the function like os.path.join: for example https://example.com/a/b + c/d = https://example.com/a/b/c/d. If resolve_href=True, the behavior is how a browser would resolve the URL: https://example.com/a/c/d. - 2. s3:// and gs:// URLs are joined like http:// URLs. + 2. s3://, gs://, oci:// URLs are joined like http:// URLs. 3. It accepts multiple components for convenience. Note that components[1:] are treated as literal path components and appended to components[0] separated by slashes.""" # Ensure a trailing slash in the path component of the base URL to get os.path.join-like @@ -87,8 +87,8 @@ def join(base: str, *components: str, resolve_href: bool = False, **kwargs) -> s try: # NOTE: we temporarily modify urllib internals so s3 and gs schemes are treated like http. # This is non-portable, and may be forward incompatible with future cpython versions. - urllib.parse.uses_netloc = [*uses_netloc, "s3", "gs"] - urllib.parse.uses_relative = [*uses_relative, "s3", "gs"] + urllib.parse.uses_netloc = [*uses_netloc, "s3", "gs", "oci"] + urllib.parse.uses_relative = [*uses_relative, "s3", "gs", "oci"] return urllib.parse.urljoin(base, "/".join(components), **kwargs) finally: urllib.parse.uses_netloc = uses_netloc From 0e9f131b441e07830c976711d90db172eeedb150 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 19 Sep 2024 19:48:34 +0300 Subject: [PATCH 185/687] bdw-gc: add v8.2.8 (#46286) --- var/spack/repos/builtin/packages/bdw-gc/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/bdw-gc/package.py b/var/spack/repos/builtin/packages/bdw-gc/package.py index 25434ffac83c2f..6c80aac4e2c2a7 100644 --- a/var/spack/repos/builtin/packages/bdw-gc/package.py +++ b/var/spack/repos/builtin/packages/bdw-gc/package.py @@ -11,10 +11,11 @@ class BdwGc(AutotoolsPackage): collecting replacement for C malloc or C++ new.""" homepage = "https://www.hboehm.info/gc/" - url = "https://github.com/ivmai/bdwgc/releases/download/v8.2.6/gc-8.2.6.tar.gz" + url = "https://github.com/ivmai/bdwgc/releases/download/v8.2.8/gc-8.2.8.tar.gz" license("Xerox") + version("8.2.8", sha256="7649020621cb26325e1fb5c8742590d92fb48ce5c259b502faf7d9fb5dabb160") version("8.2.6", sha256="b9183fe49d4c44c7327992f626f8eaa1d8b14de140f243edb1c9dcff7719a7fc") version("8.2.4", sha256="3d0d3cdbe077403d3106bb40f0cbb563413d6efdbb2a7e1cd6886595dec48fc2") version("8.2.2", sha256="f30107bcb062e0920a790ffffa56d9512348546859364c23a14be264b38836a0") From db7aece1863757997626fd7aa1ce9cc59ae9552b Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 20:11:22 +0200 Subject: [PATCH 186/687] require spec in develop entry (#46485) --- lib/spack/spack/schema/develop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/spack/spack/schema/develop.py b/lib/spack/spack/schema/develop.py index 13391dcdb0dc75..8db1220e636dac 100644 --- a/lib/spack/spack/schema/develop.py +++ b/lib/spack/spack/schema/develop.py @@ -13,6 +13,7 @@ r"\w[\w-]*": { "type": "object", "additionalProperties": False, + "required": ["spec"], "properties": {"spec": {"type": "string"}, "path": {"type": "string"}}, } }, From 098ad7ffc0d0a5ac308741f3d85d3736446648e2 Mon Sep 17 00:00:00 2001 From: etiennemlb <72296335+etiennemlb@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:00:34 +0200 Subject: [PATCH 187/687] quantum-espresso: ensure no space in HDF5 lib variable (#46089) * Ensure no space in HDF5 lib variable. * QE patch fix --- var/spack/repos/builtin/packages/quantum-espresso/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py index 23509f06c4c915..3e08ef60eca80f 100644 --- a/var/spack/repos/builtin/packages/quantum-espresso/package.py +++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py @@ -333,6 +333,11 @@ class QuantumEspresso(CMakePackage, Package): patch_checksum = "72564c168231dd4a1279a74e76919af701d47cee9a851db6e205753004fe9bb5" patch(patch_url, sha256=patch_checksum, when="@6.7+qmcpack") + # 6.6 + patch_url = "https://gitlab.com/QEF/q-e/-/commit/081409ea90cba0ddc07bea5ac29e3cd422c67d3d.diff" + patch_checksum = "f43b7411e535629d9ef564a2e1695359df2651ecbdbca563f7265412afc2228a" + patch(patch_url, sha256=patch_checksum, when="@6.6:7.3.1") + # 6.4.1 patch_url = "https://raw.githubusercontent.com/QMCPACK/qmcpack/v3.13.0/external_codes/quantum_espresso/add_pw2qmcpack_to_qe-6.4.1.diff" patch_checksum = "57cb1b06ee2653a87c3acc0dd4f09032fcf6ce6b8cbb9677ae9ceeb6a78f85e2" From e4927b35d1d820545cb09c291bd3757131581a49 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 19 Sep 2024 23:25:36 +0200 Subject: [PATCH 188/687] package_base: break dependency on installer (#46423) Removes `spack.package_base.PackageBase.do_{install,deprecate}` in favor of `spack.installer.PackageInstaller.install` and `spack.installer.deprecate` resp. That drops a dependency of `spack.package_base` on `spack.installer`, which is necessary to get rid of circular dependencies in Spack. Also change the signature of `PackageInstaller.__init__` from taking a dict as positional argument, to an explicit list of keyword arguments. --- lib/spack/spack/bootstrap/core.py | 5 +- lib/spack/spack/cmd/deprecate.py | 3 +- lib/spack/spack/cmd/dev_build.py | 7 +- lib/spack/spack/cmd/install.py | 2 +- lib/spack/spack/environment/environment.py | 2 +- lib/spack/spack/installer.py | 118 +++++++++++++++++- lib/spack/spack/package_base.py | 95 ++------------ lib/spack/spack/test/build_distribution.py | 3 +- lib/spack/spack/test/build_environment.py | 3 +- lib/spack/spack/test/build_systems.py | 11 +- lib/spack/spack/test/cmd/buildcache.py | 13 +- lib/spack/spack/test/cmd/extensions.py | 6 +- lib/spack/spack/test/cmd/gc.py | 11 +- lib/spack/spack/test/cmd/install.py | 5 +- lib/spack/spack/test/cmd/module.py | 5 +- lib/spack/spack/test/cmd/tags.py | 3 +- lib/spack/spack/test/cmd/view.py | 3 +- lib/spack/spack/test/concretize.py | 27 ++-- .../spack/test/concretize_requirements.py | 3 +- lib/spack/spack/test/conftest.py | 3 +- lib/spack/spack/test/database.py | 17 +-- lib/spack/spack/test/install.py | 65 +++++----- lib/spack/spack/test/installer.py | 7 +- lib/spack/spack/test/modules/common.py | 3 +- lib/spack/spack/test/package_class.py | 2 +- lib/spack/spack/test/packaging.py | 3 +- lib/spack/spack/test/rewiring.py | 13 +- lib/spack/spack/test/spec_list.py | 4 +- lib/spack/spack/test/views.py | 3 +- 29 files changed, 249 insertions(+), 196 deletions(-) diff --git a/lib/spack/spack/bootstrap/core.py b/lib/spack/spack/bootstrap/core.py index 9713e2866a8105..6f1d9fdb9dff52 100644 --- a/lib/spack/spack/bootstrap/core.py +++ b/lib/spack/spack/bootstrap/core.py @@ -46,6 +46,7 @@ import spack.util.spack_yaml import spack.util.url import spack.version +from spack.installer import PackageInstaller from ._common import _executables_in_store, _python_import, _root_spec, _try_import_from_store from .clingo import ClingoBootstrapConcretizer @@ -277,7 +278,7 @@ def try_import(self, module: str, abstract_spec_str: str) -> bool: # Install the spec that should make the module importable with spack.config.override(self.mirror_scope): - concrete_spec.package.do_install(fail_fast=True) + PackageInstaller([concrete_spec.package], fail_fast=True).install() if _try_import_from_store(module, query_spec=concrete_spec, query_info=info): self.last_search = info @@ -300,7 +301,7 @@ def try_search_path(self, executables: Tuple[str], abstract_spec_str: str) -> bo msg = "[BOOTSTRAP] Try installing '{0}' from sources" tty.debug(msg.format(abstract_spec_str)) with spack.config.override(self.mirror_scope): - concrete_spec.package.do_install() + PackageInstaller([concrete_spec.package], fail_fast=True).install() if _executables_in_store(executables, concrete_spec, query_info=info): self.last_search = info return True diff --git a/lib/spack/spack/cmd/deprecate.py b/lib/spack/spack/cmd/deprecate.py index d7c6c49338d981..abca550ccad4a0 100644 --- a/lib/spack/spack/cmd/deprecate.py +++ b/lib/spack/spack/cmd/deprecate.py @@ -20,6 +20,7 @@ import spack.cmd import spack.environment as ev +import spack.installer import spack.store from spack.cmd.common import arguments from spack.database import InstallStatuses @@ -142,4 +143,4 @@ def deprecate(parser, args): tty.die("Will not deprecate any packages.") for dcate, dcator in zip(all_deprecate, all_deprecators): - dcate.package.do_deprecate(dcator, symlink) + spack.installer.deprecate(dcate, dcator, symlink) diff --git a/lib/spack/spack/cmd/dev_build.py b/lib/spack/spack/cmd/dev_build.py index b289d07dc98072..696c16f4dcd808 100644 --- a/lib/spack/spack/cmd/dev_build.py +++ b/lib/spack/spack/cmd/dev_build.py @@ -14,6 +14,7 @@ import spack.config import spack.repo from spack.cmd.common import arguments +from spack.installer import PackageInstaller description = "developer build: build from code in current working directory" section = "build" @@ -131,9 +132,9 @@ def dev_build(self, args): elif args.test == "root": tests = [spec.name for spec in specs] - spec.package.do_install( + PackageInstaller( + [spec.package], tests=tests, - make_jobs=args.jobs, keep_prefix=args.keep_prefix, install_deps=not args.ignore_deps, verbose=not args.quiet, @@ -141,7 +142,7 @@ def dev_build(self, args): stop_before=args.before, skip_patch=args.skip_patch, stop_at=args.until, - ) + ).install() # drop into the build environment of the package? if args.shell is not None: diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 27b2ededcdd0bf..5040032f2bcd09 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -474,5 +474,5 @@ def install_without_active_env(args, install_kwargs, reporter_factory): installs = [s.package for s in concrete_specs] install_kwargs["explicit"] = [s.dag_hash() for s in concrete_specs] - builder = PackageInstaller(installs, install_kwargs) + builder = PackageInstaller(installs, **install_kwargs) builder.install() diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 2a22a76abe5dd0..900fd3f0723c01 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -1967,7 +1967,7 @@ def install_specs(self, specs: Optional[List[Spec]] = None, **install_args): ) install_args["explicit"] = explicit - PackageInstaller([spec.package for spec in specs], install_args).install() + PackageInstaller([spec.package for spec in specs], **install_args).install() def all_specs_generator(self) -> Iterable[Spec]: """Returns a generator for all concrete specs""" diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index fd46b9006d0639..e73fa1dc1fd2ae 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -37,7 +37,7 @@ import time from collections import defaultdict from gzip import GzipFile -from typing import Dict, Iterator, List, Optional, Set, Tuple +from typing import Dict, Iterator, List, Optional, Set, Tuple, Union import llnl.util.filesystem as fs import llnl.util.lock as lk @@ -1053,8 +1053,87 @@ class PackageInstaller: """ def __init__( - self, packages: List["spack.package_base.PackageBase"], install_args: dict + self, + packages: List["spack.package_base.PackageBase"], + *, + cache_only: bool = False, + dependencies_cache_only: bool = False, + dependencies_use_cache: bool = True, + dirty: bool = False, + explicit: Union[Set[str], bool] = False, + overwrite: Optional[Union[List[str], Set[str]]] = None, + fail_fast: bool = False, + fake: bool = False, + include_build_deps: bool = False, + install_deps: bool = True, + install_package: bool = True, + install_source: bool = False, + keep_prefix: bool = False, + keep_stage: bool = False, + package_cache_only: bool = False, + package_use_cache: bool = True, + restage: bool = False, + skip_patch: bool = False, + stop_at: Optional[str] = None, + stop_before: Optional[str] = None, + tests: Union[bool, List[str], Set[str]] = False, + unsigned: Optional[bool] = None, + use_cache: bool = False, + verbose: bool = False, ) -> None: + """ + Arguments: + explicit: Set of package hashes to be marked as installed explicitly in the db. If + True, the specs from ``packages`` are marked explicit, while their dependencies are + not. + fail_fast: Fail if any dependency fails to install; otherwise, the default is to + install as many dependencies as possible (i.e., best effort installation). + fake: Don't really build; install fake stub files instead. + install_deps: Install dependencies before installing this package + install_source: By default, source is not installed, but for debugging it might be + useful to keep it around. + keep_prefix: Keep install prefix on failure. By default, destroys it. + keep_stage: By default, stage is destroyed only if there are no exceptions during + build. Set to True to keep the stage even with exceptions. + restage: Force spack to restage the package source. + skip_patch: Skip patch stage of build if True. + stop_before: stop execution before this installation phase (or None) + stop_at: last installation phase to be executed (or None) + tests: False to run no tests, True to test all packages, or a list of package names to + run tests for some + use_cache: Install from binary package, if available. + verbose: Display verbose build output (by default, suppresses it) + """ + if isinstance(explicit, bool): + explicit = {pkg.spec.dag_hash() for pkg in packages} if explicit else set() + + install_args = { + "cache_only": cache_only, + "dependencies_cache_only": dependencies_cache_only, + "dependencies_use_cache": dependencies_use_cache, + "dirty": dirty, + "explicit": explicit, + "fail_fast": fail_fast, + "fake": fake, + "include_build_deps": include_build_deps, + "install_deps": install_deps, + "install_package": install_package, + "install_source": install_source, + "keep_prefix": keep_prefix, + "keep_stage": keep_stage, + "overwrite": overwrite or [], + "package_cache_only": package_cache_only, + "package_use_cache": package_use_cache, + "restage": restage, + "skip_patch": skip_patch, + "stop_at": stop_at, + "stop_before": stop_before, + "tests": tests, + "unsigned": unsigned, + "use_cache": use_cache, + "verbose": verbose, + } + # List of build requests self.build_requests = [BuildRequest(pkg, install_args) for pkg in packages] @@ -1518,8 +1597,8 @@ def _install_task(self, task: BuildTask, install_status: InstallStatus) -> None: spack.store.STORE.db.add(pkg.spec, explicit=explicit) except spack.error.StopPhase as e: - # A StopPhase exception means that do_install was asked to - # stop early from clients, and is not an error at this point + # A StopPhase exception means that the installer was asked to stop early from clients, + # and is not an error at this point pid = f"{self.pid}: " if tty.show_pid() else "" tty.debug(f"{pid}{str(e)}") tty.debug(f"Package stage directory: {pkg.stage.source_path}") @@ -2070,7 +2149,7 @@ def __init__(self, pkg: "spack.package_base.PackageBase", install_args: dict): Arguments: pkg: the package being installed. - install_args: arguments to do_install() from parent process. + install_args: arguments to the installer from parent process. """ self.pkg = pkg @@ -2274,7 +2353,7 @@ def build_process(pkg: "spack.package_base.PackageBase", install_args: dict) -> Arguments: pkg: the package being installed. - install_args: arguments to do_install() from parent process. + install_args: arguments to installer from parent process. """ installer = BuildProcessInstaller(pkg, install_args) @@ -2284,6 +2363,33 @@ def build_process(pkg: "spack.package_base.PackageBase", install_args: dict) -> return installer.run() +def deprecate(spec: "spack.spec.Spec", deprecator: "spack.spec.Spec", link_fn) -> None: + """Deprecate this package in favor of deprecator spec""" + # Install deprecator if it isn't installed already + if not spack.store.STORE.db.query(deprecator): + PackageInstaller([deprecator.package], explicit=True).install() + + old_deprecator = spack.store.STORE.db.deprecator(spec) + if old_deprecator: + # Find this spec file from its old deprecation + specfile = spack.store.STORE.layout.deprecated_file_path(spec, old_deprecator) + else: + specfile = spack.store.STORE.layout.spec_file_path(spec) + + # copy spec metadata to "deprecated" dir of deprecator + depr_specfile = spack.store.STORE.layout.deprecated_file_path(spec, deprecator) + fs.mkdirp(os.path.dirname(depr_specfile)) + shutil.copy2(specfile, depr_specfile) + + # Any specs deprecated in favor of this spec are re-deprecated in favor of its new deprecator + for deprecated in spack.store.STORE.db.specs_deprecated_by(spec): + deprecate(deprecated, deprecator, link_fn) + + # Now that we've handled metadata, uninstall and replace with link + spack.package_base.PackageBase.uninstall_by_spec(spec, force=True, deprecator=deprecator) + link_fn(deprecator.prefix, spec.prefix) + + class OverwriteInstall: def __init__( self, diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index 5be23ff124eaa0..cc5f11cb728288 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -19,7 +19,6 @@ import io import os import re -import shutil import sys import textwrap import time @@ -64,7 +63,6 @@ cache_extra_test_sources, install_test_root, ) -from spack.installer import PackageInstaller from spack.solver.version_order import concretization_version_order from spack.stage import DevelopStage, ResourceStage, Stage, StageComposite, compute_stage_name from spack.util.executable import ProcessError, which @@ -556,19 +554,16 @@ class PackageBase(WindowsRPath, PackageViewMixin, RedistributionMixin, metaclass There are two main parts of a Spack package: - 1. **The package class**. Classes contain ``directives``, which are - special functions, that add metadata (versions, patches, - dependencies, and other information) to packages (see - ``directives.py``). Directives provide the constraints that are - used as input to the concretizer. + 1. **The package class**. Classes contain ``directives``, which are special functions, that + add metadata (versions, patches, dependencies, and other information) to packages (see + ``directives.py``). Directives provide the constraints that are used as input to the + concretizer. - 2. **Package instances**. Once instantiated, a package is - essentially a software installer. Spack calls methods like - ``do_install()`` on the ``Package`` object, and it uses those to - drive user-implemented methods like ``patch()``, ``install()``, and - other build steps. To install software, an instantiated package - needs a *concrete* spec, which guides the behavior of the various - install methods. + 2. **Package instances**. Once instantiated, a package can be passed to the PackageInstaller. + It calls methods like ``do_stage()`` on the ``Package`` object, and it uses those to drive + user-implemented methods like ``patch()``, ``install()``, and other build steps. To + install software, an instantiated package needs a *concrete* spec, which guides the + behavior of the various install methods. Packages are imported from repos (see ``repo.py``). @@ -590,7 +585,6 @@ class PackageBase(WindowsRPath, PackageViewMixin, RedistributionMixin, metaclass p.do_fetch() # downloads tarball from a URL (or VCS) p.do_stage() # expands tarball in a temp directory p.do_patch() # applies patches to expanded source - p.do_install() # calls package's install() function p.do_uninstall() # removes install directory although packages that do not have code have nothing to fetch so omit @@ -1956,48 +1950,6 @@ def _resource_stage(self, resource): resource_stage_folder = "-".join(pieces) return resource_stage_folder - def do_install(self, **kwargs): - """Called by commands to install a package and or its dependencies. - - Package implementations should override install() to describe - their build process. - - Args: - cache_only (bool): Fail if binary package unavailable. - dirty (bool): Don't clean the build environment before installing. - explicit (bool): True if package was explicitly installed, False - if package was implicitly installed (as a dependency). - fail_fast (bool): Fail if any dependency fails to install; - otherwise, the default is to install as many dependencies as - possible (i.e., best effort installation). - fake (bool): Don't really build; install fake stub files instead. - force (bool): Install again, even if already installed. - install_deps (bool): Install dependencies before installing this - package - install_source (bool): By default, source is not installed, but - for debugging it might be useful to keep it around. - keep_prefix (bool): Keep install prefix on failure. By default, - destroys it. - keep_stage (bool): By default, stage is destroyed only if there - are no exceptions during build. Set to True to keep the stage - even with exceptions. - restage (bool): Force spack to restage the package source. - skip_patch (bool): Skip patch stage of build if True. - stop_before (str): stop execution before this - installation phase (or None) - stop_at (str): last installation phase to be executed - (or None) - tests (bool or list or set): False to run no tests, True to test - all packages, or a list of package names to run tests for some - use_cache (bool): Install from binary package, if available. - verbose (bool): Display verbose build output (by default, - suppresses it) - """ - explicit = kwargs.get("explicit", True) - if isinstance(explicit, bool): - kwargs["explicit"] = {self.spec.dag_hash()} if explicit else set() - PackageInstaller([self], kwargs).install() - # TODO (post-34236): Update tests and all packages that use this as a # TODO (post-34236): package method to the routine made available to # TODO (post-34236): packages. Once done, remove this method. @@ -2454,35 +2406,6 @@ def do_uninstall(self, force=False): # delegate to instance-less method. PackageBase.uninstall_by_spec(self.spec, force) - def do_deprecate(self, deprecator, link_fn): - """Deprecate this package in favor of deprecator spec""" - spec = self.spec - - # Install deprecator if it isn't installed already - if not spack.store.STORE.db.query(deprecator): - deprecator.package.do_install() - - old_deprecator = spack.store.STORE.db.deprecator(spec) - if old_deprecator: - # Find this specs yaml file from its old deprecation - self_yaml = spack.store.STORE.layout.deprecated_file_path(spec, old_deprecator) - else: - self_yaml = spack.store.STORE.layout.spec_file_path(spec) - - # copy spec metadata to "deprecated" dir of deprecator - depr_yaml = spack.store.STORE.layout.deprecated_file_path(spec, deprecator) - fsys.mkdirp(os.path.dirname(depr_yaml)) - shutil.copy2(self_yaml, depr_yaml) - - # Any specs deprecated in favor of this spec are re-deprecated in - # favor of its new deprecator - for deprecated in spack.store.STORE.db.specs_deprecated_by(spec): - deprecated.package.do_deprecate(deprecator, link_fn) - - # Now that we've handled metadata, uninstall and replace with link - PackageBase.uninstall_by_spec(spec, force=True, deprecator=deprecator) - link_fn(deprecator.prefix, spec.prefix) - def view(self): """Create a view with the prefix of this package as the root. Extensions added to this view will modify the installation prefix of diff --git a/lib/spack/spack/test/build_distribution.py b/lib/spack/spack/test/build_distribution.py index dc1e763e2a9d05..5edcbe5673d3a7 100644 --- a/lib/spack/spack/test/build_distribution.py +++ b/lib/spack/spack/test/build_distribution.py @@ -11,13 +11,14 @@ import spack.binary_distribution as bd import spack.mirror import spack.spec +from spack.installer import PackageInstaller pytestmark = pytest.mark.not_on_windows("does not run on windows") def test_build_tarball_overwrite(install_mockery, mock_fetch, monkeypatch, tmp_path): spec = spack.spec.Spec("trivial-install-test-package").concretized() - spec.package.do_install(fake=True) + PackageInstaller([spec.package], fake=True).install() specs = [spec] diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 8d7a09ab7ec6b9..c3ccaee0290d16 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -21,6 +21,7 @@ import spack.util.spack_yaml as syaml from spack.build_environment import UseMode, _static_to_shared_library, dso_suffix from spack.context import Context +from spack.installer import PackageInstaller from spack.paths import build_env_path from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable @@ -181,7 +182,7 @@ def test_setup_dependent_package_inherited_modules( ): # This will raise on regression s = spack.spec.Spec("cmake-client-inheritor").concretized() - s.package.do_install() + PackageInstaller([s.package]).install() @pytest.mark.parametrize( diff --git a/lib/spack/spack/test/build_systems.py b/lib/spack/spack/test/build_systems.py index a28742488a9a81..212ec412d3eec9 100644 --- a/lib/spack/spack/test/build_systems.py +++ b/lib/spack/spack/test/build_systems.py @@ -21,6 +21,7 @@ import spack.platforms import spack.platforms.test from spack.build_environment import ChildError, setup_package +from spack.installer import PackageInstaller from spack.spec import Spec from spack.util.executable import which @@ -144,7 +145,7 @@ def test_none_is_allowed(self, default_mock_concretization): def test_libtool_archive_files_are_deleted_by_default(self, mutable_database): # Install a package that creates a mock libtool archive s = Spec("libtool-deletion").concretized() - s.package.do_install(explicit=True) + PackageInstaller([s.package], explicit=True).install() # Assert the libtool archive is not there and we have # a log of removed files @@ -160,7 +161,7 @@ def test_libtool_archive_files_might_be_installed_on_demand( # patch its package to preserve the installation s = Spec("libtool-deletion").concretized() monkeypatch.setattr(type(s.package.builder), "install_libtool_archives", True) - s.package.do_install(explicit=True) + PackageInstaller([s.package], explicit=True).install() # Assert libtool archives are installed assert os.path.exists(s.package.builder.libtool_archive_file) @@ -171,7 +172,7 @@ def test_autotools_gnuconfig_replacement(self, mutable_database): files from working alternatives from the gnuconfig package. """ s = Spec("autotools-config-replacement +patch_config_files +gnuconfig").concretized() - s.package.do_install() + PackageInstaller([s.package]).install() with open(os.path.join(s.prefix.broken, "config.sub")) as f: assert "gnuconfig version of config.sub" in f.read() @@ -190,7 +191,7 @@ def test_autotools_gnuconfig_replacement_disabled(self, mutable_database): Tests whether disabling patch_config_files """ s = Spec("autotools-config-replacement ~patch_config_files +gnuconfig").concretized() - s.package.do_install() + PackageInstaller([s.package]).install() with open(os.path.join(s.prefix.broken, "config.sub")) as f: assert "gnuconfig version of config.sub" not in f.read() @@ -219,7 +220,7 @@ def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database, mo msg = "Cannot patch config files: missing dependencies: gnuconfig" with pytest.raises(ChildError, match=msg): - s.package.do_install() + PackageInstaller([s.package]).install() @pytest.mark.disable_clean_stage_check def test_broken_external_gnuconfig(self, mutable_database, tmpdir): diff --git a/lib/spack/spack/test/cmd/buildcache.py b/lib/spack/spack/test/cmd/buildcache.py index 30c779e705665b..840dd61f1aba86 100644 --- a/lib/spack/spack/test/cmd/buildcache.py +++ b/lib/spack/spack/test/cmd/buildcache.py @@ -19,6 +19,7 @@ import spack.mirror import spack.spec import spack.util.url +from spack.installer import PackageInstaller from spack.spec import Spec buildcache = spack.main.SpackCommand("buildcache") @@ -178,7 +179,7 @@ def test_buildcache_autopush(tmp_path, install_mockery, mock_fetch): s = Spec("libdwarf").concretized() # Install and generate build cache index - s.package.do_install() + PackageInstaller([s.package], explicit=True).install() metadata_file = spack.binary_distribution.tarball_name(s, ".spec.json") @@ -379,7 +380,7 @@ def test_correct_specs_are_pushed( things_to_install, expected, tmpdir, monkeypatch, default_mock_concretization, temporary_store ): spec = default_mock_concretization("dttop") - spec.package.do_install(fake=True) + PackageInstaller([spec.package], explicit=True, fake=True).install() slash_hash = f"/{spec.dag_hash()}" class DontUpload(spack.binary_distribution.Uploader): @@ -438,13 +439,13 @@ def test_push_and_install_with_mirror_marked_unsigned_does_not_require_extra_fla # Install if signed: # Need to pass "--no-check-signature" to avoid install errors - kwargs = {"cache_only": True, "unsigned": True} + kwargs = {"explicit": True, "cache_only": True, "unsigned": True} else: # No need to pass "--no-check-signature" if the mirror is unsigned - kwargs = {"cache_only": True} + kwargs = {"explicit": True, "cache_only": True} spec.package.do_uninstall(force=True) - spec.package.do_install(**kwargs) + PackageInstaller([spec.package], **kwargs).install() def test_skip_no_redistribute(mock_packages, config): @@ -489,7 +490,7 @@ def test_push_without_build_deps(tmp_path, temporary_store, mock_packages, mutab mirror("add", "--unsigned", "my-mirror", str(tmp_path)) s = spack.spec.Spec("dtrun3").concretized() - s.package.do_install(fake=True) + PackageInstaller([s.package], explicit=True, fake=True).install() s["dtbuild3"].package.do_uninstall() # fails when build deps are required diff --git a/lib/spack/spack/test/cmd/extensions.py b/lib/spack/spack/test/cmd/extensions.py index b97bfa8b06c8b1..082628cc34cf60 100644 --- a/lib/spack/spack/test/cmd/extensions.py +++ b/lib/spack/spack/test/cmd/extensions.py @@ -6,6 +6,7 @@ import pytest +from spack.installer import PackageInstaller from spack.main import SpackCommand, SpackCommandError from spack.spec import Spec @@ -15,10 +16,7 @@ @pytest.fixture def python_database(mock_packages, mutable_database): specs = [Spec(s).concretized() for s in ["python", "py-extension1", "py-extension2"]] - - for spec in specs: - spec.package.do_install(fake=True, explicit=True) - + PackageInstaller([s.package for s in specs], explicit=True, fake=True).install() yield diff --git a/lib/spack/spack/test/cmd/gc.py b/lib/spack/spack/test/cmd/gc.py index 883d37ae33e252..2eab41a4fbecd7 100644 --- a/lib/spack/spack/test/cmd/gc.py +++ b/lib/spack/spack/test/cmd/gc.py @@ -11,6 +11,7 @@ import spack.main import spack.spec import spack.traverse +from spack.installer import PackageInstaller gc = spack.main.SpackCommand("gc") add = spack.main.SpackCommand("add") @@ -27,7 +28,7 @@ def test_gc_without_build_dependency(mutable_database): def test_gc_with_build_dependency(mutable_database): s = spack.spec.Spec("simple-inheritance") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], explicit=True, fake=True).install() assert "There are no unused specs." in gc("-yb") assert "Successfully uninstalled cmake" in gc("-y") @@ -38,7 +39,7 @@ def test_gc_with_build_dependency(mutable_database): def test_gc_with_environment(mutable_database, mutable_mock_env_path): s = spack.spec.Spec("simple-inheritance") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], explicit=True, fake=True).install() e = ev.create("test_gc") with e: @@ -54,7 +55,7 @@ def test_gc_with_environment(mutable_database, mutable_mock_env_path): def test_gc_with_build_dependency_in_environment(mutable_database, mutable_mock_env_path): s = spack.spec.Spec("simple-inheritance") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], explicit=True, fake=True).install() e = ev.create("test_gc") with e: @@ -106,7 +107,7 @@ def test_gc_except_any_environments(mutable_database, mutable_mock_env_path): def test_gc_except_specific_environments(mutable_database, mutable_mock_env_path): s = spack.spec.Spec("simple-inheritance") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], explicit=True, fake=True).install() assert mutable_database.query_local("zmpi") @@ -133,7 +134,7 @@ def test_gc_except_nonexisting_dir_env(mutable_database, mutable_mock_env_path, def test_gc_except_specific_dir_env(mutable_database, mutable_mock_env_path, tmpdir): s = spack.spec.Spec("simple-inheritance") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], explicit=True, fake=True).install() assert mutable_database.query_local("zmpi") diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index da853661653fdb..13721b2a0d52e6 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -28,6 +28,7 @@ import spack.package_base import spack.store from spack.error import SpackError, SpecSyntaxError +from spack.installer import PackageInstaller from spack.main import SpackCommand from spack.spec import Spec @@ -136,7 +137,7 @@ def test_package_output(tmpdir, capsys, install_mockery, mock_fetch): # when nested AND in pytest spec = Spec("printing-package").concretized() pkg = spec.package - pkg.do_install(verbose=True) + PackageInstaller([pkg], explicit=True, verbose=True).install() with gzip.open(pkg.install_log_path, "rt") as f: out = f.read() @@ -261,7 +262,7 @@ def test_install_commit(mock_git_version_info, install_mockery, mock_packages, m # Use the earliest commit in the respository spec = Spec(f"git-test-commit@{commits[-1]}").concretized() - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() # Ensure first commit file contents were written installed = os.listdir(spec.prefix.bin) diff --git a/lib/spack/spack/test/cmd/module.py b/lib/spack/spack/test/cmd/module.py index e16c8edecbb08d..759d1391c97113 100644 --- a/lib/spack/spack/test/cmd/module.py +++ b/lib/spack/spack/test/cmd/module.py @@ -15,6 +15,7 @@ import spack.repo import spack.spec import spack.store +from spack.installer import PackageInstaller module = spack.main.SpackCommand("module") @@ -184,8 +185,8 @@ def test_setdefault_command(mutable_database, mutable_config): # Install two different versions of pkg-a other_spec, preferred = "pkg-a@1.0", "pkg-a@2.0" - spack.spec.Spec(other_spec).concretized().package.do_install(fake=True) - spack.spec.Spec(preferred).concretized().package.do_install(fake=True) + specs = [spack.spec.Spec(other_spec).concretized(), spack.spec.Spec(preferred).concretized()] + PackageInstaller([s.package for s in specs], explicit=True, fake=True).install() writers = { preferred: writer_cls(spack.spec.Spec(preferred).concretized(), "default"), diff --git a/lib/spack/spack/test/cmd/tags.py b/lib/spack/spack/test/cmd/tags.py index 7de107c9234be2..0e8e7f016591f7 100644 --- a/lib/spack/spack/test/cmd/tags.py +++ b/lib/spack/spack/test/cmd/tags.py @@ -6,6 +6,7 @@ import spack.main import spack.repo import spack.spec +from spack.installer import PackageInstaller tags = spack.main.SpackCommand("tags") @@ -48,7 +49,7 @@ class tag_path: def test_tags_installed(install_mockery, mock_fetch): s = spack.spec.Spec("mpich").concretized() - s.package.do_install() + PackageInstaller([s.package], explicit=True, fake=True).install() out = tags("-i") for tag in ["tag1", "tag2"]: diff --git a/lib/spack/spack/test/cmd/view.py b/lib/spack/spack/test/cmd/view.py index f385a69e8512c1..6c349fe68c0904 100644 --- a/lib/spack/spack/test/cmd/view.py +++ b/lib/spack/spack/test/cmd/view.py @@ -8,6 +8,7 @@ import pytest import spack.util.spack_yaml as s_yaml +from spack.installer import PackageInstaller from spack.main import SpackCommand from spack.spec import Spec @@ -180,7 +181,7 @@ def test_view_files_not_ignored( ): spec = Spec("view-not-ignored").concretized() pkg = spec.package - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() pkg.assert_installed(spec.prefix) install("view-file") # Arbitrary package to add noise diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index ef004272a777eb..9f4d411aeccda0 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -33,6 +33,7 @@ import spack.util.file_cache import spack.variant as vt from spack.concretize import find_spec +from spack.installer import PackageInstaller from spack.spec import CompilerSpec, Spec from spack.version import Version, VersionList, ver @@ -1319,7 +1320,7 @@ def test_reuse_installed_packages_when_package_def_changes( # Install a spec root = Spec("root").concretized() dependency = root["changing"].copy() - root.package.do_install(fake=True, explicit=True) + PackageInstaller([root.package], fake=True, explicit=True).install() # Modify package.py repo_with_changing_recipe.change(context) @@ -1345,7 +1346,7 @@ def test_no_reuse_when_variant_condition_does_not_hold(self, mutable_database, m # Install a spec for which the `version_based` variant condition does not hold old = Spec("conditional-variant-pkg @1").concretized() - old.package.do_install(fake=True, explicit=True) + PackageInstaller([old.package], fake=True, explicit=True).install() # Then explicitly require a spec with `+version_based`, which shouldn't reuse previous spec new1 = Spec("conditional-variant-pkg +version_based").concretized() @@ -1357,7 +1358,7 @@ def test_no_reuse_when_variant_condition_does_not_hold(self, mutable_database, m def test_reuse_with_flags(self, mutable_database, mutable_config): spack.config.set("concretizer:reuse", True) spec = Spec("pkg-a cflags=-g cxxflags=-g").concretized() - spec.package.do_install(fake=True) + PackageInstaller([spec.package], fake=True, explicit=True).install() testspec = Spec("pkg-a cflags=-g") testspec.concretize() @@ -1658,7 +1659,7 @@ def test_delete_version_and_reuse(self, mutable_database, repo_with_changing_rec declared in package.py """ root = Spec("root").concretized() - root.package.do_install(fake=True, explicit=True) + PackageInstaller([root.package], fake=True, explicit=True).install() repo_with_changing_recipe.change({"delete_version": True}) with spack.config.override("concretizer:reuse", True): @@ -1676,7 +1677,7 @@ def test_installed_version_is_selected_only_for_reuse( # Install a dependency that cannot be reused with "root" # because of a conflict in a variant, then delete its version dependency = Spec("changing@1.0~foo").concretized() - dependency.package.do_install(fake=True, explicit=True) + PackageInstaller([dependency.package], fake=True, explicit=True).install() repo_with_changing_recipe.change({"delete_version": True}) with spack.config.override("concretizer:reuse", True): @@ -1691,7 +1692,7 @@ def test_reuse_with_unknown_namespace_dont_raise( with spack.repo.use_repositories(mock_custom_repository, override=False): s = Spec("pkg-c").concretized() assert s.namespace != "builtin.mock" - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], fake=True, explicit=True).install() with spack.config.override("concretizer:reuse", True): s = Spec("pkg-c").concretized() @@ -1703,7 +1704,7 @@ def test_reuse_from_other_namespace_no_raise(self, tmpdir, temporary_store, monk myrepo.add_package("zlib") builtin = Spec("zlib").concretized() - builtin.package.do_install(fake=True, explicit=True) + PackageInstaller([builtin.package], fake=True, explicit=True).install() with spack.repo.use_repositories(myrepo.root, override=False): with spack.config.override("concretizer:reuse", True): @@ -1718,7 +1719,7 @@ def test_reuse_with_unknown_package_dont_raise(self, tmpdir, temporary_store, mo with spack.repo.use_repositories(builder.root, override=False): s = Spec("pkg-c").concretized() assert s.namespace == "myrepo" - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], fake=True, explicit=True).install() del sys.modules["spack.pkg.myrepo.pkg-c"] del sys.modules["spack.pkg.myrepo"] @@ -1936,7 +1937,7 @@ def test_installed_externals_are_reused( # Install the external spec external1 = Spec("changing@1.0").concretized() - external1.package.do_install(fake=True, explicit=True) + PackageInstaller([external1.package], fake=True, explicit=True).install() assert external1.external # Modify the package.py file @@ -2309,7 +2310,7 @@ def test_reuse_python_from_cli_and_extension_from_db(self, mutable_database): """ s = Spec("py-extension1").concretized() python_hash = s["python"].dag_hash() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], fake=True, explicit=True).install() with spack.config.override("concretizer:reuse", True): with_reuse = Spec(f"py-extension2 ^/{python_hash}").concretized() @@ -3023,7 +3024,7 @@ def test_spec_filters(specs, include, exclude, expected): @pytest.mark.regression("38484") def test_git_ref_version_can_be_reused(install_mockery, do_not_check_runtimes_on_reuse): first_spec = spack.spec.Spec("git-ref-package@git.2.1.5=2.1.5~opt").concretized() - first_spec.package.do_install(fake=True, explicit=True) + PackageInstaller([first_spec.package], fake=True, explicit=True).install() with spack.config.override("concretizer:reuse", True): # reproducer of the issue is that spack will solve when there is a change to the base spec @@ -3047,10 +3048,10 @@ def test_reuse_prefers_standard_over_git_versions( so install git ref last and ensure it is not picked up by reuse """ standard_spec = spack.spec.Spec(f"git-ref-package@{standard_version}").concretized() - standard_spec.package.do_install(fake=True, explicit=True) + PackageInstaller([standard_spec.package], fake=True, explicit=True).install() git_spec = spack.spec.Spec("git-ref-package@git.2.1.5=2.1.5").concretized() - git_spec.package.do_install(fake=True, explicit=True) + PackageInstaller([git_spec.package], fake=True, explicit=True).install() with spack.config.override("concretizer:reuse", True): test_spec = spack.spec.Spec("git-ref-package@2").concretized() diff --git a/lib/spack/spack/test/concretize_requirements.py b/lib/spack/spack/test/concretize_requirements.py index aef8d0ed5ca0c3..be66b2b0a82588 100644 --- a/lib/spack/spack/test/concretize_requirements.py +++ b/lib/spack/spack/test/concretize_requirements.py @@ -14,6 +14,7 @@ import spack.solver.asp import spack.util.spack_yaml as syaml import spack.version +from spack.installer import PackageInstaller from spack.solver.asp import InternalConcretizerError, UnsatisfiableSpecError from spack.spec import Spec from spack.util.url import path_to_file_url @@ -436,7 +437,7 @@ def test_reuse_oneof(concretize_scope, test_repo, tmp_path, mock_fetch): store_dir = tmp_path / "store" with spack.store.use_store(str(store_dir)): s1 = Spec("y@2.5 ~shared").concretized() - s1.package.do_install(fake=True, explicit=True) + PackageInstaller([s1.package], fake=True, explicit=True).install() update_packages_config(conf_str) diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 2726061cb3ff3f..dc53f50688ca09 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -61,6 +61,7 @@ import spack.util.web import spack.version from spack.fetch_strategy import URLFetchStrategy +from spack.installer import PackageInstaller from spack.util.pattern import Bunch @@ -852,7 +853,7 @@ def _populate(mock_db): def _install(spec): s = spack.spec.Spec(spec).concretized() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], fake=True, explicit=True).install() _install("mpileaks ^mpich") _install("mpileaks ^mpich2") diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index e34c85a78825c7..6fd7575ffcaa25 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -34,6 +34,7 @@ import spack.spec import spack.store import spack.version as vn +from spack.installer import PackageInstaller from spack.schema.database_index import schema from spack.util.executable import Executable @@ -385,7 +386,7 @@ def _check_remove_and_add_package(database: spack.database.Database, spec): def _mock_install(spec: str): s = spack.spec.Spec(spec).concretized() - s.package.do_install(fake=True) + PackageInstaller([s.package], fake=True, explicit=True).install() def _mock_remove(spec): @@ -713,7 +714,7 @@ def test_external_entries_in_db(mutable_database): assert not rec.spec.external_modules assert rec.explicit is False - rec.spec.package.do_install(fake=True, explicit=True) + PackageInstaller([rec.spec.package], fake=True, explicit=True).install() rec = mutable_database.get_record("externaltool") assert rec.spec.external_path == os.path.sep + os.path.join("path", "to", "external_tool") assert not rec.spec.external_modules @@ -731,7 +732,7 @@ def test_regression_issue_8036(mutable_database, usr_folder_exists): assert not s.installed # Now install the external package and check again the `installed` property - s.package.do_install(fake=True) + PackageInstaller([s.package], fake=True, explicit=True).install() assert s.installed @@ -774,7 +775,7 @@ def test_query_unused_specs(mutable_database): # This spec installs a fake cmake as a build only dependency s = spack.spec.Spec("simple-inheritance") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], fake=True, explicit=True).install() si = s.dag_hash() ml_mpich = spack.store.STORE.db.query_one("mpileaks ^mpich").dag_hash() @@ -817,7 +818,7 @@ def test_query_spec_with_conditional_dependency(mutable_database): # conditional on a Boolean variant s = spack.spec.Spec("hdf5~mpi") s.concretize() - s.package.do_install(fake=True, explicit=True) + PackageInstaller([s.package], fake=True, explicit=True).install() results = spack.store.STORE.db.query_local("hdf5 ^mpich") assert not results @@ -1144,7 +1145,7 @@ def test_reindex_with_upstreams(tmp_path, monkeypatch, mock_packages, config): {"config": {"install_tree": {"root": str(tmp_path / "upstream")}}} ) monkeypatch.setattr(spack.store, "STORE", upstream_store) - callpath.package.do_install(fake=True) + PackageInstaller([callpath.package], fake=True, explicit=True).install() local_store = spack.store.create( { @@ -1153,7 +1154,7 @@ def test_reindex_with_upstreams(tmp_path, monkeypatch, mock_packages, config): } ) monkeypatch.setattr(spack.store, "STORE", local_store) - mpileaks.package.do_install(fake=True) + PackageInstaller([mpileaks.package], fake=True, explicit=True).install() # Sanity check that callpath is from upstream. assert not local_store.db.query_local("callpath") @@ -1163,7 +1164,7 @@ def test_reindex_with_upstreams(tmp_path, monkeypatch, mock_packages, config): # checks local installs before upstream databases, even when the local database is being # reindexed. monkeypatch.setattr(spack.store, "STORE", upstream_store) - mpileaks.package.do_install(fake=True) + PackageInstaller([mpileaks.package], fake=True, explicit=True).install() # Delete the local database shutil.rmtree(local_store.db.database_directory) diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py index ba7084960add1f..efaa7cc17171b6 100644 --- a/lib/spack/spack/test/install.py +++ b/lib/spack/spack/test/install.py @@ -24,6 +24,7 @@ import spack.util.spack_json as sjson from spack import binary_distribution from spack.error import InstallError +from spack.installer import PackageInstaller from spack.package_base import ( PackageBase, PackageStillNeededError, @@ -42,7 +43,7 @@ def find_nothing(*args): def test_install_and_uninstall(install_mockery, mock_fetch, monkeypatch): spec = Spec("trivial-install-test-package").concretized() - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() assert spec.installed spec.package.do_uninstall() @@ -54,7 +55,7 @@ def test_uninstall_non_existing_package(install_mockery, mock_fetch, monkeypatch """Ensure that we can uninstall a package that has been deleted from the repo""" spec = Spec("trivial-install-test-package").concretized() - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() assert spec.installed # Mock deletion of the package @@ -75,7 +76,7 @@ def test_pkg_attributes(install_mockery, mock_fetch, monkeypatch): assert spec.concrete pkg = spec.package - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() foo = "attributes-foo" assert spec["bar"].prefix == spec[foo].prefix assert spec["baz"].prefix == spec[foo].prefix @@ -132,7 +133,7 @@ def test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch, wo s.package.remove_prefix = mock_remove_prefix with pytest.raises(MockInstallError): - s.package.do_install() + PackageInstaller([s.package], explicit=True).install() assert os.path.isdir(s.package.prefix) rm_prefix_checker = RemovePrefixChecker(instance_rm_prefix) s.package.remove_prefix = rm_prefix_checker.remove_prefix @@ -141,7 +142,7 @@ def test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch, wo spack.store.STORE.failure_tracker.clear(s, True) s.package.set_install_succeed() - s.package.do_install(restage=True) + PackageInstaller([s.package], explicit=True, restage=True).install() assert rm_prefix_checker.removed assert s.package.spec.installed @@ -160,12 +161,12 @@ def test_failing_overwrite_install_should_keep_previous_installation( s.package.set_install_succeed() # Do a failing overwrite install - s.package.do_install() + PackageInstaller([s.package], explicit=True).install() s.package.set_install_fail() kwargs = {"overwrite": [s.dag_hash()]} with pytest.raises(Exception): - s.package.do_install(**kwargs) + PackageInstaller([s.package], explicit=True, **kwargs).install() assert s.package.spec.installed assert os.path.exists(s.prefix) @@ -174,7 +175,7 @@ def test_failing_overwrite_install_should_keep_previous_installation( def test_dont_add_patches_to_installed_package(install_mockery, mock_fetch, monkeypatch): dependency = Spec("dependency-install") dependency.concretize() - dependency.package.do_install() + PackageInstaller([dependency.package], explicit=True).install() dependency_hash = dependency.dag_hash() dependent = Spec("dependent-install ^/" + dependency_hash) @@ -192,7 +193,7 @@ def test_dont_add_patches_to_installed_package(install_mockery, mock_fetch, monk def test_installed_dependency_request_conflicts(install_mockery, mock_fetch, mutable_mock_repo): dependency = Spec("dependency-install") dependency.concretize() - dependency.package.do_install() + PackageInstaller([dependency.package], explicit=True).install() dependency_hash = dependency.dag_hash() dependent = Spec("conflicting-dependent ^/" + dependency_hash) @@ -205,7 +206,7 @@ def test_install_dependency_symlinks_pkg(install_mockery, mock_fetch, mutable_mo spec = Spec("flatten-deps") spec.concretize() pkg = spec.package - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() # Ensure dependency directory exists after the installation. dependency_dir = os.path.join(pkg.prefix, "dependency-install") @@ -215,7 +216,7 @@ def test_install_dependency_symlinks_pkg(install_mockery, mock_fetch, mutable_mo def test_install_times(install_mockery, mock_fetch, mutable_mock_repo): """Test install times added.""" spec = Spec("dev-build-test-install-phases").concretized() - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() # Ensure dependency directory exists after the installation. install_times = os.path.join(spec.package.prefix, ".spack", spack_times_log) @@ -238,7 +239,7 @@ def test_flatten_deps(install_mockery, mock_fetch, mutable_mock_repo): spec = Spec("dependent-install") spec.concretize() pkg = spec.package - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() # Demonstrate that the directory does not appear under the spec # prior to the flatten operation. @@ -291,7 +292,7 @@ def test_installed_upstream_external(install_upstream, mock_fetch): assert new_dependency.external assert new_dependency.prefix == os.path.sep + os.path.join("path", "to", "external_tool") - dependent.package.do_install() + PackageInstaller([dependent.package], explicit=True).install() assert not os.path.exists(new_dependency.prefix) assert os.path.exists(dependent.prefix) @@ -310,7 +311,7 @@ def test_installed_upstream(install_upstream, mock_fetch): assert new_dependency.installed_upstream assert new_dependency.prefix == upstream_layout.path_for_spec(dependency) - dependent.package.do_install() + PackageInstaller([dependent.package], explicit=True).install() assert not os.path.exists(new_dependency.prefix) assert os.path.exists(dependent.prefix) @@ -323,14 +324,14 @@ def test_partial_install_keep_prefix(install_mockery, mock_fetch, monkeypatch, w # If remove_prefix is called at any point in this test, that is an error monkeypatch.setattr(spack.package_base.PackageBase, "remove_prefix", mock_remove_prefix) with pytest.raises(spack.build_environment.ChildError): - s.package.do_install(keep_prefix=True) + PackageInstaller([s.package], explicit=True, keep_prefix=True).install() assert os.path.exists(s.package.prefix) # must clear failure markings for the package before re-installing it spack.store.STORE.failure_tracker.clear(s, True) s.package.set_install_succeed() - s.package.do_install(keep_prefix=True) + PackageInstaller([s.package], explicit=True, keep_prefix=True).install() assert s.package.spec.installed @@ -339,12 +340,12 @@ def test_second_install_no_overwrite_first(install_mockery, mock_fetch, monkeypa monkeypatch.setattr(spack.package_base.PackageBase, "remove_prefix", mock_remove_prefix) s.package.set_install_succeed() - s.package.do_install() + PackageInstaller([s.package], explicit=True).install() assert s.package.spec.installed # If Package.install is called after this point, it will fail s.package.set_install_fail() - s.package.do_install() + PackageInstaller([s.package], explicit=True).install() def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdir): @@ -357,16 +358,16 @@ def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdi with spack.config.override("config:checksum", False): pkg_a = Spec("libelf@0.8.13").concretized().package pkg_b = Spec("libelf@0.8.12").concretized().package - pkg_a.do_install() + PackageInstaller([pkg_a], explicit=True).install() with pytest.raises(InstallError, match="Install prefix collision"): - pkg_b.do_install() + PackageInstaller([pkg_b], explicit=True).install() def test_store(install_mockery, mock_fetch): spec = Spec("cmake-client").concretized() pkg = spec.package - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() @pytest.mark.disable_clean_stage_check @@ -375,7 +376,7 @@ def test_failing_build(install_mockery, mock_fetch, capfd): pkg = spec.package with pytest.raises(spack.build_environment.ChildError, match="Expected failure"): - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() class MockInstallError(spack.error.SpackError): @@ -404,7 +405,7 @@ def test_nosource_pkg_install(install_mockery, mock_fetch, mock_packages, capfd, pkg = spec.package # Make sure install works even though there is no associated code. - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() out = capfd.readouterr() assert "Installing dependency-install" in out[0] @@ -421,7 +422,7 @@ def test_nosource_bundle_pkg_install( pkg = spec.package # Make sure install works even though there is no associated code. - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() out = capfd.readouterr() assert "Installing dependency-install" in out[0] @@ -435,7 +436,7 @@ def test_nosource_pkg_install_post_install(install_mockery, mock_fetch, mock_pac pkg = spec.package # Make sure both the install and post-install package methods work. - pkg.do_install() + PackageInstaller([pkg], explicit=True).install() # Ensure the file created in the package's `install` method exists. install_txt = os.path.join(spec.prefix, "install.txt") @@ -564,7 +565,7 @@ def test_unconcretized_install(install_mockery, mock_fetch, mock_packages): pkg_cls = spack.repo.PATH.get_pkg_class(spec.name) with pytest.raises(ValueError, match="must have a concrete spec"): - pkg_cls(spec).do_install() + PackageInstaller([pkg_cls(spec)], explicit=True).install() with pytest.raises(ValueError, match="only patch concrete packages"): pkg_cls(spec).do_patch() @@ -588,7 +589,7 @@ def test_empty_install_sanity_check_prefix( """Test empty install triggers sanity_check_prefix.""" spec = Spec("failing-empty-install").concretized() with pytest.raises(spack.build_environment.ChildError, match="Nothing was installed"): - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() def test_install_from_binary_with_missing_patch_succeeds( @@ -624,10 +625,16 @@ def test_install_from_binary_with_missing_patch_succeeds( # Source install: fails, we don't have the patch. with pytest.raises(spack.error.SpecError, match="Couldn't find patch for package"): - s.package.do_install() + PackageInstaller([s.package], explicit=True).install() # Binary install: succeeds, we don't need the patch. spack.mirror.add(mirror) - s.package.do_install(package_cache_only=True, dependencies_cache_only=True, unsigned=True) + PackageInstaller( + [s.package], + explicit=True, + package_cache_only=True, + dependencies_cache_only=True, + unsigned=True, + ).install() assert temporary_store.db.query_local_by_spec_hash(s.dag_hash()) diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index 25dcafb64d537c..a95d151b5085a8 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -28,6 +28,7 @@ import spack.spec import spack.store import spack.util.lock as lk +from spack.installer import PackageInstaller def _mock_repo(root, namespace): @@ -82,7 +83,7 @@ def create_installer( concretized.""" _specs = [spack.spec.Spec(s).concretized() if isinstance(s, str) else s for s in specs] _install_args = {} if install_args is None else install_args - return inst.PackageInstaller([spec.package for spec in _specs], _install_args) + return inst.PackageInstaller([spec.package for spec in _specs], **_install_args) @pytest.mark.parametrize( @@ -140,7 +141,9 @@ def test_install_from_cache_errors(install_mockery): with pytest.raises( spack.error.InstallError, match="No binary found when cache-only was specified" ): - spec.package.do_install(package_cache_only=True, dependencies_cache_only=True) + PackageInstaller( + [spec.package], package_cache_only=True, dependencies_cache_only=True + ).install() assert not spec.package.installed_from_binary_cache # Check when don't expect to install only from binary cache diff --git a/lib/spack/spack/test/modules/common.py b/lib/spack/spack/test/modules/common.py index 49f63f6c3b68ac..f1430ecf6ebe20 100644 --- a/lib/spack/spack/test/modules/common.py +++ b/lib/spack/spack/test/modules/common.py @@ -18,6 +18,7 @@ import spack.package_prefs import spack.repo import spack.spec +from spack.installer import PackageInstaller from spack.modules.common import UpstreamModuleIndex from spack.spec import Spec @@ -180,7 +181,7 @@ def test_get_module_upstream(): def test_load_installed_package_not_in_repo(install_mockery, mock_fetch, monkeypatch): """Test that installed packages that have been removed are still loadable""" spec = Spec("trivial-install-test-package").concretized() - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() spack.modules.module_types["tcl"](spec, "default", True).write() def find_nothing(*args): diff --git a/lib/spack/spack/test/package_class.py b/lib/spack/spack/test/package_class.py index 5a61d90d336168..70955e9638ccf6 100644 --- a/lib/spack/spack/test/package_class.py +++ b/lib/spack/spack/test/package_class.py @@ -5,7 +5,7 @@ """Test class methods on Package objects. -This doesn't include methods on package *instances* (like do_install(), +This doesn't include methods on package *instances* (like do_patch(), etc.). Only methods like ``possible_dependencies()`` that deal with the static DSL metadata for packages. """ diff --git a/lib/spack/spack/test/packaging.py b/lib/spack/spack/test/packaging.py index f616cb47a786e0..d6ac1b190dd2de 100644 --- a/lib/spack/spack/test/packaging.py +++ b/lib/spack/spack/test/packaging.py @@ -30,6 +30,7 @@ import spack.util.gpg import spack.util.url as url_util from spack.fetch_strategy import URLFetchStrategy +from spack.installer import PackageInstaller from spack.paths import mock_gpg_keys_path from spack.relocate import ( macho_find_paths, @@ -50,7 +51,7 @@ def test_buildcache(mock_archive, tmp_path, monkeypatch, mutable_config): # Install a test package spec = Spec("trivial-install-test-package").concretized() monkeypatch.setattr(spec.package, "fetcher", URLFetchStrategy(url=mock_archive.url)) - spec.package.do_install() + PackageInstaller([spec.package], explicit=True).install() pkghash = "/" + str(spec.dag_hash(7)) # Put some non-relocatable file in there diff --git a/lib/spack/spack/test/rewiring.py b/lib/spack/spack/test/rewiring.py index f082b1b1539964..523ae5325b2be2 100644 --- a/lib/spack/spack/test/rewiring.py +++ b/lib/spack/spack/test/rewiring.py @@ -11,6 +11,7 @@ import spack.rewiring import spack.store +from spack.installer import PackageInstaller from spack.spec import Spec from spack.test.relocate import text_in_bin @@ -27,8 +28,7 @@ def test_rewire_db(mock_fetch, install_mockery, transitive): """Tests basic rewiring without binary executables.""" spec = Spec("splice-t^splice-h~foo").concretized() dep = Spec("splice-h+foo").concretized() - spec.package.do_install() - dep.package.do_install() + PackageInstaller([spec.package, dep.package], explicit=True).install() spliced_spec = spec.splice(dep, transitive=transitive) assert spec.dag_hash() != spliced_spec.dag_hash() @@ -57,8 +57,7 @@ def test_rewire_bin(mock_fetch, install_mockery, transitive): """Tests basic rewiring with binary executables.""" spec = Spec("quux").concretized() dep = Spec("garply cflags=-g").concretized() - spec.package.do_install() - dep.package.do_install() + PackageInstaller([spec.package, dep.package], explicit=True).install() spliced_spec = spec.splice(dep, transitive=transitive) assert spec.dag_hash() != spliced_spec.dag_hash() @@ -86,8 +85,7 @@ def test_rewire_writes_new_metadata(mock_fetch, install_mockery): Accuracy of metadata is left to other tests.""" spec = Spec("quux").concretized() dep = Spec("garply cflags=-g").concretized() - spec.package.do_install() - dep.package.do_install() + PackageInstaller([spec.package, dep.package], explicit=True).install() spliced_spec = spec.splice(dep, transitive=True) spack.rewiring.rewire(spliced_spec) @@ -129,8 +127,7 @@ def test_uninstall_rewired_spec(mock_fetch, install_mockery, transitive): """Test that rewired packages can be uninstalled as normal.""" spec = Spec("quux").concretized() dep = Spec("garply cflags=-g").concretized() - spec.package.do_install() - dep.package.do_install() + PackageInstaller([spec.package, dep.package], explicit=True).install() spliced_spec = spec.splice(dep, transitive=transitive) spack.rewiring.rewire(spliced_spec) spliced_spec.package.do_uninstall() diff --git a/lib/spack/spack/test/spec_list.py b/lib/spack/spack/test/spec_list.py index 98f0f8b312a786..295665ecfbd8e6 100644 --- a/lib/spack/spack/test/spec_list.py +++ b/lib/spack/spack/test/spec_list.py @@ -6,6 +6,7 @@ import pytest +from spack.installer import PackageInstaller from spack.spec import Spec from spack.spec_list import SpecList @@ -200,8 +201,7 @@ def test_spec_list_exclude_with_abstract_hashes(self, mock_packages, install_moc # Put mpich in the database so it can be referred to by hash. mpich_1 = Spec("mpich+debug").concretized() mpich_2 = Spec("mpich~debug").concretized() - mpich_1.package.do_install(fake=True) - mpich_2.package.do_install(fake=True) + PackageInstaller([mpich_1.package, mpich_2.package], explicit=True, fake=True).install() # Create matrix and exclude +debug, which excludes the first mpich after its abstract hash # is resolved. diff --git a/lib/spack/spack/test/views.py b/lib/spack/spack/test/views.py index c8ff50eeb9a2fa..2a62d04312b8cf 100644 --- a/lib/spack/spack/test/views.py +++ b/lib/spack/spack/test/views.py @@ -9,6 +9,7 @@ from spack.directory_layout import DirectoryLayout from spack.filesystem_view import SimpleFilesystemView, YamlFilesystemView +from spack.installer import PackageInstaller from spack.spec import Spec @@ -17,7 +18,7 @@ def test_remove_extensions_ordered(install_mockery, mock_fetch, tmpdir): layout = DirectoryLayout(view_dir) view = YamlFilesystemView(view_dir, layout) e2 = Spec("extension2").concretized() - e2.package.do_install() + PackageInstaller([e2.package], explicit=True).install() view.add_specs(e2) e1 = e2["extension1"] From 7f57a85514eea522cf0fb4d606ab2e398cc59d12 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 20 Sep 2024 01:25:33 +0200 Subject: [PATCH 189/687] py-pyogrio: add missing GDAL dependency (#46458) --- var/spack/repos/builtin/packages/py-pyogrio/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-pyogrio/package.py b/var/spack/repos/builtin/packages/py-pyogrio/package.py index 6493a3e5103a70..2c0a7c8766b091 100644 --- a/var/spack/repos/builtin/packages/py-pyogrio/package.py +++ b/var/spack/repos/builtin/packages/py-pyogrio/package.py @@ -20,6 +20,7 @@ class PyPyogrio(PythonPackage): version("0.9.0", sha256="6a6fa2e8cf95b3d4a7c0fac48bce6e5037579e28d3eb33b53349d6e11f15e5a8") depends_on("python@3.8:", type=("build", "run")) + depends_on("gdal@2.4:", type=("build", "link", "run")) depends_on("py-cython@0.29:", type="build") depends_on("py-versioneer@0.28 +toml", type="build") # this is an implicit dependency already listed in py-versioneer, not needed From e780a83ac6a93704b310b7b3835814015702395a Mon Sep 17 00:00:00 2001 From: Jon Rood Date: Thu, 19 Sep 2024 17:58:57 -0600 Subject: [PATCH 190/687] amr-wind: use CMAKE_CUDA_ARCHITECTURES (#46442) --- var/spack/repos/builtin/packages/amr-wind/package.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/amr-wind/package.py b/var/spack/repos/builtin/packages/amr-wind/package.py index ba5c15da37539b..5c11e17c465be6 100644 --- a/var/spack/repos/builtin/packages/amr-wind/package.py +++ b/var/spack/repos/builtin/packages/amr-wind/package.py @@ -156,9 +156,7 @@ def cmake_args(self): args.append(define("HDF5_IS_PARALLEL", spec.satisfies("+mpi"))) if spec.satisfies("+cuda"): - amrex_arch = CudaPackage.compute_capabilities(spec.variants["cuda_arch"].value) - if amrex_arch: - args.append(define("AMReX_CUDA_ARCH", amrex_arch)) + args.append(define("CMAKE_CUDA_ARCHITECTURES", spec.variants["cuda_arch"].value)) if spec.satisfies("+rocm"): args.append(define("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) From f9f6f094c34ddbe76e4e8455582041b239b5ff3c Mon Sep 17 00:00:00 2001 From: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Date: Fri, 20 Sep 2024 00:45:31 -0700 Subject: [PATCH 191/687] do_install: post #46423 cleanup (#46496) --- lib/spack/spack/installer.py | 2 +- lib/spack/spack/rewiring.py | 3 ++- lib/spack/spack/test/database.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index e73fa1dc1fd2ae..a02c6bc8564782 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -2221,7 +2221,7 @@ def run(self) -> bool: f"{self.pre} Building {self.pkg_id} [{self.pkg.build_system_class}]" # type: ignore[attr-defined] # noqa: E501 ) - # get verbosity from do_install() parameter or saved value + # get verbosity from install parameter or saved value self.echo = self.verbose if spack.package_base.PackageBase._verbose is not None: self.echo = spack.package_base.PackageBase._verbose diff --git a/lib/spack/spack/rewiring.py b/lib/spack/spack/rewiring.py index bffd085619d011..3b1a9ba451a793 100644 --- a/lib/spack/spack/rewiring.py +++ b/lib/spack/spack/rewiring.py @@ -39,7 +39,8 @@ def rewire(spliced_spec): for spec in spliced_spec.traverse(order="post", root=True): if not spec.build_spec.installed: # TODO: May want to change this at least for the root spec... - # spec.build_spec.package.do_install(force=True) + # TODO: Also remember to import PackageInstaller + # PackageInstaller([spec.build_spec.package]).install() raise PackageNotInstalledError(spliced_spec, spec.build_spec, spec) if spec.build_spec is not spec and not spec.installed: explicit = spec is spliced_spec diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index 6fd7575ffcaa25..7140a502878105 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -725,8 +725,8 @@ def test_external_entries_in_db(mutable_database): def test_regression_issue_8036(mutable_database, usr_folder_exists): # The test ensures that the external package prefix is treated as # existing. Even when the package prefix exists, the package should - # not be considered installed until it is added to the database with - # do_install. + # not be considered installed until it is added to the database by + # the installer with install(). s = spack.spec.Spec("externaltool@0.9") s.concretize() assert not s.installed From b28583bc5887c6ff8929a3178c2441f2a23e8064 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 20 Sep 2024 10:00:34 +0200 Subject: [PATCH 192/687] Remove code from Compiler that is not used anymore (#45982) Signed-off-by: Massimiliano Culpo --- lib/spack/spack/compiler.py | 24 ---------- lib/spack/spack/compilers/__init__.py | 48 +++++++++---------- lib/spack/spack/compilers/aocc.py | 12 ----- lib/spack/spack/compilers/arm.py | 20 -------- lib/spack/spack/compilers/cce.py | 12 ----- lib/spack/spack/compilers/clang.py | 12 ----- lib/spack/spack/compilers/fj.py | 12 ----- lib/spack/spack/compilers/gcc.py | 47 ------------------ lib/spack/spack/compilers/intel.py | 12 ----- lib/spack/spack/compilers/msvc.py | 18 +------ lib/spack/spack/compilers/nag.py | 13 ----- lib/spack/spack/compilers/nvhpc.py | 12 ----- lib/spack/spack/compilers/oneapi.py | 12 ----- lib/spack/spack/compilers/pgi.py | 12 ----- lib/spack/spack/compilers/rocmcc.py | 20 -------- lib/spack/spack/compilers/xl.py | 40 ---------------- lib/spack/spack/compilers/xl_r.py | 12 ----- lib/spack/spack/test/architecture.py | 1 + lib/spack/spack/test/compilers/basics.py | 1 + .../repos/builtin/packages/molgw/package.py | 2 +- 20 files changed, 27 insertions(+), 315 deletions(-) diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index f24ccf679fe7c3..5e9b463dbb9ffc 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -202,18 +202,6 @@ class Compiler: support for specific compilers, their possible names, arguments, and how to identify the particular type of compiler.""" - # Subclasses use possible names of C compiler - cc_names: List[str] = [] - - # Subclasses use possible names of C++ compiler - cxx_names: List[str] = [] - - # Subclasses use possible names of Fortran 77 compiler - f77_names: List[str] = [] - - # Subclasses use possible names of Fortran 90 compiler - fc_names: List[str] = [] - # Optional prefix regexes for searching for this type of compiler. # Prefixes are sometimes used for toolchains prefixes: List[str] = [] @@ -619,18 +607,6 @@ def extract_version_from_output(cls, output): def cc_version(cls, cc): return cls.default_version(cc) - @classmethod - def cxx_version(cls, cxx): - return cls.default_version(cxx) - - @classmethod - def f77_version(cls, f77): - return cls.default_version(f77) - - @classmethod - def fc_version(cls, fc): - return cls.default_version(fc) - @classmethod def search_regexps(cls, language): # Compile all the regular expressions used for files beforehand. diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index 8c14ab759cd190..6b038108269e00 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -8,6 +8,7 @@ """ import importlib import os +import re import sys import warnings from typing import Dict, List, Optional @@ -631,37 +632,34 @@ def is_mixed_toolchain(compiler): Args: compiler (spack.compiler.Compiler): a valid compiler object """ - cc = os.path.basename(compiler.cc or "") - cxx = os.path.basename(compiler.cxx or "") - f77 = os.path.basename(compiler.f77 or "") - fc = os.path.basename(compiler.fc or "") + import spack.detection.path + + executables = [ + os.path.basename(compiler.cc or ""), + os.path.basename(compiler.cxx or ""), + os.path.basename(compiler.f77 or ""), + os.path.basename(compiler.fc or ""), + ] toolchains = set() - for compiler_cls in all_compiler_types(): - # Inspect all the compiler toolchain we know. If a compiler is the - # only compiler supported there it belongs to that toolchain. - def name_matches(name, name_list): - # This is such that 'gcc' matches variations - # like 'ggc-9' etc that are found in distros - name, _, _ = name.partition("-") - return len(name_list) == 1 and name and name in name_list - - if any( - [ - name_matches(cc, compiler_cls.cc_names), - name_matches(cxx, compiler_cls.cxx_names), - name_matches(f77, compiler_cls.f77_names), - name_matches(fc, compiler_cls.fc_names), - ] - ): - tty.debug("[TOOLCHAIN] MATCH {0}".format(compiler_cls.__name__)) - toolchains.add(compiler_cls.__name__) + finder = spack.detection.path.ExecutablesFinder() + + for pkg_name in spack.repo.PATH.packages_with_tags(COMPILER_TAG): + pkg_cls = spack.repo.PATH.get_pkg_class(pkg_name) + patterns = finder.search_patterns(pkg=pkg_cls) + if not patterns: + continue + joined_pattern = re.compile(r"|".join(patterns)) + + if any(joined_pattern.search(exe) for exe in executables): + tty.debug(f"[TOOLCHAIN] MATCH {pkg_name}") + toolchains.add(pkg_name) if len(toolchains) > 1: if ( - toolchains == set(["Clang", "AppleClang", "Aocc"]) + toolchains == {"llvm", "apple-clang", "aocc"} # Msvc toolchain uses Intel ifx - or toolchains == set(["Msvc", "Dpcpp", "Oneapi"]) + or toolchains == {"msvc", "intel-oneapi-compilers"} ): return False tty.debug("[TOOLCHAINS] {0}".format(toolchains)) diff --git a/lib/spack/spack/compilers/aocc.py b/lib/spack/spack/compilers/aocc.py index 26e0b7d893cb19..7ac861c745733d 100644 --- a/lib/spack/spack/compilers/aocc.py +++ b/lib/spack/spack/compilers/aocc.py @@ -13,18 +13,6 @@ class Aocc(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["clang"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["clang++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["flang"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["flang"] - version_argument = "--version" @property diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py index 3bf40aec200519..84e661337bddd8 100644 --- a/lib/spack/spack/compilers/arm.py +++ b/lib/spack/spack/compilers/arm.py @@ -9,18 +9,6 @@ class Arm(spack.compiler.Compiler): - # Subclasses use possible names of C compiler - cc_names = ["armclang"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["armclang++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["armflang"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["armflang"] - # Named wrapper links within lib/spack/env link_paths = { "cc": os.path.join("arm", "armclang"), @@ -90,11 +78,3 @@ def fc_pic_flag(self): return "-fPIC" required_libs = ["libclang", "libflang"] - - @classmethod - def fc_version(cls, fc): - return cls.default_version(fc) - - @classmethod - def f77_version(cls, f77): - return cls.fc_version(f77) diff --git a/lib/spack/spack/compilers/cce.py b/lib/spack/spack/compilers/cce.py index ae3d9889a3a892..7082ffa3c98e82 100644 --- a/lib/spack/spack/compilers/cce.py +++ b/lib/spack/spack/compilers/cce.py @@ -19,18 +19,6 @@ def __init__(self, *args, **kwargs): if not self.is_clang_based: self.version_argument = "-V" - # Subclasses use possible names of C compiler - cc_names = ["craycc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["crayCC"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["crayftn"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["crayftn"] - # MacPorts builds gcc versions with prefixes and -mp-X.Y suffixes. suffixes = [r"-mp-\d\.\d"] diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index 577586cda110d4..98e00aa270f8a8 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -31,18 +31,6 @@ class Clang(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["clang"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["clang++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["flang-new", "flang"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["flang-new", "flang"] - version_argument = "--version" @property diff --git a/lib/spack/spack/compilers/fj.py b/lib/spack/spack/compilers/fj.py index a9df7d2c23cfe9..54fa832fd70a81 100644 --- a/lib/spack/spack/compilers/fj.py +++ b/lib/spack/spack/compilers/fj.py @@ -9,18 +9,6 @@ class Fj(spack.compiler.Compiler): - # Subclasses use possible names of C compiler - cc_names = ["fcc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["FCC"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["frt"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["frt"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("fj", "fcc"), diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index acf3003c3df5f5..41915f5a8aea73 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os -import re from llnl.util.filesystem import ancestor @@ -15,18 +14,6 @@ class Gcc(spack.compiler.Compiler): - # Subclasses use possible names of C compiler - cc_names = ["gcc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["g++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["gfortran"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["gfortran"] - # MacPorts builds gcc versions with prefixes and -mp-X or -mp-X.Y suffixes. # Homebrew and Linuxbrew may build gcc with -X, -X.Y suffixes. # Old compatibility versions may contain XY suffixes. @@ -181,40 +168,6 @@ def default_version(cls, cc): version = cls.extract_version_from_output(output) return version - @classmethod - def fc_version(cls, fc): - """Older versions of gfortran use the ``-dumpversion`` option. - Output looks like this:: - - GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) - Copyright (C) 2010 Free Software Foundation, Inc. - - or:: - - 4.8.5 - - In GCC 7, this option was changed to only return the major - version of the compiler:: - - 7 - - A new ``-dumpfullversion`` option was added that gives us - what we want:: - - 7.2.0 - """ - output = spack.compiler.get_compiler_version_output(fc, "-dumpversion") - match = re.search(r"(?:GNU Fortran \(GCC\) )?([\d.]+)", output) - version = match.group(match.lastindex) if match else "unknown" - if Version(version) >= Version("7"): - output = spack.compiler.get_compiler_version_output(fc, "-dumpfullversion") - version = cls.extract_version_from_output(output) - return version - - @classmethod - def f77_version(cls, f77): - return cls.fc_version(f77) - @property def stdcxx_libs(self): return ("-lstdc++",) diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 1e8ad20afa8f59..3cae5e5873d367 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -11,18 +11,6 @@ class Intel(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["icc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["icpc"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["ifort"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["ifort"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("intel", "icc"), diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index e74bb4e307afaf..0954d0b7d32ad6 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -8,7 +8,7 @@ import subprocess import sys import tempfile -from typing import Dict, List +from typing import Dict import archspec.cpu @@ -117,18 +117,6 @@ def get_valid_fortran_pth(): class Msvc(Compiler): - # Subclasses use possible names of C compiler - cc_names: List[str] = ["cl"] - - # Subclasses use possible names of C++ compiler - cxx_names: List[str] = ["cl"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names: List[str] = ["ifx"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names: List[str] = ["ifx"] - # Named wrapper links within build_env_path # Due to the challenges of supporting compiler wrappers # in Windows, we leave these blank, and dynamically compute @@ -393,7 +381,3 @@ def fc_version(cls, fc): ) clp = spack.util.executable.which_string("cl", path=sps) return cls.default_version(clp) if clp else fc_ver - - @classmethod - def f77_version(cls, f77): - return cls.fc_version(f77) diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py index 6040b74a149ead..4c735c35624971 100644 --- a/lib/spack/spack/compilers/nag.py +++ b/lib/spack/spack/compilers/nag.py @@ -5,7 +5,6 @@ import os import re -from typing import List import llnl.util.lang @@ -13,18 +12,6 @@ class Nag(spack.compiler.Compiler): - # Subclasses use possible names of C compiler - cc_names: List[str] = [] - - # Subclasses use possible names of C++ compiler - cxx_names: List[str] = [] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["nagfor"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["nagfor"] - # Named wrapper links within build_env_path # Use default wrappers for C and C++, in case provided in compilers.yaml link_paths = { diff --git a/lib/spack/spack/compilers/nvhpc.py b/lib/spack/spack/compilers/nvhpc.py index 813d14a6c2df5b..9031ee8fc35c32 100644 --- a/lib/spack/spack/compilers/nvhpc.py +++ b/lib/spack/spack/compilers/nvhpc.py @@ -9,18 +9,6 @@ class Nvhpc(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["nvc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["nvc++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["nvfortran"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["nvfortran"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("nvhpc", "nvc"), diff --git a/lib/spack/spack/compilers/oneapi.py b/lib/spack/spack/compilers/oneapi.py index e8edc227d8a35a..ee279433c321a4 100644 --- a/lib/spack/spack/compilers/oneapi.py +++ b/lib/spack/spack/compilers/oneapi.py @@ -13,18 +13,6 @@ class Oneapi(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["icx"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["icpx"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["ifx"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["ifx"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("oneapi", "icx"), diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py index 1dd7eeed42a7cd..bb7f290be3bb7c 100644 --- a/lib/spack/spack/compilers/pgi.py +++ b/lib/spack/spack/compilers/pgi.py @@ -10,18 +10,6 @@ class Pgi(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["pgcc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["pgc++", "pgCC"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["pgfortran", "pgf77"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["pgfortran", "pgf95", "pgf90"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("pgi", "pgcc"), diff --git a/lib/spack/spack/compilers/rocmcc.py b/lib/spack/spack/compilers/rocmcc.py index 5dc8d1c1d30590..04c3456066afd2 100644 --- a/lib/spack/spack/compilers/rocmcc.py +++ b/lib/spack/spack/compilers/rocmcc.py @@ -11,18 +11,6 @@ class Rocmcc(spack.compilers.clang.Clang): - # Subclasses use possible names of C compiler - cc_names = ["amdclang"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["amdclang++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["amdflang"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["amdflang"] - @property def link_paths(self): link_paths = { @@ -61,14 +49,6 @@ def extract_version_from_output(cls, output): if match: return ".".join(match.groups()) - @classmethod - def fc_version(cls, fortran_compiler): - return cls.default_version(fortran_compiler) - - @classmethod - def f77_version(cls, f77): - return cls.fc_version(f77) - @property def stdcxx_libs(self): return ("-lstdc++",) diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py index 1c1be0e41b4378..f3232e5807ef69 100644 --- a/lib/spack/spack/compilers/xl.py +++ b/lib/spack/spack/compilers/xl.py @@ -10,18 +10,6 @@ class Xl(Compiler): - # Subclasses use possible names of C compiler - cc_names = ["xlc"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["xlC", "xlc++"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["xlf"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["xlf90", "xlf95", "xlf2003", "xlf2008"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("xl", "xlc"), @@ -103,31 +91,3 @@ def fflags(self): # For Fortran 90 and beyond, it is set by default and has not impact. # Its use has no negative side effects. return "-qzerosize" - - @classmethod - def fc_version(cls, fc): - # The fortran and C/C++ versions of the XL compiler are always - # two units apart. By this we mean that the fortran release that - # goes with XL C/C++ 11.1 is 13.1. Having such a difference in - # version number is confusing spack quite a lot. Most notably - # if you keep the versions as is the default xl compiler will - # only have fortran and no C/C++. So we associate the Fortran - # compiler with the version associated to the C/C++ compiler. - # One last stumble. Version numbers over 10 have at least a .1 - # those under 10 a .0. There is no xlf 9.x or under currently - # available. BG/P and BG/L can such a compiler mix and possibly - # older version of AIX and linux on power. - fortran_version = cls.default_version(fc) - if fortran_version >= 16: - # Starting with version 16.1, the XL C and Fortran compilers - # have the same version. So no need to downgrade the Fortran - # compiler version to match that of the C compiler version. - return str(fortran_version) - c_version = float(fortran_version) - 2 - if c_version < 10: - c_version = c_version - 0.1 - return str(c_version) - - @classmethod - def f77_version(cls, f77): - return cls.fc_version(f77) diff --git a/lib/spack/spack/compilers/xl_r.py b/lib/spack/spack/compilers/xl_r.py index 15bcb7234f89b3..7a3007a9c4439a 100644 --- a/lib/spack/spack/compilers/xl_r.py +++ b/lib/spack/spack/compilers/xl_r.py @@ -9,18 +9,6 @@ class XlR(spack.compilers.xl.Xl): - # Subclasses use possible names of C compiler - cc_names = ["xlc_r"] - - # Subclasses use possible names of C++ compiler - cxx_names = ["xlC_r", "xlc++_r"] - - # Subclasses use possible names of Fortran 77 compiler - f77_names = ["xlf_r"] - - # Subclasses use possible names of Fortran 90 compiler - fc_names = ["xlf90_r", "xlf95_r", "xlf2003_r", "xlf2008_r"] - # Named wrapper links within build_env_path link_paths = { "cc": os.path.join("xl_r", "xlc_r"), diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py index 24040ee0c4a892..cbd8a0b9d75ba7 100644 --- a/lib/spack/spack/test/architecture.py +++ b/lib/spack/spack/test/architecture.py @@ -130,6 +130,7 @@ def test_arch_spec_container_semantic(item, architecture_str): ], ) @pytest.mark.filterwarnings("ignore:microarchitecture specific") +@pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper") def test_optimization_flags(compiler_spec, target_name, expected_flags, compiler_factory): target = spack.target.Target(target_name) compiler_dict = compiler_factory(spec=compiler_spec, operating_system="")["compiler"] diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py index ca12ad6030a001..65c05ccbdf3eda 100644 --- a/lib/spack/spack/test/compilers/basics.py +++ b/lib/spack/spack/test/compilers/basics.py @@ -589,6 +589,7 @@ def test_xl_r_flags(): "compiler_spec,expected_result", [("gcc@4.7.2", False), ("clang@3.3", False), ("clang@8.0.0", True)], ) +@pytest.mark.not_on_windows("GCC and LLVM currently not supported on the platform") def test_detecting_mixed_toolchains( compiler_spec, expected_result, mutable_config, compiler_factory ): diff --git a/var/spack/repos/builtin/packages/molgw/package.py b/var/spack/repos/builtin/packages/molgw/package.py index 64325684212c54..ed52c14dd32fa7 100644 --- a/var/spack/repos/builtin/packages/molgw/package.py +++ b/var/spack/repos/builtin/packages/molgw/package.py @@ -101,7 +101,7 @@ def edit(self, spec, prefix): if "+scalapack" in spec: flags["FC"] = "{0}".format(spec["mpi"].mpifc) else: - flags["FC"] = self.compiler.fc_names[0] + flags["FC"] = self.compiler.fc # Set FCFLAGS if self.compiler.flags.get("fflags") is not None: From 51df7e088a0b4cc36e3ec0ac2239d8576455fe5d Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Fri, 20 Sep 2024 11:02:22 -0500 Subject: [PATCH 193/687] gptune: don't make `git` attribute an Executable (#46492) * gptune: don't make `git` attribute an Executable * gptune: fine, I'll fix style myself then --- .../repos/builtin/packages/gptune/package.py | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/var/spack/repos/builtin/packages/gptune/package.py b/var/spack/repos/builtin/packages/gptune/package.py index 5eb7976777ec76..dd047980593048 100644 --- a/var/spack/repos/builtin/packages/gptune/package.py +++ b/var/spack/repos/builtin/packages/gptune/package.py @@ -199,10 +199,7 @@ def cache_test_sources(self): def setup_run_environment(self, env): env.set("GPTUNE_INSTALL_PATH", python_platlib) - bash = which("bash") - cp = which("cp") - git = which("git") - rm = which("rm") + cmd = {"bash": which("bash"), "cp": which("cp"), "git": which("git"), "rm": which("rm")} def test_hypre(self): """set up and run hypre example""" @@ -219,8 +216,8 @@ def test_hypre(self): # copy hypre executables to the correct place wd = join_path(test_dir, "Hypre") with working_dir(wd): - self.rm("-rf", "hypre") - self.git( + self.cmd["rm"]("-rf", "hypre") + self.cmd["git"]( "clone", "--depth", "1", @@ -231,12 +228,12 @@ def test_hypre(self): hypre_test_dir = join_path(wd, "hypre", "src", "test") mkdirp(hypre_test_dir) - self.cp("-r", self.spec["hypre"].prefix.bin.ij, hypre_test_dir) + self.cmd["cp"]("-r", self.spec["hypre"].prefix.bin.ij, hypre_test_dir) # now run the test example with working_dir(join_path(test_dir, "Hypre")): terminate_bash_failures(".") - self.bash("run_examples.sh") + self.cmd["bash"]("run_examples.sh") def test_superlu(self): """set up and run superlu tests""" @@ -252,13 +249,13 @@ def test_superlu(self): # copy only works for-dist executables to the correct place wd = join_path(test_dir, "SuperLU_DIST") with working_dir(wd): - self.rm("-rf", "superlu_dist") + self.cmd["rm"]("-rf", "superlu_dist") version = self.spec["superlu-dist"].version.string tag = f"v{version}" if version.replace(".", "").isdigit() else version # TODO: Replace this IF/when superlu-dist renames its "master" # branch's version from "develop" to "master". tag = "master" if tag == "develop" else tag - self.git( + self.cmd["git"]( "clone", "--depth", "1", @@ -270,7 +267,7 @@ def test_superlu(self): superludriver = self.spec["superlu-dist"].prefix.lib.EXAMPLE.pddrive_spawn example_dir = join_path(wd, "superlu_dist", "build", "EXAMPLE") mkdirp(example_dir) - self.cp("-r", superludriver, example_dir) + self.cmd["cp"]("-r", superludriver, example_dir) apps = ["SuperLU_DIST", "SuperLU_DIST_RCI"] for app in apps: @@ -279,7 +276,7 @@ def test_superlu(self): raise SkipTest("Package must be installed with +superlu+mpispawn") with working_dir(join_path(test_dir, app)): terminate_bash_failures(".") - self.bash("run_examples.sh") + self.cmd["bash"]("run_examples.sh") def test_demo(self): """Run the demo test""" @@ -290,7 +287,7 @@ def test_demo(self): with working_dir(join_path(test_dir, "GPTune-Demo")): terminate_bash_failures(".") - self.bash("run_examples.sh") + self.cmd["bash"]("run_examples.sh") def test_scalapack(self): """Run scalapack tests""" @@ -303,4 +300,4 @@ def test_scalapack(self): raise SkipTest("Package must be installed with +superlu+mpispawn") with working_dir(join_path(test_dir, app)): terminate_bash_failures(".") - self.bash("run_examples.sh") + self.cmd["bash"]("run_examples.sh") From 97961555dc672ee8b1915603d0809b42aae9bd55 Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:12:56 -0700 Subject: [PATCH 194/687] petsc@3.21 +rocm: add patches for rocm 6+ (#46486) --- var/spack/repos/builtin/packages/petsc/package.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index ae06e55a1285a3..460b034c6afccb 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -183,6 +183,16 @@ class Petsc(Package, CudaPackage, ROCmPackage): when="@3.20.0", sha256="ba327f8b2a0fa45209dfb7a4278f3e9a323965b5a668be204c1c77c17a963a7f", ) + patch( + "https://gitlab.com/petsc/petsc/-/commit/20d5ecbf88175ced320006c488dcefa2efb1e67f.diff", + when="@3.21 ^hip@6:", + sha256="2904ea20c71e2f21b8475513c3e5de7465e328e2485ae706b003aa79314e3e7c", + ) + patch( + "https://gitlab.com/petsc/petsc/-/commit/bdb83d9f3e3c55b3bd4c8732bfe2066c23f10f61.diff", + when="@3.21 ^hip@6:", + sha256="89cf2c9a01d4a3233c889dd98496a29bf43db1bc69195892f9e5405c537b87e3", + ) patch("hip-5.6.0-for-3.18.diff", when="@3.18:3.19 ^hipsparse@5.6.0") patch("hip-5.7-plus-for-3.18.diff", when="@3.18:3.19 ^hipsparse@5.7:") patch( From 14e8902854127edaeb38ca76560e0e7fa2f1b30c Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 20 Sep 2024 18:30:43 +0200 Subject: [PATCH 195/687] gcc: simplify setup_run_environment (#46505) If the spec is external, it has extra attributes. If not, we know which names are used. In both cases we don't need to search again for executables. Signed-off-by: Massimiliano Culpo --- .../repos/builtin/packages/gcc/package.py | 33 ++++--------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index eca0fdb71443f2..88709c03ddc210 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -3,7 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import glob -import itertools import os import sys @@ -979,33 +978,15 @@ def write_specs_file(self): tty.info(f"Wrote new spec file to {specs_file}") def setup_run_environment(self, env): - # Search prefix directory for possibly modified compiler names - from spack.compilers.gcc import Gcc as Compiler - - # Get the contents of the installed binary directory - bin_path = self.spec.prefix.bin - - if not os.path.isdir(bin_path): - return - - bin_contents = os.listdir(bin_path) - - # Find the first non-symlink compiler binary present for each language - for lang in ["cc", "cxx", "fc", "f77"]: - for filename, regexp in itertools.product(bin_contents, Compiler.search_regexps(lang)): - if not regexp.match(filename): - continue - - abspath = os.path.join(bin_path, filename) + if self.spec.satisfies("languages=c"): + env.set("CC", self.cc) - # Skip broken symlinks (https://github.com/spack/spack/issues/41327) - if not os.path.exists(abspath): - continue + if self.spec.satisfies("languages=cxx"): + env.set("CXX", self.cxx) - # Set the proper environment variable - env.set(lang.upper(), abspath) - # Stop searching filename/regex combos for this language - break + if self.spec.satisfies("languages=fortran"): + env.set("FC", self.fortran) + env.set("F77", self.fortran) def detect_gdc(self): """Detect and return the path to GDC that belongs to the same instance of GCC that is used From 7711730f2cfb167a93d93577a0ca180325ccbd0d Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 20 Sep 2024 19:30:09 +0200 Subject: [PATCH 196/687] spack.modules: move get_module up (#46428) --- lib/spack/spack/cmd/modules/__init__.py | 6 +-- lib/spack/spack/modules/__init__.py | 71 +++++++++++++++++++++++++ lib/spack/spack/modules/common.py | 62 --------------------- lib/spack/spack/test/modules/common.py | 4 +- 4 files changed, 76 insertions(+), 67 deletions(-) diff --git a/lib/spack/spack/cmd/modules/__init__.py b/lib/spack/spack/cmd/modules/__init__.py index 4cf940ca17e889..b11063714f75c7 100644 --- a/lib/spack/spack/cmd/modules/__init__.py +++ b/lib/spack/spack/cmd/modules/__init__.py @@ -173,7 +173,7 @@ def loads(module_type, specs, args, out=None): modules = list( ( spec, - spack.modules.common.get_module( + spack.modules.get_module( module_type, spec, get_full_path=False, @@ -222,7 +222,7 @@ def find(module_type, specs, args): try: modules = [ - spack.modules.common.get_module( + spack.modules.get_module( module_type, spec, args.full_path, @@ -233,7 +233,7 @@ def find(module_type, specs, args): ] modules.append( - spack.modules.common.get_module( + spack.modules.get_module( module_type, single_spec, args.full_path, diff --git a/lib/spack/spack/modules/__init__.py b/lib/spack/spack/modules/__init__.py index b466b2aafb428a..39d696b1369ff1 100644 --- a/lib/spack/spack/modules/__init__.py +++ b/lib/spack/spack/modules/__init__.py @@ -7,8 +7,16 @@ include Tcl non-hierarchical modules, Lua hierarchical modules, and others. """ +import os from typing import Dict, Type +import llnl.util.tty as tty + +import spack.repo +import spack.spec +import spack.store + +from . import common from .common import BaseModuleFileWriter, disable_modules from .lmod import LmodModulefileWriter from .tcl import TclModulefileWriter @@ -19,3 +27,66 @@ "tcl": TclModulefileWriter, "lmod": LmodModulefileWriter, } + + +def get_module( + module_type, spec: spack.spec.Spec, get_full_path, module_set_name="default", required=True +): + """Retrieve the module file for a given spec and module type. + + Retrieve the module file for the given spec if it is available. If the + module is not available, this will raise an exception unless the module + is excluded or if the spec is installed upstream. + + Args: + module_type: the type of module we want to retrieve (e.g. lmod) + spec: refers to the installed package that we want to retrieve a module + for + required: if the module is required but excluded, this function will + print a debug message. If a module is missing but not excluded, + then an exception is raised (regardless of whether it is required) + get_full_path: if ``True``, this returns the full path to the module. + Otherwise, this returns the module name. + module_set_name: the named module configuration set from modules.yaml + for which to retrieve the module. + + Returns: + The module name or path. May return ``None`` if the module is not + available. + """ + try: + upstream = spec.installed_upstream + except spack.repo.UnknownPackageError: + upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash()) + if upstream: + module = common.upstream_module_index.upstream_module(spec, module_type) + if not module: + return None + + if get_full_path: + return module.path + else: + return module.use_name + else: + writer = module_types[module_type](spec, module_set_name) + if not os.path.isfile(writer.layout.filename): + fmt_str = "{name}{@version}{/hash:7}" + if not writer.conf.excluded: + raise common.ModuleNotFoundError( + "The module for package {} should be at {}, but it does not exist".format( + spec.format(fmt_str), writer.layout.filename + ) + ) + elif required: + tty.debug( + "The module configuration has excluded {}: omitting it".format( + spec.format(fmt_str) + ) + ) + else: + return None + + if get_full_path: + return writer.layout.filename + else: + return writer.layout.use_name diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index cf81bcaba55fc7..b6972aba453ff1 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -46,7 +46,6 @@ import spack.deptypes as dt import spack.environment import spack.error -import spack.modules import spack.paths import spack.projections as proj import spack.repo @@ -324,67 +323,6 @@ def upstream_module(self, spec, module_type): return None -def get_module(module_type, spec, get_full_path, module_set_name="default", required=True): - """Retrieve the module file for a given spec and module type. - - Retrieve the module file for the given spec if it is available. If the - module is not available, this will raise an exception unless the module - is excluded or if the spec is installed upstream. - - Args: - module_type: the type of module we want to retrieve (e.g. lmod) - spec: refers to the installed package that we want to retrieve a module - for - required: if the module is required but excluded, this function will - print a debug message. If a module is missing but not excluded, - then an exception is raised (regardless of whether it is required) - get_full_path: if ``True``, this returns the full path to the module. - Otherwise, this returns the module name. - module_set_name: the named module configuration set from modules.yaml - for which to retrieve the module. - - Returns: - The module name or path. May return ``None`` if the module is not - available. - """ - try: - upstream = spec.installed_upstream - except spack.repo.UnknownPackageError: - upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash()) - if upstream: - module = upstream_module_index.upstream_module(spec, module_type) - if not module: - return None - - if get_full_path: - return module.path - else: - return module.use_name - else: - writer = spack.modules.module_types[module_type](spec, module_set_name) - if not os.path.isfile(writer.layout.filename): - fmt_str = "{name}{@version}{/hash:7}" - if not writer.conf.excluded: - raise ModuleNotFoundError( - "The module for package {} should be at {}, but it does not exist".format( - spec.format(fmt_str), writer.layout.filename - ) - ) - elif required: - tty.debug( - "The module configuration has excluded {}: omitting it".format( - spec.format(fmt_str) - ) - ) - else: - return None - - if get_full_path: - return writer.layout.filename - else: - return writer.layout.use_name - - class BaseConfiguration: """Manipulates the information needed to generate a module file to make querying easier. It needs to be sub-classed for specific module types. diff --git a/lib/spack/spack/test/modules/common.py b/lib/spack/spack/test/modules/common.py index f1430ecf6ebe20..7190689f824dec 100644 --- a/lib/spack/spack/test/modules/common.py +++ b/lib/spack/spack/test/modules/common.py @@ -171,7 +171,7 @@ def test_get_module_upstream(): old_index = spack.modules.common.upstream_module_index spack.modules.common.upstream_module_index = upstream_index - m1_path = spack.modules.common.get_module("tcl", s1, True) + m1_path = spack.modules.get_module("tcl", s1, True) assert m1_path == "/path/to/a" finally: spack.modules.common.upstream_module_index = old_index @@ -193,7 +193,7 @@ def find_nothing(*args): with pytest.raises(spack.repo.UnknownPackageError): spec.package - module_path = spack.modules.common.get_module("tcl", spec, True) + module_path = spack.modules.get_module("tcl", spec, True) assert module_path spack.package_base.PackageBase.uninstall_by_spec(spec) From cfee88a5bb56a1c8ec892879e04cb6a17c4f9404 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:55:17 -0400 Subject: [PATCH 197/687] Docs/Windows: Clarify supported shells and caveats (#46381) While the existing getting started guide does in fact reference the powershell support, it's a footnote and easily missed. This PR adds explicit, upfront mentions of the powershell support. Additionally this PR adds notes about some of the issues with certain components of the spec syntax when using CMD. --- lib/spack/docs/basic_usage.rst | 11 +++++++++++ lib/spack/docs/getting_started.rst | 31 +++++++++--------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst index 69cbefc083db4d..171a82b6ea1e37 100644 --- a/lib/spack/docs/basic_usage.rst +++ b/lib/spack/docs/basic_usage.rst @@ -1175,6 +1175,17 @@ unspecified version, but packages can depend on other packages with could depend on ``mpich@1.2:`` if it can only build with version ``1.2`` or higher of ``mpich``. +.. note:: Windows Spec Syntax Caveats + Windows has a few idiosyncrasies when it comes to the Spack spec syntax and the use of certain shells + Spack's spec dependency syntax uses the carat (``^``) character, however this is an escape string in CMD + so it must be escaped with an additional carat (i.e. ``^^``). + CMD also will attempt to interpret strings with ``=`` characters in them. Any spec including this symbol + must double quote the string. + + Note: All of these issues are unique to CMD, they can be avoided by using Powershell. + + For more context on these caveats see the related issues: `carat `_ and `equals `_ + Below are more details about the specifiers that you can add to specs. .. _version-specifier: diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst index 4cbd1efee7a549..7bcb7b178d4212 100644 --- a/lib/spack/docs/getting_started.rst +++ b/lib/spack/docs/getting_started.rst @@ -1475,16 +1475,14 @@ in a Windows CMD prompt. Step 3: Run and configure Spack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -To use Spack, run ``bin\spack_cmd.bat`` (you may need to Run as Administrator) from the top-level spack -directory. This will provide a Windows command prompt with an environment properly set up with Spack -and its prerequisites. If you receive a warning message that Python is not in your ``PATH`` +On Windows, Spack supports both primary native shells, Powershell and the traditional command prompt. +To use Spack, pick your favorite shell, and run ``bin\spack_cmd.bat`` or ``share/spack/setup-env.ps1`` +(you may need to Run as Administrator) from the top-level spack +directory. This will provide a Spack enabled shell. If you receive a warning message that Python is not in your ``PATH`` (which may happen if you installed Python from the website and not the Windows Store) add the location of the Python executable to your ``PATH`` now. You can permanently add Python to your ``PATH`` variable by using the ``Edit the system environment variables`` utility in Windows Control Panel. -.. note:: - Alternatively, Powershell can be used in place of CMD - To configure Spack, first run the following command inside the Spack console: .. code-block:: console @@ -1549,7 +1547,7 @@ and not tabs, so ensure that this is the case when editing one directly. .. note:: Cygwin The use of Cygwin is not officially supported by Spack and is not tested. - However Spack will not throw an error, so use if choosing to use Spack + However Spack will not prevent this, so use if choosing to use Spack with Cygwin, know that no functionality is garunteed. ^^^^^^^^^^^^^^^^^ @@ -1563,21 +1561,12 @@ Spack console via: spack install cpuinfo -If in the previous step, you did not have CMake or Ninja installed, running the command above should bootstrap both packages +If in the previous step, you did not have CMake or Ninja installed, running the command above should install both packages -""""""""""""""""""""""""""" -Windows Compatible Packages -""""""""""""""""""""""""""" +.. note:: Spec Syntax Caveats + Windows has a few idiosyncrasies when it comes to the Spack spec syntax and the use of certain shells + See the Spack spec syntax doc for more information -Not all spack packages currently have Windows support. Some are inherently incompatible with the -platform, and others simply have yet to be ported. To view the current set of packages with Windows -support, the list command should be used via `spack list -t windows`. If there's a package you'd like -to install on Windows but is not in that list, feel free to reach out to request the port or contribute -the port yourself. - -.. note:: - This is by no means a comprehensive list, some packages may have ports that were not tagged - while others may just work out of the box on Windows and have not been tagged as such. ^^^^^^^^^^^^^^ For developers @@ -1588,5 +1577,3 @@ Python, Git, and Spack, instead of requiring the user to do so manually. Instructions for creating the installer are at https://github.com/spack/spack/blob/develop/lib/spack/spack/cmd/installer/README.md -Alternatively a pre-built copy of the Windows installer is available as an artifact of Spack's Windows CI -available at each run of the CI on develop or any PR. From fc6cd7c51f21a6cd7d4a7be8b0f4430358d02006 Mon Sep 17 00:00:00 2001 From: Stephen Herbener <32968781+srherbener@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:46:42 -0600 Subject: [PATCH 198/687] Introduce the bufr_query library from NOAA-EMC (#45920) * Introduce the bufr_query library from NOAA-EMC (#461) This PR adds in a new package.py script for the new bufr_query library from NOAA-EMC. This is being used by JEDI and other applications. * Add explicit build dependency spec to the pybind11 depends_on spec Co-authored-by: Wouter Deconinck * Convert patch file to the URL form which pulls the changes from github. Co-authored-by: Wouter Deconinck * Added new version (0.0.3) and removed obsolete site-packages.patch file --------- Co-authored-by: Wouter Deconinck --- .../builtin/packages/bufr-query/package.py | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 var/spack/repos/builtin/packages/bufr-query/package.py diff --git a/var/spack/repos/builtin/packages/bufr-query/package.py b/var/spack/repos/builtin/packages/bufr-query/package.py new file mode 100644 index 00000000000000..bf79f5f581bd82 --- /dev/null +++ b/var/spack/repos/builtin/packages/bufr-query/package.py @@ -0,0 +1,59 @@ +# Copyright 2013-2024 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 BufrQuery(CMakePackage, PythonExtension): + """The NOAA bufr-query Library can be used to read NCEP and WMO formated BUFR + files using a simple interface that does not require the user to know the + details of the BUFR format. Detailed documentation for the BUFR Library can + be found at https://bufr-query.readthedocs.io/en/latest/index.html""" + + homepage = "https://github.com/NOAA-EMC/bufr-query" + url = "https://github.com/NOAA-EMC/bufr-query/archive/refs/tags/v0.0.1.tar.gz" + maintainers("srherbener", "rmclaren") + + license("Apache-2.0", checked_by="srherbener") + + version("0.0.3", sha256="f2952a190cc1d7714a3bfe481fb1545459639ba304fc31b941062b471dea1d41") + version("0.0.2", sha256="b87a128246e79e3c76e3158d89823e2ae38e9ee1a5a81b6f7b423837bdb93a1f") + version("0.0.1", sha256="001990d864533c101b93d1c351edf50cf8b5ccc575e442d174735f6c332d3d03") + + # Required dependencies + depends_on("ecbuild", type=("build")) + depends_on("llvm-openmp", when="%apple-clang", type=("build", "run")) + depends_on("mpi", type=("build", "run")) + depends_on("eckit@1.24.4:", type=("build", "run")) + depends_on("eigen@3:", type=("build", "run")) + depends_on("gsl-lite", type=("build", "run")) + depends_on("netcdf-c", type=("build", "run")) + depends_on("netcdf-cxx4", type=("build", "run")) + depends_on("bufr", type=("build", "run")) + + # Optional dependencies + variant("python", default=True, description="Enable Python interface") + + with when("+python"): + extends("python") + depends_on("py-pybind11", type="build") + + # Patches + patch( + "https://github.com/NOAA-EMC/bufr-query/pull/20.patch?full_index=1", + sha256="3acf11082c9e76e64dbbda4f62ac0cbc234dca7e60c85a275e778417cfd65001", + when="+python @:0.0.2", + ) + + # CMake configuration + def cmake_args(self): + args = [self.define_from_variant("BUILD_PYTHON_BINDINGS", "python")] + + # provide path to netcdf-c include files + nc_include_dir = Executable("nc-config")("--includedir", output=str).strip() + args.append("-DCMAKE_C_FLAGS=-I" + nc_include_dir) + args.append("-DCMAKE_CXX_FLAGS=-I" + nc_include_dir) + + return args From cd3bd453d3dcf72c08176c2e73f3dba73d7cc7c3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 21 Sep 2024 01:44:49 -0500 Subject: [PATCH 199/687] chatterbug: update homepage and git (#46489) --- var/spack/repos/builtin/packages/chatterbug/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/chatterbug/package.py b/var/spack/repos/builtin/packages/chatterbug/package.py index d8d7c0351ecd9a..2ce3a2c7f995ea 100644 --- a/var/spack/repos/builtin/packages/chatterbug/package.py +++ b/var/spack/repos/builtin/packages/chatterbug/package.py @@ -15,8 +15,8 @@ class Chatterbug(MakefilePackage): tags = ["proxy-app"] - homepage = "https://chatterbug.readthedocs.io" - git = "https://github.com/LLNL/chatterbug.git" + homepage = "https://github.com/hpcgroup/chatterbug" + git = "https://github.com/hpcgroup/chatterbug.git" license("MIT") From 35ae2743d9888098a8f1409a327aeefa2f97f4b0 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 21 Sep 2024 01:45:29 -0500 Subject: [PATCH 200/687] cans: update homepage and url (#46488) --- var/spack/repos/builtin/packages/cans/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/cans/package.py b/var/spack/repos/builtin/packages/cans/package.py index 8279910a085f55..8c8472a84d93c1 100644 --- a/var/spack/repos/builtin/packages/cans/package.py +++ b/var/spack/repos/builtin/packages/cans/package.py @@ -15,8 +15,8 @@ class Cans(MakefilePackage): finite-difference Poisson equation in a 3D Cartesian grid.""" - homepage = "https://github.com/p-costa/CaNS" - url = "https://github.com/p-costa/CaNS/archive/refs/tags/v1.1.4.tar.gz" + homepage = "https://github.com/CaNS-World/CaNS" + url = "https://github.com/CaNS-World/CaNS/archive/refs/tags/v1.1.4.tar.gz" maintainers("lhxone", "p-costa", "nscapin", "GabrieleBoga") From b93c57cab972d676c9540e01137fd5e0af87fa5a Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Sat, 21 Sep 2024 14:05:41 +0200 Subject: [PATCH 201/687] Remove `spack.target` from code (#46503) The `spack.target.Target` class is a weird entity, that is just needed to: 1. Sort microarchitectures in lists deterministically 2. Being able to use microarchitectures in hashed containers This PR removes it, and uses `archspec.cpu.Microarchitecture` directly. To sort lists, we use a proper `key=` when needed. Being able to use `Microarchitecture` objects in sets is achieved by updating the external `archspec`. Signed-off-by: Massimiliano Culpo --- lib/spack/docs/conf.py | 1 + lib/spack/external/__init__.py | 2 +- .../archspec/cpu/microarchitecture.py | 3 + lib/spack/spack/build_environment.py | 38 ++++- lib/spack/spack/compilers/__init__.py | 5 +- lib/spack/spack/patch.py | 14 +- lib/spack/spack/platforms/_platform.py | 8 +- lib/spack/spack/platforms/darwin.py | 5 +- lib/spack/spack/platforms/freebsd.py | 4 +- lib/spack/spack/platforms/linux.py | 4 +- lib/spack/spack/platforms/test.py | 7 +- lib/spack/spack/platforms/windows.py | 5 +- lib/spack/spack/solver/asp.py | 4 +- lib/spack/spack/spec.py | 64 ++++--- lib/spack/spack/stage.py | 12 +- lib/spack/spack/target.py | 161 ------------------ lib/spack/spack/test/architecture.py | 82 --------- lib/spack/spack/test/build_environment.py | 63 +++++++ lib/spack/spack/test/config.py | 2 +- lib/spack/spack/util/path.py | 2 +- .../repos/builtin/packages/amdfftw/package.py | 6 +- .../repos/builtin/packages/arbor/package.py | 18 +- .../repos/builtin/packages/hpcc/package.py | 3 +- .../repos/builtin/packages/lammps/package.py | 3 +- .../repos/builtin/packages/namd/package.py | 3 +- .../repos/builtin/packages/neuron/package.py | 3 +- .../builtin/packages/py-tensorflow/package.py | 3 +- .../repos/builtin/packages/wgl/package.py | 2 +- 28 files changed, 201 insertions(+), 326 deletions(-) delete mode 100644 lib/spack/spack/target.py diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 95b711db93f725..c80a661abdd910 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -219,6 +219,7 @@ def setup(sphinx): ("py:class", "spack.install_test.Pb"), ("py:class", "spack.filesystem_view.SimpleFilesystemView"), ("py:class", "spack.traverse.EdgeAndDepth"), + ("py:class", "archspec.cpu.microarchitecture.Microarchitecture"), ] # The reST default role (used for this markup: `text`) to use for all documents. diff --git a/lib/spack/external/__init__.py b/lib/spack/external/__init__.py index b6a35925d5cc1b..603cb412c89b70 100644 --- a/lib/spack/external/__init__.py +++ b/lib/spack/external/__init__.py @@ -18,7 +18,7 @@ * Homepage: https://pypi.python.org/pypi/archspec * Usage: Labeling, comparison and detection of microarchitectures -* Version: 0.2.5-dev (commit cbb1fd5eb397a70d466e5160b393b87b0dbcc78f) +* Version: 0.2.5-dev (commit bceb39528ac49dd0c876b2e9bf3e7482e9c2be4a) astunparse ---------------- diff --git a/lib/spack/external/archspec/cpu/microarchitecture.py b/lib/spack/external/archspec/cpu/microarchitecture.py index 1ffe51d9184087..3f4e30fab55982 100644 --- a/lib/spack/external/archspec/cpu/microarchitecture.py +++ b/lib/spack/external/archspec/cpu/microarchitecture.py @@ -115,6 +115,9 @@ def __eq__(self, other): and self.cpu_part == other.cpu_part ) + def __hash__(self): + return hash(self.name) + @coerce_target_names def __ne__(self, other): return not self == other diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 26eb0e79f68e03..fd0adbf39d3016 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -45,6 +45,8 @@ from itertools import chain from typing import Dict, List, Set, Tuple +import archspec.cpu + import llnl.util.tty as tty from llnl.string import plural from llnl.util.filesystem import join_path @@ -358,7 +360,7 @@ def set_compiler_environment_variables(pkg, env): _add_werror_handling(keep_werror, env) # Set the target parameters that the compiler will add - isa_arg = spec.architecture.target.optimization_flags(compiler) + isa_arg = optimization_flags(compiler, spec.target) env.set("SPACK_TARGET_ARGS", isa_arg) # Trap spack-tracked compiler flags as appropriate. @@ -403,6 +405,36 @@ def set_compiler_environment_variables(pkg, env): return env +def optimization_flags(compiler, target): + if spack.compilers.is_mixed_toolchain(compiler): + msg = ( + "microarchitecture specific optimizations are not " + "supported yet on mixed compiler toolchains [check" + f" {compiler.name}@{compiler.version} for further details]" + ) + tty.debug(msg) + return "" + + # Try to check if the current compiler comes with a version number or + # has an unexpected suffix. If so, treat it as a compiler with a + # custom spec. + compiler_version = compiler.version + version_number, suffix = archspec.cpu.version_components(compiler.version) + if not version_number or suffix: + try: + compiler_version = compiler.real_version + except spack.util.executable.ProcessError as e: + # log this and just return compiler.version instead + tty.debug(str(e)) + + try: + result = target.optimization_flags(compiler.name, compiler_version.dotted_numeric_string) + except (ValueError, archspec.cpu.UnsupportedMicroarchitecture): + result = "" + + return result + + def set_wrapper_variables(pkg, env): """Set environment variables used by the Spack compiler wrapper (which have the prefix `SPACK_`) and also add the compiler wrappers to PATH. @@ -783,7 +815,6 @@ def setup_package(pkg, dirty, context: Context = Context.BUILD): # Platform specific setup goes before package specific setup. This is for setting # defaults like MACOSX_DEPLOYMENT_TARGET on macOS. platform = spack.platforms.by_name(pkg.spec.architecture.platform) - target = platform.target(pkg.spec.architecture.target) platform.setup_platform_environment(pkg, env_mods) tty.debug("setup_package: grabbing modifications from dependencies") @@ -808,9 +839,6 @@ def setup_package(pkg, dirty, context: Context = Context.BUILD): for mod in pkg.compiler.modules: load_module(mod) - if target and target.module_name: - load_module(target.module_name) - load_external_modules(pkg) implicit_rpaths = pkg.compiler.implicit_rpaths() diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index 6b038108269e00..bfb781685f834a 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -558,7 +558,7 @@ def get_compilers(config, cspec=None, arch_spec=None): except KeyError: # TODO: Check if this exception handling makes sense, or if we # TODO: need to change / refactor tests - family = arch_spec.target + family = str(arch_spec.target) except AttributeError: assert arch_spec is None @@ -803,12 +803,11 @@ def _extract_os_and_target(spec: "spack.spec.Spec"): if not spec.architecture: host_platform = spack.platforms.host() operating_system = host_platform.operating_system("default_os") - target = host_platform.target("default_target").microarchitecture + target = host_platform.target("default_target") else: target = spec.architecture.target if not target: target = spack.platforms.host().target("default_target") - target = target.microarchitecture operating_system = spec.os if not operating_system: diff --git a/lib/spack/spack/patch.py b/lib/spack/spack/patch.py index 50393ecfad11e8..a0f4152317c1e9 100644 --- a/lib/spack/spack/patch.py +++ b/lib/spack/spack/patch.py @@ -15,7 +15,7 @@ import spack import spack.error -import spack.fetch_strategy as fs +import spack.fetch_strategy import spack.mirror import spack.repo import spack.stage @@ -314,11 +314,15 @@ def stage(self) -> "spack.stage.Stage": # Two checksums, one for compressed file, one for its contents if self.archive_sha256 and self.sha256: - fetcher: fs.FetchStrategy = fs.FetchAndVerifyExpandedFile( - self.url, archive_sha256=self.archive_sha256, expanded_sha256=self.sha256 + fetcher: spack.fetch_strategy.FetchStrategy = ( + spack.fetch_strategy.FetchAndVerifyExpandedFile( + self.url, archive_sha256=self.archive_sha256, expanded_sha256=self.sha256 + ) ) else: - fetcher = fs.URLFetchStrategy(url=self.url, sha256=self.sha256, expand=False) + fetcher = spack.fetch_strategy.URLFetchStrategy( + url=self.url, sha256=self.sha256, expand=False + ) # The same package can have multiple patches with the same name but # with different contents, therefore apply a subset of the hash. @@ -397,7 +401,7 @@ def from_dict( sha256 = dictionary["sha256"] checker = Checker(sha256) if patch.path and not checker.check(patch.path): - raise fs.ChecksumError( + raise spack.fetch_strategy.ChecksumError( "sha256 checksum failed for %s" % patch.path, "Expected %s but got %s " % (sha256, checker.sum) + "Patch may have changed since concretization.", diff --git a/lib/spack/spack/platforms/_platform.py b/lib/spack/spack/platforms/_platform.py index c165cf9f3375af..866895896610cb 100644 --- a/lib/spack/spack/platforms/_platform.py +++ b/lib/spack/spack/platforms/_platform.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from typing import Optional +import archspec.cpu + import llnl.util.lang import spack.error @@ -60,7 +62,7 @@ def __init__(self, name): self.operating_sys = {} self.name = name - def add_target(self, name, target): + def add_target(self, name: str, target: archspec.cpu.Microarchitecture) -> None: """Used by the platform specific subclass to list available targets. Raises an error if the platform specifies a name that is reserved by spack as an alias. @@ -70,6 +72,10 @@ def add_target(self, name, target): raise ValueError(msg.format(name)) self.targets[name] = target + def _add_archspec_targets(self): + for name, microarchitecture in archspec.cpu.TARGETS.items(): + self.add_target(name, microarchitecture) + def target(self, name): """This is a getter method for the target dictionary that handles defaulting based on the values provided by default, diff --git a/lib/spack/spack/platforms/darwin.py b/lib/spack/spack/platforms/darwin.py index 1b7a5927f43ac2..7ea6a09c5838c4 100644 --- a/lib/spack/spack/platforms/darwin.py +++ b/lib/spack/spack/platforms/darwin.py @@ -7,7 +7,6 @@ import archspec.cpu -import spack.target from spack.operating_systems.mac_os import MacOs from spack.version import Version @@ -21,9 +20,7 @@ class Darwin(Platform): def __init__(self): super().__init__("darwin") - - for name in archspec.cpu.TARGETS: - self.add_target(name, spack.target.Target(name)) + self._add_archspec_targets() self.default = archspec.cpu.host().name self.front_end = self.default diff --git a/lib/spack/spack/platforms/freebsd.py b/lib/spack/spack/platforms/freebsd.py index 4485550789726e..af9b1a093464ba 100644 --- a/lib/spack/spack/platforms/freebsd.py +++ b/lib/spack/spack/platforms/freebsd.py @@ -6,7 +6,6 @@ import archspec.cpu -import spack.target from spack.operating_systems.freebsd import FreeBSDOs from ._platform import Platform @@ -18,8 +17,7 @@ class FreeBSD(Platform): def __init__(self): super().__init__("freebsd") - for name in archspec.cpu.TARGETS: - self.add_target(name, spack.target.Target(name)) + self._add_archspec_targets() # Get specific default self.default = archspec.cpu.host().name diff --git a/lib/spack/spack/platforms/linux.py b/lib/spack/spack/platforms/linux.py index 2be5b51cb295e2..aede37d8682417 100644 --- a/lib/spack/spack/platforms/linux.py +++ b/lib/spack/spack/platforms/linux.py @@ -6,7 +6,6 @@ import archspec.cpu -import spack.target from spack.operating_systems.linux_distro import LinuxDistro from ._platform import Platform @@ -18,8 +17,7 @@ class Linux(Platform): def __init__(self): super().__init__("linux") - for name in archspec.cpu.TARGETS: - self.add_target(name, spack.target.Target(name)) + self._add_archspec_targets() # Get specific default self.default = archspec.cpu.host().name diff --git a/lib/spack/spack/platforms/test.py b/lib/spack/spack/platforms/test.py index 9ead66ab273191..8633efc7cb830a 100644 --- a/lib/spack/spack/platforms/test.py +++ b/lib/spack/spack/platforms/test.py @@ -4,8 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import platform +import archspec.cpu + import spack.operating_systems -import spack.target from ._platform import Platform @@ -32,8 +33,8 @@ class Test(Platform): def __init__(self, name=None): name = name or "test" super().__init__(name) - self.add_target(self.default, spack.target.Target(self.default)) - self.add_target(self.front_end, spack.target.Target(self.front_end)) + self.add_target(self.default, archspec.cpu.TARGETS[self.default]) + self.add_target(self.front_end, archspec.cpu.TARGETS[self.front_end]) self.add_operating_system( self.default_os, spack.operating_systems.OperatingSystem("debian", 6) diff --git a/lib/spack/spack/platforms/windows.py b/lib/spack/spack/platforms/windows.py index c00382e1980d17..8cc89b4b19a7f0 100755 --- a/lib/spack/spack/platforms/windows.py +++ b/lib/spack/spack/platforms/windows.py @@ -7,7 +7,6 @@ import archspec.cpu -import spack.target from spack.operating_systems.windows_os import WindowsOs from ._platform import Platform @@ -18,9 +17,7 @@ class Windows(Platform): def __init__(self): super().__init__("windows") - - for name in archspec.cpu.TARGETS: - self.add_target(name, spack.target.Target(name)) + self._add_archspec_targets() self.default = archspec.cpu.host().name self.front_end = self.default diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index d8d052f3113e5d..3fd8b9cc8d85a0 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -2479,7 +2479,7 @@ def _all_targets_satisfiying(single_constraint): return allowed_targets cache = {} - for target_constraint in sorted(self.target_constraints): + for target_constraint in sorted(self.target_constraints, key=lambda x: x.name): # Construct the list of allowed targets for this constraint allowed_targets = [] for single_constraint in str(target_constraint).split(","): @@ -3237,7 +3237,7 @@ def add_compiler_from_concrete_spec(self, spec: "spack.spec.Spec") -> None: candidate = KnownCompiler( spec=spec.compiler, os=str(spec.architecture.os), - target=str(spec.architecture.target.microarchitecture.family), + target=str(spec.architecture.target.family), available=False, compiler_obj=None, ) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index fb1a05f37c556a..1c566349a4fdba 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -61,6 +61,8 @@ import warnings from typing import Any, Callable, Dict, List, Match, Optional, Set, Tuple, Union +import archspec.cpu + import llnl.path import llnl.string import llnl.util.filesystem as fs @@ -82,7 +84,6 @@ import spack.repo import spack.solver import spack.store -import spack.target import spack.traverse as traverse import spack.util.executable import spack.util.hash @@ -213,6 +214,12 @@ def ensure_modern_format_string(fmt: str) -> None: ) +def _make_microarchitecture(name: str) -> archspec.cpu.Microarchitecture: + if isinstance(name, archspec.cpu.Microarchitecture): + return name + return archspec.cpu.TARGETS.get(name, archspec.cpu.generic_microarchitecture(name)) + + @lang.lazy_lexicographic_ordering class ArchSpec: """Aggregate the target platform, the operating system and the target microarchitecture.""" @@ -301,7 +308,10 @@ def _autospec(self, spec_like): def _cmp_iter(self): yield self.platform yield self.os - yield self.target + if self.target is None: + yield self.target + else: + yield self.target.name @property def platform(self): @@ -360,10 +370,10 @@ def target(self, value): # will assumed to be the host machine's platform. def target_or_none(t): - if isinstance(t, spack.target.Target): + if isinstance(t, archspec.cpu.Microarchitecture): return t if t and t != "None": - return spack.target.Target(t) + return _make_microarchitecture(t) return None value = target_or_none(value) @@ -452,10 +462,11 @@ def _target_constrain(self, other: "ArchSpec") -> bool: results = self._target_intersection(other) attribute_str = ",".join(results) - if self.target == attribute_str: + intersection_target = _make_microarchitecture(attribute_str) + if self.target == intersection_target: return False - self.target = attribute_str + self.target = intersection_target return True def _target_intersection(self, other): @@ -473,7 +484,7 @@ def _target_intersection(self, other): # s_target_range is a concrete target # get a microarchitecture reference for at least one side # of each comparison so we can use archspec comparators - s_comp = spack.target.Target(s_min).microarchitecture + s_comp = _make_microarchitecture(s_min) if not o_sep: if s_min == o_min: results.append(s_min) @@ -481,21 +492,21 @@ def _target_intersection(self, other): results.append(s_min) elif not o_sep: # "cast" to microarchitecture - o_comp = spack.target.Target(o_min).microarchitecture + o_comp = _make_microarchitecture(o_min) if (not s_min or o_comp >= s_min) and (not s_max or o_comp <= s_max): results.append(o_min) else: # Take intersection of two ranges # Lots of comparisons needed - _s_min = spack.target.Target(s_min).microarchitecture - _s_max = spack.target.Target(s_max).microarchitecture - _o_min = spack.target.Target(o_min).microarchitecture - _o_max = spack.target.Target(o_max).microarchitecture + _s_min = _make_microarchitecture(s_min) + _s_max = _make_microarchitecture(s_max) + _o_min = _make_microarchitecture(o_min) + _o_max = _make_microarchitecture(o_max) n_min = s_min if _s_min >= _o_min else o_min n_max = s_max if _s_max <= _o_max else o_max - _n_min = spack.target.Target(n_min).microarchitecture - _n_max = spack.target.Target(n_max).microarchitecture + _n_min = _make_microarchitecture(n_min) + _n_max = _make_microarchitecture(n_max) if _n_min == _n_max: results.append(n_min) elif not n_min or not n_max or _n_min < _n_max: @@ -548,12 +559,18 @@ def target_concrete(self): ) def to_dict(self): + # Generic targets represent either an architecture family (like x86_64) + # or a custom micro-architecture + if self.target.vendor == "generic": + target_data = str(self.target) + else: + # Get rid of compiler flag information before turning the uarch into a dict + uarch_dict = self.target.to_dict() + uarch_dict.pop("compilers", None) + target_data = syaml.syaml_dict(uarch_dict.items()) + d = syaml.syaml_dict( - [ - ("platform", self.platform), - ("platform_os", self.os), - ("target", self.target.to_dict_or_value()), - ] + [("platform", self.platform), ("platform_os", self.os), ("target", target_data)] ) return syaml.syaml_dict([("arch", d)]) @@ -561,7 +578,10 @@ def to_dict(self): def from_dict(d): """Import an ArchSpec from raw YAML/JSON data""" arch = d["arch"] - target = spack.target.Target.from_dict_or_value(arch["target"]) + target_name = arch["target"] + if not isinstance(target_name, str): + target_name = target_name["name"] + target = _make_microarchitecture(target_name) return ArchSpec((arch["platform"], arch["platform_os"], target)) def __str__(self): @@ -4120,9 +4140,7 @@ def os(self): @property def target(self): - # This property returns the underlying microarchitecture object - # to give to the attribute the appropriate comparison semantic - return self.architecture.target.microarchitecture + return self.architecture.target @property def build_spec(self): diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index ee3b4e95e549d8..8b4efcf387b8f2 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -33,7 +33,6 @@ import spack.caches import spack.config import spack.error -import spack.fetch_strategy as fs import spack.mirror import spack.resource import spack.spec @@ -43,6 +42,7 @@ import spack.util.path as sup import spack.util.pattern as pattern import spack.util.url as url_util +from spack import fetch_strategy as fs # breaks a cycle from spack.util.crypto import bit_length, prefix_bits from spack.util.editor import editor, executable from spack.version import StandardVersion, VersionList @@ -352,8 +352,8 @@ def __init__( url_or_fetch_strategy, *, name=None, - mirror_paths: Optional[spack.mirror.MirrorLayout] = None, - mirrors: Optional[Iterable[spack.mirror.Mirror]] = None, + mirror_paths: Optional["spack.mirror.MirrorLayout"] = None, + mirrors: Optional[Iterable["spack.mirror.Mirror"]] = None, keep=False, path=None, lock=True, @@ -464,7 +464,7 @@ def source_path(self): """Returns the well-known source directory path.""" return os.path.join(self.path, _source_path_subdir) - def _generate_fetchers(self, mirror_only=False) -> Generator[fs.FetchStrategy, None, None]: + def _generate_fetchers(self, mirror_only=False) -> Generator["fs.FetchStrategy", None, None]: fetchers: List[fs.FetchStrategy] = [] if not mirror_only: fetchers.append(self.default_fetcher) @@ -600,7 +600,7 @@ def cache_local(self): spack.caches.FETCH_CACHE.store(self.fetcher, self.mirror_layout.path) def cache_mirror( - self, mirror: spack.caches.MirrorCache, stats: spack.mirror.MirrorStats + self, mirror: "spack.caches.MirrorCache", stats: "spack.mirror.MirrorStats" ) -> None: """Perform a fetch if the resource is not already cached @@ -668,7 +668,7 @@ def destroy(self): class ResourceStage(Stage): def __init__( self, - fetch_strategy: fs.FetchStrategy, + fetch_strategy: "fs.FetchStrategy", root: Stage, resource: spack.resource.Resource, **kwargs, diff --git a/lib/spack/spack/target.py b/lib/spack/spack/target.py deleted file mode 100644 index 4a781968653897..00000000000000 --- a/lib/spack/spack/target.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright 2013-2024 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) -import functools - -import archspec.cpu - -import llnl.util.tty as tty - -import spack.compiler -import spack.compilers -import spack.spec -import spack.util.executable -import spack.util.spack_yaml as syaml - - -def _ensure_other_is_target(method): - """In a single argument method, ensure that the argument is an - instance of ``Target``. - """ - - @functools.wraps(method) - def _impl(self, other): - if isinstance(other, str): - other = Target(other) - - if not isinstance(other, Target): - return NotImplemented - - return method(self, other) - - return _impl - - -class Target: - def __init__(self, name, module_name=None): - """Target models microarchitectures and their compatibility. - - Args: - name (str or Microarchitecture): microarchitecture of the target - module_name (str): optional module name to get access to the - current target. This is typically used on machines - like Cray (e.g. craype-compiler) - """ - if not isinstance(name, archspec.cpu.Microarchitecture): - name = archspec.cpu.TARGETS.get(name, archspec.cpu.generic_microarchitecture(name)) - self.microarchitecture = name - self.module_name = module_name - - @property - def name(self): - return self.microarchitecture.name - - @_ensure_other_is_target - def __eq__(self, other): - return ( - self.microarchitecture == other.microarchitecture - and self.module_name == other.module_name - ) - - def __ne__(self, other): - # This method is necessary as long as we support Python 2. In Python 3 - # __ne__ defaults to the implementation below - return not self == other - - @_ensure_other_is_target - def __lt__(self, other): - # TODO: In the future it would be convenient to say - # TODO: `spec.architecture.target < other.architecture.target` - # TODO: and change the semantic of the comparison operators - - # This is needed to sort deterministically specs in a list. - # It doesn't implement a total ordering semantic. - return self.microarchitecture.name < other.microarchitecture.name - - def __hash__(self): - return hash((self.name, self.module_name)) - - @staticmethod - def from_dict_or_value(dict_or_value): - # A string here represents a generic target (like x86_64 or ppc64) or - # a custom micro-architecture - if isinstance(dict_or_value, str): - return Target(dict_or_value) - - # TODO: From a dict we actually retrieve much more information than - # TODO: just the name. We can use that information to reconstruct an - # TODO: "old" micro-architecture or check the current definition. - target_info = dict_or_value - return Target(target_info["name"]) - - def to_dict_or_value(self): - """Returns a dict or a value representing the current target. - - String values are used to keep backward compatibility with generic - targets, like e.g. x86_64 or ppc64. More specific micro-architectures - will return a dictionary which contains information on the name, - features, vendor, generation and parents of the current target. - """ - # Generic targets represent either an architecture - # family (like x86_64) or a custom micro-architecture - if self.microarchitecture.vendor == "generic": - return str(self) - - # Get rid of compiler flag information before turning the uarch into a dict - uarch_dict = self.microarchitecture.to_dict() - uarch_dict.pop("compilers", None) - return syaml.syaml_dict(uarch_dict.items()) - - def __repr__(self): - cls_name = self.__class__.__name__ - fmt = cls_name + "({0}, {1})" - return fmt.format(repr(self.microarchitecture), repr(self.module_name)) - - def __str__(self): - return str(self.microarchitecture) - - def __contains__(self, cpu_flag): - return cpu_flag in self.microarchitecture - - def optimization_flags(self, compiler): - """Returns the flags needed to optimize for this target using - the compiler passed as argument. - - Args: - compiler (spack.spec.CompilerSpec or spack.compiler.Compiler): object that - contains both the name and the version of the compiler we want to use - """ - # Mixed toolchains are not supported yet - if isinstance(compiler, spack.compiler.Compiler): - if spack.compilers.is_mixed_toolchain(compiler): - msg = ( - "microarchitecture specific optimizations are not " - "supported yet on mixed compiler toolchains [check" - " {0.name}@{0.version} for further details]" - ) - tty.debug(msg.format(compiler)) - return "" - - # Try to check if the current compiler comes with a version number or - # has an unexpected suffix. If so, treat it as a compiler with a - # custom spec. - compiler_version = compiler.version - version_number, suffix = archspec.cpu.version_components(compiler.version) - if not version_number or suffix: - # Try to deduce the underlying version of the compiler, regardless - # of its name in compilers.yaml. Depending on where this function - # is called we might get either a CompilerSpec or a fully fledged - # compiler object. - if isinstance(compiler, spack.spec.CompilerSpec): - compiler = spack.compilers.compilers_for_spec(compiler).pop() - try: - compiler_version = compiler.real_version - except spack.util.executable.ProcessError as e: - # log this and just return compiler.version instead - tty.debug(str(e)) - - return self.microarchitecture.optimization_flags( - compiler.name, compiler_version.dotted_numeric_string - ) diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py index cbd8a0b9d75ba7..3d489a22cc8d4a 100644 --- a/lib/spack/spack/test/architecture.py +++ b/lib/spack/spack/test/architecture.py @@ -12,7 +12,6 @@ import spack.concretize import spack.operating_systems import spack.platforms -import spack.target from spack.spec import ArchSpec, Spec @@ -83,25 +82,6 @@ def test_operating_system_conversion_to_dict(): assert operating_system.to_dict() == {"name": "os", "version": "1.0"} -@pytest.mark.parametrize( - "cpu_flag,target_name", - [ - # Test that specific flags can be used in queries - ("ssse3", "haswell"), - ("popcnt", "nehalem"), - ("avx512f", "skylake_avx512"), - ("avx512ifma", "icelake"), - # Test that proxy flags can be used in queries too - ("sse3", "nehalem"), - ("avx512", "skylake_avx512"), - ("avx512", "icelake"), - ], -) -def test_target_container_semantic(cpu_flag, target_name): - target = spack.target.Target(target_name) - assert cpu_flag in target - - @pytest.mark.parametrize( "item,architecture_str", [ @@ -118,68 +98,6 @@ def test_arch_spec_container_semantic(item, architecture_str): assert item in architecture -@pytest.mark.parametrize( - "compiler_spec,target_name,expected_flags", - [ - # Homogeneous compilers - ("gcc@4.7.2", "ivybridge", "-march=core-avx-i -mtune=core-avx-i"), - ("clang@3.5", "x86_64", "-march=x86-64 -mtune=generic"), - ("apple-clang@9.1.0", "x86_64", "-march=x86-64"), - # Mixed toolchain - ("clang@8.0.0", "broadwell", ""), - ], -) -@pytest.mark.filterwarnings("ignore:microarchitecture specific") -@pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper") -def test_optimization_flags(compiler_spec, target_name, expected_flags, compiler_factory): - target = spack.target.Target(target_name) - compiler_dict = compiler_factory(spec=compiler_spec, operating_system="")["compiler"] - if compiler_spec == "clang@8.0.0": - compiler_dict["paths"] = { - "cc": "/path/to/clang-8", - "cxx": "/path/to/clang++-8", - "f77": "/path/to/gfortran-9", - "fc": "/path/to/gfortran-9", - } - compiler = spack.compilers.compiler_from_dict(compiler_dict) - - opt_flags = target.optimization_flags(compiler) - assert opt_flags == expected_flags - - -@pytest.mark.parametrize( - "compiler_str,real_version,target_str,expected_flags", - [ - ("gcc@=9.2.0", None, "haswell", "-march=haswell -mtune=haswell"), - # Check that custom string versions are accepted - ("gcc@=10foo", "9.2.0", "icelake", "-march=icelake-client -mtune=icelake-client"), - # Check that we run version detection (4.4.0 doesn't support icelake) - ("gcc@=4.4.0-special", "9.2.0", "icelake", "-march=icelake-client -mtune=icelake-client"), - # Check that the special case for Apple's clang is treated correctly - # i.e. it won't try to detect the version again - ("apple-clang@=9.1.0", None, "x86_64", "-march=x86-64"), - ], -) -def test_optimization_flags_with_custom_versions( - compiler_str, - real_version, - target_str, - expected_flags, - monkeypatch, - mutable_config, - compiler_factory, -): - target = spack.target.Target(target_str) - compiler_dict = compiler_factory(spec=compiler_str, operating_system="redhat6") - mutable_config.set("compilers", [compiler_dict]) - if real_version: - monkeypatch.setattr(spack.compiler.Compiler, "get_real_version", lambda x: real_version) - compiler = spack.compilers.compiler_from_dict(compiler_dict["compiler"]) - - opt_flags = target.optimization_flags(compiler) - assert opt_flags == expected_flags - - @pytest.mark.regression("15306") @pytest.mark.parametrize( "architecture_tuple,constraint_tuple", diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index c3ccaee0290d16..f435a893a14ac9 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -9,6 +9,8 @@ import pytest +import archspec.cpu + from llnl.path import Path, convert_to_platform_path from llnl.util.filesystem import HeaderList, LibraryList @@ -737,3 +739,64 @@ def test_rpath_with_duplicate_link_deps(): assert child in rpath_deps assert runtime_2 in rpath_deps assert runtime_1 not in rpath_deps + + +@pytest.mark.parametrize( + "compiler_spec,target_name,expected_flags", + [ + # Homogeneous compilers + ("gcc@4.7.2", "ivybridge", "-march=core-avx-i -mtune=core-avx-i"), + ("clang@3.5", "x86_64", "-march=x86-64 -mtune=generic"), + ("apple-clang@9.1.0", "x86_64", "-march=x86-64"), + # Mixed toolchain + ("clang@8.0.0", "broadwell", ""), + ], +) +@pytest.mark.filterwarnings("ignore:microarchitecture specific") +@pytest.mark.not_on_windows("Windows doesn't support the compiler wrapper") +def test_optimization_flags(compiler_spec, target_name, expected_flags, compiler_factory): + target = archspec.cpu.TARGETS[target_name] + compiler_dict = compiler_factory(spec=compiler_spec, operating_system="")["compiler"] + if compiler_spec == "clang@8.0.0": + compiler_dict["paths"] = { + "cc": "/path/to/clang-8", + "cxx": "/path/to/clang++-8", + "f77": "/path/to/gfortran-9", + "fc": "/path/to/gfortran-9", + } + compiler = spack.compilers.compiler_from_dict(compiler_dict) + opt_flags = spack.build_environment.optimization_flags(compiler, target) + assert opt_flags == expected_flags + + +@pytest.mark.parametrize( + "compiler_str,real_version,target_str,expected_flags", + [ + ("gcc@=9.2.0", None, "haswell", "-march=haswell -mtune=haswell"), + # Check that custom string versions are accepted + ("gcc@=10foo", "9.2.0", "icelake", "-march=icelake-client -mtune=icelake-client"), + # Check that we run version detection (4.4.0 doesn't support icelake) + ("gcc@=4.4.0-special", "9.2.0", "icelake", "-march=icelake-client -mtune=icelake-client"), + # Check that the special case for Apple's clang is treated correctly + # i.e. it won't try to detect the version again + ("apple-clang@=9.1.0", None, "x86_64", "-march=x86-64"), + ], +) +def test_optimization_flags_with_custom_versions( + compiler_str, + real_version, + target_str, + expected_flags, + monkeypatch, + mutable_config, + compiler_factory, +): + target = archspec.cpu.TARGETS[target_str] + compiler_dict = compiler_factory(spec=compiler_str, operating_system="redhat6") + mutable_config.set("compilers", [compiler_dict]) + if real_version: + monkeypatch.setattr(spack.compiler.Compiler, "get_real_version", lambda x: real_version) + compiler = spack.compilers.compiler_from_dict(compiler_dict["compiler"]) + + opt_flags = spack.build_environment.optimization_flags(compiler, target) + assert opt_flags == expected_flags diff --git a/lib/spack/spack/test/config.py b/lib/spack/spack/test/config.py index ddf21ffb051f43..be727f1c561e95 100644 --- a/lib/spack/spack/test/config.py +++ b/lib/spack/spack/test/config.py @@ -407,7 +407,7 @@ def test_substitute_config_variables(mock_low_high_config, monkeypatch): ) == os.path.abspath(os.path.join("foo", "test", "bar")) host_target = spack.platforms.host().target("default_target") - host_target_family = str(host_target.microarchitecture.family) + host_target_family = str(host_target.family) assert spack_path.canonicalize_path( os.path.join("foo", "$target_family", "bar") ) == os.path.abspath(os.path.join("foo", host_target_family, "bar")) diff --git a/lib/spack/spack/util/path.py b/lib/spack/spack/util/path.py index e0fa29dbccd904..a91972c79b9031 100644 --- a/lib/spack/spack/util/path.py +++ b/lib/spack/spack/util/path.py @@ -71,7 +71,7 @@ def replacements(): "operating_system": lambda: arch.os, "os": lambda: arch.os, "target": lambda: arch.target, - "target_family": lambda: arch.target.microarchitecture.family, + "target_family": lambda: arch.target.family, "date": lambda: date.today().strftime("%Y-%m-%d"), "env": lambda: ev.active_environment().path if ev.active_environment() else NOMATCH, } diff --git a/var/spack/repos/builtin/packages/amdfftw/package.py b/var/spack/repos/builtin/packages/amdfftw/package.py index 6ac400a013e408..f508c4162b6123 100644 --- a/var/spack/repos/builtin/packages/amdfftw/package.py +++ b/var/spack/repos/builtin/packages/amdfftw/package.py @@ -7,6 +7,7 @@ from llnl.util import tty +from spack.build_environment import optimization_flags from spack.package import * from spack.pkg.builtin.fftw import FftwBase @@ -213,10 +214,7 @@ def configure(self, spec, prefix): # variable to set AMD_ARCH configure option. # Spack user can not directly use AMD_ARCH for this purpose but should # use target variable to set appropriate -march option in AMD_ARCH. - arch = spec.architecture - options.append( - "AMD_ARCH={0}".format(arch.target.optimization_flags(spec.compiler).split("=")[-1]) - ) + options.append(f"AMD_ARCH={optimization_flags(self.compiler, spec.target)}") # Specific SIMD support. # float and double precisions are supported diff --git a/var/spack/repos/builtin/packages/arbor/package.py b/var/spack/repos/builtin/packages/arbor/package.py index 832078c7bd9501..415914b7baf5ef 100644 --- a/var/spack/repos/builtin/packages/arbor/package.py +++ b/var/spack/repos/builtin/packages/arbor/package.py @@ -2,7 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - +from spack.build_environment import optimization_flags from spack.package import * @@ -110,21 +110,23 @@ def build_targets(self): return ["all", "html"] if "+doc" in self.spec else ["all"] def cmake_args(self): + spec = self.spec args = [ self.define_from_variant("ARB_WITH_ASSERTIONS", "assertions"), self.define_from_variant("ARB_WITH_MPI", "mpi"), self.define_from_variant("ARB_WITH_PYTHON", "python"), self.define_from_variant("ARB_VECTORIZE", "vectorize"), + self.define("ARB_ARCH", "none"), + self.define("ARB_CXX_FLAGS_TARGET", optimization_flags(self.compiler, spec.target)), ] if self.spec.satisfies("+cuda"): - args.append("-DARB_GPU=cuda") - args.append(self.define_from_variant("ARB_USE_GPU_RNG", "gpu_rng")) - - # query spack for the architecture-specific compiler flags set by its wrapper - args.append("-DARB_ARCH=none") - opt_flags = self.spec.architecture.target.optimization_flags(self.spec.compiler) - args.append("-DARB_CXX_FLAGS_TARGET=" + opt_flags) + args.extend( + [ + self.define("ARB_GPU", "cuda"), + self.define_from_variant("ARB_USE_GPU_RNG", "gpu_rng"), + ] + ) return args diff --git a/var/spack/repos/builtin/packages/hpcc/package.py b/var/spack/repos/builtin/packages/hpcc/package.py index 448342602412fc..e8a9acb6dea99b 100644 --- a/var/spack/repos/builtin/packages/hpcc/package.py +++ b/var/spack/repos/builtin/packages/hpcc/package.py @@ -7,6 +7,7 @@ import platform import re +from spack.build_environment import optimization_flags from spack.package import * @@ -161,7 +162,7 @@ def edit(self, spec, prefix): if spec.satisfies("%intel"): # with intel-parallel-studio+mpi the '-march' arguments # are not passed to icc - arch_opt = spec.architecture.target.optimization_flags(spec.compiler) + arch_opt = optimization_flags(self.compiler, spec.target) self.config["@CCFLAGS@"] = f"-O3 -restrict -ansi-alias -ip {arch_opt}" self.config["@CCNOOPT@"] = "-restrict" self._write_make_arch(spec, prefix) diff --git a/var/spack/repos/builtin/packages/lammps/package.py b/var/spack/repos/builtin/packages/lammps/package.py index 5c1f9c0588c8a1..be1697543e7160 100644 --- a/var/spack/repos/builtin/packages/lammps/package.py +++ b/var/spack/repos/builtin/packages/lammps/package.py @@ -5,6 +5,7 @@ import datetime as dt import os +from spack.build_environment import optimization_flags from spack.package import * @@ -898,7 +899,7 @@ def cmake_args(self): args.append(self.define("CMAKE_CXX_FLAGS_RELWITHDEBINFO", cxx_flags)) # Overwrite generic cpu tune option - cmake_tune_flags = spec.architecture.target.optimization_flags(spec.compiler) + cmake_tune_flags = optimization_flags(self.compiler, spec.target) args.append(self.define("CMAKE_TUNE_FLAGS", cmake_tune_flags)) args.append(self.define_from_variant("LAMMPS_SIZES", "lammps_sizes")) diff --git a/var/spack/repos/builtin/packages/namd/package.py b/var/spack/repos/builtin/packages/namd/package.py index 2e9fc20f7947e8..47fcb3b03cc74c 100644 --- a/var/spack/repos/builtin/packages/namd/package.py +++ b/var/spack/repos/builtin/packages/namd/package.py @@ -9,6 +9,7 @@ import llnl.util.tty as tty +from spack.build_environment import optimization_flags from spack.package import * @@ -175,7 +176,7 @@ def _edit_arch_generic(self, spec, prefix): # this options are take from the default provided # configuration files # https://github.com/UIUC-PPL/charm/pull/2778 - archopt = spec.architecture.target.optimization_flags(spec.compiler) + archopt = optimization_flags(self.compiler, spec.target) if self.spec.satisfies("^charmpp@:6.10.1"): optims_opts = { diff --git a/var/spack/repos/builtin/packages/neuron/package.py b/var/spack/repos/builtin/packages/neuron/package.py index 2887ea934286aa..2cb16fdd03d00f 100644 --- a/var/spack/repos/builtin/packages/neuron/package.py +++ b/var/spack/repos/builtin/packages/neuron/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack.build_environment import optimization_flags from spack.package import * @@ -149,7 +150,7 @@ def cmake_args(self): # add cpu arch specific optimisation flags to CMake so that they are passed # to embedded Makefile that neuron has for compiling MOD files - compilation_flags = self.spec.architecture.target.optimization_flags(self.spec.compiler) + compilation_flags = optimization_flags(self.compiler, self.spec.target) args.append(self.define("CMAKE_CXX_FLAGS", compilation_flags)) return args diff --git a/var/spack/repos/builtin/packages/py-tensorflow/package.py b/var/spack/repos/builtin/packages/py-tensorflow/package.py index 9935be8b294fc6..dfe4f72e6b412e 100644 --- a/var/spack/repos/builtin/packages/py-tensorflow/package.py +++ b/var/spack/repos/builtin/packages/py-tensorflow/package.py @@ -8,6 +8,7 @@ import sys import tempfile +from spack.build_environment import optimization_flags from spack.package import * rocm_dependencies = [ @@ -656,7 +657,7 @@ def setup_build_environment(self, env): # Please specify optimization flags to use during compilation when # bazel option '--config=opt' is specified - env.set("CC_OPT_FLAGS", spec.architecture.target.optimization_flags(spec.compiler)) + env.set("CC_OPT_FLAGS", optimization_flags(self.compiler, spec.target)) # Would you like to interactively configure ./WORKSPACE for # Android builds? diff --git a/var/spack/repos/builtin/packages/wgl/package.py b/var/spack/repos/builtin/packages/wgl/package.py index b420cdcf644d80..9d02f3c1394881 100644 --- a/var/spack/repos/builtin/packages/wgl/package.py +++ b/var/spack/repos/builtin/packages/wgl/package.py @@ -83,7 +83,7 @@ def determine_variants(cls, libs, ver_str): return variants def _spec_arch_to_sdk_arch(self): - spec_arch = str(self.spec.architecture.target.microarchitecture.family).lower() + spec_arch = str(self.spec.architecture.target.family).lower() _64bit = "64" in spec_arch arm = "arm" in spec_arch if arm: From 8088fb8ccc24ab68330565e62c4ac7c794a9efac Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 21 Sep 2024 18:18:27 +0200 Subject: [PATCH 202/687] py-cmocean: add v4.0.3 (#46454) --- var/spack/repos/builtin/packages/py-cmocean/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-cmocean/package.py b/var/spack/repos/builtin/packages/py-cmocean/package.py index c8b235ebbfbd9d..2d20f5d1dcf722 100644 --- a/var/spack/repos/builtin/packages/py-cmocean/package.py +++ b/var/spack/repos/builtin/packages/py-cmocean/package.py @@ -15,6 +15,7 @@ class PyCmocean(PythonPackage): license("MIT") + version("4.0.3", sha256="37868399fb5f41b4eac596e69803f9bfaea49946514dfb2e7f48886854250d7c") version("3.0.3", sha256="abaf99383c1a60f52970c86052ae6c14eafa84fc16984488040283c02db77c0b") version("2.0", sha256="13eea3c8994d8e303e32a2db0b3e686f6edfb41cb21e7b0e663c2b17eea9b03a") @@ -23,3 +24,6 @@ class PyCmocean(PythonPackage): depends_on("py-matplotlib", type=("build", "run")) depends_on("py-numpy", type=("build", "run")) depends_on("py-packaging", when="@3:", type=("build", "run")) + + # https://github.com/matplotlib/cmocean/pull/99 + conflicts("^py-numpy@2:", when="@:3.0") From 9577fd8b8ad26c209cd457edf30d103e08a2d64b Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 21 Sep 2024 18:39:32 +0200 Subject: [PATCH 203/687] py-ruff: add v0.6.5 (#46459) --- var/spack/repos/builtin/packages/py-ruff/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-ruff/package.py b/var/spack/repos/builtin/packages/py-ruff/package.py index cb41f2fe90914a..f38b08a4d772a8 100644 --- a/var/spack/repos/builtin/packages/py-ruff/package.py +++ b/var/spack/repos/builtin/packages/py-ruff/package.py @@ -16,6 +16,7 @@ class PyRuff(PythonPackage): license("MIT") maintainers("adamjstewart") + version("0.6.5", sha256="4d32d87fab433c0cf285c3683dd4dae63be05fd7a1d65b3f5bf7cdd05a6b96fb") version("0.5.7", sha256="8dfc0a458797f5d9fb622dd0efc52d796f23f0a1493a9527f4e49a550ae9a7e5") version("0.4.5", sha256="286eabd47e7d4d521d199cab84deca135557e6d1e0f0d01c29e757c3cb151b54") version("0.4.0", sha256="7457308d9ebf00d6a1c9a26aa755e477787a636c90b823f91cd7d4bea9e89260") From 096ab11961995ac8d69f7b177cbcadf618d3068e Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 21 Sep 2024 18:59:20 +0200 Subject: [PATCH 204/687] py-onnx: link to external protobuf (#46434) --- var/spack/repos/builtin/packages/py-onnx/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-onnx/package.py b/var/spack/repos/builtin/packages/py-onnx/package.py index c80bee5736078e..e8286c232e5a06 100644 --- a/var/spack/repos/builtin/packages/py-onnx/package.py +++ b/var/spack/repos/builtin/packages/py-onnx/package.py @@ -45,6 +45,7 @@ class PyOnnx(PythonPackage): # requirements.txt depends_on("py-setuptools@64:", type="build") depends_on("py-setuptools", type="build") + depends_on("protobuf") depends_on("py-protobuf@3.20.2:", type=("build", "run"), when="@1.15:") depends_on("py-protobuf@3.20.2:3", type=("build", "run"), when="@1.13") depends_on("py-protobuf@3.12.2:3.20.1", type=("build", "run"), when="@1.12") @@ -56,7 +57,6 @@ class PyOnnx(PythonPackage): # https://github.com/protocolbuffers/protobuf/pull/8794, fixed in # https://github.com/onnx/onnx/pull/3112 depends_on("py-protobuf@:3.17", type=("build", "run"), when="@:1.8") - depends_on("py-protobuf+cpp", type=("build", "run")) depends_on("py-numpy", type=("build", "run")) depends_on("py-numpy@1.16.6:", type=("build", "run"), when="@1.8.1:1.13") depends_on("py-numpy@1.20:", type=("build", "run"), when="@1.16.0:") From 8a3128eb703def279bf7459b636c7502136baa76 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sat, 21 Sep 2024 19:24:38 +0200 Subject: [PATCH 205/687] Bazel: add GCC 13 support for v6 (#46430) * Bazel: add GCC 13 support for v6 * Fix offline builds --- var/spack/repos/builtin/packages/bazel/package.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/bazel/package.py b/var/spack/repos/builtin/packages/bazel/package.py index 52ba8f74bf1ca6..bbd0acf278fe70 100644 --- a/var/spack/repos/builtin/packages/bazel/package.py +++ b/var/spack/repos/builtin/packages/bazel/package.py @@ -120,6 +120,14 @@ class Bazel(Package): # https://blog.bazel.build/2021/05/21/bazel-4-1.html conflicts("platform=darwin target=aarch64:", when="@:4.0") + # https://github.com/bazelbuild/bazel/issues/18642 + patch( + "https://github.com/bazelbuild/bazel/pull/20785.patch?full_index=1", + sha256="85dde31d129bbd31e004c5c87f23cdda9295fbb22946dc6d362f23d83bae1fd8", + when="@6.0:6.4", + ) + conflicts("%gcc@13:", when="@:5") + # Patches for compiling various older bazels which had ICWYU violations revealed by # (but not unique to) GCC 11 header changes. These are derived from # https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/29084/ @@ -131,8 +139,6 @@ class Bazel(Package): # Bazel-4.0.0 does not compile with gcc-11 # Newer versions of grpc and abseil dependencies are needed but are not in bazel-4.0.0 conflicts("@4.0.0", when="%gcc@11:") - # https://github.com/bazelbuild/bazel/issues/18642 - conflicts("@:6", when="%gcc@13:") executables = ["^bazel$"] @@ -144,6 +150,11 @@ class Bazel(Package): "sha256": "f1c8360c01fcf276778d3519394805dc2a71a64274a3a0908bc9edff7b5aebc8", "when": "@4:6", } + resource_dictionary["com_google_absl"] = { + "url": "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz", + "sha256": "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5", + "when": "@6.0:6.4", + } resource_dictionary["zulu_11_56_19"] = { "url": "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz", "sha256": "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247", From 3c7357225a17475c7b7a98443a48421a4b4a22b3 Mon Sep 17 00:00:00 2001 From: afzpatel <122491982+afzpatel@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:23:59 -0400 Subject: [PATCH 206/687] py-onnxruntime: add v1.18.0 -> v1.18.3 and add ROCm support (#46448) * add ROCm support for py-onnxruntime * add new versions of py-onnxruntime * add review changes --- ...0001-Find-ROCm-Packages-Individually.patch | 45 ++++++++++++ .../packages/py-onnxruntime/package.py | 71 ++++++++++++++++++- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/py-onnxruntime/0001-Find-ROCm-Packages-Individually.patch diff --git a/var/spack/repos/builtin/packages/py-onnxruntime/0001-Find-ROCm-Packages-Individually.patch b/var/spack/repos/builtin/packages/py-onnxruntime/0001-Find-ROCm-Packages-Individually.patch new file mode 100644 index 00000000000000..a48c1921828c37 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-onnxruntime/0001-Find-ROCm-Packages-Individually.patch @@ -0,0 +1,45 @@ +From c4930c939cc1c8b4c6122b1e9530942ecd517fb2 Mon Sep 17 00:00:00 2001 +From: Afzal Patel +Date: Tue, 17 Sep 2024 19:33:51 +0000 +Subject: [PATCH] Find individual ROCm dependencies + +--- + cmake/onnxruntime_providers_rocm.cmake | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/cmake/onnxruntime_providers_rocm.cmake b/cmake/onnxruntime_providers_rocm.cmake +index b662682915..2e9574c04d 100644 +--- a/cmake/onnxruntime_providers_rocm.cmake ++++ b/cmake/onnxruntime_providers_rocm.cmake +@@ -11,6 +11,12 @@ + find_package(rocblas REQUIRED) + find_package(MIOpen REQUIRED) + find_package(hipfft REQUIRED) ++ find_package(rocrand REQUIRED) ++ find_package(hipsparse REQUIRED) ++ find_package(hipcub REQUIRED) ++ find_package(rocprim REQUIRED) ++ find_package(rocthrust REQUIRED) ++ find_package(hipblas REQUIRED) + + # MIOpen version + if(NOT DEFINED ENV{MIOPEN_PATH}) +@@ -147,7 +153,14 @@ + ${eigen_INCLUDE_DIRS} + PUBLIC + ${onnxruntime_ROCM_HOME}/include +- ${onnxruntime_ROCM_HOME}/include/roctracer) ++ ${onnxruntime_ROCM_HOME}/include/roctracer ++ ${HIPRAND_INCLUDE_DIR} ++ ${ROCRAND_INCLUDE_DIR} ++ ${HIPSPARSE_INCLUDE_DIR} ++ ${HIPCUB_INCLUDE_DIR} ++ ${ROCPRIM_INCLUDE_DIR} ++ ${ROCTHRUST_INCLUDE_DIR} ++ ${HIPBLAS_INCLUDE_DIR}) + + set_target_properties(onnxruntime_providers_rocm PROPERTIES LINKER_LANGUAGE CXX) + set_target_properties(onnxruntime_providers_rocm PROPERTIES FOLDER "ONNXRuntime") +-- +2.43.5 + diff --git a/var/spack/repos/builtin/packages/py-onnxruntime/package.py b/var/spack/repos/builtin/packages/py-onnxruntime/package.py index 14d1f54715ddd8..7ea80f69d69406 100644 --- a/var/spack/repos/builtin/packages/py-onnxruntime/package.py +++ b/var/spack/repos/builtin/packages/py-onnxruntime/package.py @@ -6,7 +6,7 @@ from spack.package import * -class PyOnnxruntime(CMakePackage, PythonExtension): +class PyOnnxruntime(CMakePackage, PythonExtension, ROCmPackage): """ONNX Runtime is a performance-focused complete scoring engine for Open Neural Network Exchange (ONNX) models, with an open extensible architecture to continually address the @@ -22,6 +22,9 @@ class PyOnnxruntime(CMakePackage, PythonExtension): license("MIT") + version("1.18.2", tag="v1.18.2", commit="9691af1a2a17b12af04652f4d8d2a18ce9507025") + version("1.18.1", tag="v1.18.1", commit="387127404e6c1d84b3468c387d864877ed1c67fe") + version("1.18.0", tag="v1.18.0", commit="45737400a2f3015c11f005ed7603611eaed306a6") version("1.17.3", tag="v1.17.3", commit="56b660f36940a919295e6f1e18ad3a9a93a10bf7") version("1.17.1", tag="v1.17.1", commit="8f5c79cb63f09ef1302e85081093a3fe4da1bc7d") version("1.10.0", tag="v1.10.0", commit="0d9030e79888d1d5828730b254fedc53c7b640c1") @@ -50,6 +53,8 @@ class PyOnnxruntime(CMakePackage, PythonExtension): depends_on("py-coloredlogs", when="@1.17:", type=("build", "run")) depends_on("py-flatbuffers", type=("build", "run")) depends_on("py-numpy@1.16.6:", type=("build", "run")) + depends_on("py-numpy@1.21.6:", when="@1.18:", type=("build", "run")) + depends_on("py-numpy@:1", when="@:1.18", type=("build", "run")) depends_on("py-packaging", type=("build", "run")) depends_on("py-protobuf", type=("build", "run")) depends_on("py-sympy@1.1:", type=("build", "run")) @@ -60,6 +65,7 @@ class PyOnnxruntime(CMakePackage, PythonExtension): depends_on("py-cerberus", type=("build", "run")) depends_on("py-onnx", type=("build", "run")) depends_on("py-onnx@:1.15.0", type=("build", "run"), when="@:1.17") + depends_on("py-onnx@:1.16", type=("build", "run"), when="@:1.18") depends_on("zlib-api") depends_on("libpng") depends_on("cuda", when="+cuda") @@ -67,6 +73,35 @@ class PyOnnxruntime(CMakePackage, PythonExtension): depends_on("iconv", type=("build", "link", "run")) depends_on("re2+shared") + rocm_dependencies = [ + "hsa-rocr-dev", + "hip", + "hiprand", + "hipsparse", + "hipfft", + "hipcub", + "hipblas", + "llvm-amdgpu", + "miopen-hip", + "migraphx", + "rocblas", + "rccl", + "rocprim", + "rocminfo", + "rocm-core", + "rocm-cmake", + "roctracer-dev", + "rocthrust", + "rocrand", + "rocsparse", + ] + + with when("+rocm"): + for pkg_dep in rocm_dependencies: + depends_on(f"{pkg_dep}@5.7:6.1", when="@1.17") + depends_on(f"{pkg_dep}@6.1:", when="@1.18:") + depends_on(pkg_dep) + # Adopted from CMS experiment's fork of onnxruntime # https://github.com/cms-externals/onnxruntime/compare/5bc92df...d594f80 patch("cms.patch", level=1, when="@1.7.2") @@ -85,6 +120,10 @@ class PyOnnxruntime(CMakePackage, PythonExtension): when="@1.10:1.15", ) + # ORT is assuming all ROCm components are installed in a single path, + # this patch finds the packages individually + patch("0001-Find-ROCm-Packages-Individually.patch", when="@1.17: +rocm") + dynamic_cpu_arch_values = ("NOAVX", "AVX", "AVX2", "AVX512") variant( @@ -99,10 +138,28 @@ class PyOnnxruntime(CMakePackage, PythonExtension): root_cmakelists_dir = "cmake" build_directory = "." + def patch(self): + if self.spec.satisfies("@1.17 +rocm"): + filter_file( + r"${onnxruntime_ROCM_HOME}/.info/version-dev", + "{0}/.info/version".format(self.spec["rocm-core"].prefix), + "cmake/CMakeLists.txt", + string=True, + ) + if self.spec.satisfies("@1.18: +rocm"): + filter_file( + r"${onnxruntime_ROCM_HOME}/.info/version", + "{0}/.info/version".format(self.spec["rocm-core"].prefix), + "cmake/CMakeLists.txt", + string=True, + ) + def setup_build_environment(self, env): value = self.spec.variants["dynamic_cpu_arch"].value value = self.dynamic_cpu_arch_values.index(value) env.set("MLAS_DYNAMIC_CPU_ARCH", str(value)) + if self.spec.satisfies("+rocm"): + env.set("MIOPEN_PATH", self.spec["miopen-hip"].prefix) def setup_run_environment(self, env): value = self.spec.variants["dynamic_cpu_arch"].value @@ -137,6 +194,18 @@ def cmake_args(self): ) ) + if self.spec.satisfies("+rocm"): + args.extend( + ( + define("CMAKE_HIP_COMPILER", f"{self.spec['llvm-amdgpu'].prefix}/bin/clang++"), + define("onnxruntime_USE_MIGRAPHX", "ON"), + define("onnxruntime_MIGRAPHX_HOME", self.spec["migraphx"].prefix), + define("onnxruntime_USE_ROCM", "ON"), + define("onnxruntime_ROCM_HOME", self.spec["hip"].prefix), + define("onnxruntime_ROCM_VERSION", self.spec["hip"].version), + define("onnxruntime_USE_COMPOSABLE_KERNEL", "OFF"), + ) + ) return args @run_after("install") From 478d1fd8ff2e70b2e9e87364689cd2d9517a3d63 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Sun, 22 Sep 2024 12:10:37 +0200 Subject: [PATCH 207/687] geant4: Add a patch for twisted tubes (#45368) Co-authored-by: jmcarcell --- .../repos/builtin/packages/geant4/package.py | 3 + .../packages/geant4/twisted-tubes.patch | 875 ++++++++++++++++++ 2 files changed, 878 insertions(+) create mode 100644 var/spack/repos/builtin/packages/geant4/twisted-tubes.patch diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py index ef53b3e4d49a82..a606c9c7e1cdcc 100644 --- a/var/spack/repos/builtin/packages/geant4/package.py +++ b/var/spack/repos/builtin/packages/geant4/package.py @@ -195,6 +195,9 @@ def std_when(values): # See https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2556 patch("package-cache.patch", level=1, when="@10.7.0:11.1.2^cmake@3.17:") + # Issue with Twisted tubes, see https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2619 + patch("twisted-tubes.patch", level=1, when="@11.2.0:11.2.2") + # NVHPC: "thread-local declaration follows non-thread-local declaration" conflicts("%nvhpc", when="+threads") diff --git a/var/spack/repos/builtin/packages/geant4/twisted-tubes.patch b/var/spack/repos/builtin/packages/geant4/twisted-tubes.patch new file mode 100644 index 00000000000000..6039025829665d --- /dev/null +++ b/var/spack/repos/builtin/packages/geant4/twisted-tubes.patch @@ -0,0 +1,875 @@ +diff --git a/source/geometry/solids/specific/include/G4TwistedTubs.hh b/source/geometry/solids/specific/include/G4TwistedTubs.hh +index b8be4e629da8edb87c8e7fdcb12ae243fbb910e4..e6ca127646f1aa1f60b04b5100123ccfff9b698c 100644 +--- a/source/geometry/solids/specific/include/G4TwistedTubs.hh ++++ b/source/geometry/solids/specific/include/G4TwistedTubs.hh +@@ -226,109 +226,6 @@ class G4TwistedTubs : public G4VSolid + mutable G4bool fRebuildPolyhedron = false; + mutable G4Polyhedron* fpPolyhedron = nullptr; // polyhedron for vis + +- class LastState // last Inside result +- { +- public: +- LastState() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- inside = kOutside; +- } +- ~LastState()= default; +- LastState(const LastState& r) = default; +- LastState& operator=(const LastState& r) +- { +- if (this == &r) { return *this; } +- p = r.p; inside = r.inside; +- return *this; +- } +- public: +- G4ThreeVector p; +- EInside inside; +- }; +- +- class LastVector // last SurfaceNormal result +- { +- public: +- LastVector() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- vec.set(kInfinity,kInfinity,kInfinity); +- surface = new G4VTwistSurface*[1]; +- } +- ~LastVector() +- { +- delete [] surface; +- } +- LastVector(const LastVector& r) : p(r.p), vec(r.vec) +- { +- surface = new G4VTwistSurface*[1]; +- surface[0] = r.surface[0]; +- } +- LastVector& operator=(const LastVector& r) +- { +- if (&r == this) { return *this; } +- p = r.p; vec = r.vec; +- delete [] surface; surface = new G4VTwistSurface*[1]; +- surface[0] = r.surface[0]; +- return *this; +- } +- public: +- G4ThreeVector p; +- G4ThreeVector vec; +- G4VTwistSurface **surface; +- }; +- +- class LastValue // last G4double value +- { +- public: +- LastValue() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- value = DBL_MAX; +- } +- ~LastValue()= default; +- LastValue(const LastValue& r) = default; +- LastValue& operator=(const LastValue& r) +- { +- if (this == &r) { return *this; } +- p = r.p; value = r.value; +- return *this; +- } +- public: +- G4ThreeVector p; +- G4double value; +- }; +- +- class LastValueWithDoubleVector // last G4double value +- { +- public: +- LastValueWithDoubleVector() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- vec.set(kInfinity,kInfinity,kInfinity); +- value = DBL_MAX; +- } +- ~LastValueWithDoubleVector()= default; +- LastValueWithDoubleVector(const LastValueWithDoubleVector& r) = default; +- LastValueWithDoubleVector& operator=(const LastValueWithDoubleVector& r) +- { +- if (this == &r) { return *this; } +- p = r.p; vec = r.vec; value = r.value; +- return *this; +- } +- public: +- G4ThreeVector p; +- G4ThreeVector vec; +- G4double value; +- }; +- +- LastState fLastInside; +- LastVector fLastNormal; +- LastValue fLastDistanceToIn; +- LastValue fLastDistanceToOut; +- LastValueWithDoubleVector fLastDistanceToInWithV; +- LastValueWithDoubleVector fLastDistanceToOutWithV; + }; + + //===================================================================== +diff --git a/source/geometry/solids/specific/include/G4VTwistedFaceted.hh b/source/geometry/solids/specific/include/G4VTwistedFaceted.hh +index 3d58ba0b242bb4ddc900a3bf0dfd404252cc42e3..6c412c390d0bf780abfe68fdaa89ea76e3264f7c 100644 +--- a/source/geometry/solids/specific/include/G4VTwistedFaceted.hh ++++ b/source/geometry/solids/specific/include/G4VTwistedFaceted.hh +@@ -190,110 +190,6 @@ class G4VTwistedFaceted: public G4VSolid + G4VTwistSurface* fSide180 ; // Twisted Side at phi = 180 deg + G4VTwistSurface* fSide270 ; // Twisted Side at phi = 270 deg + +- private: +- +- class LastState // last Inside result +- { +- public: +- LastState() +- { +- p.set(kInfinity,kInfinity,kInfinity); inside = kOutside; +- } +- ~LastState()= default; +- LastState(const LastState& r) = default; +- LastState& operator=(const LastState& r) +- { +- if (this == &r) { return *this; } +- p = r.p; inside = r.inside; +- return *this; +- } +- public: +- G4ThreeVector p; +- EInside inside; +- }; +- +- class LastVector // last SurfaceNormal result +- { +- public: +- LastVector() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- vec.set(kInfinity,kInfinity,kInfinity); +- surface = new G4VTwistSurface*[1]; +- } +- ~LastVector() +- { +- delete [] surface; +- } +- LastVector(const LastVector& r) : p(r.p), vec(r.vec) +- { +- surface = new G4VTwistSurface*[1]; +- surface[0] = r.surface[0]; +- } +- LastVector& operator=(const LastVector& r) +- { +- if (&r == this) { return *this; } +- p = r.p; vec = r.vec; +- delete [] surface; surface = new G4VTwistSurface*[1]; +- surface[0] = r.surface[0]; +- return *this; +- } +- public: +- G4ThreeVector p; +- G4ThreeVector vec; +- G4VTwistSurface **surface; +- }; +- +- class LastValue // last G4double value +- { +- public: +- LastValue() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- value = DBL_MAX; +- } +- ~LastValue()= default; +- LastValue(const LastValue& r) = default; +- LastValue& operator=(const LastValue& r) +- { +- if (this == &r) { return *this; } +- p = r.p; value = r.value; +- return *this; +- } +- public: +- G4ThreeVector p; +- G4double value; +- }; +- +- class LastValueWithDoubleVector // last G4double value +- { +- public: +- LastValueWithDoubleVector() +- { +- p.set(kInfinity,kInfinity,kInfinity); +- vec.set(kInfinity,kInfinity,kInfinity); +- value = DBL_MAX; +- } +- ~LastValueWithDoubleVector()= default; +- LastValueWithDoubleVector(const LastValueWithDoubleVector& r) = default; +- LastValueWithDoubleVector& operator=(const LastValueWithDoubleVector& r) +- { +- if (this == &r) { return *this; } +- p = r.p; vec = r.vec; value = r.value; +- return *this; +- } +- public: +- G4ThreeVector p; +- G4ThreeVector vec; +- G4double value; +- }; +- +- LastState fLastInside; +- LastVector fLastNormal; +- LastValue fLastDistanceToIn; +- LastValue fLastDistanceToOut; +- LastValueWithDoubleVector fLastDistanceToInWithV; +- LastValueWithDoubleVector fLastDistanceToOutWithV; + }; + + //===================================================================== +diff --git a/source/geometry/solids/specific/src/G4TwistedTubs.cc b/source/geometry/solids/specific/src/G4TwistedTubs.cc +index 60dea7239081e58af194ecbe6cdeb33781a069b3..e8e414fabd74ecd1e2ed83ee8c072b932e9ae6dd 100644 +--- a/source/geometry/solids/specific/src/G4TwistedTubs.cc ++++ b/source/geometry/solids/specific/src/G4TwistedTubs.cc +@@ -56,6 +56,7 @@ namespace + G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER; + } + ++ + //===================================================================== + //* constructors ------------------------------------------------------ + +@@ -223,12 +224,7 @@ G4TwistedTubs::G4TwistedTubs(const G4TwistedTubs& rhs) + fTanOuterStereo2(rhs.fTanOuterStereo2), + fLowerEndcap(nullptr), fUpperEndcap(nullptr), fLatterTwisted(nullptr), fFormerTwisted(nullptr), + fInnerHype(nullptr), fOuterHype(nullptr), +- fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea), +- fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal), +- fLastDistanceToIn(rhs.fLastDistanceToIn), +- fLastDistanceToOut(rhs.fLastDistanceToOut), +- fLastDistanceToInWithV(rhs.fLastDistanceToInWithV), +- fLastDistanceToOutWithV(rhs.fLastDistanceToOutWithV) ++ fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea) + { + for (auto i=0; i<2; ++i) + { +@@ -268,11 +264,6 @@ G4TwistedTubs& G4TwistedTubs::operator = (const G4TwistedTubs& rhs) + fLowerEndcap= fUpperEndcap= fLatterTwisted= fFormerTwisted= nullptr; + fInnerHype= fOuterHype= nullptr; + fCubicVolume= rhs.fCubicVolume; fSurfaceArea= rhs.fSurfaceArea; +- fLastInside= rhs.fLastInside; fLastNormal= rhs.fLastNormal; +- fLastDistanceToIn= rhs.fLastDistanceToIn; +- fLastDistanceToOut= rhs.fLastDistanceToOut; +- fLastDistanceToInWithV= rhs.fLastDistanceToInWithV; +- fLastDistanceToOutWithV= rhs.fLastDistanceToOutWithV; + + for (auto i=0; i<2; ++i) + { +@@ -381,44 +372,32 @@ EInside G4TwistedTubs::Inside(const G4ThreeVector& p) const + // G4Timer timer(timerid, "G4TwistedTubs", "Inside"); + // timer.Start(); + +- G4ThreeVector *tmpp; +- EInside *tmpinside; +- if (fLastInside.p == p) +- { +- return fLastInside.inside; +- } +- else +- { +- tmpp = const_cast(&(fLastInside.p)); +- tmpinside = const_cast(&(fLastInside.inside)); +- tmpp->set(p.x(), p.y(), p.z()); +- } + + EInside outerhypearea = ((G4TwistTubsHypeSide *)fOuterHype)->Inside(p); + G4double innerhyperho = ((G4TwistTubsHypeSide *)fInnerHype)->GetRhoAtPZ(p); + G4double distanceToOut = p.getRho() - innerhyperho; // +ve: inside +- ++ EInside tmpinside; + if ((outerhypearea == kOutside) || (distanceToOut < -halftol)) + { +- *tmpinside = kOutside; ++ tmpinside = kOutside; + } + else if (outerhypearea == kSurface) + { +- *tmpinside = kSurface; ++ tmpinside = kSurface; + } + else + { + if (distanceToOut <= halftol) + { +- *tmpinside = kSurface; ++ tmpinside = kSurface; + } + else + { +- *tmpinside = kInside; ++ tmpinside = kInside; + } + } + +- return fLastInside.inside; ++ return tmpinside; + } + + //===================================================================== +@@ -433,14 +412,6 @@ G4ThreeVector G4TwistedTubs::SurfaceNormal(const G4ThreeVector& p) const + // Which of the three or four surfaces are we closest to? + // + +- if (fLastNormal.p == p) +- { +- return fLastNormal.vec; +- } +- auto tmpp = const_cast(&(fLastNormal.p)); +- auto tmpnormal = const_cast(&(fLastNormal.vec)); +- auto tmpsurface = const_cast(fLastNormal.surface); +- tmpp->set(p.x(), p.y(), p.z()); + + G4double distance = kInfinity; + +@@ -466,10 +437,7 @@ G4ThreeVector G4TwistedTubs::SurfaceNormal(const G4ThreeVector& p) const + } + } + +- tmpsurface[0] = surfaces[besti]; +- *tmpnormal = tmpsurface[0]->GetNormal(bestxx, true); +- +- return fLastNormal.vec; ++ return surfaces[besti]->GetNormal(bestxx, true); + } + + //===================================================================== +@@ -485,26 +453,6 @@ G4double G4TwistedTubs::DistanceToIn (const G4ThreeVector& p, + // The function returns kInfinity if no intersection or + // just grazing within tolerance. + +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4ThreeVector* tmpv; +- G4double* tmpdist; +- if ((fLastDistanceToInWithV.p == p) && (fLastDistanceToInWithV.vec == v)) +- { +- return fLastDistanceToIn.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToInWithV.p)); +- tmpv = const_cast(&(fLastDistanceToInWithV.vec)); +- tmpdist = const_cast(&(fLastDistanceToInWithV.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- tmpv->set(v.x(), v.y(), v.z()); +- } +- + // + // Calculate DistanceToIn(p,v) + // +@@ -524,8 +472,7 @@ G4double G4TwistedTubs::DistanceToIn (const G4ThreeVector& p, + G4ThreeVector normal = SurfaceNormal(p); + if (normal*v < 0) + { +- *tmpdist = 0.; +- return fLastDistanceToInWithV.value; ++ return 0; + } + } + } +@@ -557,9 +504,7 @@ G4double G4TwistedTubs::DistanceToIn (const G4ThreeVector& p, + bestxx = xx; + } + } +- *tmpdist = distance; +- +- return fLastDistanceToInWithV.value; ++ return distance; + } + + //===================================================================== +@@ -570,23 +515,6 @@ G4double G4TwistedTubs::DistanceToIn (const G4ThreeVector& p) const + // DistanceToIn(p): + // Calculate distance to surface of shape from `outside', + // allowing for tolerance +- +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4double* tmpdist; +- if (fLastDistanceToIn.p == p) +- { +- return fLastDistanceToIn.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToIn.p)); +- tmpdist = const_cast(&(fLastDistanceToIn.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- } + + // + // Calculate DistanceToIn(p) +@@ -600,8 +528,7 @@ G4double G4TwistedTubs::DistanceToIn (const G4ThreeVector& p) const + {} + case (kSurface) : + { +- *tmpdist = 0.; +- return fLastDistanceToIn.value; ++ return 0; + } + case (kOutside) : + { +@@ -628,8 +555,7 @@ G4double G4TwistedTubs::DistanceToIn (const G4ThreeVector& p) const + bestxx = xx; + } + } +- *tmpdist = distance; +- return fLastDistanceToIn.value; ++ return distance; + } + default : + { +@@ -656,32 +582,11 @@ G4double G4TwistedTubs::DistanceToOut( const G4ThreeVector& p, + // The function returns kInfinity if no intersection or + // just grazing within tolerance. + +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4ThreeVector* tmpv; +- G4double* tmpdist; +- if ((fLastDistanceToOutWithV.p == p) && (fLastDistanceToOutWithV.vec == v) ) +- { +- return fLastDistanceToOutWithV.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToOutWithV.p)); +- tmpv = const_cast(&(fLastDistanceToOutWithV.vec)); +- tmpdist = const_cast(&(fLastDistanceToOutWithV.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- tmpv->set(v.x(), v.y(), v.z()); +- } +- + // + // Calculate DistanceToOut(p,v) + // + + EInside currentside = Inside(p); +- + if (currentside == kOutside) + { + } +@@ -693,16 +598,14 @@ G4double G4TwistedTubs::DistanceToOut( const G4ThreeVector& p, + // If the particle is exiting from the volume, return 0. + // + G4ThreeVector normal = SurfaceNormal(p); +- G4VTwistSurface *blockedsurface = fLastNormal.surface[0]; + if (normal*v > 0) + { + if (calcNorm) + { +- *norm = (blockedsurface->GetNormal(p, true)); +- *validNorm = blockedsurface->IsValidNorm(); ++ *norm = normal; ++ *validNorm = true; + } +- *tmpdist = 0.; +- return fLastDistanceToOutWithV.value; ++ return 0; + } + } + } +@@ -746,9 +649,7 @@ G4double G4TwistedTubs::DistanceToOut( const G4ThreeVector& p, + } + } + +- *tmpdist = distance; +- +- return fLastDistanceToOutWithV.value; ++ return distance; + } + + +@@ -761,23 +662,6 @@ G4double G4TwistedTubs::DistanceToOut( const G4ThreeVector& p ) const + // Calculate distance to surface of shape from `inside', + // allowing for tolerance + +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4double* tmpdist; +- if (fLastDistanceToOut.p == p) +- { +- return fLastDistanceToOut.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToOut.p)); +- tmpdist = const_cast(&(fLastDistanceToOut.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- } +- + // + // Calculate DistanceToOut(p) + // +@@ -791,8 +675,7 @@ G4double G4TwistedTubs::DistanceToOut( const G4ThreeVector& p ) const + } + case (kSurface) : + { +- *tmpdist = 0.; +- return fLastDistanceToOut.value; ++ return 0; + } + case (kInside) : + { +@@ -819,9 +702,7 @@ G4double G4TwistedTubs::DistanceToOut( const G4ThreeVector& p ) const + bestxx = xx; + } + } +- *tmpdist = distance; +- +- return fLastDistanceToOut.value; ++ return distance; + } + default : + { +diff --git a/source/geometry/solids/specific/src/G4VTwistedFaceted.cc b/source/geometry/solids/specific/src/G4VTwistedFaceted.cc +index b8d5c74539453e7a5a5f99623c5e4c9477ff8014..5a524e3398509d340955028835cdf6d52b70b66b 100644 +--- a/source/geometry/solids/specific/src/G4VTwistedFaceted.cc ++++ b/source/geometry/solids/specific/src/G4VTwistedFaceted.cc +@@ -54,6 +54,7 @@ namespace + G4Mutex polyhedronMutex = G4MUTEX_INITIALIZER; + } + ++ + //===================================================================== + //* constructors ------------------------------------------------------ + +@@ -222,12 +223,7 @@ G4VTwistedFaceted::G4VTwistedFaceted(const G4VTwistedFaceted& rhs) + fDx3(rhs.fDx3), fDx4(rhs.fDx4), fDz(rhs.fDz), fDx(rhs.fDx), fDy(rhs.fDy), + fAlph(rhs.fAlph), fTAlph(rhs.fTAlph), fdeltaX(rhs.fdeltaX), + fdeltaY(rhs.fdeltaY), fPhiTwist(rhs.fPhiTwist), fLowerEndcap(nullptr), +- fUpperEndcap(nullptr), fSide0(nullptr), fSide90(nullptr), fSide180(nullptr), fSide270(nullptr), +- fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal), +- fLastDistanceToIn(rhs.fLastDistanceToIn), +- fLastDistanceToOut(rhs.fLastDistanceToOut), +- fLastDistanceToInWithV(rhs.fLastDistanceToInWithV), +- fLastDistanceToOutWithV(rhs.fLastDistanceToOutWithV) ++ fUpperEndcap(nullptr), fSide0(nullptr), fSide90(nullptr), fSide180(nullptr), fSide270(nullptr) + { + CreateSurfaces(); + } +@@ -257,11 +253,6 @@ G4VTwistedFaceted& G4VTwistedFaceted::operator = (const G4VTwistedFaceted& rhs) + fCubicVolume= rhs.fCubicVolume; fSurfaceArea= rhs.fSurfaceArea; + fRebuildPolyhedron = false; + delete fpPolyhedron; fpPolyhedron = nullptr; +- fLastInside= rhs.fLastInside; fLastNormal= rhs.fLastNormal; +- fLastDistanceToIn= rhs.fLastDistanceToIn; +- fLastDistanceToOut= rhs.fLastDistanceToOut; +- fLastDistanceToInWithV= rhs.fLastDistanceToInWithV; +- fLastDistanceToOutWithV= rhs.fLastDistanceToOutWithV; + + CreateSurfaces(); + +@@ -347,20 +338,7 @@ G4VTwistedFaceted::CalculateExtent( const EAxis pAxis, + EInside G4VTwistedFaceted::Inside(const G4ThreeVector& p) const + { + +- G4ThreeVector *tmpp; +- EInside *tmpin; +- if (fLastInside.p == p) +- { +- return fLastInside.inside; +- } +- else +- { +- tmpp = const_cast(&(fLastInside.p)); +- tmpin = const_cast(&(fLastInside.inside)); +- tmpp->set(p.x(), p.y(), p.z()); +- } +- +- *tmpin = kOutside ; ++ EInside tmpin = kOutside ; + + G4double phi = p.z()/(2*fDz) * fPhiTwist ; // rotate the point to z=0 + G4double cphi = std::cos(-phi) ; +@@ -414,13 +392,13 @@ EInside G4VTwistedFaceted::Inside(const G4ThreeVector& p) const + if ( posy <= yMax - kCarTolerance*0.5 + && posy >= yMin + kCarTolerance*0.5 ) + { +- if (std::fabs(posz) <= fDz - kCarTolerance*0.5 ) *tmpin = kInside ; +- else if (std::fabs(posz) <= fDz + kCarTolerance*0.5 ) *tmpin = kSurface ; ++ if (std::fabs(posz) <= fDz - kCarTolerance*0.5 ) tmpin = kInside ; ++ else if (std::fabs(posz) <= fDz + kCarTolerance*0.5 ) tmpin = kSurface ; + } + else if ( posy <= yMax + kCarTolerance*0.5 + && posy >= yMin - kCarTolerance*0.5 ) + { +- if (std::fabs(posz) <= fDz + kCarTolerance*0.5 ) *tmpin = kSurface ; ++ if (std::fabs(posz) <= fDz + kCarTolerance*0.5 ) tmpin = kSurface ; + } + } + else if ( posx <= xMax + kCarTolerance*0.5 +@@ -429,15 +407,15 @@ EInside G4VTwistedFaceted::Inside(const G4ThreeVector& p) const + if ( posy <= yMax + kCarTolerance*0.5 + && posy >= yMin - kCarTolerance*0.5 ) + { +- if (std::fabs(posz) <= fDz + kCarTolerance*0.5) *tmpin = kSurface ; ++ if (std::fabs(posz) <= fDz + kCarTolerance*0.5) tmpin = kSurface ; + } + } + + #ifdef G4TWISTDEBUG +- G4cout << "inside = " << fLastInside.inside << G4endl ; ++ G4cout << "inside = " << tmpin << G4endl ; + #endif + +- return fLastInside.inside; ++ return tmpin; + + } + +@@ -454,15 +432,6 @@ G4ThreeVector G4VTwistedFaceted::SurfaceNormal(const G4ThreeVector& p) const + // Which of the three or four surfaces are we closest to? + // + +- if (fLastNormal.p == p) +- { +- return fLastNormal.vec; +- } +- +- auto tmpp = const_cast(&(fLastNormal.p)); +- auto tmpnormal = const_cast(&(fLastNormal.vec)); +- auto tmpsurface = const_cast(fLastNormal.surface); +- tmpp->set(p.x(), p.y(), p.z()); + + G4double distance = kInfinity; + +@@ -490,10 +459,7 @@ G4ThreeVector G4VTwistedFaceted::SurfaceNormal(const G4ThreeVector& p) const + } + } + +- tmpsurface[0] = surfaces[besti]; +- *tmpnormal = tmpsurface[0]->GetNormal(bestxx, true); +- +- return fLastNormal.vec; ++ return surfaces[besti]->GetNormal(bestxx, true); + } + + +@@ -510,26 +476,6 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p, + // The function returns kInfinity if no intersection or + // just grazing within tolerance. + +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4ThreeVector* tmpv; +- G4double* tmpdist; +- if (fLastDistanceToInWithV.p == p && fLastDistanceToInWithV.vec == v) +- { +- return fLastDistanceToIn.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToInWithV.p)); +- tmpv = const_cast(&(fLastDistanceToInWithV.vec)); +- tmpdist = const_cast(&(fLastDistanceToInWithV.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- tmpv->set(v.x(), v.y(), v.z()); +- } +- + // + // Calculate DistanceToIn(p,v) + // +@@ -547,8 +493,7 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p, + G4ThreeVector normal = SurfaceNormal(p); + if (normal*v < 0) + { +- *tmpdist = 0.; +- return fLastDistanceToInWithV.value; ++ return 0; + } + } + +@@ -574,7 +519,7 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p, + for (const auto & surface : surfaces) + { + #ifdef G4TWISTDEBUG +- G4cout << G4endl << "surface " << i << ": " << G4endl << G4endl ; ++ G4cout << G4endl << "surface " << &surface - &*surfaces << ": " << G4endl << G4endl ; + #endif + G4double tmpdistance = surface->DistanceToIn(p, v, xx); + #ifdef G4TWISTDEBUG +@@ -592,9 +537,8 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p, + G4cout << "best distance = " << distance << G4endl ; + #endif + +- *tmpdist = distance; + // timer.Stop(); +- return fLastDistanceToInWithV.value; ++ return distance; + } + + +@@ -608,23 +552,6 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p) const + // allowing for tolerance + // + +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4double* tmpdist; +- if (fLastDistanceToIn.p == p) +- { +- return fLastDistanceToIn.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToIn.p)); +- tmpdist = const_cast(&(fLastDistanceToIn.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- } +- + // + // Calculate DistanceToIn(p) + // +@@ -639,8 +566,7 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p) const + + case (kSurface) : + { +- *tmpdist = 0.; +- return fLastDistanceToIn.value; ++ return 0; + } + + case (kOutside) : +@@ -671,8 +597,7 @@ G4double G4VTwistedFaceted::DistanceToIn (const G4ThreeVector& p) const + bestxx = xx; + } + } +- *tmpdist = distance; +- return fLastDistanceToIn.value; ++ return distance; + } + + default: +@@ -702,26 +627,6 @@ G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p, + // The function returns kInfinity if no intersection or + // just grazing within tolerance. + +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4ThreeVector* tmpv; +- G4double* tmpdist; +- if (fLastDistanceToOutWithV.p == p && fLastDistanceToOutWithV.vec == v ) +- { +- return fLastDistanceToOutWithV.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToOutWithV.p)); +- tmpv = const_cast(&(fLastDistanceToOutWithV.vec)); +- tmpdist = const_cast(&(fLastDistanceToOutWithV.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- tmpv->set(v.x(), v.y(), v.z()); +- } +- + // + // Calculate DistanceToOut(p,v) + // +@@ -737,17 +642,15 @@ G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p, + // if the particle is exiting from the volume, return 0 + // + G4ThreeVector normal = SurfaceNormal(p); +- G4VTwistSurface *blockedsurface = fLastNormal.surface[0]; + if (normal*v > 0) + { + if (calcNorm) + { +- *norm = (blockedsurface->GetNormal(p, true)); +- *validNorm = blockedsurface->IsValidNorm(); ++ *norm = normal; ++ *validNorm = true; + } +- *tmpdist = 0.; + // timer.Stop(); +- return fLastDistanceToOutWithV.value; ++ return 0; + } + } + +@@ -789,8 +692,7 @@ G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p, + } + } + +- *tmpdist = distance; +- return fLastDistanceToOutWithV.value; ++ return distance; + } + + +@@ -802,24 +704,6 @@ G4double G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p ) const + // DistanceToOut(p): + // Calculate distance to surface of shape from `inside', + // allowing for tolerance +- +- // +- // checking last value +- // +- +- G4ThreeVector* tmpp; +- G4double* tmpdist; +- +- if (fLastDistanceToOut.p == p) +- { +- return fLastDistanceToOut.value; +- } +- else +- { +- tmpp = const_cast(&(fLastDistanceToOut.p)); +- tmpdist = const_cast(&(fLastDistanceToOut.value)); +- tmpp->set(p.x(), p.y(), p.z()); +- } + + // + // Calculate DistanceToOut(p) +@@ -848,8 +732,7 @@ G4double G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p ) const + } + case (kSurface) : + { +- *tmpdist = 0.; +- retval = fLastDistanceToOut.value; ++ retval = 0; + break; + } + +@@ -881,9 +764,7 @@ G4double G4VTwistedFaceted::DistanceToOut( const G4ThreeVector& p ) const + bestxx = xx; + } + } +- *tmpdist = distance; +- +- retval = fLastDistanceToOut.value; ++ retval = distance; + break; + } + From f4ddb5429370899cf8d632c2e73e4cc33fdb7bc6 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Sun, 22 Sep 2024 12:51:25 +0200 Subject: [PATCH 208/687] opendatadetector: Add an env variable pointing to the share directory (#46511) * opendatadetector: Add an env variable pointing to the share directory * Rename the new variable to OPENDATADETECTOR_DATA and use join_path --------- Co-authored-by: jmcarcell --- var/spack/repos/builtin/packages/opendatadetector/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/opendatadetector/package.py b/var/spack/repos/builtin/packages/opendatadetector/package.py index a2be138b5734d6..6953fbd115a04b 100644 --- a/var/spack/repos/builtin/packages/opendatadetector/package.py +++ b/var/spack/repos/builtin/packages/opendatadetector/package.py @@ -32,10 +32,10 @@ class Opendatadetector(CMakePackage): def cmake_args(self): args = [] - # C++ Standard args.append("-DCMAKE_CXX_STANDARD=%s" % self.spec["root"].variants["cxxstd"].value) return args def setup_run_environment(self, env): + env.set("OPENDATADETECTOR_DATA", join_path(self.prefix.share, "OpenDataDetector")) env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib) env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib64) From b88971e125808f63a7ff73b036d954a522fb0506 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:28:52 -0500 Subject: [PATCH 209/687] tinker: add v8.7.2 (#46527) --- var/spack/repos/builtin/packages/tinker/package.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/tinker/package.py b/var/spack/repos/builtin/packages/tinker/package.py index 1d26543d8d547e..8d3bcb7f3b2a9f 100644 --- a/var/spack/repos/builtin/packages/tinker/package.py +++ b/var/spack/repos/builtin/packages/tinker/package.py @@ -16,7 +16,13 @@ class Tinker(CMakePackage): homepage = "https://dasher.wustl.edu/tinker/" url = "https://dasher.wustl.edu/tinker/downloads/tinker-8.7.1.tar.gz" - version("8.7.1", sha256="0d6eff8bbc9be0b37d62b6fd3da35bb5499958eafe67aa9c014c4648c8b46d0f") + version("8.7.2", sha256="f9e94ae0684d527cd2772a4a7a05c41864ce6246f1194f6c1c402a94598151c2") + version( + "8.7.1", + sha256="0d6eff8bbc9be0b37d62b6fd3da35bb5499958eafe67aa9c014c4648c8b46d0f", + deprecated=True, + ) + patch("tinker-8.7.1-cmake.patch") depends_on("fftw") From 17199e7fed21165a8656ba892d4f69bd402bafb3 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:32:14 -0500 Subject: [PATCH 210/687] py-cftime: fix url (#46523) --- var/spack/repos/builtin/packages/py-cftime/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-cftime/package.py b/var/spack/repos/builtin/packages/py-cftime/package.py index 7bc37434c1603e..7c343d92a3c44c 100644 --- a/var/spack/repos/builtin/packages/py-cftime/package.py +++ b/var/spack/repos/builtin/packages/py-cftime/package.py @@ -12,7 +12,7 @@ class PyCftime(PythonPackage): netCDF conventions""" homepage = "https://unidata.github.io/cftime/" - url = "https://github.com/Unidata/cftime/archive/v1.0.3.4rel.tar.gz" + url = "https://github.com/Unidata/cftime/archive/refs/tags/v1.0.3.4rel.tar.gz" version("1.0.3.4", sha256="f261ff8c65ceef4799784cd999b256d608c177d4c90b083553aceec3b6c23fd3") From 1ccfb1444a842ad8197c62984b592dc7e00d123b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:34:38 -0500 Subject: [PATCH 211/687] py-falcon: fix url (#46522) --- var/spack/repos/builtin/packages/py-falcon/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-falcon/package.py b/var/spack/repos/builtin/packages/py-falcon/package.py index c6475fd12b8b59..2383ae4bfee6c9 100644 --- a/var/spack/repos/builtin/packages/py-falcon/package.py +++ b/var/spack/repos/builtin/packages/py-falcon/package.py @@ -11,7 +11,7 @@ class PyFalcon(PythonPackage): building large-scale app backends and microservices.""" homepage = "https://github.com/falconry/falcon" - url = "https://github.com/falconry/falcon/archive/3.0.0a2.tar.gz" + url = "https://github.com/falconry/falcon/archive/refs/tags/3.0.0a2.tar.gz" license("Apache-2.0") From 960f206a68352ac6e5dfd2b97eabc87708ee7792 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:35:31 -0500 Subject: [PATCH 212/687] evemu: fix url (#46521) --- var/spack/repos/builtin/packages/evemu/package.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/var/spack/repos/builtin/packages/evemu/package.py b/var/spack/repos/builtin/packages/evemu/package.py index fee10a7f91eb21..b9c4340a56a1ff 100644 --- a/var/spack/repos/builtin/packages/evemu/package.py +++ b/var/spack/repos/builtin/packages/evemu/package.py @@ -10,17 +10,18 @@ class Evemu(AutotoolsPackage): """The evemu library and tools are used to describe devices, record data, create devices and replay data from kernel evdev devices.""" - homepage = "https://github.com/freedesktop/evemu" - url = "https://github.com/freedesktop/evemu/archive/v2.7.0.tar.gz" + homepage = "https://gitlab.freedesktop.org/libevdev/evemu" + url = "https://gitlab.freedesktop.org/libevdev/evemu/-/archive/v2.7.0/evemu-v2.7.0.tar.gz" license("LGPL-3.0-only") - version("2.7.0", sha256="aee1ecc2b6761134470316d97208b173adb4686dc72548b82b2c2b5d1e5dc259") - version("2.6.0", sha256="dc2382bee4dcb6c413271d586dc11d9b4372a70fa2b66b1e53a7107f2f9f51f8") - version("2.5.0", sha256="ab7cce32800db84ab3504789583d1be0d9b0a5f2689389691367b18cf059b09f") - version("2.4.0", sha256="d346ec59289f588bd93fe3cfa40858c7e048660164338787da79b9ebe3256069") - version("2.3.1", sha256="f2dd97310520bc7824adc38b69ead22c53944a666810c60a3e49592914e14e8a") + version("2.7.0", sha256="b4ba7458ccb394e9afdb2562c9809e9e90fd1099e8a028d05de3f12349ab6afa") + version("2.6.0", sha256="2efa4abb51f9f35a48605db51ab835cf688f02f6041d48607e78e11ec3524ac8") + version("2.5.0", sha256="1d88b2a81db36b6018cdc3e8d57fbb95e3a5df9e6806cd7b3d29c579a7113d4f") + version("2.4.0", sha256="ea8e7147550432321418ae1161a909e054ff482c86a6a1631f727171791a501d") + version("2.3.1", sha256="fbe77a083ed4328e76e2882fb164efc925b308b83e879b518136ee54d74def46") + depends_on("c", type="build") depends_on("autoconf", type="build") depends_on("automake", type="build") depends_on("libtool", type="build") From 27c590d2dc9d1eac8cd6347326177f4ceedd5099 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:42:21 -0500 Subject: [PATCH 213/687] testdfsio: fix url and switch to be deprecated (#46520) --- var/spack/repos/builtin/packages/testdfsio/package.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/testdfsio/package.py b/var/spack/repos/builtin/packages/testdfsio/package.py index f002893c21c431..cbe7e75fc39bfd 100644 --- a/var/spack/repos/builtin/packages/testdfsio/package.py +++ b/var/spack/repos/builtin/packages/testdfsio/package.py @@ -10,9 +10,13 @@ class Testdfsio(MavenPackage): """A corrected and enhanced version of Apache Hadoop TestDFSIO""" - homepage = "https://github.com/tthx/testdfsio" - url = "https://github.com/tthx/testdfsio/archive/0.0.1.tar.gz" + homepage = "https://github.com/asotirov0/testdfsio" + url = "https://github.com/asotirov0/testdfsio/archive/0.0.1.tar.gz" - version("0.0.1", sha256="fe8cc47260ffb3e3ac90e0796ebfe73eb4dac64964ab77671e5d32435339dd09") + version( + "0.0.1", + sha256="fe8cc47260ffb3e3ac90e0796ebfe73eb4dac64964ab77671e5d32435339dd09", + deprecated=True, + ) depends_on("hadoop@3.2.1:", type="run") From 87d389fe78232ee38f2387ccfb6f6d480e787281 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:54:10 -0500 Subject: [PATCH 214/687] shc: fix url (#46517) --- var/spack/repos/builtin/packages/shc/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/shc/package.py b/var/spack/repos/builtin/packages/shc/package.py index 5ff617eebc655e..4338930e42120b 100644 --- a/var/spack/repos/builtin/packages/shc/package.py +++ b/var/spack/repos/builtin/packages/shc/package.py @@ -13,7 +13,7 @@ class Shc(AutotoolsPackage): and linked to produce a stripped binary executable.""" homepage = "https://neurobin.org/projects/softwares/unix/shc/" - url = "https://github.com/neurobin/shc/archive/4.0.3.tar.gz" + url = "https://github.com/neurobin/shc/archive/refs/tags/4.0.3.tar.gz" license("GPL-3.0-or-later") From c302013c5b1e80653d8a54fb3cf8c079392bd492 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:54:57 -0500 Subject: [PATCH 215/687] yajl: fix url (#46518) --- var/spack/repos/builtin/packages/yajl/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/yajl/package.py b/var/spack/repos/builtin/packages/yajl/package.py index 686714cadbd358..24572d06f74cd3 100644 --- a/var/spack/repos/builtin/packages/yajl/package.py +++ b/var/spack/repos/builtin/packages/yajl/package.py @@ -10,7 +10,7 @@ class Yajl(CMakePackage): """Yet Another JSON Library (YAJL)""" homepage = "https://lloyd.github.io/yajl/" - url = "https://github.com/lloyd/yajl/archive/2.1.0.zip" + url = "https://github.com/lloyd/yajl/archive/refs/tags/2.1.0.zip" git = "https://github.com/lloyd/yajl.git" license("MIT") From 3e0331b25031474cd05ca2bc12d9099f493e323f Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 06:58:07 -0500 Subject: [PATCH 216/687] goblin-hmc-sim: fix url (#46515) --- var/spack/repos/builtin/packages/goblin-hmc-sim/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/goblin-hmc-sim/package.py b/var/spack/repos/builtin/packages/goblin-hmc-sim/package.py index 74865bfcef6915..bad1c82d1c2044 100644 --- a/var/spack/repos/builtin/packages/goblin-hmc-sim/package.py +++ b/var/spack/repos/builtin/packages/goblin-hmc-sim/package.py @@ -15,7 +15,7 @@ class GoblinHmcSim(MakefilePackage): homepage = "https://github.com/tactcomplabs/gc64-hmcsim" git = "https://github.com/tactcomplabs/gc64-hmcsim" # The version numbers track the SST they were released with - url = "https://github.com/tactcomplabs/gc64-hmcsim/archive/sst-8.0.0-release.tar.gz" + url = "https://github.com/tactcomplabs/gc64-hmcsim/archive/refs/tags/sst-8.0.0-release.tar.gz" # This works with parallel builds outside Spack # For some reason .o files get thrashed inside Spack parallel = False From 2375f873bfad3e38e9f6fe335b045ad3f5f72258 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 07:01:28 -0500 Subject: [PATCH 217/687] grackle: fix url, checksums, deps and sbang (#46516) --- .../repos/builtin/packages/grackle/package.py | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/grackle/package.py b/var/spack/repos/builtin/packages/grackle/package.py index a859ab4ad144cb..63b0c4b5ce2e22 100644 --- a/var/spack/repos/builtin/packages/grackle/package.py +++ b/var/spack/repos/builtin/packages/grackle/package.py @@ -5,6 +5,7 @@ import os.path +from spack.hooks.sbang import filter_shebang from spack.package import * @@ -15,23 +16,39 @@ class Grackle(Package): simulation code """ - homepage = "http://grackle.readthedocs.io/en/grackle-3.1/" - url = "https://bitbucket.org/grackle/grackle/get/grackle-3.1.tar.bz2" + homepage = "http://grackle.readthedocs.io/en/latest/" + url = "https://github.com/grackle-project/grackle/archive/refs/tags/grackle-3.1.tar.gz" - version("3.1", sha256="504fb080c7f8578c92dcde76cf9e8b851331a38ac76fc4a784df4ecbe1ff2ae8") - version("3.0", sha256="9219033332188d615e49135a3b030963f076b3afee098592b0c3e9f8bafdf504") - version("2.2", sha256="b1d201313c924df38d1e677015f7c31dce42083ef6a0e0936bb9410ccd8a3655") - version("2.0.1", sha256="8f784aaf53d98ddb52b448dc51eb9ec452261a2dbb360170a798693b85165f7d") + version("3.1", sha256="5705985a70d65bc2478cc589ca26f631a8de90e3c8f129a6b2af69db17c01079") + version("3.0", sha256="41e9ba1fe18043a98db194a6f5b9c76a7f0296a95a457d2b7d73311195b7d781") + version("2.2", sha256="5855cb0f93736fd8dd47efeb0abdf36af9339ede86de7f895f527513566c0fae") + version("2.0.1", sha256="bcdf6b3ff7b7515ae5e9f1f3369b2690ed8b3c450040e92a03e40582f57a0864") variant("float", default=False, description="Build with float") - depends_on("libtool", when="@2.2") + depends_on("libtool", when="@2.2:") + depends_on("c", type="build") + depends_on("fortran", type="build") + depends_on("tcsh", type="build") depends_on("mpi") depends_on("hdf5+mpi") parallel = False + @run_before("install") + def filter_sbang(self): + """Run before install so that the standard Spack sbang install hook + can fix up the path to the tcsh binary. + """ + tcsh = self.spec["tcsh"].command + with working_dir(self.stage.source_path): + match = "^#!/bin/csh.*" + substitute = f"#!{tcsh}" + filter_file(match, substitute, "configure") + # Since scripts are run during installation, we need to add sbang + filter_shebang("configure") + def install(self, spec, prefix): template_name = "{0.architecture}-{0.compiler.name}" grackle_architecture = template_name.format(spec) @@ -59,7 +76,7 @@ def install(self, spec, prefix): filter_file(key, value, makefile) configure() - with working_dir("src/clib"): + with working_dir(join_path(self.stage.source_path, "src", "clib")): make("clean") make("machine-{0}".format(grackle_architecture)) make("opt-high") From 34525388fe377de5f3327455889b5e9ebb0cfe14 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 07:06:57 -0500 Subject: [PATCH 218/687] codec2: fix url; add v1.2.0 (#46514) --- var/spack/repos/builtin/packages/codec2/package.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/codec2/package.py b/var/spack/repos/builtin/packages/codec2/package.py index 5639ee6d5dcc2e..227de4f3b738fb 100644 --- a/var/spack/repos/builtin/packages/codec2/package.py +++ b/var/spack/repos/builtin/packages/codec2/package.py @@ -12,10 +12,20 @@ class Codec2(CMakePackage): HF/VHF digital radio.""" homepage = "https://www.rowetel.com/?page_id=452" - url = "https://github.com/drowe67/codec2/archive/v0.9.2.tar.gz" + url = "https://github.com/drowe67/codec2/archive/refs/tags/1.2.0.tar.gz" license("LGPL-2.1-or-later") + version("1.2.0", sha256="cbccae52b2c2ecc5d2757e407da567eb681241ff8dadce39d779a7219dbcf449") version("1.1.0", sha256="d56ba661008a780b823d576a5a2742c94d0b0507574643a7d4f54c76134826a3") version("1.0.5", sha256="cd9a065dd1c3477f6172a0156294f767688847e4d170103d1f08b3a075f82826") version("0.9.2", sha256="19181a446f4df3e6d616b50cabdac4485abb9cd3242cf312a0785f892ed4c76c") + + depends_on("c", type="build") + + def url_for_version(self, version): + # Release 1.2.0 started with shallow git clone "to reduce repo size" + if version < Version("1.2.0"): + return f"https://github.com/drowe67/codec2-dev/archive/refs/tags/v{version}.tar.gz" + else: + return f"https://github.com/drowe67/codec2/archive/refs/tags/{version}.tar.gz" From 639990c385368b2035a1a0abc9c5a6e6cce58d8c Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 07:10:26 -0500 Subject: [PATCH 219/687] bird: change url and checksums, add v2.15.1 (#46513) --- .../repos/builtin/packages/bird/package.py | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/bird/package.py b/var/spack/repos/builtin/packages/bird/package.py index b9ed84e0c3d3b1..7706f59e675f53 100644 --- a/var/spack/repos/builtin/packages/bird/package.py +++ b/var/spack/repos/builtin/packages/bird/package.py @@ -14,13 +14,42 @@ class Bird(AutotoolsPackage): systems and distributed under the GNU General Public License.""" homepage = "https://bird.network.cz/" - url = "https://github.com/BIRD/bird/archive/v2.0.2.tar.gz" + url = "https://gitlab.nic.cz/labs/bird/-/archive/v2.0.2/bird-v2.0.2.tar.gz" - license("GPL-2.0-or-later") + license("GPL-2.0-or-later", checked_by="wdconinc") - version("2.0.2", sha256="bd42d48fbcc2c0046d544f1183cd98193ff15b792d332ff45f386b0180b09335") - version("2.0.1", sha256="cd6ea4a39ca97ad16d364bf80f919f0e75eba02dd7fe46be40f55d78d022244a") + version("2.15.1", sha256="5a4cf55c4767192aa57880ac5f6763e5b8c26f688ab5934df96e3615c4b0a1e1") + version("2.15", sha256="485b731ed0668b0da4f5110ba8ea98d248e10b25421820feca5dcdd94ab98a29") + version("2.14", sha256="22823b20d31096fcfded6773ecc7d9ee6da0339ede805422647c04127c67472f") + version("2.13.1", sha256="4a55c469f5d2984b62eef929343815b75a7b19132b8c3f40b41f8f66e27d3078") + version("2.13", sha256="db3df5dd84de98c2a61f8415c9812876578d6ba159038d853b211700e43dbae1") + version("2.0.12", sha256="70ef51cbf2b7711db484225da5bdf0344ba31629a167148bfe294f61f07573f6") + version("2.0.11", sha256="a2a1163166def10e014c6f832d6552b00ab46714024613c76cd6ebc3cd3e51c4") + version("2.0.10", sha256="8e053a64ed3e2c681fcee33ee31e61c7a5df32f94644799f283d294108e83722") + version("2.0.9", sha256="912d5c1bbefffd6198b10688ef6e16d0b9dfb2886944f481fc38b4d869ffd2c4") + version("2.0.8", sha256="4d0eeea762dcd4422e1e276e2ed123cfed630cf1cce017b50463d79fcf2fff0c") + version("2.0.7", sha256="d0c6aeaaef3217d6210261a49751fc662838b55fec92f576e20938917dbf89ab") + version("2.0.6", sha256="61518120c76bbfe0b52eff614e7580a1d973e66907df5aeac83fe344aa30595a") + version("2.0.5", sha256="f20dc822fc95aa580759c9b83bfd6c7c2e8504d8d0602cee118db1447054f5d0") + version("2.0.4", sha256="8c191b87524db3ff587253f46f94524ad2a89efdec8a12c800544a5fb01a2861") + version("2.0.3", sha256="54ec151518564f87e81de4ac19376689e5ba8dd9129f1e9a79086db3df0931f8") + version("2.0.2", sha256="e1e9ac92faf5893890c478386fdbd3c391ec2e9b911b1dfccec7b7fa825e9820") + version("2.0.1", sha256="c222968bb017e6b77d14f4e778f437b84f4ccae686355a3ad8e88799285e7636") + # fix multiple definitions with extern rta_dest_names + patch( + "https://gitlab.nic.cz/labs/bird/-/commit/4bbc10614f3431c37e6352f5a6ea5c693c31021e.diff", + sha256="ab891b10dab2fa17a3047cd48e082cccc14f958f4255dcae771deab1330da7c8", + when="@:2.0.7", + ) + # fix linker errors due to undefined behavior on signals + patch( + "https://gitlab.nic.cz/labs/bird/-/commit/24493e9169d3058958ab3ec4d2b02c5753954981.diff", + sha256="ea49dea1c503836feea127c605b99352b1e353df490d63873af09973cf2b3d14", + when="@:2.0.6", + ) + + depends_on("c", type="build") depends_on("autoconf", type="build") depends_on("automake", type="build") depends_on("libtool", type="build") From 73125df0ec00af1f6af3e51bdb01294ba8b3e31e Mon Sep 17 00:00:00 2001 From: Derek Ryan Strong Date: Sun, 22 Sep 2024 05:15:56 -0700 Subject: [PATCH 220/687] fpart: Confirm license and c dependency (#46509) --- var/spack/repos/builtin/packages/fpart/package.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/fpart/package.py b/var/spack/repos/builtin/packages/fpart/package.py index 86fe178a4db8d3..5fb4168c6b421b 100644 --- a/var/spack/repos/builtin/packages/fpart/package.py +++ b/var/spack/repos/builtin/packages/fpart/package.py @@ -17,14 +17,12 @@ class Fpart(AutotoolsPackage): maintainers("drkrynstrng") - license("BSD-2-Clause") + license("BSD-2-Clause", checked_by="drkrynstrng") version("master", branch="master") version("1.6.0", sha256="ed1fac2853fc421071b72e4c5d8455a231bc30e50034db14af8b0485ece6e097") version("1.5.1", sha256="c353a28f48e4c08f597304cb4ebb88b382f66b7fabfc8d0328ccbb0ceae9220c") - depends_on("c", type="build") # generated - variant("embfts", default=False, description="Build with embedded fts functions") variant("static", default=False, description="Build static binary") variant("debug", default=False, description="Build with debugging support") @@ -37,6 +35,7 @@ class Fpart(AutotoolsPackage): description="Tools used by fpsync to copy files", ) + depends_on("c", type="build") depends_on("autoconf", type="build") depends_on("automake", type="build") depends_on("libtool", type="build") From 8328851391edf154d905740115e962faed8be25d Mon Sep 17 00:00:00 2001 From: Thomas Bouvier Date: Sun, 22 Sep 2024 12:51:09 +0000 Subject: [PATCH 221/687] py-nvidia-dali: update to v1.41.0 (#46369) * py-nvidia-dali: update to v1.41.0 * py-nvidia-dali: drop unnecessary 'preferred' attribute --- .../packages/py-nvidia-dali/package.py | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-nvidia-dali/package.py b/var/spack/repos/builtin/packages/py-nvidia-dali/package.py index d43371b80db941..248d78fc49d64c 100644 --- a/var/spack/repos/builtin/packages/py-nvidia-dali/package.py +++ b/var/spack/repos/builtin/packages/py-nvidia-dali/package.py @@ -23,10 +23,21 @@ class PyNvidiaDali(PythonPackage): system = platform.system().lower() arch = platform.machine() if "linux" in system and arch == "x86_64": + version( + "1.41.0-cuda120", + sha256="240b4135e7c71c5f669d2f2970fa350f7ad1a0a4aab588a3ced578f9b6d7abd9", + url="https://developer.download.nvidia.com/compute/redist/nvidia-dali-cuda120/nvidia_dali_cuda120-1.41.0-17427117-py3-none-manylinux2014_x86_64.whl", + expand=False, + ) + version( + "1.41.0.cuda110", + sha256="6b12993384b694463c651a6c22621e6982b8834946eefcc864ab061b5c6e972e", + url="https://developer.download.nvidia.com/compute/redist/nvidia-dali-cuda110/nvidia_dali_cuda110-1.41.0-17427118-py3-none-manylinux2014_x86_64.whl", + expand=False, + ) version( "1.36.0-cuda120", sha256="9a7754aacb245785462592aec89cbaec72e0a84d84399a061a563546bbf44805", - preferred=True, url="https://developer.download.nvidia.com/compute/redist/nvidia-dali-cuda120/nvidia_dali_cuda120-1.36.0-13435171-py3-none-manylinux2014_x86_64.whl", expand=False, ) @@ -109,10 +120,21 @@ class PyNvidiaDali(PythonPackage): expand=False, ) elif "linux" in system and arch == "aarch64": + version( + "1.41.0-cuda120", + sha256="5b9eddcd6433244a1c5bec44db71c5dccede7d81f929711c634c4d79f6ce5f81", + url="https://developer.download.nvidia.com/compute/redist/nvidia-dali-cuda120/nvidia_dali_cuda120-1.41.0-17427117-py3-none-manylinux2014_aarch64.whl", + expand=False, + ) + version( + "1.41.0-cuda110", + sha256="7ec004a65ea7c1bd1272f27b3a5aea9f0d74e95e5d54523db2fabbf8b6efedc9", + url="https://developer.download.nvidia.com/compute/redist/nvidia-dali-cuda110/nvidia_dali_cuda110-1.41.0-17427118-py3-none-manylinux2014_aarch64.whl", + expand=False, + ) version( "1.36.0-cuda120", sha256="575ae1ff9b7633c847182163e2d339f2bdafe8dd0ca4ca6e3092a02890f803c2", - preferred=True, url="https://developer.download.nvidia.com/compute/redist/nvidia-dali-cuda120/nvidia_dali_cuda120-1.36.0-13435171-py3-none-manylinux2014_aarch64.whl", expand=False, ) @@ -196,6 +218,7 @@ class PyNvidiaDali(PythonPackage): ) cuda120_versions = ( + "@1.41.0-cuda120", "@1.36.0-cuda120", "@1.27.0-cuda120", "@1.26.0-cuda120", @@ -205,6 +228,7 @@ class PyNvidiaDali(PythonPackage): "@1.22.0-cuda120", ) cuda110_versions = ( + "@1.41.0-cuda110", "@1.36.0-cuda110", "@1.27.0-cuda110", "@1.26.0-cuda110", From 4e48ed73c6aadddde87f79c9a46c9d381509161a Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 07:56:02 -0500 Subject: [PATCH 222/687] static-analysis-suite: delete: no longer available (#46519) --- .../packages/static-analysis-suite/package.py | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/static-analysis-suite/package.py diff --git a/var/spack/repos/builtin/packages/static-analysis-suite/package.py b/var/spack/repos/builtin/packages/static-analysis-suite/package.py deleted file mode 100644 index f2e75c06b232e0..00000000000000 --- a/var/spack/repos/builtin/packages/static-analysis-suite/package.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2013-2024 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 StaticAnalysisSuite(CMakePackage): - """SAS (Static Analysis Suite) is a powerful tool for running static - analysis on C++ code.""" - - homepage = "https://github.com/dpiparo/SAS" - url = "https://github.com/dpiparo/SAS/archive/0.1.3.tar.gz" - - version( - "0.2.0", - sha256="a369e56f8edc61dbf59ae09dbb11d98bc05fd337c5e47e13af9c913bf7bfc538", - deprecated=True, - ) - version( - "0.1.4", - sha256="9b2a3436efe3c8060ee4882f3ed37d848ee79a63d6055a71a23fad6409559f40", - deprecated=True, - ) - version( - "0.1.3", - sha256="93c3194bb7d518c215e79436bfb43304683832b3cc66bfc838f6195ce4574943", - deprecated=True, - ) - - depends_on("python@2.7:") - depends_on("llvm@3.5:") - depends_on("cmake@2.8:", type="build") - - def cmake_args(self): - args = ["-DLLVM_DEV_DIR=%s" % self.spec["llvm"].prefix] - return args From d62a03bbf82631f1d1f3d76ce8304ec9156a5ecf Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 22 Sep 2024 15:28:55 +0200 Subject: [PATCH 223/687] py-fiona: add v1.10.1 (#46425) --- var/spack/repos/builtin/packages/py-fiona/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-fiona/package.py b/var/spack/repos/builtin/packages/py-fiona/package.py index 04901bbc851a6b..6d59878ab5375b 100644 --- a/var/spack/repos/builtin/packages/py-fiona/package.py +++ b/var/spack/repos/builtin/packages/py-fiona/package.py @@ -18,6 +18,7 @@ class PyFiona(PythonPackage): license("BSD-3-Clause") version("master", branch="master") + version("1.10.1", sha256="b00ae357669460c6491caba29c2022ff0acfcbde86a95361ea8ff5cd14a86b68") version("1.10.0", sha256="3529fd46d269ff3f70aeb9316a93ae95cf2f87d7e148a8ff0d68532bf81ff7ae") version("1.9.6", sha256="791b3494f8b218c06ea56f892bd6ba893dfa23525347761d066fb7738acda3b1") version("1.9.5", sha256="99e2604332caa7692855c2ae6ed91e1fffdf9b59449aa8032dd18e070e59a2f7") From c2eea418485f142550bb830589e9a7ffb887b0e0 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 22 Sep 2024 07:59:02 -0600 Subject: [PATCH 224/687] py-linkchecker: new package (#46403) --- .../packages/py-linkchecker/package.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-linkchecker/package.py diff --git a/var/spack/repos/builtin/packages/py-linkchecker/package.py b/var/spack/repos/builtin/packages/py-linkchecker/package.py new file mode 100644 index 00000000000000..ac0de717a6e993 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-linkchecker/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2024 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 PyLinkchecker(PythonPackage): + """Check for broken links in web sites.""" + + homepage = "https://linkchecker.github.io/linkchecker/" + pypi = "LinkChecker/LinkChecker-10.5.0.tar.gz" + + maintainers("rbberger") + + license("GPL-2.0") + + version("10.5.0", sha256="978b42b803e58b7a8f6ffae1ff88fa7fd1e87b944403b5dc82380dd59f516bb9") + + depends_on("python@3.9:", type=("build", "run")) + depends_on("py-requests@2.20:", type=("build", "run")) + depends_on("py-dnspython@2:", type=("build", "run")) + depends_on("py-beautifulsoup4@4.8.1:", type=("build", "run")) + depends_on("py-hatchling@1.8.0:", type="build") + depends_on("py-hatch-vcs", type="build") + depends_on("py-setuptools-scm@7.1.0:", type="build") From 873cb5c1a06f162b7fe0a649d954524e0ddbec1f Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 22 Sep 2024 16:26:25 +0200 Subject: [PATCH 225/687] py-horovod: support newer torch, gcc (#46432) --- .../builtin/packages/py-horovod/package.py | 169 ++++++------------ 1 file changed, 56 insertions(+), 113 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-horovod/package.py b/var/spack/repos/builtin/packages/py-horovod/package.py index 7f98321996c470..d7a2e9b3bbf36a 100644 --- a/var/spack/repos/builtin/packages/py-horovod/package.py +++ b/var/spack/repos/builtin/packages/py-horovod/package.py @@ -13,121 +13,51 @@ class PyHorovod(PythonPackage, CudaPackage): homepage = "https://github.com/horovod" git = "https://github.com/horovod/horovod.git" - - maintainers("adamjstewart", "aweits", "tgaddair", "thomas-bouvier") + submodules = True license("Apache-2.0") + maintainers("adamjstewart", "aweits", "tgaddair", "thomas-bouvier") - version("master", branch="master", submodules=True) - version( - "0.28.1", tag="v0.28.1", commit="1d217b59949986d025f6db93c49943fb6b6cc78f", submodules=True - ) - version( - "0.28.0", tag="v0.28.0", commit="587d72004736209a93ebda8cec0acdb7870db583", submodules=True - ) - version( - "0.27.0", tag="v0.27.0", commit="bfaca90d5cf66780a97d8799d4e1573855b64560", submodules=True - ) - version( - "0.26.1", tag="v0.26.1", commit="34604870eabd9dc670c222deb1da9acc6b9d7c03", submodules=True - ) - version( - "0.26.0", tag="v0.26.0", commit="c638dcec972750d4a75b229bc208cff9dc76b00a", submodules=True - ) - version( - "0.25.0", tag="v0.25.0", commit="48e0affcba962831668cd1222866af2d632920c2", submodules=True - ) - version( - "0.24.3", tag="v0.24.3", commit="a2d9e280c1210a8e364a7dc83ca6c2182fefa99d", submodules=True - ) - version( - "0.24.2", tag="v0.24.2", commit="b4c191c8d05086842517b3836285a85c6f96ab22", submodules=True - ) - version( - "0.24.1", tag="v0.24.1", commit="ebd135098571722469bb6290a6d098a9e1c96574", submodules=True - ) - version( - "0.24.0", tag="v0.24.0", commit="b089df66a29d3ba6672073eef3d42714d9d3626b", submodules=True - ) - version( - "0.23.0", tag="v0.23.0", commit="66ad6d5a3586decdac356e8ec95c204990bbc3d6", submodules=True - ) - version( - "0.22.1", tag="v0.22.1", commit="93a2f2583ed63391a904aaeb03b602729be90f15", submodules=True - ) - version( - "0.22.0", tag="v0.22.0", commit="3ff94801fbb4dbf6bc47c23888c93cad4887435f", submodules=True - ) - version( - "0.21.3", tag="v0.21.3", commit="6916985c9df111f36864724e2611827f64de8e11", submodules=True - ) - version( - "0.21.2", tag="v0.21.2", commit="c64b1d60c6bad7834f3315f12707f8ebf11c9c3d", submodules=True - ) - version( - "0.21.1", tag="v0.21.1", commit="a9dea74abc1f0b8e81cd2b6dd9fe81e2c4244e39", submodules=True - ) - version( - "0.21.0", tag="v0.21.0", commit="7d71874258fc8625ad8952defad0ea5b24531248", submodules=True - ) - version( - "0.20.3", tag="v0.20.3", commit="b3c4d81327590c9064d544622b6250d9a19ce2c2", submodules=True - ) - version( - "0.20.2", tag="v0.20.2", commit="cef4393eb980d4137bb91256da4dd847b7f44d1c", submodules=True - ) - version( - "0.20.1", tag="v0.20.1", commit="4099c2b7f34f709f0db1c09f06b2594d7b4b9615", submodules=True - ) - version( - "0.20.0", tag="v0.20.0", commit="396c1319876039ad8f5a56c007a020605ccb8277", submodules=True - ) - version( - "0.19.5", tag="v0.19.5", commit="b52e4b3e6ce5b1b494b77052878a0aad05c2e3ce", submodules=True - ) - version( - "0.19.4", tag="v0.19.4", commit="31f1f700b8fa6d3b6df284e291e302593fbb4fa3", submodules=True - ) - version( - "0.19.3", tag="v0.19.3", commit="ad63bbe9da8b41d0940260a2dd6935fa0486505f", submodules=True - ) - version( - "0.19.2", tag="v0.19.2", commit="f8fb21e0ceebbdc6ccc069c43239731223d2961d", submodules=True - ) - version( - "0.19.1", tag="v0.19.1", commit="9ad69e78e83c34568743e8e97b1504c6c7af34c3", submodules=True - ) - version( - "0.19.0", tag="v0.19.0", commit="1a805d9b20224069b294f361e47f5d9b55f426ff", submodules=True - ) - version( - "0.18.2", tag="v0.18.2", commit="bb2134b427e0e0c5a83624d02fafa4f14de623d9", submodules=True - ) - version( - "0.18.1", tag="v0.18.1", commit="0008191b3e61b5dfccddabe0129bbed7cd544c56", submodules=True - ) - version( - "0.18.0", tag="v0.18.0", commit="a639de51e9a38d5c1f99f458c045aeaebe70351e", submodules=True - ) - version( - "0.17.1", tag="v0.17.1", commit="399e70adc0f74184b5848d9a46b9b6ad67b5fe6d", submodules=True - ) - version( - "0.17.0", tag="v0.17.0", commit="2fed0410774b480ad19057320be9027be06b309e", submodules=True - ) - version( - "0.16.4", tag="v0.16.4", commit="2aac48c95c035bee7d68f9aff30e59319f46c21e", submodules=True - ) - version( - "0.16.3", tag="v0.16.3", commit="30a2148784478415dc31d65a6aa08d237f364b42", submodules=True - ) - version( - "0.16.2", tag="v0.16.2", commit="217774652eeccfcd60aa6e268dfd6b766d71b768", submodules=True - ) - - depends_on("c", type="build") # generated - depends_on("cxx", type="build") # generated - depends_on("fortran", type="build") # generated + version("master", branch="master") + version("0.28.1", tag="v0.28.1", commit="1d217b59949986d025f6db93c49943fb6b6cc78f") + version("0.28.0", tag="v0.28.0", commit="587d72004736209a93ebda8cec0acdb7870db583") + version("0.27.0", tag="v0.27.0", commit="bfaca90d5cf66780a97d8799d4e1573855b64560") + version("0.26.1", tag="v0.26.1", commit="34604870eabd9dc670c222deb1da9acc6b9d7c03") + version("0.26.0", tag="v0.26.0", commit="c638dcec972750d4a75b229bc208cff9dc76b00a") + version("0.25.0", tag="v0.25.0", commit="48e0affcba962831668cd1222866af2d632920c2") + version("0.24.3", tag="v0.24.3", commit="a2d9e280c1210a8e364a7dc83ca6c2182fefa99d") + version("0.24.2", tag="v0.24.2", commit="b4c191c8d05086842517b3836285a85c6f96ab22") + version("0.24.1", tag="v0.24.1", commit="ebd135098571722469bb6290a6d098a9e1c96574") + version("0.24.0", tag="v0.24.0", commit="b089df66a29d3ba6672073eef3d42714d9d3626b") + version("0.23.0", tag="v0.23.0", commit="66ad6d5a3586decdac356e8ec95c204990bbc3d6") + version("0.22.1", tag="v0.22.1", commit="93a2f2583ed63391a904aaeb03b602729be90f15") + version("0.22.0", tag="v0.22.0", commit="3ff94801fbb4dbf6bc47c23888c93cad4887435f") + version("0.21.3", tag="v0.21.3", commit="6916985c9df111f36864724e2611827f64de8e11") + version("0.21.2", tag="v0.21.2", commit="c64b1d60c6bad7834f3315f12707f8ebf11c9c3d") + version("0.21.1", tag="v0.21.1", commit="a9dea74abc1f0b8e81cd2b6dd9fe81e2c4244e39") + version("0.21.0", tag="v0.21.0", commit="7d71874258fc8625ad8952defad0ea5b24531248") + version("0.20.3", tag="v0.20.3", commit="b3c4d81327590c9064d544622b6250d9a19ce2c2") + version("0.20.2", tag="v0.20.2", commit="cef4393eb980d4137bb91256da4dd847b7f44d1c") + version("0.20.1", tag="v0.20.1", commit="4099c2b7f34f709f0db1c09f06b2594d7b4b9615") + version("0.20.0", tag="v0.20.0", commit="396c1319876039ad8f5a56c007a020605ccb8277") + version("0.19.5", tag="v0.19.5", commit="b52e4b3e6ce5b1b494b77052878a0aad05c2e3ce") + version("0.19.4", tag="v0.19.4", commit="31f1f700b8fa6d3b6df284e291e302593fbb4fa3") + version("0.19.3", tag="v0.19.3", commit="ad63bbe9da8b41d0940260a2dd6935fa0486505f") + version("0.19.2", tag="v0.19.2", commit="f8fb21e0ceebbdc6ccc069c43239731223d2961d") + version("0.19.1", tag="v0.19.1", commit="9ad69e78e83c34568743e8e97b1504c6c7af34c3") + version("0.19.0", tag="v0.19.0", commit="1a805d9b20224069b294f361e47f5d9b55f426ff") + version("0.18.2", tag="v0.18.2", commit="bb2134b427e0e0c5a83624d02fafa4f14de623d9") + version("0.18.1", tag="v0.18.1", commit="0008191b3e61b5dfccddabe0129bbed7cd544c56") + version("0.18.0", tag="v0.18.0", commit="a639de51e9a38d5c1f99f458c045aeaebe70351e") + version("0.17.1", tag="v0.17.1", commit="399e70adc0f74184b5848d9a46b9b6ad67b5fe6d") + version("0.17.0", tag="v0.17.0", commit="2fed0410774b480ad19057320be9027be06b309e") + version("0.16.4", tag="v0.16.4", commit="2aac48c95c035bee7d68f9aff30e59319f46c21e") + version("0.16.3", tag="v0.16.3", commit="30a2148784478415dc31d65a6aa08d237f364b42") + version("0.16.2", tag="v0.16.2", commit="217774652eeccfcd60aa6e268dfd6b766d71b768") + + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build") # https://github.com/horovod/horovod/blob/master/docs/install.rst variant( @@ -232,7 +162,20 @@ class PyHorovod(PythonPackage, CudaPackage): "controllers=gloo", when="@:0.20.0 platform=darwin", msg="Gloo cannot be compiled on MacOS" ) # https://github.com/horovod/horovod/issues/3996 - conflicts("^py-torch@2.1:", when="@:0.28.1") + patch( + "https://github.com/horovod/horovod/pull/3998.patch?full_index=1", + sha256="9ecd4e8e315764afab20f2086e24baccf8178779a3c663196b24dc55a23a6aca", + when="@0.25:0.28.1", + ) + conflicts("^py-torch@2.1:", when="@:0.24") + + # https://github.com/horovod/horovod/pull/3957 + patch( + "https://github.com/horovod/horovod/pull/3957.patch?full_index=1", + sha256="9e22e312c0cbf224b4135ba70bd4fd2e4170d8316c996643e360112abaac8f93", + when="@0.21:0.28.1", + ) + conflicts("%gcc@13:", when="@:0.20") # https://github.com/horovod/horovod/pull/1835 patch("fma.patch", when="@0.19.0:0.19.1") From f2c132af2db3ecf8b7adb4157b8a6c095f326b34 Mon Sep 17 00:00:00 2001 From: Tuomas Koskela Date: Sun, 22 Sep 2024 15:35:17 +0100 Subject: [PATCH 226/687] fftw: Apply fix for missing FFTW3LibraryDepends.cmake (#46477) --- var/spack/repos/builtin/packages/fftw/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index bcf54524008ac3..44aace9f3ed3d4 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -247,6 +247,11 @@ class Fftw(FftwBase): provides("fftw-api@3", when="@3:") patch("pfft-3.3.9.patch", when="@3.3.9:+pfft_patches", level=0) + patch( + "https://github.com/FFTW/fftw3/commit/f69fef7aa546d4477a2a3fd7f13fa8b2f6c54af7.patch?full_index=1", + sha256="872cff9a7d346e91a108ffd3540bfcebeb8cf86c7f40f6b31fd07a80267cbf53", + when="@3.3.7:", + ) patch("pfft-3.3.5.patch", when="@3.3.5:3.3.8+pfft_patches", level=0) patch("pfft-3.3.4.patch", when="@3.3.4+pfft_patches", level=0) patch("pgi-3.3.6-pl2.patch", when="@3.3.6-pl2%pgi", level=0) From a608f83bfc8bb79c7116f8bd81a08e785d3c2728 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 22 Sep 2024 08:39:37 -0600 Subject: [PATCH 227/687] py-pyenchant: new package (#46400) --- .../builtin/packages/py-pyenchant/package.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-pyenchant/package.py diff --git a/var/spack/repos/builtin/packages/py-pyenchant/package.py b/var/spack/repos/builtin/packages/py-pyenchant/package.py new file mode 100644 index 00000000000000..a97afb66ecb06b --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pyenchant/package.py @@ -0,0 +1,23 @@ +# Copyright 2013-2024 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 PyPyenchant(PythonPackage): + """Sphinx Documentation Generator.""" + + homepage = "https://pyenchant.github.io/pyenchant/" + pypi = "pyenchant/pyenchant-3.2.2.tar.gz" + git = "https://github.com/pyenchant/pyenchant.git" + + license("LGPL-2.1") + + version("3.2.2", sha256="1cf830c6614362a78aab78d50eaf7c6c93831369c52e1bb64ffae1df0341e637") + + depends_on("enchant") + depends_on("python@3.5:") + depends_on("py-setuptools") From 98b149d711cef22c347190b2447620d4dc5fc16f Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 22 Sep 2024 08:52:23 -0600 Subject: [PATCH 228/687] py-sphinx-fortran: new package (#46401) --- .../packages/py-sphinx-fortran/package.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-sphinx-fortran/package.py diff --git a/var/spack/repos/builtin/packages/py-sphinx-fortran/package.py b/var/spack/repos/builtin/packages/py-sphinx-fortran/package.py new file mode 100644 index 00000000000000..dc67326bb26268 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-sphinx-fortran/package.py @@ -0,0 +1,26 @@ +# Copyright 2013-2024 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 PySphinxFortran(PythonPackage): + """Fortran domain and autodoc extensions to Sphinx""" + + homepage = "https://sphinx-fortran.readthedocs.io" + pypi = "sphinx-fortran/sphinx-fortran-1.1.1.tar.gz" + git = "https://github.com/VACUMM/sphinx-fortran.git" + + maintainers("rbberger") + + license("CeCILL-2.1") + + version("master", branch="master") + version("1.1.1", sha256="e912e6b292e80768ad3cf580a560a4752c2c077eda4a1bbfc3a4ca0f11fb8ee1") + + depends_on("py-sphinx@1:") + depends_on("py-numpy@1:") + depends_on("py-six") + depends_on("py-future") From 61c07becc562bf8bfb0e5cf5db20460c226e3e7e Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 22 Sep 2024 17:17:32 +0200 Subject: [PATCH 229/687] py-tensorflow: add GCC 13 conflict (#46435) --- var/spack/repos/builtin/packages/py-tensorflow/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-tensorflow/package.py b/var/spack/repos/builtin/packages/py-tensorflow/package.py index dfe4f72e6b412e..c94a2082d55c54 100644 --- a/var/spack/repos/builtin/packages/py-tensorflow/package.py +++ b/var/spack/repos/builtin/packages/py-tensorflow/package.py @@ -384,6 +384,7 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): # https://www.tensorflow.org/install/source#tested_build_configurations # https://github.com/tensorflow/tensorflow/issues/70199 # (-mavx512fp16 exists in gcc@12:) + conflicts("%gcc@13:", when="@:2.14") conflicts("%gcc@:11", when="@2.17:") conflicts("%gcc@:9.3.0", when="@2.9:") conflicts("%gcc@:7.3.0") From f2474584bfe2982fe7b8b2deb883ffb9be6f6833 Mon Sep 17 00:00:00 2001 From: Christophe Prud'homme Date: Sun, 22 Sep 2024 17:23:19 +0200 Subject: [PATCH 230/687] gsmsh: add missing png, jpeg and zlib deps (#46395) --- var/spack/repos/builtin/packages/gmsh/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/gmsh/package.py b/var/spack/repos/builtin/packages/gmsh/package.py index 636abe009602b4..79517a3cf5bd7a 100644 --- a/var/spack/repos/builtin/packages/gmsh/package.py +++ b/var/spack/repos/builtin/packages/gmsh/package.py @@ -80,6 +80,9 @@ class Gmsh(CMakePackage): # https://gmsh.info/doc/texinfo/gmsh.html#Compiling-the-source-code # We make changes to the GMSH default, such as external blas. + depends_on("libpng", when="+fltk") + depends_on("libjpeg-turbo", when="+fltk") + depends_on("zlib-api") depends_on("blas", when="~eigen") depends_on("lapack", when="~eigen") depends_on("eigen@3:", when="+eigen+external") From ac0a1ff3a298f56ef71aa157eb35f79a18fd3c02 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sun, 22 Sep 2024 11:29:53 -0400 Subject: [PATCH 231/687] py-beautifulsoup4: added 4.12.3 (#46310) --- var/spack/repos/builtin/packages/py-beautifulsoup4/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py b/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py index 2906db7e3b5daa..072a987a733e81 100644 --- a/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py +++ b/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py @@ -17,6 +17,7 @@ class PyBeautifulsoup4(PythonPackage): # Requires pytest skip_modules = ["bs4.tests"] + version("4.12.3", sha256="74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051") version("4.12.2", sha256="492bbc69dca35d12daac71c4db1bfff0c876c00ef4a2ffacce226d4638eb72da") version("4.11.1", sha256="ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693") version("4.10.0", sha256="c23ad23c521d818955a4151a67d81580319d4bf548d3d49f4223ae041ff98891") From ba978964e5d1be2bc340b0d32d2a55ba64461e15 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sun, 22 Sep 2024 11:30:50 -0400 Subject: [PATCH 232/687] py-typing-extensions: added 4.12.2 (#46309) --- var/spack/repos/builtin/packages/py-typing-extensions/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/py-typing-extensions/package.py b/var/spack/repos/builtin/packages/py-typing-extensions/package.py index aef21d66be91a0..b1d8c9134589e9 100644 --- a/var/spack/repos/builtin/packages/py-typing-extensions/package.py +++ b/var/spack/repos/builtin/packages/py-typing-extensions/package.py @@ -17,6 +17,7 @@ class PyTypingExtensions(PythonPackage): license("0BSD") + version("4.12.2", sha256="1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8") version("4.8.0", sha256="df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef") version("4.6.3", sha256="d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5") version("4.5.0", sha256="5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb") From 29aefd8d86d822c9ed8b06efb7de16467292f477 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sun, 22 Sep 2024 11:33:00 -0400 Subject: [PATCH 233/687] py-dirtyjson: new package (#46305) --- .../builtin/packages/py-dirtyjson/package.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-dirtyjson/package.py diff --git a/var/spack/repos/builtin/packages/py-dirtyjson/package.py b/var/spack/repos/builtin/packages/py-dirtyjson/package.py new file mode 100644 index 00000000000000..369dc26a62fecf --- /dev/null +++ b/var/spack/repos/builtin/packages/py-dirtyjson/package.py @@ -0,0 +1,19 @@ +# Copyright 2013-2024 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 PyDirtyjson(PythonPackage): + """JSON decoder for Python that can extract data from the muck""" + + homepage = "https://github.com/codecobblers/dirtyjson" + pypi = "dirtyjson/dirtyjson-1.0.8.tar.gz" + + license("MIT or AFL-2.1", checked_by="qwertos") + + version("1.0.8", sha256="90ca4a18f3ff30ce849d100dcf4a003953c79d3a2348ef056f1d9c22231a25fd") + + depends_on("py-setuptools", type="build") From 3a353c2a043ee8e6ca0121e8f95bb77ddcad0eed Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sun, 22 Sep 2024 11:33:55 -0400 Subject: [PATCH 234/687] py-striprtf: New package (#46304) --- .../builtin/packages/py-striprtf/package.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-striprtf/package.py diff --git a/var/spack/repos/builtin/packages/py-striprtf/package.py b/var/spack/repos/builtin/packages/py-striprtf/package.py new file mode 100644 index 00000000000000..7e8dea330e226c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-striprtf/package.py @@ -0,0 +1,19 @@ +# Copyright 2013-2024 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 PyStriprtf(PythonPackage): + """A simple library to convert rtf to text""" + + homepage = "https://github.com/joshy/striprtf" + pypi = "striprtf/striprtf-0.0.26.tar.gz" + + license("BSD-3-Clause", checked_by="qwertos") + + version("0.0.26", sha256="fdb2bba7ac440072d1c41eab50d8d74ae88f60a8b6575c6e2c7805dc462093aa") + + depends_on("py-setuptools", type="build") From 315f3a0b4dbc0301147172ba21f9425b2ab73b4c Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Sun, 22 Sep 2024 11:42:12 -0400 Subject: [PATCH 235/687] py-jiter: new package (#46308) --- .../builtin/packages/py-jiter/package.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-jiter/package.py diff --git a/var/spack/repos/builtin/packages/py-jiter/package.py b/var/spack/repos/builtin/packages/py-jiter/package.py new file mode 100644 index 00000000000000..466dff204c7306 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-jiter/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2024 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 PyJiter(PythonPackage): + """Fast iterable JSON parser.""" + + homepage = "https://github.com/pydantic/jiter/" + pypi = "jiter/jiter-0.5.0.tar.gz" + + license("MIT", checked_by="qwertos") + + version("0.5.0", sha256="1d916ba875bcab5c5f7d927df998c4cb694d27dceddf3392e58beaf10563368a") + + depends_on("python@3.8:", type=("build", "run")) + depends_on("py-maturin@1", type="build") + depends_on("rust@1.73:", type=("build", "run")) From 5811d754d90e61a30b3c84d2b1bc34fdb1950276 Mon Sep 17 00:00:00 2001 From: Sajid Ali Date: Sun, 22 Sep 2024 11:44:23 -0400 Subject: [PATCH 236/687] libwebsockets: add v4.3.3 (#46380) Co-authored-by: Bernhard Kaindl --- var/spack/repos/builtin/packages/libwebsockets/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/libwebsockets/package.py b/var/spack/repos/builtin/packages/libwebsockets/package.py index 37e66b3d153737..5347f241dfb5f5 100644 --- a/var/spack/repos/builtin/packages/libwebsockets/package.py +++ b/var/spack/repos/builtin/packages/libwebsockets/package.py @@ -15,6 +15,7 @@ class Libwebsockets(CMakePackage): license("MIT") + version("4.3.3", sha256="6fd33527b410a37ebc91bb64ca51bdabab12b076bc99d153d7c5dd405e4bdf90") version("2.2.1", sha256="e7f9eaef258e003c9ada0803a9a5636757a5bc0a58927858834fb38a87d18ad2") version("2.1.1", sha256="96183cbdfcd6e6a3d9465e854a924b7bfde6c8c6d3384d6159ad797c2e823b4d") version("2.1.0", sha256="bcc96aaa609daae4d3f7ab1ee480126709ef4f6a8bf9c85de40aae48e38cce66") @@ -26,3 +27,6 @@ class Libwebsockets(CMakePackage): depends_on("zlib-api") depends_on("openssl") + + def cmake_args(self): + return ["-DLWS_WITHOUT_TESTAPPS=ON"] From d4ad1675671fb2f486e7e6ff15bcbfe059594767 Mon Sep 17 00:00:00 2001 From: potter-s Date: Sun, 22 Sep 2024 16:50:24 +0100 Subject: [PATCH 237/687] bcftools: Add runtime dependency gffutils (#46255) Co-authored-by: Simon Potter --- var/spack/repos/builtin/packages/bcftools/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/bcftools/package.py b/var/spack/repos/builtin/packages/bcftools/package.py index 44b8dedc26108b..4dd8f74c5ea388 100644 --- a/var/spack/repos/builtin/packages/bcftools/package.py +++ b/var/spack/repos/builtin/packages/bcftools/package.py @@ -55,6 +55,7 @@ class Bcftools(AutotoolsPackage): depends_on("gsl", when="+libgsl") depends_on("py-matplotlib", when="@1.6:", type="run") + depends_on("py-gffutils", when="@1.9:", type="run") depends_on("perl", when="@1.8:~perl-filters", type="run") depends_on("perl", when="@1.8:+perl-filters", type=("build", "run")) From 2269d424f95ce063e5dba0ed0b68a11f45acb8a9 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 22 Sep 2024 17:55:06 +0200 Subject: [PATCH 238/687] py-jaxlib: add GCC 13 support (#46433) --- var/spack/repos/builtin/packages/py-jaxlib/package.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-jaxlib/package.py b/var/spack/repos/builtin/packages/py-jaxlib/package.py index 951aa4d9d39c25..fcd624cdd23de7 100644 --- a/var/spack/repos/builtin/packages/py-jaxlib/package.py +++ b/var/spack/repos/builtin/packages/py-jaxlib/package.py @@ -99,6 +99,12 @@ class PyJaxlib(PythonPackage, CudaPackage): depends_on("py-numpy@:1", when="@:0.4.25") depends_on("py-ml-dtypes@0.4:", when="@0.4.29") + patch( + "https://github.com/google/jax/pull/20101.patch?full_index=1", + sha256="4dfb9f32d4eeb0a0fb3a6f4124c4170e3fe49511f1b768cd634c78d489962275", + when="@:0.4.25", + ) + conflicts( "cuda_arch=none", when="+cuda", From f73f0f861dc5d2f14ed8f4ac563d3e46b66be4ae Mon Sep 17 00:00:00 2001 From: Joseph Wang Date: Mon, 23 Sep 2024 00:05:26 +0800 Subject: [PATCH 239/687] qd: add new versions and pull from main source tree (#46451) * qd: add new versions and pull from main source tree * add comment to that sha256 identical is intentional --- var/spack/repos/builtin/packages/qd/package.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/qd/package.py b/var/spack/repos/builtin/packages/qd/package.py index b80efee78edd88..452ca12d1d8ca5 100644 --- a/var/spack/repos/builtin/packages/qd/package.py +++ b/var/spack/repos/builtin/packages/qd/package.py @@ -13,12 +13,15 @@ class Qd(AutotoolsPackage): homepage = "https://bitbucket.org/njet/qd-library/src/master/" git = "https://bitbucket.org/njet/qd-library.git" + url = "https://www.davidhbailey.com/dhbsoftware/qd-2.3.13.tar.gz" tags = ["hep"] license("BSD-3-Clause-LBNL") - - version("2.3.13", commit="a57dde96b3255b80f7f39cd80217c213bf78d949") + version("2.3.24", sha256="a47b6c73f86e6421e86a883568dd08e299b20e36c11a99bdfbe50e01bde60e38") + version("2.3.23", sha256="b3eaf41ce413ec08f348ee73e606bd3ff9203e411c377c3c0467f89acf69ee26") + # The sha256 for 2.3.23 and 2.3.13 are identical as they are the same content + version("2.3.13", sha256="b3eaf41ce413ec08f348ee73e606bd3ff9203e411c377c3c0467f89acf69ee26") depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated From c118c7733b9e20f079bb19b84b8ad60cacd2a673 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 22 Sep 2024 12:04:23 -0500 Subject: [PATCH 240/687] *: no loop over files with filter_file(*files) (#46420) * *: no loop over files with filter_file(*files) * scalpel: revert --- var/spack/repos/builtin/packages/augustus/package.py | 6 ++---- var/spack/repos/builtin/packages/braker/package.py | 3 +-- var/spack/repos/builtin/packages/fplo/package.py | 3 +-- .../repos/builtin/packages/genemark-et/package.py | 3 +-- var/spack/repos/builtin/packages/hisat2/package.py | 12 ++++-------- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/var/spack/repos/builtin/packages/augustus/package.py b/var/spack/repos/builtin/packages/augustus/package.py index bfba305f623cd7..fe979ec5b91bf4 100644 --- a/var/spack/repos/builtin/packages/augustus/package.py +++ b/var/spack/repos/builtin/packages/augustus/package.py @@ -168,13 +168,11 @@ def filter_sbang(self): pattern = "^#!.*" repl = f"#!{self.spec['perl'].command.path}" files = glob.glob("*.pl") - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) repl = f"#!{self.spec['python'].command.path}" files = glob.glob("*.py") - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) def setup_build_environment(self, env): htslib = self.spec["htslib"].prefix diff --git a/var/spack/repos/builtin/packages/braker/package.py b/var/spack/repos/builtin/packages/braker/package.py index d9db1868840b0f..6180c1895b485b 100644 --- a/var/spack/repos/builtin/packages/braker/package.py +++ b/var/spack/repos/builtin/packages/braker/package.py @@ -63,8 +63,7 @@ def filter_sbang(self): pattern = "^#!.*/usr/bin/env perl" repl = "#!{0}".format(self.spec["perl"].command.path) files = glob.iglob("*.pl") - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) def setup_run_environment(self, env): env.prepend_path("PERL5LIB", self.prefix.lib) diff --git a/var/spack/repos/builtin/packages/fplo/package.py b/var/spack/repos/builtin/packages/fplo/package.py index f294fc05d346ac..61e8f4da09d6e0 100644 --- a/var/spack/repos/builtin/packages/fplo/package.py +++ b/var/spack/repos/builtin/packages/fplo/package.py @@ -136,5 +136,4 @@ def perl_interpreter(self): pattern = "^#!.*/usr/bin/perl" repl = "#!{0}".format(self.spec["perl"].command.path) files = ["fconv2", "fconvdens2", "fdowngrad.pl", "fout2in", "grBhfat", "grpop"] - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) diff --git a/var/spack/repos/builtin/packages/genemark-et/package.py b/var/spack/repos/builtin/packages/genemark-et/package.py index 8a344157fed7d5..0a65beaa6252c4 100644 --- a/var/spack/repos/builtin/packages/genemark-et/package.py +++ b/var/spack/repos/builtin/packages/genemark-et/package.py @@ -62,8 +62,7 @@ def filter_sbang(self): pattern = "^#!.*/usr/bin/perl" repl = "#!{0}".format(self.spec["perl"].command.path) files = glob.iglob("*.pl") - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) def setup_run_environment(self, env): env.prepend_path("PERL5LIB", self.prefix.lib) diff --git a/var/spack/repos/builtin/packages/hisat2/package.py b/var/spack/repos/builtin/packages/hisat2/package.py index 6821930bb184bd..ca96899314f9dc 100644 --- a/var/spack/repos/builtin/packages/hisat2/package.py +++ b/var/spack/repos/builtin/packages/hisat2/package.py @@ -89,24 +89,20 @@ def filter_sbang(self): pattern = "^#!.*/usr/bin/env python" repl = f"#!{self.spec['python'].command.path}" files = ["hisat2-build", "hisat2-inspect"] - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) pattern = "^#!.*/usr/bin/env perl" repl = f"#!{self.spec['perl'].command.path}" files = ["hisat2"] - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) pattern = "^#!.*/usr/bin/env python3" repl = f"#!{self.spec['python'].command.path}" files = glob.glob("*.py") - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) with working_dir(self.prefix.scripts): pattern = "^#!.*/usr/bin/perl" repl = f"#!{self.spec['perl'].command.path}" files = glob.glob("*.pl") - for file in files: - filter_file(pattern, repl, *files, backup=False) + filter_file(pattern, repl, *files, backup=False) From 5b77ce15c75c642e1dd4ad6679b182283973497d Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Mon, 23 Sep 2024 03:15:55 -0600 Subject: [PATCH 241/687] `py-cffi`: Add macos patch from cffi-feedstock, add version 1.17.1, update depe (#46484) * Add macos patch from cffi-feedstock, add version 1.17.1, update depends_on versions * missing patch * Use a url for the patch * Remove 3.12 support --- .../repos/builtin/packages/py-cffi/package.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-cffi/package.py b/var/spack/repos/builtin/packages/py-cffi/package.py index 677823af8e98a4..6f312fd942fdf1 100644 --- a/var/spack/repos/builtin/packages/py-cffi/package.py +++ b/var/spack/repos/builtin/packages/py-cffi/package.py @@ -16,6 +16,7 @@ class PyCffi(PythonPackage): license("MIT") + version("1.17.1", sha256="1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824") version("1.16.0", sha256="bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0") version("1.15.1", sha256="d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9") version("1.15.0", sha256="920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954") @@ -33,11 +34,29 @@ class PyCffi(PythonPackage): # setuptools before distutils, but only on Windows. This could be made # unconditional to support Python 3.12 depends_on("python@:3.11", type=("build", "run")) + + # python 3.12 support was released in @1.16:, however the removal + # in python3.12 of distutils has resulted in an imperfect fix for prefix-based + # tools like spack, see: + # https://github.com/spack/spack/pull/46224 + # https://github.com/cython/cython/pull/5754#issuecomment-1752102480 + # until this is correctly fixed, do not enable 3.12 support + # depends_on("python@:3.12", type=("build", "run"), when="@1.16:") + depends_on("pkgconfig", type="build") depends_on("py-setuptools", type="build") + depends_on("py-setuptools@66.1:", type="build", when="@1.16:") depends_on("py-pycparser", type=("build", "run")) depends_on("libffi") + # This patch enables allocate write+execute memory for ffi.callback() on macos + # https://github.com/conda-forge/cffi-feedstock/pull/47/files + patch( + "https://raw.githubusercontent.com/conda-forge/cffi-feedstock/refs/heads/main/recipe/0003-apple-api.patch", + when="@1.16: platform=darwin", + sha256="db836e67e2973ba7d3f4185b385fda49e2398281fc10362e5e413b75fdf93bf0", + ) + def flag_handler(self, name, flags): if self.spec.satisfies("%clang@13:"): if name in ["cflags", "cxxflags", "cppflags"]: From 44215de24e4553c2174717f3d30282ccf8713bdc Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Mon, 23 Sep 2024 14:16:55 +0200 Subject: [PATCH 242/687] acts dependencies: new versions as of 2024/09/23 (#46538) This commit adds some new versions of acts, detray, and vecmem. --- var/spack/repos/builtin/packages/acts/package.py | 1 + var/spack/repos/builtin/packages/detray/package.py | 2 ++ var/spack/repos/builtin/packages/vecmem/package.py | 1 + 3 files changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/acts/package.py b/var/spack/repos/builtin/packages/acts/package.py index 026a2096cb0f38..9fa3ee6a98ae46 100644 --- a/var/spack/repos/builtin/packages/acts/package.py +++ b/var/spack/repos/builtin/packages/acts/package.py @@ -41,6 +41,7 @@ class Acts(CMakePackage, CudaPackage): # Supported Acts versions version("main", branch="main") version("master", branch="main", deprecated=True) # For compatibility + version("36.3.1", commit="b58e5b0c33fb8423ce60a6a45f333edd0d178acd", submodules=True) version("36.3.0", commit="3b875cebabdd10462e224279558429f49ed75945", submodules=True) version("36.2.0", commit="e2fb53da911dc481969e56d635898a46b8d78df9", submodules=True) version("36.1.0", commit="3f19d1a0eec1d11937d66d0ef603f0b25b9b4e96", submodules=True) diff --git a/var/spack/repos/builtin/packages/detray/package.py b/var/spack/repos/builtin/packages/detray/package.py index b4a1d11c61e472..2bcc2ca2f2dd44 100644 --- a/var/spack/repos/builtin/packages/detray/package.py +++ b/var/spack/repos/builtin/packages/detray/package.py @@ -20,6 +20,7 @@ class Detray(CMakePackage): license("MPL-2.0", checked_by="stephenswat") + version("0.75.2", sha256="249066c138eac4114032e8d558f3a05885140a809332a347c7667978dbff54ee") version("0.74.2", sha256="9fd14cf1ec30477d33c530670e9fed86b07db083912fe51dac64bf2453b321e8") version("0.73.0", sha256="f574016bc7515a34a675b577e93316e18cf753f1ab7581dcf1c8271a28cb7406") version("0.72.1", sha256="6cc8d34bc0d801338e9ab142c4a9884d19d9c02555dbb56972fab86b98d0f75b") @@ -92,6 +93,7 @@ def cmake_args(self): self.define("DETRAY_SETUP_GOOGLETEST", False), self.define("DETRAY_SETUP_BENCHMARK", False), self.define("DETRAY_BUILD_TUTORIALS", False), + self.define("DETRAY_BUILD_TEST_UTILS", True), ] return args diff --git a/var/spack/repos/builtin/packages/vecmem/package.py b/var/spack/repos/builtin/packages/vecmem/package.py index cb82181cb04ae9..d24cb1fa2b1e8f 100644 --- a/var/spack/repos/builtin/packages/vecmem/package.py +++ b/var/spack/repos/builtin/packages/vecmem/package.py @@ -17,6 +17,7 @@ class Vecmem(CMakePackage, CudaPackage): license("MPL-2.0-no-copyleft-exception") + version("1.8.0", sha256="d04f1bfcd08837f85c794a69da9f248e163985214a302c22381037feb5b3a7a9") version("1.7.0", sha256="ff4bf8ea86a5edcb4a1e3d8dd0c42c73c60e998c6fb6512a40182c1f4620a73d") version("1.6.0", sha256="797b016ac0b79bb39abad059ffa9f4817e519218429c9ab4c115f989616bd5d4") version("1.5.0", sha256="5d7a2d2dd8eb961af12a1ed9e4e427b89881e843064ffa96ad0cf0934ba9b7ae") From 93ab70b07c0563f3bb9fe278da443e6a09b5eb7e Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 23 Sep 2024 18:11:38 +0200 Subject: [PATCH 243/687] py-dm-tree: support externally-installed pybind11 and abseil-cpp (#46431) --- .../builtin/packages/py-dm-tree/package.py | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-dm-tree/package.py b/var/spack/repos/builtin/packages/py-dm-tree/package.py index f00909fe73881a..c44acd8e308bcd 100644 --- a/var/spack/repos/builtin/packages/py-dm-tree/package.py +++ b/var/spack/repos/builtin/packages/py-dm-tree/package.py @@ -23,13 +23,37 @@ class PyDmTree(PythonPackage): version("0.1.8", sha256="0fcaabbb14e7980377439e7140bd05552739ca5e515ecb3119f234acee4b9430") version("0.1.7", sha256="30fec8aca5b92823c0e796a2f33b875b4dccd470b57e91e6c542405c5f77fd2a") - version("0.1.6", sha256="6776404b23b4522c01012ffb314632aba092c9541577004ab153321e87da439a") - version("0.1.5", sha256="a951d2239111dfcc468071bc8ff792c7b1e3192cab5a3c94d33a8b2bda3127fa") + version( + "0.1.6", + sha256="6776404b23b4522c01012ffb314632aba092c9541577004ab153321e87da439a", + deprecated=True, + ) + version( + "0.1.5", + sha256="a951d2239111dfcc468071bc8ff792c7b1e3192cab5a3c94d33a8b2bda3127fa", + deprecated=True, + ) - depends_on("cxx", type="build") # generated + depends_on("cxx", type="build") + + # Based on PyPI wheel availability + depends_on("python@:3.12", when="@0.1.8:", type=("build", "run")) + depends_on("python@:3.10", when="@0.1.6:0.1.7", type=("build", "run")) + depends_on("python@:3.8", when="@0.1.5", type=("build", "run")) depends_on("py-setuptools", type="build") - depends_on("cmake", when="@0.1.7:", type="build") + depends_on("cmake@3.12:", when="@0.1.7:", type="build") + depends_on("py-pybind11@2.10.1:", when="@0.1.8:") + depends_on("abseil-cpp", when="@0.1.8:") + + patch( + "https://github.com/google-deepmind/tree/pull/73.patch?full_index=1", + sha256="77dbd895611d412da99a5afbf312c3c49984ad02bd0e56ad342b2002a87d789c", + when="@0.1.8", + ) + conflicts("%gcc@13:", when="@:0.1.7") + + # Historical dependencies depends_on("bazel@:5", when="@:0.1.6", type="build") depends_on("py-six@1.12.0:", when="@:0.1.6", type=("build", "run")) From bda94e4067f13d098c314ffed8bc59cee8ef7bda Mon Sep 17 00:00:00 2001 From: Kyoko Nagahashi Date: Mon, 23 Sep 2024 14:35:41 -0700 Subject: [PATCH 244/687] linux-external-modules: update maintainers (#46474) --- .../repos/builtin/packages/linux-external-modules/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/linux-external-modules/package.py b/var/spack/repos/builtin/packages/linux-external-modules/package.py index 4bbf9a4a1cb787..1934cb688d04e0 100644 --- a/var/spack/repos/builtin/packages/linux-external-modules/package.py +++ b/var/spack/repos/builtin/packages/linux-external-modules/package.py @@ -24,9 +24,9 @@ class LinuxExternalModules(MakefilePackage): # linux-external-modules. how_to = "https://docs.kernel.org/kbuild/modules.html" - maintainers("fleshling", "rountree") + maintainers("kyotsukete", "rountree") - license("GPL-2.0-only", checked_by="fleshling") + license("GPL-2.0-only", checked_by="kyotsukete") version("6.10.3", sha256="fa5f22fd67dd05812d39dca579320c493048e26c4a556048a12385e7ae6fc698") version("6.10.2", sha256="73d8520dd9cba5acfc5e7208e76b35d9740b8aae38210a9224e32ec4c0d29b70") From 2c36a8aac3dab1d86a8cb60630e460d1db1b7f35 Mon Sep 17 00:00:00 2001 From: Kyoko Nagahashi Date: Mon, 23 Sep 2024 15:04:33 -0700 Subject: [PATCH 245/687] new package: msr-safe (#46289) This includes a test_linux699 variant which "activates" a version that pulls from a repository other than the official repository. This version is required to work with Linux kernel version 6.9.9 or later. Future official `msr-safe` versions are expected to support later Linux kernel versions. --- .../builtin/packages/msr-safe/package.py | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 var/spack/repos/builtin/packages/msr-safe/package.py diff --git a/var/spack/repos/builtin/packages/msr-safe/package.py b/var/spack/repos/builtin/packages/msr-safe/package.py new file mode 100644 index 00000000000000..d0c4d44a6d245a --- /dev/null +++ b/var/spack/repos/builtin/packages/msr-safe/package.py @@ -0,0 +1,61 @@ +# Copyright 2013-2024 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 MsrSafe(MakefilePackage): + """msr_safe provides controlled userspace access to model-specific registers (MSRs). + It allows system administrators to give register-level read access and bit-level write + access to trusted users in production environments. This access is useful where kernel + drivers have not caught up with new processor features, or performance constraints + requires batch access across dozens or hundreds of registers.""" + + homepage = "https://github.com/LLNL/msr-safe" + url = "https://github.com/LLNL/msr-safe/archive/refs/tags/v1.7.0.tar.gz" + + maintainers("kyotsukete", "rountree") + + license("GPL-2.0-only", checked_by="kyotsukete") + + variant( + "test_linux699", + default=False, + description="This variant is for testing against Linux kernel 6.9.9", + ) + + requires("@0.0.0_linux6.9.9", when="+test_linux699") + conflicts("@0.0.0_linux6.9.9", when="~test_linux699") + + # Version 0.0.0_linux6.9.9 is based on msr-safe@1.7.0 and solves for conflicts between 1.7.0 + # and the Linux kernel version 6.9.9. + version( + "0.0.0_linux6.9.9", + sha256="2b68670eda4467eaa9ddd7340522ab2000cf9d16d083607f9c481650ea1a2fc9", + url="https://github.com/rountree/msr-safe/archive/refs/heads/linux-6.9.9-cleanup.zip", + ) + version("1.7.0", sha256="bdf4f96bde92a23dc3a98716611ebbe7d302005305adf6a368cb25da9c8a609a") + version("1.6.0", sha256="defe9d12e2cdbcb1a9aa29bb09376d4156c3dbbeb7afc33315ca4b0b6859f5bb") + version("1.5.0", sha256="e91bac281339bcb0d119a74d68a73eafb5944fd933a893e0e3209576b4c6f233") + version("1.4.0", sha256="3e5a913e73978c9ce15ec5d2bf1a4583e9e5c30e4e75da0f76d9a7a6153398c0") + version("1.3.0", sha256="718dcc78272b45ffddf520078e7e54b0b6ce272f1ef0376de009a133149982a0") + version("1.2.0", sha256="d3c2e5280f94d65866f82a36fea50562dc3eaccbcaa81438562caaf35989d8e8") + version("1.1.0", sha256="5b723e9d360e15f3ed854a84de7430b2b77be1eb1515db03c66456db43684a83") + version("1.0.2", sha256="9511d021ab6510195e8cc3b0353a0ac414ab6965a188f47fbb8581f9156a970e") + + depends_on("linux-external-modules") + + @property + def build_targets(self): + return [ + "-C", + f"{self.spec['linux-external-modules'].prefix}", + f"M={self.build_directory}", + "modules", + ] + + @property + def install_targets(self): + return [f"DESTDIR={self.prefix}", "spack-install"] From 971577d85326b6a73e01dc5b77e5151c68be31fc Mon Sep 17 00:00:00 2001 From: Justin Cook Date: Tue, 24 Sep 2024 00:06:54 -0500 Subject: [PATCH 246/687] spec: fix spelling (#46550) Signed-off-by: Justin Cook --- lib/spack/spack/spec.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 1c566349a4fdba..6ae8fa036d7eb1 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -26,7 +26,7 @@ version, like "1.2", or it can be a range of versions, e.g. "1.2:1.4". If multiple specific versions or multiple ranges are acceptable, they can be separated by commas, e.g. if a package will only build with - versions 1.0, 1.2-1.4, and 1.6-1.8 of mavpich, you could say: + versions 1.0, 1.2-1.4, and 1.6-1.8 of mvapich, you could say: depends_on("mvapich@1.0,1.2:1.4,1.6:1.8") @@ -1155,7 +1155,7 @@ def _libs_default_handler(spec: "Spec"): for shared in search_shared: # Since we are searching for link libraries, on Windows search only for - # ".Lib" extensions by default as those represent import libraries for implict links. + # ".Lib" extensions by default as those represent import libraries for implicit links. libs = fs.find_libraries(name, home, shared=shared, recursive=True, runtime=False) if libs: return libs @@ -2497,7 +2497,7 @@ def spec_builder(d): spec_like, dep_like = next(iter(d.items())) # If the requirements was for unique nodes (default) - # then re-use keys from the local cache. Otherwise build + # then reuse keys from the local cache. Otherwise build # a new node every time. if not isinstance(spec_like, Spec): spec = spec_cache[spec_like] if normal else Spec(spec_like) @@ -5039,7 +5039,7 @@ def __init__(self, provided, required): class UnsatisfiableCompilerSpecError(spack.error.UnsatisfiableSpecError): - """Raised when a spec comiler conflicts with package constraints.""" + """Raised when a spec compiler conflicts with package constraints.""" def __init__(self, provided, required): super().__init__(provided, required, "compiler") From 679770b02cf9505752b8da93026e8533bbf38651 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 24 Sep 2024 08:44:47 +0200 Subject: [PATCH 247/687] solver: use a new heuristic (#46548) This PR introduces a new heuristic for the solver, which behaves better when compilers are treated as nodes. Apparently, it performs better also on `develop`, where compilers are still node attributes. The new heuristic: - Sets an initial priority for guessing a few attributes. The order is "nodes" (300), "dependencies" (150), "virtual dependencies" (60), "version" and "variants" (30), and "targets" and "compilers" (1). This initial priority decays over time during the solve, and falls back to the defaults. - By default, it considers most guessed facts as "false". For instance, by default a node doesn't exist in the optimal answer set, or a version is not picked as a node version etc. - There are certain conditions that override the default heuristic using the _priority_ of a rule, which previously we didn't use. For instance, by default we guess that a `attr("variant", Node, Variant, Value)` is false, but if we know that the node is already in the answer set, and the value is the default one, then we guess it is true. Signed-off-by: Massimiliano Culpo --- lib/spack/spack/solver/heuristic.lp | 49 ++++++++++++++++------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/lib/spack/spack/solver/heuristic.lp b/lib/spack/spack/solver/heuristic.lp index a5d6767ff2b1b4..e5d7de4966af57 100644 --- a/lib/spack/spack/solver/heuristic.lp +++ b/lib/spack/spack/solver/heuristic.lp @@ -7,32 +7,37 @@ % Heuristic to speed-up solves %============================================================================= -% No duplicates by default (most of them will be true) -#heuristic attr("node", node(PackageID, Package)). [100, init] -#heuristic attr("node", node(PackageID, Package)). [ 2, factor] -#heuristic attr("virtual_node", node(VirtualID, Virtual)). [100, init] -#heuristic attr("node", node(1..X-1, Package)) : max_dupes(Package, X), not virtual(Package), X > 1. [-1, sign] -#heuristic attr("virtual_node", node(1..X-1, Package)) : max_dupes(Package, X), virtual(Package) , X > 1. [-1, sign] - -% Pick preferred version -#heuristic attr("version", node(PackageID, Package), Version) : pkg_fact(Package, version_declared(Version, Weight)), attr("node", node(PackageID, Package)). [40, init] -#heuristic version_weight(node(PackageID, Package), 0) : pkg_fact(Package, version_declared(Version, 0 )), attr("node", node(PackageID, Package)). [ 1, sign] -#heuristic attr("version", node(PackageID, Package), Version) : pkg_fact(Package, version_declared(Version, 0 )), attr("node", node(PackageID, Package)). [ 1, sign] -#heuristic attr("version", node(PackageID, Package), Version) : pkg_fact(Package, version_declared(Version, Weight)), attr("node", node(PackageID, Package)), Weight > 0. [-1, sign] +#heuristic attr("node", PackageNode). [300, init] +#heuristic attr("node", PackageNode). [ 2, factor] +#heuristic attr("node", PackageNode). [ -1, sign] +#heuristic attr("node", node(0, Dependency)) : attr("dependency_holds", ParentNode, Dependency, Type), not virtual(Dependency). [1@2, sign] -% Use default variants -#heuristic attr("variant_value", node(PackageID, Package), Variant, Value) : variant_default_value(Package, Variant, Value), attr("node", node(PackageID, Package)). [40, true] -#heuristic attr("variant_value", node(PackageID, Package), Variant, Value) : not variant_default_value(Package, Variant, Value), attr("node", node(PackageID, Package)). [40, false] +#heuristic attr("virtual_node", node(X, Virtual)). [60, init] +#heuristic attr("virtual_node", node(X, Virtual)). [-1, sign] +#heuristic attr("virtual_node", node(0, Virtual)) : node_depends_on_virtual(PackageNode, Virtual). [1@2, sign] + +#heuristic attr("depends_on", ParentNode, ChildNode, Type). [150, init] +#heuristic attr("depends_on", ParentNode, ChildNode, Type). [4, factor] +#heuristic attr("depends_on", ParentNode, ChildNode, Type). [-1, sign] +#heuristic attr("depends_on", ParentNode, node(0, Dependency), Type) : attr("dependency_holds", ParentNode, Dependency, Type), not virtual(Dependency). [1@2, sign] +#heuristic attr("depends_on", ParentNode, ProviderNode , Type) : node_depends_on_virtual(ParentNode, Virtual, Type), provider(ProviderNode, node(VirtualID, Virtual)). [1@2, sign] + +#heuristic attr("version", node(PackageID, Package), Version). [30, init] +#heuristic attr("version", node(PackageID, Package), Version). [-1, sign] +#heuristic attr("version", node(PackageID, Package), Version) : pkg_fact(Package, version_declared(Version, 0)), attr("node", node(PackageID, Package)). [ 1@2, sign] -% Use default operating system and platform -#heuristic attr("node_os", node(PackageID, Package), OS) : os(OS, 0), attr("root", node(PackageID, Package)). [40, true] -#heuristic attr("node_platform", node(PackageID, Package), Platform) : allowed_platform(Platform), attr("root", node(PackageID, Package)). [40, true] +#heuristic version_weight(node(PackageID, Package), Weight). [30, init] +#heuristic version_weight(node(PackageID, Package), Weight). [-1 , sign] +#heuristic version_weight(node(PackageID, Package), 0 ) : attr("node", node(PackageID, Package)). [ 1@2, sign] + +% Use default variants +#heuristic attr("variant_value", PackageNode, Variant, Value). [30, init] +#heuristic attr("variant_value", PackageNode, Variant, Value). [-1, sign] +#heuristic attr("variant_value", PackageNode, Variant, Value) : variant_default_value(PackageNode, Variant, Value), attr("node", PackageNode). [1@2, sign] % Use default targets -#heuristic attr("node_target", node(PackageID, Package), Target) : target_weight(Target, Weight), attr("node", node(PackageID, Package)). [30, init] -#heuristic attr("node_target", node(PackageID, Package), Target) : target_weight(Target, Weight), attr("node", node(PackageID, Package)). [ 2, factor] -#heuristic attr("node_target", node(PackageID, Package), Target) : target_weight(Target, 0), attr("node", node(PackageID, Package)). [ 1, sign] -#heuristic attr("node_target", node(PackageID, Package), Target) : target_weight(Target, Weight), attr("node", node(PackageID, Package)), Weight > 0. [-1, sign] +#heuristic attr("node_target", node(PackageID, Package), Target). [-1, sign] +#heuristic attr("node_target", node(PackageID, Package), Target) : target_weight(Target, 0), attr("node", node(PackageID, Package)). [1@2, sign] % Use the default compilers #heuristic node_compiler(node(PackageID, Package), ID) : compiler_weight(ID, 0), compiler_id(ID), attr("node", node(PackageID, Package)). [30, init] From c070ddac97546bf8f54ec78141e8ce374054513d Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 23 Sep 2024 23:59:07 -0700 Subject: [PATCH 248/687] database: don't call `socket.getfqdn()` on every write (#46554) We've seen `getfqdn()` cause slowdowns on macOS in CI when added elsewhere. It's also called by database.py every time we write the DB file. - [x] replace the call with a memoized version so that it is only called once per process. Signed-off-by: Todd Gamblin --- lib/spack/spack/database.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index 404288ff83ae1b..907b73c5db71a6 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -50,6 +50,7 @@ pass import llnl.util.filesystem as fs +import llnl.util.lang import llnl.util.tty as tty import spack.deptypes as dt @@ -121,6 +122,17 @@ ) +@llnl.util.lang.memoized +def _getfqdn(): + """Memoized version of `getfqdn()`. + + If we call `getfqdn()` too many times, DNS can be very slow. We only need to call it + one time per process, so we cache it here. + + """ + return socket.getfqdn() + + def reader(version: vn.StandardVersion) -> Type["spack.spec.SpecfileReaderBase"]: reader_cls = { vn.Version("5"): spack.spec.SpecfileV1, @@ -1084,7 +1096,7 @@ def _write(self, type, value, traceback): self._state_is_inconsistent = True return - temp_file = self._index_path + (".%s.%s.temp" % (socket.getfqdn(), os.getpid())) + temp_file = self._index_path + (".%s.%s.temp" % (_getfqdn(), os.getpid())) # Write a temporary database file them move it into place try: From 728da2ff87ad6f3e8a38d03c0da60f86247d08cd Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 24 Sep 2024 08:26:16 -0400 Subject: [PATCH 249/687] trilinos: add cuda_constexpr variant (#45812) --- var/spack/repos/builtin/packages/trilinos/package.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index c5c6d44d1be5b7..ce7f86cdf0c515 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -80,6 +80,11 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): # Build options variant("complex", default=False, description="Enable complex numbers in Trilinos") + variant( + "cuda_constexpr", + default=False, + description="Enable relaxed constexpr functions for CUDA build", + ) variant("cuda_rdc", default=False, description="Turn on RDC for CUDA build") variant("rocm_rdc", default=False, description="Turn on RDC for ROCm build") variant( @@ -1006,6 +1011,7 @@ def define_tpl(trilinos_name, spack_name, have_dep): [ define_kok_enable("CUDA_UVM", use_uvm), define_kok_enable("CUDA_LAMBDA", True), + define_kok_enable("CUDA_CONSTEXPR", "cuda_constexpr"), define_kok_enable("CUDA_RELOCATABLE_DEVICE_CODE", "cuda_rdc"), ] ) From 6692eb7b6fe625bbddab2ba1a7b94483b5c086b1 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Tue, 24 Sep 2024 15:07:41 +0200 Subject: [PATCH 250/687] py-pillow-simd: add v9.5.0 (#46543) --- var/spack/repos/builtin/packages/py-pillow-simd/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-pillow-simd/package.py b/var/spack/repos/builtin/packages/py-pillow-simd/package.py index e3d71e68d65c81..59dd312678a0f5 100644 --- a/var/spack/repos/builtin/packages/py-pillow-simd/package.py +++ b/var/spack/repos/builtin/packages/py-pillow-simd/package.py @@ -16,6 +16,9 @@ class PyPillowSimd(PyPillowBase): homepage = "https://github.com/uploadcare/pillow-simd" pypi = "Pillow-SIMD/Pillow-SIMD-7.0.0.post3.tar.gz" + version( + "9.5.0.post1", sha256="8c89b85c4085532752625f2cc066a28547cebb98529acf932d5d84c1a7ab2abc" + ) version( "9.0.0.post1", sha256="918541cfaa90ba3c0e1bae5da31ba1b1f52b09c0009bd90183b787af4e018263" ) @@ -28,7 +31,7 @@ class PyPillowSimd(PyPillowBase): depends_on("c", type="build") # generated - for ver in ["6.2.2.post1", "7.0.0.post3", "9.0.0.post1"]: + for ver in ["6.2.2.post1", "7.0.0.post3", "9.0.0.post1", "9.5.0.post1"]: provides("pil@" + ver, when="@" + ver) conflicts("target=aarch64:") From d7031dcd0979b10075d9ea503ae9db9b015627da Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Tue, 24 Sep 2024 15:21:17 +0200 Subject: [PATCH 251/687] py-pybind11: add v2.13.5 (#46230) * py-pybind11: add v2.13 * Remove build-tools tag --- var/spack/repos/builtin/packages/py-pybind11/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py index daaa541afa1e2b..16b0e77a7150d0 100644 --- a/var/spack/repos/builtin/packages/py-pybind11/package.py +++ b/var/spack/repos/builtin/packages/py-pybind11/package.py @@ -27,6 +27,7 @@ class PyPybind11(CMakePackage, PythonExtension): maintainers("ax3l") version("master", branch="master") + version("2.13.5", sha256="b1e209c42b3a9ed74da3e0b25a4f4cd478d89d5efbb48f04b277df427faf6252") version("2.13.4", sha256="efc901aa0aab439a3fea6efeaf930b5a349fb06394bf845c64ce15a9cf8f0240") version("2.13.3", sha256="6e7a84ec241544f2f5e30c7a82c09c81f0541dd14e9d9ef61051e07105f9c445") version("2.13.2", sha256="50eebef369d28f07ce1fe1797f38149e5928817be8e539239f2aadfd95b227f3") @@ -58,7 +59,7 @@ class PyPybind11(CMakePackage, PythonExtension): version("2.1.1", sha256="f2c6874f1ea5b4ad4ffffe352413f7d2cd1a49f9050940805c2a082348621540") version("2.1.0", sha256="2860f2b8d0c9f65f0698289a161385f59d099b7ead1bf64e8993c486f2b93ee0") - depends_on("cxx", type="build") # generated + depends_on("cxx", type="build") depends_on("py-setuptools@42:", type="build") depends_on("py-pytest", type="test") From 1c6b6d0a0819409b75d7a59a90c3daf24fe80fee Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Tue, 24 Sep 2024 15:44:49 +0200 Subject: [PATCH 252/687] lcio: Add version 2.22.2 (#46556) Add the latest tag for LCIO --- var/spack/repos/builtin/packages/lcio/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/lcio/package.py b/var/spack/repos/builtin/packages/lcio/package.py index cd6b34540e1bbd..c768ee39be1f1c 100644 --- a/var/spack/repos/builtin/packages/lcio/package.py +++ b/var/spack/repos/builtin/packages/lcio/package.py @@ -21,6 +21,7 @@ class Lcio(CMakePackage): license("BSD-3-Clause") version("master", branch="master") + version("2.22.2", sha256="e5ad9690af85160ef52dd407fc0995451b4293f3aee415a8ea8a950de63d87a1") version("2.22.1", sha256="4bc3d2c83af7b1c65d6736dd14ee82f41af7ce9bfc7cfe779c5f47417e8dc326") version("2.22", sha256="95676977a0427f5ecc857e8504b13f332c2c2e5769dc00f6beecff3c73dab395") version("2.21", sha256="a9f0a9922ab2ef17c6f1b8f7187bfc341f27567745a43c0480c103b617dfcea6") From 8471b1b471b26fc6e5f27a4d61188f4742cc84a3 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Tue, 24 Sep 2024 15:52:44 +0200 Subject: [PATCH 253/687] patch (#46545) --- .../cp2k/d4-dispersion-bugfix-2024.3.patch | 56 +++++++++++++++++++ .../repos/builtin/packages/cp2k/package.py | 5 ++ 2 files changed, 61 insertions(+) create mode 100644 var/spack/repos/builtin/packages/cp2k/d4-dispersion-bugfix-2024.3.patch diff --git a/var/spack/repos/builtin/packages/cp2k/d4-dispersion-bugfix-2024.3.patch b/var/spack/repos/builtin/packages/cp2k/d4-dispersion-bugfix-2024.3.patch new file mode 100644 index 00000000000000..36613ab6dd32c4 --- /dev/null +++ b/var/spack/repos/builtin/packages/cp2k/d4-dispersion-bugfix-2024.3.patch @@ -0,0 +1,56 @@ +diff --git a/src/qs_dispersion_d4.F b/src/qs_dispersion_d4.F +index 74df989b4..e513ed435 100644 +--- a/src/qs_dispersion_d4.F ++++ b/src/qs_dispersion_d4.F +@@ -26,6 +26,7 @@ MODULE qs_dispersion_d4 + #endif + USE kinds, ONLY: dp + USE particle_types, ONLY: particle_type ++ USE periodic_table, ONLY: get_ptable_info, ptable + USE qs_dispersion_types, ONLY: qs_dispersion_type + USE qs_force_types, ONLY: qs_force_type + USE message_passing, ONLY: mp_para_env_type +@@ -76,7 +77,8 @@ CONTAINS + TYPE(structure_type) :: mol + TYPE(realspace_cutoff) :: cutoff + +- INTEGER :: iatom, natom, ind_atom ++ LOGICAL :: found ++ INTEGER :: iatom, natom, ind_atom, zatom + INTEGER, ALLOCATABLE, DIMENSION(:) :: el_num + REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: gradient, xyz + REAL(KIND=dp), DIMENSION(3, 3) :: stress +@@ -94,7 +96,9 @@ CONTAINS + DO iatom = 1, natom + xyz(:, iatom) = particle_set(iatom)%r(:) + CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind) +- el_num(iatom) = ikind ++ CALL get_ptable_info(particle_set(iatom)%atomic_kind%element_symbol, & ++ ielement=zatom, found=found) ++ el_num(iatom) = zatom + END DO + + !get information about cell / lattice +@@ -125,7 +129,7 @@ CONTAINS + IF (para_env%num_pe > 1 .AND. para_env%mepos > 0) virial = 0.00_dp + END IF + DO iatom = 1, natom +- ikind = el_num(iatom) ++ CALL get_atomic_kind(particle_set(iatom)%atomic_kind, kind_number=ikind) + ind_atom = atom_of_kind(iatom) + force(ikind)%dispersion(:, ind_atom) = force(ikind)%dispersion(:, ind_atom) + gradient(:, iatom) + END DO +diff --git a/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES b/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES +index 047421204..c817677df 100644 +--- a/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES ++++ b/tests/QS/regtest-dft-vdw-corr-4/TEST_FILES +@@ -3,7 +3,7 @@ + # e.g. 0 means do not compare anything, running is enough + # 1 compares the last total energy in the file + # for details see cp2k/tools/do_regtest +-pbe_dftd4.inp 33 1.0E-14 -0.00141644869634 ++pbe_dftd4.inp 33 1.0E-14 -0.00283102230260 + pbe_dftd4_force.inp 72 1.0E-07 0.00007217 +-pbe_dftd4_stress.inp 31 1.0E-07 -5.16289312880E-03 ++pbe_dftd4_stress.inp 31 1.0E-07 -2.14003785359E-02 + #EOF diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 8e013a39d3c985..e71368a0870dc8 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -362,6 +362,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): # These patches backport 2023.x fixes to previous versions patch("backport_avoid_null_2022.x.patch", when="@2022.1:2022.2 %aocc@:4.0") patch("backport_avoid_null_9.1.patch", when="@9.1 %aocc@:4.0") + patch("cmake-fixes-2023.2.patch", when="@2023.2 build_system=cmake") # Allow compilation with build_type=RelWithDebInfo and build_type=MinSizeRel @@ -369,6 +370,10 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): # The patch applies https://github.com/cp2k/cp2k/pull/3251 to version 2024.1 patch("cmake-relwithdebinfo-2024.1.patch", when="@2024.1 build_system=cmake") + # Bugfix for D4 dispersion correction in CP2K 2024.3 + # https://github.com/cp2k/cp2k/issues/3688 + patch("d4-dispersion-bugfix-2024.3.patch", when="@2024.3") + # Patch for an undefined constant due to incompatible changes in ELPA @when("@9.1:2022.2 +elpa") def patch(self): From 5d9c534018593fdef5db1028c60026d26bf4d65b Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Tue, 24 Sep 2024 15:56:21 +0200 Subject: [PATCH 254/687] podio: add version 1.1, edm4hep: add version 0.99.1 (#46502) * podio: Add tag for 1.1 * edm4hep: Add 0.99.1 tag and update c++ standards * Avoid repetition of cxxstd values * Remove stray assert from developing --- var/spack/repos/builtin/packages/edm4hep/package.py | 8 +++++--- var/spack/repos/builtin/packages/podio/package.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/edm4hep/package.py b/var/spack/repos/builtin/packages/edm4hep/package.py index b795086353535e..ddf72870ebae82 100644 --- a/var/spack/repos/builtin/packages/edm4hep/package.py +++ b/var/spack/repos/builtin/packages/edm4hep/package.py @@ -21,6 +21,7 @@ class Edm4hep(CMakePackage): license("Apache-2.0") version("main", branch="main") + version("0.99.1", sha256="84d990f09dbd0ad2198596c0c51238a4b15391f51febfb15dd3d191dc7aae9f4") version("0.99", sha256="3636e8c14474237029bf1a8be11c53b57ad3ed438fd70a7e9b87c5d08f1f2ea6") version("0.10.5", sha256="003c8e0c8e1d1844592d43d41384f4320586fbfa51d4d728ae0870b9c4f78d81") version( @@ -51,10 +52,10 @@ class Edm4hep(CMakePackage): depends_on("cxx", type="build") # generated - _cxxstd_values = ("17", "20") + _cxxstd_values = (conditional("17", when="@:0.99.0"), conditional("20")) variant( "cxxstd", - default="17", + default="20", values=_cxxstd_values, multi=False, description="Use the specified C++ standard when building.", @@ -69,7 +70,8 @@ class Edm4hep(CMakePackage): depends_on("podio@1:", when="@0.99:") depends_on("podio@0.15:", when="@:0.10.5") for _std in _cxxstd_values: - depends_on("podio cxxstd=" + _std, when="cxxstd=" + _std) + for _v in _std: + depends_on(f"podio cxxstd={_v.value}", when=f"cxxstd={_v.value}") depends_on("py-jinja2", type="build") depends_on("py-pyyaml", type="build") diff --git a/var/spack/repos/builtin/packages/podio/package.py b/var/spack/repos/builtin/packages/podio/package.py index a4c00ce226e560..8b76e75f998187 100644 --- a/var/spack/repos/builtin/packages/podio/package.py +++ b/var/spack/repos/builtin/packages/podio/package.py @@ -20,6 +20,7 @@ class Podio(CMakePackage): tags = ["hep", "key4hep"] version("master", branch="master") + version("1.1", sha256="2cb5040761f3da4383e1f126da25d68e99ecd8398e0ff12e7475a3745a7030a6") version("1.0.1", sha256="915531a2bcf638011bb6cc19715bbc46d846ec8b985555a1afdcd6abc017e21b") version("1.0", sha256="491f335e148708e387e90e955a6150e1fc2e01bf6b4980b65e257ab0619559a9") version("0.99", sha256="c823918a6ec1365d316e0a753feb9d492e28903141dd124a1be06efac7c1877a") From 2d16e1565987d5e8791c456518ded402586c3455 Mon Sep 17 00:00:00 2001 From: Darren Bolduc Date: Tue, 24 Sep 2024 10:05:58 -0400 Subject: [PATCH 255/687] google-cloud-cpp: new package (#46285) --- .../packages/google-cloud-cpp/package.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 var/spack/repos/builtin/packages/google-cloud-cpp/package.py diff --git a/var/spack/repos/builtin/packages/google-cloud-cpp/package.py b/var/spack/repos/builtin/packages/google-cloud-cpp/package.py new file mode 100644 index 00000000000000..7a477505cc94ca --- /dev/null +++ b/var/spack/repos/builtin/packages/google-cloud-cpp/package.py @@ -0,0 +1,48 @@ +# Copyright 2013-2024 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 GoogleCloudCpp(CMakePackage): + """C++ Client Libraries for Google Cloud Platform.""" + + homepage = "https://cloud.google.com/cpp" + url = "https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v2.28.0.tar.gz" + + maintainers("dbolduc") + + license("Apache-2.0", checked_by="dbolduc") + + sanity_check_is_dir = ["lib", "include"] + + version("2.28.0", sha256="1d51910cb4419f6100d8b9df6bccd33477d09f50e378f12b06dae0f137ed7bc6") + + depends_on("abseil-cpp") + depends_on("curl") + depends_on("google-crc32c") + depends_on("grpc") + depends_on("nlohmann-json") + depends_on("protobuf") + + variant("shared", default=False, description="Build shared instead of static libraries") + variant( + "cxxstd", + default="11", + values=("11", "14", "17", "20"), + multi=False, + description="Use the specified C++ standard when building.", + ) + + def cmake_args(self): + args = [ + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), + self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"), + "-DBUILD_TESTING:Bool=OFF", + "-DGOOGLE_CLOUD_CPP_WITH_MOCKS:Bool=OFF", + "-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES:Bool=OFF", + "-DGOOGLE_CLOUD_CPP_ENABLE:String=__ga_libraries__", + ] + return args From 0b575f60a56b25aa0f802d62065b558cf44ea31d Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Tue, 24 Sep 2024 16:07:02 +0200 Subject: [PATCH 256/687] libsodium: add v1.0.20 (#46455) --- var/spack/repos/builtin/packages/libsodium/package.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/libsodium/package.py b/var/spack/repos/builtin/packages/libsodium/package.py index 10ae833ad1fa2e..2b29d2db829a7d 100644 --- a/var/spack/repos/builtin/packages/libsodium/package.py +++ b/var/spack/repos/builtin/packages/libsodium/package.py @@ -22,8 +22,9 @@ class Libsodium(AutotoolsPackage): version("master", branch="master") version("stable", branch="stable") - version("next", branch="next") + version("next", branch="next", deprecated=True) + version("1.0.20", sha256="ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce19") version("1.0.19", sha256="018d79fe0a045cca07331d37bd0cb57b2e838c51bc48fd837a1472e50068bbea") version("1.0.18", sha256="6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1") version("1.0.17", sha256="0cc3dae33e642cc187b5ceb467e0ad0e1b51dcba577de1190e9ffa17766ac2b1") @@ -36,7 +37,10 @@ class Libsodium(AutotoolsPackage): version("1.0.0", sha256="ced1fe3d2066953fea94f307a92f8ae41bf0643739a44309cbe43aa881dbc9a5") version("0.7.1", sha256="ef46bbb5bac263ef6d3fc00ccc11d4690aea83643412919fe15369b9870280a7") - depends_on("c", type="build") # generated + depends_on("c", type="build") + + # https://github.com/jedisct1/libsodium/issues/1372 + conflicts("target=aarch64:", when="@1.0.19") def patch(self): # Necessary on ppc64le / aarch64, because Spack tries to execute these scripts From d5b8b0600aa7938354775805fd951b1f8529eece Mon Sep 17 00:00:00 2001 From: "Kelly (KT) Thompson" Date: Tue, 24 Sep 2024 08:29:16 -0600 Subject: [PATCH 257/687] random123: Add support for HIP/rocm. (#46284) --- .../builtin/packages/random123/package.py | 3 + .../packages/random123/v1140-hip.patch | 296 ++++++++++++++++++ 2 files changed, 299 insertions(+) create mode 100644 var/spack/repos/builtin/packages/random123/v1140-hip.patch diff --git a/var/spack/repos/builtin/packages/random123/package.py b/var/spack/repos/builtin/packages/random123/package.py index efcd5e9b87ca4d..e474f882794619 100644 --- a/var/spack/repos/builtin/packages/random123/package.py +++ b/var/spack/repos/builtin/packages/random123/package.py @@ -16,6 +16,8 @@ class Random123(Package): homepage = "https://www.deshawresearch.com/resources_random123.html" url = "https://github.com/DEShawResearch/random123/archive/refs/tags/v1.14.0.tar.gz" + maintainers("KineticTheory") + version("1.14.0", sha256="effafd8656b18030b2a5b995cd3650c51a7c45052e6e1c21e48b9fa7a59d926e") version( "1.13.2", @@ -39,6 +41,7 @@ class Random123(Package): patch("ibmxl.patch", when="@1.09") patch("arm-gcc.patch", when="@1.09") patch("v1132-xl161.patch", when="@1.13.2") + patch("v1140-hip.patch", when="@1.14.0") def install(self, spec, prefix): # Random123 doesn't have a build system. diff --git a/var/spack/repos/builtin/packages/random123/v1140-hip.patch b/var/spack/repos/builtin/packages/random123/v1140-hip.patch new file mode 100644 index 00000000000000..4e3ef56a12514e --- /dev/null +++ b/var/spack/repos/builtin/packages/random123/v1140-hip.patch @@ -0,0 +1,296 @@ +warning: refname 'v1.14.0' is ambiguous. +diff --git a/include/Random123/array.h b/include/Random123/array.h +index 8076f23..06650ec 100644 +--- a/include/Random123/array.h ++++ b/include/Random123/array.h +@@ -81,7 +81,7 @@ inline R123_CUDA_DEVICE value_type assemble_from_u32(uint32_t *p32){ + + /** @endcond */ + +-#ifdef __CUDA_ARCH__ ++#if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__) + /* CUDA can't handle std::reverse_iterator. We *could* implement it + ourselves, but let's not bother until somebody really feels a need + to reverse-iterate through an r123array */ +@@ -114,8 +114,8 @@ inline R123_CUDA_DEVICE value_type assemble_from_u32(uint32_t *p32){ + enum {static_size = _N}; \ + R123_CUDA_DEVICE reference operator[](size_type i){return v[i];} \ + R123_CUDA_DEVICE const_reference operator[](size_type i) const {return v[i];} \ +- R123_CUDA_DEVICE reference at(size_type i){ if(i >= _N) R123_THROW(std::out_of_range("array index out of range")); return (*this)[i]; } \ +- R123_CUDA_DEVICE const_reference at(size_type i) const { if(i >= _N) R123_THROW(std::out_of_range("array index out of range")); return (*this)[i]; } \ ++ R123_CUDA_DEVICE reference at(size_type i){ if(i >= _N) {R123_THROW(std::out_of_range("array index out of range"));}; return (*this)[i]; } \ ++ R123_CUDA_DEVICE const_reference at(size_type i) const { if(i >= _N) {R123_THROW(std::out_of_range("array index out of range"));}; return (*this)[i]; } \ + R123_CUDA_DEVICE size_type size() const { return _N; } \ + R123_CUDA_DEVICE size_type max_size() const { return _N; } \ + R123_CUDA_DEVICE bool empty() const { return _N==0; }; \ +diff --git a/include/Random123/boxmuller.hpp b/include/Random123/boxmuller.hpp +index 9c91cf8..16d91f9 100644 +--- a/include/Random123/boxmuller.hpp ++++ b/include/Random123/boxmuller.hpp +@@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + // + // r123::float2 r123::boxmuller(uint32_t u0, uint32_t u1); + // r123::double2 r123::boxmuller(uint64_t u0, uint64_t u1); +-// ++// + // float2 and double2 are identical to their synonymous global- + // namespace structures in CUDA. + // +@@ -68,7 +68,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + namespace r123{ + +-#if !defined(__CUDACC__) ++#if !(defined(__CUDACC__) || defined(__HIPCC__)) + typedef struct { float x, y; } float2; + typedef struct { double x, y; } double2; + #else +diff --git a/include/Random123/features/compilerfeatures.h b/include/Random123/features/compilerfeatures.h +index 0606dee..9ad3f82 100644 +--- a/include/Random123/features/compilerfeatures.h ++++ b/include/Random123/features/compilerfeatures.h +@@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + The Random123 library is portable across C, C++, CUDA, OpenCL environments, + and multiple operating systems (Linux, Windows 7, Mac OS X, FreeBSD, Solaris). + This level of portability requires the abstraction of some features +-and idioms that are either not standardized (e.g., asm statments), or for which ++and idioms that are either not standardized (e.g., asm statments), or for which + different vendors have their own standards (e.g., SSE intrinsics) or for + which vendors simply refuse to conform to well-established standards (e.g., ). + +@@ -55,7 +55,7 @@ Most of the symbols are boolean valued. In general, they will + Library users can override any value by defining the pp-symbol with a compiler option, + e.g., + +- cc -DR123_USE_MULHILO64_C99 ++ cc -DR123_USE_MULHILO64_C99 + + will use a strictly c99 version of the full-width 64x64->128-bit multiplication + function, even if it would be disabled by default. +@@ -84,8 +84,8 @@ All boolean-valued pre-processor symbols in Random123/features/compilerfeatures. + CXX11_EXPLICIT_CONVERSIONS + CXX11_LONG_LONG + CXX11_STD_ARRAY +- CXX11 +- ++ CXX11 ++ + X86INTRIN_H + IA32INTRIN_H + XMMINTRIN_H +@@ -102,7 +102,7 @@ All boolean-valued pre-processor symbols in Random123/features/compilerfeatures. + MULHILO64_C99 + + U01_DOUBLE +- ++ + @endverbatim + Most have obvious meanings. Some non-obvious ones: + +@@ -141,11 +141,11 @@ There are also non-boolean valued symbols: +