From de8c827983556f77899adad46a2c7dd46388883b Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 11 Oct 2022 19:28:27 +0200 Subject: Refactor a few classes related to package repositories (#32273) Caches used by repositories don't reference the global spack.repo.path instance anymore, but get the repository they refer to during initialization. Spec.virtual now use the index, and computation done to compute the index use Repository.is_virtual_safe. Code to construct mock packages and mock repository has been factored into a unique MockRepositoryBuilder that is used throughout the codebase. Add debug print for pushing and popping config scopes. Changed spack.repo.use_repositories so that it can override or not previous repos spack.repo.use_repositories updates spack.config.config according to the modifications done Removed a peculiar behavior from spack.config.Configuration where push would always bubble-up a scope named command_line if it existed --- share/spack/templates/misc/coconcretization.pyt | 15 --------------- share/spack/templates/mock-repository/package.pyt | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 share/spack/templates/misc/coconcretization.pyt create mode 100644 share/spack/templates/mock-repository/package.pyt (limited to 'share') diff --git a/share/spack/templates/misc/coconcretization.pyt b/share/spack/templates/misc/coconcretization.pyt deleted file mode 100644 index cd313216d9..0000000000 --- a/share/spack/templates/misc/coconcretization.pyt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -class Concretizationroot(Package): - url = 'fake_url' - - version('1.0') - -{% for dep in specs %} - depends_on('{{ dep }}') -{% endfor %} - diff --git a/share/spack/templates/mock-repository/package.pyt b/share/spack/templates/mock-repository/package.pyt new file mode 100644 index 0000000000..82bd50bd05 --- /dev/null +++ b/share/spack/templates/mock-repository/package.pyt @@ -0,0 +1,19 @@ +class {{ cls_name }}(Package): + homepage = "http://www.example.com" + url = "http://www.example.com/root-1.0.tar.gz" + + version("3.0", sha256='abcde') + version("2.0", sha256='abcde') + version("1.0", sha256='abcde') + +{% for dep_spec, dep_type, condition in dependencies %} +{% if dep_type and condition %} + depends_on("{{ dep_spec }}", type="{{ dep_type }}", when="{{ condition }}") +{% elif dep_type %} + depends_on("{{ dep_spec }}", type="{{ dep_type }}") +{% elif condition %} + depends_on("{{ dep_spec }}", when="{{ condition }}") +{% else %} + depends_on("{{ dep_spec }}") +{% endif %} +{% endfor %} \ No newline at end of file -- cgit v1.2.3-70-g09d2