diff options
Diffstat (limited to 'var/spack/repos/builtin.mock')
16 files changed, 105 insertions, 50 deletions
diff --git a/var/spack/repos/builtin.mock/packages/a/package.py b/var/spack/repos/builtin.mock/packages/a/package.py index b556fbf06f..5dbcd1f9c2 100644 --- a/var/spack/repos/builtin.mock/packages/a/package.py +++ b/var/spack/repos/builtin.mock/packages/a/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) - +import spack.build_systems.autotools from spack.package import * @@ -32,21 +32,23 @@ class A(AutotoolsPackage): parallel = False + +class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): def with_or_without_fee(self, activated): if not activated: return "--no-fee" return "--fee-all-the-time" - def autoreconf(self, spec, prefix): + def autoreconf(self, pkg, spec, prefix): pass - def configure(self, spec, prefix): + def configure(self, pkg, spec, prefix): pass - def build(self, spec, prefix): + def build(self, pkg, spec, prefix): pass - def install(self, spec, prefix): + def install(self, pkg, spec, prefix): # sanity_check_prefix requires something in the install directory # Test requires overriding the one provided by `AutotoolsPackage` mkdirp(prefix.bin) diff --git a/var/spack/repos/builtin.mock/packages/attributes-foo/package.py b/var/spack/repos/builtin.mock/packages/attributes-foo/package.py index 9010c52958..83b41b98ac 100644 --- a/var/spack/repos/builtin.mock/packages/attributes-foo/package.py +++ b/var/spack/repos/builtin.mock/packages/attributes-foo/package.py @@ -8,7 +8,6 @@ from spack.package import * class AttributesFoo(BundlePackage): - phases = ["install"] version("1.0") provides("bar") diff --git a/var/spack/repos/builtin.mock/packages/canfail/package.py b/var/spack/repos/builtin.mock/packages/canfail/package.py index eb35fdec56..75bb66df25 100644 --- a/var/spack/repos/builtin.mock/packages/canfail/package.py +++ b/var/spack/repos/builtin.mock/packages/canfail/package.py @@ -2,6 +2,7 @@ # 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 * @@ -14,7 +15,16 @@ class Canfail(Package): version("1.0", "0123456789abcdef0123456789abcdef") - succeed = False + def set_install_succeed(self): + os.environ["CANFAIL_SUCCEED"] = "1" + + def set_install_fail(self): + os.environ.pop("CANFAIL_SUCCEED", None) + + @property + def succeed(self): + result = True if "CANFAIL_SUCCEED" in os.environ else False + return result def install(self, spec, prefix): if not self.succeed: diff --git a/var/spack/repos/builtin.mock/packages/cmake-client/package.py b/var/spack/repos/builtin.mock/packages/cmake-client/package.py index 54842fd2d8..ed3998e550 100644 --- a/var/spack/repos/builtin.mock/packages/cmake-client/package.py +++ b/var/spack/repos/builtin.mock/packages/cmake-client/package.py @@ -15,7 +15,7 @@ def check(condition, msg): class CmakeClient(CMakePackage): - """A dumy package that uses cmake.""" + """A dummy package that uses cmake.""" homepage = "https://www.example.com" url = "https://www.example.com/cmake-client-1.0.tar.gz" @@ -38,14 +38,16 @@ class CmakeClient(CMakePackage): did_something = False @run_after("cmake") - @run_before("cmake", "build", "install") + @run_before("cmake") + @run_before("build") + @run_before("install") def increment(self): - self.callback_counter += 1 + CmakeClient.callback_counter += 1 @run_after("cmake") @on_package_attributes(run_this=True, check_this_is_none=None) def flip(self): - self.flipped = True + CmakeClient.flipped = True @run_after("cmake") @on_package_attributes(does_not_exist=None) diff --git a/var/spack/repos/builtin.mock/packages/cmake/package.py b/var/spack/repos/builtin.mock/packages/cmake/package.py index 30c3647df2..dac2c19875 100644 --- a/var/spack/repos/builtin.mock/packages/cmake/package.py +++ b/var/spack/repos/builtin.mock/packages/cmake/package.py @@ -18,12 +18,17 @@ def check(condition, msg): class Cmake(Package): - """A dumy package for the cmake build system.""" + """A dummy package for the cmake build system.""" homepage = "https://www.cmake.org" url = "https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz" version( + "3.23.1", + "4cb3ff35b2472aae70f542116d616e63", + url="https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz", + ) + version( "3.4.3", "4cb3ff35b2472aae70f542116d616e63", url="https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz", diff --git a/var/spack/repos/builtin.mock/packages/dev-build-test-dependent/package.py b/var/spack/repos/builtin.mock/packages/dev-build-test-dependent/package.py index 44374cd1a7..a5ac04d282 100644 --- a/var/spack/repos/builtin.mock/packages/dev-build-test-dependent/package.py +++ b/var/spack/repos/builtin.mock/packages/dev-build-test-dependent/package.py @@ -7,14 +7,12 @@ from spack.package import * -class DevBuildTestDependent(Package): +class DevBuildTestDependent(MakefilePackage): homepage = "example.com" url = "fake.com" version("0.0.0", sha256="0123456789abcdef0123456789abcdef") - phases = ["edit", "install"] - filename = "dev-build-test-file.txt" original_string = "This file should be edited" replacement_string = "This file has been edited" @@ -28,5 +26,8 @@ class DevBuildTestDependent(Package): f.truncate() f.write(self.replacement_string) + def build(self, spec, prefix): + pass + def install(self, spec, prefix): install(self.filename, prefix) diff --git a/var/spack/repos/builtin.mock/packages/dev-build-test-install-phases/package.py b/var/spack/repos/builtin.mock/packages/dev-build-test-install-phases/package.py index fa0f6b794e..916156c1f5 100644 --- a/var/spack/repos/builtin.mock/packages/dev-build-test-install-phases/package.py +++ b/var/spack/repos/builtin.mock/packages/dev-build-test-install-phases/package.py @@ -29,4 +29,5 @@ class DevBuildTestInstallPhases(Package): print("Three locomoco") def install(self, spec, prefix): + mkdirp(prefix.bin) print("install") diff --git a/var/spack/repos/builtin.mock/packages/dev-build-test-install/package.py b/var/spack/repos/builtin.mock/packages/dev-build-test-install/package.py index 185fe5552c..ba0b1400a3 100644 --- a/var/spack/repos/builtin.mock/packages/dev-build-test-install/package.py +++ b/var/spack/repos/builtin.mock/packages/dev-build-test-install/package.py @@ -2,19 +2,15 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - - from spack.package import * -class DevBuildTestInstall(Package): +class DevBuildTestInstall(MakefilePackage): homepage = "example.com" url = "fake.com" version("0.0.0", sha256="0123456789abcdef0123456789abcdef") - phases = ["edit", "install"] - filename = "dev-build-test-file.txt" original_string = "This file should be edited" replacement_string = "This file has been edited" @@ -26,5 +22,8 @@ class DevBuildTestInstall(Package): f.truncate() f.write(self.replacement_string) + def build(self, spec, prefix): + pass + def install(self, spec, prefix): install(self.filename, prefix) diff --git a/var/spack/repos/builtin.mock/packages/fail-test-audit/package.py b/var/spack/repos/builtin.mock/packages/fail-test-audit/package.py new file mode 100644 index 0000000000..1e290724d1 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/fail-test-audit/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack.package import * + + +class FailTestAudit(MakefilePackage): + """Simple package with one optional dependency""" + + homepage = "http://www.example.com" + url = "http://www.example.com/a-1.0.tar.gz" + + version("1.0", "0123456789abcdef0123456789abcdef") + version("2.0", "abcdef0123456789abcdef0123456789") + + build_time_test_callbacks = ["test"] + + def test(self): + print("test: test-install-callbacks") + print("PASSED") diff --git a/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py b/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py index a169a78d2e..8ab87d2064 100644 --- a/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py +++ b/var/spack/repos/builtin.mock/packages/libtool-deletion/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os.path +import spack.build_systems.autotools from spack.package import * @@ -19,17 +20,21 @@ class LibtoolDeletion(AutotoolsPackage): def do_stage(self): mkdirp(self.stage.source_path) - def autoreconf(self, spec, prefix): + +class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): + install_libtool_archives = False + + def autoreconf(self, pkg, spec, prefix): mkdirp(os.path.dirname(self.configure_abs_path)) touch(self.configure_abs_path) - def configure(self, spec, prefix): + def configure(self, pkg, spec, prefix): pass - def build(self, spec, prefix): + def build(self, pkg, spec, prefix): pass - def install(self, spec, prefix): + def install(self, pkg, spec, prefix): mkdirp(os.path.dirname(self.libtool_archive_file)) touch(self.libtool_archive_file) diff --git a/var/spack/repos/builtin.mock/packages/libtool-installation/package.py b/var/spack/repos/builtin.mock/packages/libtool-installation/package.py new file mode 100644 index 0000000000..72883b9042 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/libtool-installation/package.py @@ -0,0 +1,15 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +from spack.package import * +from spack.pkg.builtin.mock.libtool_deletion import AutotoolsBuilder as BuilderBase +from spack.pkg.builtin.mock.libtool_deletion import LibtoolDeletion + + +class LibtoolInstallation(LibtoolDeletion, AutotoolsPackage): + """Mock AutotoolsPackage to check proper installation of libtool archives.""" + + +class AutotoolsBuilder(BuilderBase): + install_libtool_archives = True diff --git a/var/spack/repos/builtin.mock/packages/nosource-install/package.py b/var/spack/repos/builtin.mock/packages/nosource-install/package.py index a1ca724448..5166480dd4 100644 --- a/var/spack/repos/builtin.mock/packages/nosource-install/package.py +++ b/var/spack/repos/builtin.mock/packages/nosource-install/package.py @@ -16,9 +16,6 @@ class NosourceInstall(BundlePackage): depends_on("dependency-install") - # The install phase must be specified. - phases = ["install"] - # The install method must also be present. def install(self, spec, prefix): touch(join_path(self.prefix, "install.txt")) diff --git a/var/spack/repos/builtin.mock/packages/test-build-callbacks/package.py b/var/spack/repos/builtin.mock/packages/test-build-callbacks/package.py index 4b4b74e9b3..d45f0d295b 100644 --- a/var/spack/repos/builtin.mock/packages/test-build-callbacks/package.py +++ b/var/spack/repos/builtin.mock/packages/test-build-callbacks/package.py @@ -2,9 +2,9 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - +import spack.build_systems._checks as checks +import spack.build_systems.generic from spack.package import * -from spack.package_base import run_after class TestBuildCallbacks(Package): @@ -15,17 +15,16 @@ class TestBuildCallbacks(Package): version("1.0", "0123456789abcdef0123456789abcdef") + +class GenericBuilder(spack.build_systems.generic.GenericBuilder): phases = ["build", "install"] - # Include undefined method (runtime failure) and 'test' (audit failure) - build_time_test_callbacks = ["undefined-build-test", "test"] - run_after("build")(Package._run_default_build_time_test_callbacks) - def build(self, spec, prefix): + # Include undefined method (runtime failure) + build_time_test_callbacks = ["undefined-build-test"] + run_after("build")(checks.execute_build_time_tests) + + def build(self, pkg, spec, prefix): pass - def install(self, spec, prefix): + def install(self, pkg, spec, prefix): mkdirp(prefix.bin) - - def test(self): - print("test: running test-build-callbacks") - print("PASSED") diff --git a/var/spack/repos/builtin.mock/packages/test-install-callbacks/package.py b/var/spack/repos/builtin.mock/packages/test-install-callbacks/package.py index 27a31227c3..0d348c0d67 100644 --- a/var/spack/repos/builtin.mock/packages/test-install-callbacks/package.py +++ b/var/spack/repos/builtin.mock/packages/test-install-callbacks/package.py @@ -2,9 +2,9 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - +import spack.build_systems._checks as checks +import spack.build_systems.generic from spack.package import * -from spack.package_base import run_after class TestInstallCallbacks(Package): @@ -15,13 +15,11 @@ class TestInstallCallbacks(Package): version("1.0", "0123456789abcdef0123456789abcdef") + +class GenericBuilder(spack.build_systems.generic.GenericBuilder): # Include an undefined callback method - install_time_test_callbacks = ["undefined-install-test", "test"] - run_after("install")(Package._run_default_install_time_test_callbacks) + install_time_test_callbacks = ["undefined-install-test"] + run_after("install")(checks.execute_install_time_tests) - def install(self, spec, prefix): + def install(self, pkg, spec, prefix): mkdirp(prefix.bin) - - def test(self): - print("test: test-install-callbacks") - print("PASSED") diff --git a/var/spack/repos/builtin.mock/packages/transitive-conditional-virtual-dependency/package.py b/var/spack/repos/builtin.mock/packages/transitive-conditional-virtual-dependency/package.py index a7c4658810..9078d63b4d 100644 --- a/var/spack/repos/builtin.mock/packages/transitive-conditional-virtual-dependency/package.py +++ b/var/spack/repos/builtin.mock/packages/transitive-conditional-virtual-dependency/package.py @@ -5,12 +5,10 @@ from spack.package import * -class TransitiveConditionalVirtualDependency(Package): +class TransitiveConditionalVirtualDependency(BundlePackage): """Depends on a package with a conditional virtual dependency.""" homepage = "https://dev.null" - has_code = False - phases = [] version("1.0") depends_on("conditional-virtual-dependency") diff --git a/var/spack/repos/builtin.mock/packages/trivial-smoke-test/package.py b/var/spack/repos/builtin.mock/packages/trivial-smoke-test/package.py index ec80640d21..35983a18f4 100644 --- a/var/spack/repos/builtin.mock/packages/trivial-smoke-test/package.py +++ b/var/spack/repos/builtin.mock/packages/trivial-smoke-test/package.py @@ -16,6 +16,9 @@ class TrivialSmokeTest(Package): test_source_filename = "cached_file.in" + def install(self, spec, prefix): + pass + @run_before("install") def create_extra_test_source(self): mkdirp(self.install_test_root) |