summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/hpcviewer/package.py96
1 files changed, 78 insertions, 18 deletions
diff --git a/var/spack/repos/builtin/packages/hpcviewer/package.py b/var/spack/repos/builtin/packages/hpcviewer/package.py
index c0e075c4a5..8fb69e7323 100644
--- a/var/spack/repos/builtin/packages/hpcviewer/package.py
+++ b/var/spack/repos/builtin/packages/hpcviewer/package.py
@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os
import os.path
import platform
@@ -28,17 +29,35 @@ def trace_url(ver, mach):
).format(ver, ver2, mach)
+def darwin_url(ver, mach):
+ return (
+ 'http://hpctoolkit.org/download/hpcviewer/{0}/'
+ 'hpcviewer-{0}-macosx.cocoa.{1}.zip'
+ ).format(ver, mach)
+
+
class Hpcviewer(Package):
- """Binary distribution of hpcviewer and hpctraceviewer for the Rice
- HPCToolkit (Linux x86_64, ppc64le and aarch64). Note: hpctoolkit
- databases are platform independent, so you don't need to install
- hpctoolkit to run the viewers and it's common to run hpcrun and
- hpcviewer on different machines."""
+ """Binary distribution of hpcviewer and integrated hpctraceviewer for
+ the Rice HPCToolkit (Linux x86_64, ppc64le and aarch64, and MacOSX
+ x86_64).
+
+ Note: hpctoolkit databases are platform independent, so you don't
+ need to install hpctoolkit to run the viewers and it's common to
+ run hpcrun and hpcviewer on different machines.
+ """
homepage = "http://hpctoolkit.org"
maintainers = ['mwkrentel']
+ darwin_sha = {
+ ('2021.10', 'x86_64'): '0b71f2d63d99eb00fbaf9c03cf8632c198627c80e4372eeec5f20864509cbbe8',
+ ('2021.05', 'x86_64'): '4643567b41dddbbf9272cb56b0720f4eddfb144ca05aaad7d08c878ffaf8f2fa',
+ }
+
viewer_sha = {
+ ('2021.10', 'aarch64'): 'c696a0ecc6696f9979de3940b5471a3d99c8d573736cabb24b86255d860a23dc',
+ ('2021.10', 'ppc64le'): 'f0eda3510b71fd9115c5653efba29aaefcb335c66b118cf63f36e1353c39e24e',
+ ('2021.10', 'x86_64'): 'd5a444e28d6c9d1a087c39bd3ffe55c6f982dc37a7a743b83bbba2fbfc7ca7c6',
('2021.05', 'aarch64'): 'a500bf14be14ca9b08a8382f1d122f59b45690b6a567df0932fc2cabd6382a9a',
('2021.05', 'ppc64le'): 'd39f9f6556abcd5a184db242711b72b2e8571d0b78bb08d0e497fd4e6dbe87a1',
('2021.05', 'x86_64'): 'f316c1fd0b134c96392cd4eb5e5aa2bffa36bd449f401d8fe950ab4f761c34ab',
@@ -121,25 +140,66 @@ class Hpcviewer(Package):
('2019.02', 'ppc64le'): '01a159306e7810efe07157ec823ac6ca7570ec2014c95db599a3f90eee33355c',
}
- for key in viewer_sha.keys():
- if key[1] == platform.machine():
- version(key[0], url=viewer_url(*key), sha256=viewer_sha[key])
-
- # Current versions include the viewer and trace viewer in
- # one tar file. Before 2020.07, the trace viewer was a
- # separate tar file (resource).
- if key in trace_sha:
- resource(name='hpctraceviewer', url=trace_url(*key),
- sha256=trace_sha[key], placement='TRACE',
- when='@{0}'.format(key[0]))
+ system = platform.system().lower()
+ machine = platform.machine().lower()
+
+ # Versions for MacOSX / Darwin
+ if system == 'darwin':
+ for key in darwin_sha.keys():
+ if key[1] == machine:
+ version(key[0], url=darwin_url(*key), sha256=darwin_sha[key])
+
+ # Versions for Linux and Cray front-end
+ if system == 'linux':
+ for key in viewer_sha.keys():
+ if key[1] == machine:
+ version(key[0], url=viewer_url(*key), sha256=viewer_sha[key],
+ deprecated=(key[0] <= '2020.01'))
+
+ # Current versions include the viewer and trace viewer in
+ # one tar file. Before 2020.07, the trace viewer was a
+ # separate tar file (resource).
+ if key in trace_sha:
+ resource(name='hpctraceviewer', url=trace_url(*key),
+ sha256=trace_sha[key], placement='TRACE',
+ when='@{0}'.format(key[0]))
depends_on('java@11:', type=('build', 'run'), when='@2021.0:')
depends_on('java@8', type=('build', 'run'), when='@:2020')
- conflicts('platform=darwin', msg='hpcviewer requires a manual install on MacOS, see homepage')
+ # Install for MacOSX / Darwin
+ @when('platform=darwin')
+ def install(self, spec, prefix):
+ # Add path to java binary to hpcviewer.ini file.
+ ini_file = join_path('Contents', 'Eclipse', 'hpcviewer.ini')
+ java_binary = join_path(spec['java'].prefix.bin, 'java')
+ filter_file('(-startup)', '-vm\n' + java_binary + '\n' + r'\1',
+ ini_file, backup=False)
+
+ # Copy files into prefix/hpcviewer.app.
+ app_dir = join_path(prefix, 'hpcviewer.app')
+ mkdirp(app_dir)
+ install_tree('.', app_dir)
+
+ # Add launch script to call 'open' on app directory.
+ mkdirp(prefix.bin)
+ viewer_file = join_path(prefix.bin, 'hpcviewer')
+ with open(viewer_file, 'w') as file:
+ file.write('#!/bin/sh\n')
+ file.write('open ' + app_dir + '\n')
+ os.chmod(viewer_file, 0o755)
+
+ # Install for Cray front-end is the same as Linux.
+ @when('platform=cray')
+ def install(self, spec, prefix):
+ self.linux_install(spec, prefix)
+
+ @when('platform=linux')
+ def install(self, spec, prefix):
+ self.linux_install(spec, prefix)
# Both hpcviewer and trace viewer have an install script.
- def install(self, spec, prefix):
+ def linux_install(self, spec, prefix):
args = [
'--java', spec['java'].home,
prefix