diff --git a/var/spack/repos/builtin/packages/berkeley-db/package.py b/var/spack/repos/builtin/packages/berkeley-db/package.py index 0e5fbdbbf1..a31e9f6dfd 100644 --- a/var/spack/repos/builtin/packages/berkeley-db/package.py +++ b/var/spack/repos/builtin/packages/berkeley-db/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 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"):