diff options
author | Jordan Galby <67924449+Jordan474@users.noreply.github.com> | 2022-11-08 03:58:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-08 02:58:19 +0000 |
commit | 84a3d32aa36f8af902ef67a58ce1944050bd7e1d (patch) | |
tree | 6760a6f841fe623fb022501d69de32f9b7036ddf /var | |
parent | 69d4637671f50d1224de02aa278ab721a438c98f (diff) | |
download | spack-84a3d32aa36f8af902ef67a58ce1944050bd7e1d.tar.gz spack-84a3d32aa36f8af902ef67a58ce1944050bd7e1d.tar.bz2 spack-84a3d32aa36f8af902ef67a58ce1944050bd7e1d.tar.xz spack-84a3d32aa36f8af902ef67a58ce1944050bd7e1d.zip |
Fix missing "*.spack*" files in views (#30980)
All files/dirs containing ".spack" anywhere their name were ignored when
generating a spack view.
For example, this happened with the 'r' package.
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin.mock/packages/view-not-ignored/package.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/view-not-ignored/package.py b/var/spack/repos/builtin.mock/packages/view-not-ignored/package.py new file mode 100644 index 0000000000..3342de9899 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/view-not-ignored/package.py @@ -0,0 +1,46 @@ +# 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) + +import os.path + +from spack.package import * + + +class ViewNotIgnored(Package): + """Install files that should not be ignored by spack.""" + + homepage = "http://www.spack.org" + url = "http://www.spack.org/downloads/aml-1.0.tar.gz" + has_code = False + + version("0.1.0", sha256="cc89a8768693f1f11539378b21cdca9f0ce3fc5cb564f9b3e4154a051dcea69b") + + install_test_files = [ + "foo.spack", + ".spack.bar", + "aspack", + "bin/foo.spack", + "bin/.spack.bar", + "bin/aspack", + ] + + def install(self, spec, prefix): + for test_file in self.install_test_files: + path = os.path.join(prefix, test_file) + mkdirp(os.path.dirname(path)) + with open(path, "w") as f: + f.write(test_file) + + @classmethod + def assert_installed(cls, prefix): + for test_file in cls.install_test_files: + path = os.path.join(prefix, test_file) + assert os.path.exists(path), "Missing installed file: {}".format(path) + + @classmethod + def assert_not_installed(cls, prefix): + for test_file in cls.install_test_files: + path = os.path.join(prefix, test_file) + assert not os.path.exists(path), "File was not uninstalled: {}".format(path) |