From e47a6059a711611532dc81a96411b5ca0a918b93 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 28 Jan 2025 00:34:34 +0100 Subject: [PATCH] Improve definition of a few placeholder packages (#48730) * Improve definition of a few placeholder packages These packages are placeholders for vendor provided software, that is not buildable, and should be declared as external. * ibm-java: remove package, as asked by maintainer --- etc/spack/defaults/packages.yaml | 14 ++- .../builtin/packages/apple-clang/package.py | 2 + .../packages/apple-libunwind/package.py | 41 +------ .../builtin/packages/apple-libuuid/package.py | 3 +- .../builtin/packages/fujitsu-fftw/package.py | 12 +- .../builtin/packages/ibm-java/package.py | 114 ------------------ .../repos/builtin/packages/wgl/package.py | 3 +- 7 files changed, 23 insertions(+), 166 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/ibm-java/package.py diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index dda4b83eab2..0fcb8f08d7f 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -36,7 +36,7 @@ packages: go-or-gccgo-bootstrap: [go-bootstrap, gcc] iconv: [libiconv] ipp: [intel-oneapi-ipp] - java: [openjdk, jdk, ibm-java] + java: [openjdk, jdk] jpeg: [libjpeg-turbo, libjpeg] lapack: [openblas, amdlibflame] libc: [glibc, musl] @@ -73,15 +73,27 @@ packages: permissions: read: world write: user + cray-fftw: + buildable: false + cray-libsci: + buildable: false cray-mpich: buildable: false cray-mvapich2: buildable: false + cray-pmi: + buildable: false egl: buildable: false + essl: + buildable: false fujitsu-mpi: buildable: false + fujitsu-ssl2: + buildable: false hpcx-mpi: buildable: false + mpt: + buildable: false spectrum-mpi: buildable: false diff --git a/var/spack/repos/builtin/packages/apple-clang/package.py b/var/spack/repos/builtin/packages/apple-clang/package.py index 491d8d4574d..a4636a9ee0e 100644 --- a/var/spack/repos/builtin/packages/apple-clang/package.py +++ b/var/spack/repos/builtin/packages/apple-clang/package.py @@ -16,6 +16,8 @@ class AppleClang(BundlePackage, LlvmDetection, CompilerPackage): compiler_languages = ["c", "cxx"] compiler_version_regex = r"^Apple (?:LLVM|clang) version ([^ )]+)" + requires("platform=darwin") + @classmethod def validate_detected_spec(cls, spec, extra_attributes): msg = f'the extra attribute "compilers" must be set for the detected spec "{spec}"' diff --git a/var/spack/repos/builtin/packages/apple-libunwind/package.py b/var/spack/repos/builtin/packages/apple-libunwind/package.py index 31f650442bb..09b4a3db95d 100644 --- a/var/spack/repos/builtin/packages/apple-libunwind/package.py +++ b/var/spack/repos/builtin/packages/apple-libunwind/package.py @@ -5,47 +5,16 @@ from spack.package import * -class AppleLibunwind(Package): - """Placeholder package for Apple's analogue to non-GNU libunwind""" +class AppleLibunwind(BundlePackage): + """This package is intended to be a placeholder for Apple's system-provided, + non-GNU-compatible libunwind library. + """ homepage = "https://opensource.apple.com/source/libunwind/libunwind-35.3/" provides("unwind") - # The 'conflicts' directive only accepts valid spack specs; - # platforms cannot be negated -- 'platform!=darwin' is not a valid - # spec -- so expressing a conflict for any platform that isn't - # Darwin must be expressed by listing a conflict with every - # platform that isn't Darwin/macOS - conflicts("platform=linux") - - # Override the fetcher method to throw a useful error message; - # avoids GitHub issue (#7061) in which the opengl placeholder - # package threw a generic, uninformative error during the `fetch` - # step, - @property - def fetcher(self): - msg = """This package is intended to be a placeholder for Apple's - system-provided, non-GNU-compatible libunwind library. - - Add to your packages.yaml: - - packages: - apple-libunwind: - buildable: False - externals: - - spec: apple-libunwind@35.3 - prefix: /usr - """ - raise InstallError(msg) - - @fetcher.setter # Since fetcher is read-write, must override both - def fetcher(self): - _ = self.fetcher - - def install(self, spec, prefix): - # sanity_check_prefix requires something in the install directory - mkdirp(prefix.lib) + requires("platform=darwin") @property def libs(self): diff --git a/var/spack/repos/builtin/packages/apple-libuuid/package.py b/var/spack/repos/builtin/packages/apple-libuuid/package.py index e376527078b..8aed0710ee5 100644 --- a/var/spack/repos/builtin/packages/apple-libuuid/package.py +++ b/var/spack/repos/builtin/packages/apple-libuuid/package.py @@ -15,8 +15,7 @@ class AppleLibuuid(BundlePackage): provides("uuid") # Only supported on 'platform=darwin' - conflicts("platform=linux") - conflicts("platform=windows") + requires("platform=darwin") @property def headers(self): diff --git a/var/spack/repos/builtin/packages/fujitsu-fftw/package.py b/var/spack/repos/builtin/packages/fujitsu-fftw/package.py index 0f7214eed68..2d270039b7d 100644 --- a/var/spack/repos/builtin/packages/fujitsu-fftw/package.py +++ b/var/spack/repos/builtin/packages/fujitsu-fftw/package.py @@ -1,18 +1,10 @@ # Copyright Spack Project Developers. See COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack.error import SpackError from spack.package import * from spack.pkg.builtin.fftw import FftwBase -def target_check(spec): - if spec.target != "a64fx": - error_msg = "It can only be built on an A64FX machine.\n" - raise SpackError(error_msg) - - class FujitsuFftw(FftwBase): """FFTW (Fujitsu Optimized version) is a comprehensive collection of fast C routines for computing the Discrete Fourier Transform (DFT) @@ -53,11 +45,9 @@ class FujitsuFftw(FftwBase): msg="ARM-SVE vector instructions only works in single or double precision", ) requires("%fj") + requires("target=a64fx") def autoreconf(self, spec, prefix): - if spec.target != "a64fx": - target_check(spec) - touch = which("touch") touch("ChangeLog") autoreconf = which("autoreconf") diff --git a/var/spack/repos/builtin/packages/ibm-java/package.py b/var/spack/repos/builtin/packages/ibm-java/package.py deleted file mode 100644 index 3ede20e8d10..00000000000 --- a/var/spack/repos/builtin/packages/ibm-java/package.py +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright Spack Project Developers. See COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -import os -import platform - -from llnl.util.symlink import readlink - -from spack.package import * - - -class IbmJava(Package): - """Binary distribution of the IBM Java Software Development Kit - for big and little-endian powerpc (power7, 8 and 9). Note: IBM - is fairly aggressive about taking down old versions, so old - (and even current) versions may not be available.""" - - homepage = "https://developer.ibm.com/javasdk/" - maintainers("mwkrentel") - - # Note: IBM is fairly aggressive about taking down old versions, - # so we may need to update this frequently. Also, old revs may - # not be available for download. - - version_list = [ - ("8.0.6.20", "ppc64", "88748d1502a35845b18d514dd76835f0f47270c6ffbd81f67f611e32d042b288"), - ( - "8.0.6.20", - "ppc64le", - "4a7ac4712548d7630f2471a067406c94c3846fff75a0afc660682129dcf80e5b", - ), - ("8.0.6.11", "ppc64", "6fd17a6b9a34bb66e0db37f6402dc1b7612d54084c94b859f4a42f445fd174d4"), - ( - "8.0.6.11", - "ppc64le", - "d69ff7519e32e89db88a9a4d4d88d1881524073ac940f35d3860db2c6647be2e", - ), - ("8.0.6.10", "ppc64", "ff5151ead88f891624eefe33d80d56c325ca0aa4b93bd96c135cad326993eda2"), - ( - "8.0.6.10", - "ppc64le", - "ea99ab28dd300b08940882d178247e99aafe5a998b1621cf288dfb247394e067", - ), - ("8.0.6.7", "ppc64", "a1accb461a039af4587ea86511e317fea1d423e7f781459a17ed3947afed2982"), - ("8.0.6.7", "ppc64le", "9ede76a597af28c7f10c6f8a68788cc2dcd39fdab178c9bac56df8b3766ac717"), - ("8.0.6.0", "ppc64", "e142746a83e47ab91d71839d5776f112ed154ae180d0628e3f10886151dad710"), - ("8.0.6.0", "ppc64le", "18c2eccf99225e6e7643141d8da4110cacc39f2fa00149fc26341d2272cc0102"), - ("8.0.5.30", "ppc64", "d39ce321bdadd2b2b829637cacf9c1c0d90235a83ff6e7dcfa7078faca2f212f"), - ( - "8.0.5.30", - "ppc64le", - "dec6434d926861366c135aac6234fc28b3e7685917015aa3a3089c06c3b3d8f0", - ), - ] - - # There are separate tar files for big and little-endian machine - # types. And no, this won't work cross platform. - - for ver, mach, sha in version_list: - if mach == platform.machine(): - version(ver, sha256=sha, expand=False) - - provides("java@8") - - conflicts("target=x86_64:", msg="ibm-java is only available for ppc64 and ppc64le") - conflicts("target=aarch64", msg="ibm-java is only available for ppc64 and ppc64le") - - # This assumes version numbers are 4-tuples: 8.0.5.30 - def url_for_version(self, version): - # Convert 8.0.5.30 to 8.0-5.30 for the file name. - dash = "{0}.{1}-{2}.{3}".format(*(str(version).split("."))) - - url = ( - "http://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud" - "/runtimes/java/{0}/linux/{1}/ibm-java-sdk-{2}-{1}" - "-archive.bin" - ).format(version, platform.machine(), dash) - - return url - - @property - def libs(self): - return find_libraries(["libjvm"], root=self.home, recursive=True) - - def setup_run_environment(self, env): - env.set("JAVA_HOME", self.home) - - def setup_dependent_build_environment(self, env, dependent_spec): - env.set("JAVA_HOME", self.home) - - def install(self, spec, prefix): - archive = os.path.basename(self.stage.archive_file) - - # The archive.bin file is quite fussy and doesn't work as a - # symlink. - if os.path.islink(archive): - targ = readlink(archive) - os.unlink(archive) - copy(targ, archive) - - # The properties file is how we avoid an interactive install. - prop = "properties" - with open(prop, "w") as file: - file.write("INSTALLER_UI=silent\n") - file.write("USER_INSTALL_DIR=%s\n" % prefix) - file.write("LICENSE_ACCEPTED=TRUE\n") - - # Running the archive file installs everything. - set_executable(archive) - inst = Executable(join_path(".", archive)) - inst("-f", prop) - - return diff --git a/var/spack/repos/builtin/packages/wgl/package.py b/var/spack/repos/builtin/packages/wgl/package.py index 98671349e4c..7e603b03a50 100644 --- a/var/spack/repos/builtin/packages/wgl/package.py +++ b/var/spack/repos/builtin/packages/wgl/package.py @@ -61,8 +61,7 @@ class Wgl(Package): depends_on("win-sdk@10.0.14393", when="@10.0.14393") # WGL has no meaning on other platforms, should not be able to spec - for plat in ["linux", "darwin"]: - conflicts("platform=%s" % plat) + requires("platform=windows") @classmethod def determine_version(cls, lib):