berkeley-db: Add minimal external detection (#27752)

This commit is contained in:
Tamara Dahlgren 2021-12-03 14:42:45 -08:00 committed by GitHub
parent 324e046f06
commit 6f9dc1c926
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
class BerkeleyDb(AutotoolsPackage):
@ -11,6 +12,8 @@ class BerkeleyDb(AutotoolsPackage):
# URL must remain http:// so Spack can bootstrap curl
url = "https://download.oracle.com/berkeley-db/db-18.1.40.tar.gz"
executables = [r'^db_load$'] # One should be sufficient
version("18.1.40", sha256="0cecb2ef0c67b166de93732769abdeba0555086d51de1090df325e18ee8da9c8")
version('18.1.32', sha256='fa1fe7de9ba91ad472c25d026f931802597c29f28ae951960685cde487c8d654', deprecated=True)
version('6.2.32', sha256='a9c5e2b004a5777aa03510cfe5cd766a4a3b777713406b02809c17c8e0e7a8fb')
@ -32,6 +35,18 @@ class BerkeleyDb(AutotoolsPackage):
conflicts('+stl', when='~cxx', msg='+stl implies +cxx')
@classmethod
def determine_version(cls, exe):
"""Return the version of the provided executable or ``None`` if
the version cannot be determined.
Arguments:
exe (str): absolute path to the executable being examined
"""
output = Executable(exe)('-V', output=str, error=str)
match = re.search(r'Berkeley DB\s+([\d\.]+)', output)
return match.group(1) if match else None
def patch(self):
# some of the docs are missing in 18.1.40
if self.spec.satisfies("@18.1.40"):