From 8fdd8fcf63aa74a1c4ba107e48d982225cafe9b2 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Mon, 10 Jul 2023 12:01:20 -0500 Subject: Perl package: detect opcode support in externals (#38618) Spack-installed Perl always has opcode support, but external Perl installations might not. This commit adds a +opcode variant and updates the external detection logic to check for opcode support. The postgresql package is updated to require perl+opcode (in combination with the above, this helps detect when an external Perl instance is sufficient for a Spack build of postgreqsql, or if Spack needs to build its own Perl). --- var/spack/repos/builtin/packages/perl/package.py | 5 +++++ var/spack/repos/builtin/packages/postgresql/package.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py index 599504b77a..4971033896 100644 --- a/var/spack/repos/builtin/packages/perl/package.py +++ b/var/spack/repos/builtin/packages/perl/package.py @@ -179,6 +179,7 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package variant("shared", default=True, description="Build a shared libperl.so library") variant("threads", default=True, description="Build perl with threads support") variant("open", default=True, description="Support open.pm") + variant("opcode", default=True, description="Support Opcode.pm") resource( name="cpanm", @@ -241,6 +242,10 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package fail_on_error=False, ) variants += "+open" if perl.returncode == 0 else "~open" + # this is just to detect incomplete installs + # normally perl installs Opcode.pm + perl("-e", "use Opcode", output=os.devnull, error=os.devnull, fail_on_error=False) + variants += "+opcode" if perl.returncode == 0 else "~opcode" return variants # On a lustre filesystem, patch may fail when files diff --git a/var/spack/repos/builtin/packages/postgresql/package.py b/var/spack/repos/builtin/packages/postgresql/package.py index ed13a9dea8..f1e904c560 100644 --- a/var/spack/repos/builtin/packages/postgresql/package.py +++ b/var/spack/repos/builtin/packages/postgresql/package.py @@ -57,7 +57,7 @@ class Postgresql(AutotoolsPackage): depends_on("libedit", when="lineedit=libedit") depends_on("openssl") depends_on("tcl", when="+tcl") - depends_on("perl", when="+perl") + depends_on("perl+opcode", when="+perl") depends_on("python", when="+python") depends_on("libxml2", when="+xml") -- cgit v1.2.3-70-g09d2