From 383a343412216ad4f470da9bf1b6b96529cd1060 Mon Sep 17 00:00:00 2001 From: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:51:01 -0800 Subject: GenericBuilder: facilitate post-install phase test callbacks (#35314) --- lib/spack/spack/build_systems/generic.py | 13 +++++++++++-- var/spack/repos/builtin/packages/oommf/package.py | 10 +++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/spack/spack/build_systems/generic.py b/lib/spack/spack/build_systems/generic.py index 6d94998741..1db40d9124 100644 --- a/lib/spack/spack/build_systems/generic.py +++ b/lib/spack/spack/build_systems/generic.py @@ -8,7 +8,7 @@ import spack.builder import spack.directives import spack.package_base -from ._checks import BaseBuilder, apply_macos_rpath_fixups +from ._checks import BaseBuilder, apply_macos_rpath_fixups, execute_install_time_tests class Package(spack.package_base.PackageBase): @@ -38,7 +38,16 @@ class GenericBuilder(BaseBuilder): legacy_methods: Tuple[str, ...] = () #: Names associated with package attributes in the old build-system format - legacy_attributes: Tuple[str, ...] = ("archive_files",) + legacy_attributes: Tuple[str, ...] = ( + "archive_files", + "install_time_test_callbacks", + ) + + #: Callback names for post-install phase tests + install_time_test_callbacks = [] # On macOS, force rpaths for shared library IDs and remove duplicate rpaths spack.builder.run_after("install", when="platform=darwin")(apply_macos_rpath_fixups) + + # unconditionally perform any post-install phase tests + spack.builder.run_after("install")(execute_install_time_tests) diff --git a/var/spack/repos/builtin/packages/oommf/package.py b/var/spack/repos/builtin/packages/oommf/package.py index 4913d51428..84711d37dd 100644 --- a/var/spack/repos/builtin/packages/oommf/package.py +++ b/var/spack/repos/builtin/packages/oommf/package.py @@ -39,6 +39,13 @@ class Oommf(Package): # default URL for versions url = "https://github.com/fangohr/oommf/archive/refs/tags/20a1_20180930_ext.tar.gz" + #: post-install phase methods used to check the installation + install_time_test_callbacks = [ + "check_install_version", + "check_install_platform", + "check_install_stdprob3", + ] + maintainers("fangohr") version( @@ -220,15 +227,12 @@ class Oommf(Package): print("output received from oommf is %s" % output) - @run_after("install") def check_install_version(self): self._check_install_oommf_command(["+version"]) - @run_after("install") def check_install_platform(self): self._check_install_oommf_command(["+platform"]) - @run_after("install") def check_install_stdprob3(self): oommf_examples = join_path(self.spec.prefix.usr.bin, "oommf/app/oxs/examples") task = join_path(oommf_examples, "stdprob3.mif") -- cgit v1.2.3-70-g09d2