openssl: introduce ~docs to make installation smaller (#21962)

This commit is contained in:
Harmen Stoppels 2021-03-02 14:58:59 +01:00 committed by GitHub
parent eeff906ccc
commit dc5022a9d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,7 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package
version('1.0.1e', sha256='f74f15e8c8ff11aa3d5bb5f276d202ec18d7246e95f961db76054199c69c1ae3', deprecated=True) version('1.0.1e', sha256='f74f15e8c8ff11aa3d5bb5f276d202ec18d7246e95f961db76054199c69c1ae3', deprecated=True)
variant('systemcerts', default=True, description='Use system certificates') variant('systemcerts', default=True, description='Use system certificates')
variant('docs', default=False, description='Install docs and manpages')
depends_on('zlib') depends_on('zlib')
@ -137,8 +138,10 @@ def install(self, spec, prefix):
if self.run_tests: if self.run_tests:
make('test', parallel=False) # 'VERBOSE=1' make('test', parallel=False) # 'VERBOSE=1'
install_tgt = 'install' if self.spec.satisfies('+docs') else 'install_sw'
# See https://github.com/openssl/openssl/issues/7466#issuecomment-432148137 # See https://github.com/openssl/openssl/issues/7466#issuecomment-432148137
make('install', parallel=False) make(install_tgt, parallel=False)
@run_after('install') @run_after('install')
def link_system_certs(self): def link_system_certs(self):
@ -156,6 +159,8 @@ def link_system_certs(self):
pkg_dir = join_path(self.prefix, 'etc', 'openssl') pkg_dir = join_path(self.prefix, 'etc', 'openssl')
mkdirp(pkg_dir)
for directory in system_dirs: for directory in system_dirs:
sys_cert = join_path(directory, 'cert.pem') sys_cert = join_path(directory, 'cert.pem')
pkg_cert = join_path(pkg_dir, 'cert.pem') pkg_cert = join_path(pkg_dir, 'cert.pem')
@ -170,7 +175,8 @@ def link_system_certs(self):
# We symlink the whole directory instead of all files because # We symlink the whole directory instead of all files because
# the directory contents might change without Spack noticing. # the directory contents might change without Spack noticing.
if os.path.isdir(sys_certs) and not os.path.islink(pkg_certs): if os.path.isdir(sys_certs) and not os.path.islink(pkg_certs):
os.rmdir(pkg_certs) if os.path.isdir(pkg_certs):
os.rmdir(pkg_certs)
os.symlink(sys_certs, pkg_certs) os.symlink(sys_certs, pkg_certs)
def patch(self): def patch(self):