spack/var/spack/repos/builtin/packages/ratel/package.py
Harmen Stoppels eef9939c21
Automated git version fixes (#39637)
Use full length commit sha instead of short prefixes, to improve
reproducibility (future clashes) and guard against compromised repos and
man in the middle attacks.

Abbreviated commit shas are expanded to full length, to guard against future
clashes on short hash. It also guards against compromised repos and
man in the middle attacks, where attackers can easily fabricate a malicious
commit with a shasum prefix collision.

Versions with just tags now also get a commit sha, which can later be used to
check for retagged commits.
2023-08-29 16:33:03 +02:00

76 lines
2.6 KiB
Python

# Copyright 2013-2023 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 Ratel(MakefilePackage, CudaPackage, ROCmPackage):
"""Extensible, performance-portable solid mechanics with libCEED and PETSc"""
homepage = "https://ratel.micromorph.org"
git = "https://gitlab.com/micromorph/ratel.git"
maintainers("jedbrown", "jeremylt")
version("develop", branch="main")
version("0.2.1", tag="v0.2.1", commit="043b61696a2407205fdfd898681467d1a7ff59e0")
version("0.1.2", tag="v0.1.2", commit="94ad630bf897d231af7a94bf08257f6067258aae")
# development version
depends_on("libceed@develop", when="@develop")
depends_on("petsc@main", when="@develop")
# released versions
depends_on("libceed@0.11.0:0.11", when="@0.2.1")
depends_on("petsc@3.18.3:3.18", when="@0.2.1")
depends_on("libceed@0.10.1:0.10", when="@0.1.2")
depends_on("petsc@3.17:3.17", when="@0.1.2")
# Note: '+cuda' and 'cuda_arch' variants are added by the CudaPackage
# '+rocm' and 'amdgpu_target' variants are added by the ROCmPackage
# But we need to sync cuda/rocm with libCEED and PETSc
for sm_ in CudaPackage.cuda_arch_values:
depends_on(
"libceed+cuda cuda_arch={0}".format(sm_), when="+cuda cuda_arch={0}".format(sm_)
)
depends_on("petsc+cuda cuda_arch={0}".format(sm_), when="+cuda cuda_arch={0}".format(sm_))
for gfx in ROCmPackage.amdgpu_targets:
depends_on(
"libceed+rocm amdgpu_target={0}".format(gfx),
when="+rocm amdgpu_target={0}".format(gfx),
)
depends_on(
"petsc+rocm amdgpu_target={0}".format(gfx), when="+rocm amdgpu_target={0}".format(gfx)
)
# Kokkos required for AMD GPUs
depends_on("petsc+kokkos", when="+rocm")
@property
def common_make_opts(self):
spec = self.spec
# verbose build and test
make_options = ["V=1", "PROVE_OPTS=-v"]
# libCEED and PETSc dirs
make_options += [
"CEED_DIR=%s" % spec["libceed"].prefix,
"PETSC_DIR=%s" % spec["petsc"].prefix,
]
return make_options
def edit(self, spec, prefix):
make("info", *self.common_make_opts)
@property
def build_targets(self):
return self.common_make_opts
@property
def install_targets(self):
return ["install", "prefix={0}".format(self.prefix)] + self.common_make_opts
def check(self):
make("prove", *self.common_make_opts, parallel=False)