summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorGregory Lee <lee218@llnl.gov>2024-10-25 11:45:14 -0700
committerGitHub <noreply@github.com>2024-10-25 12:45:14 -0600
commita2a3a83a26efe8111ab1a33f882f5dacd1199161 (patch)
treec8354a786189d556b3ce7754cfb4427a9093c27d /var
parent7d86670826cb0e0b17e37207ecb2fb2ae4e62327 (diff)
downloadspack-a2a3a83a26efe8111ab1a33f882f5dacd1199161.tar.gz
spack-a2a3a83a26efe8111ab1a33f882f5dacd1199161.tar.bz2
spack-a2a3a83a26efe8111ab1a33f882f5dacd1199161.tar.xz
spack-a2a3a83a26efe8111ab1a33f882f5dacd1199161.zip
Packages/javacerts (#47201)
* new openjdk variant to symlink system certificate * new openjdk variant to symlink system certificate * new openjdk variant to symlink system certificate * new openjdk variant to symlink system certificate * Update var/spack/repos/builtin/packages/openjdk/package.py Co-authored-by: Alec Scott <hi@alecbcs.com> --------- Co-authored-by: Alec Scott <hi@alecbcs.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/openjdk/package.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/openjdk/package.py b/var/spack/repos/builtin/packages/openjdk/package.py
index a884eaddbb..bcaec85a86 100644
--- a/var/spack/repos/builtin/packages/openjdk/package.py
+++ b/var/spack/repos/builtin/packages/openjdk/package.py
@@ -406,6 +406,14 @@ class Openjdk(Package):
version(ver, sha256=pkg[0], url=pkg[1], preferred=is_preferred)
+ variant(
+ "certs",
+ default="none",
+ values=("system", "none"),
+ multi=False,
+ description=("symlink system certs if requested, otherwise use default package version"),
+ )
+
provides("java@21", when="@21.0:21")
provides("java@17", when="@17.0:17")
provides("java@16", when="@16.0:16")
@@ -479,6 +487,37 @@ class Openjdk(Package):
top_dir = "Contents/Home/" if platform.system() == "Darwin" else "."
install_tree(top_dir, prefix)
+ @run_after("install")
+ def link_system_certs(self):
+ if self.spec.variants["certs"].value != "system":
+ return
+
+ system_dirs = [
+ # CentOS, Fedora, RHEL
+ "/etc/pki/java",
+ # Ubuntu
+ "/etc/ssl/certs/java",
+ # OpenSUSE
+ "/var/lib/ca-certificates/java-certs",
+ ]
+
+ for directory in system_dirs:
+ # Link configuration file
+ sys_certs = join_path(directory, "cacerts")
+
+ # path for 1.8.0 versions
+ pkg_dir = join_path(self.prefix, "jre", "lib", "security")
+ if not os.path.exists(pkg_dir):
+ # path for version 11 and newer
+ pkg_dir = join_path(self.prefix, "lib", "security")
+ if not os.path.exists(pkg_dir):
+ break
+ pkg_conf = join_path(pkg_dir, "cacerts")
+ if os.path.exists(sys_certs):
+ if os.path.exists(pkg_conf):
+ os.remove(pkg_conf)
+ os.symlink(sys_certs, pkg_conf)
+
def setup_run_environment(self, env):
"""Set JAVA_HOME."""