summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/totalview/package.py
blob: 437e9b2466e5fbef2dde4d9c8508a0f4c0c5885f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import os

from spack.package import *


class Totalview(Package):
    """Totalview parallel debugger.

    Source must be made available to Spack
    externally, either by having the tarballs in the current working directory
    or having the tarballs in a Spack mirror.

    The documentation tarball will
    be used as the primary source and the architecture appropriate tarball will
    be downloaded as a resource."""

    homepage = "https://totalview.io"
    maintainers("dshrader", "petertea")
    manual_download = True
    license_required = True
    license_comment = "#"
    license_files = ["licenses/license.dat", "licenses/tv_license_file"]
    license_vars = ["LM_LICENSE_FILE", "TV_LICENSE_FILE"]

    # As the install of Totalview is via multiple tarballs, the base install
    # will be the documentation.  The architecture-specific tarballs are added
    # as resources dependent on the specific architecture used.
    version("2022.3.6", sha256="3f60714b8c885c562433e30c8bcde7e6383b3517664f37f25da7bf7f9110f308")
    version("2022.2.13", sha256="4bf625c760454e532fe66666f2f5479d38f36f569f104bbe3341c0f48cbc8766")
    version("2022.1.11", sha256="0042afdbb024b99350c395decf2606b6913479ab0117bfd7bd4252d91843ef69")
    version("2021.4.10", sha256="c476288ebe1964e0803c7316975c71a957e52f45187b135bc1dc3b65491bb61d")
    version("2021.3.9", sha256="fd947ce755e76a6a06747755aa61bedd0c1428999a46e920db9498ac930ddc29")

    # Distributed with Totalview
    variant("memoryscape", default=True, description="Install memoryscape")

    # Because the actual source tarball is architecture dependent, the main
    # download is the documentation tarball and the source is downloaded as a
    # resource once the target architecture is known.

    # Version 2022.3.6
    resource(
        name="crayx86",
        url="file://totalview_2022.3.6_linux_x86-64.tar",
        destination=".",
        sha256="a2639c52bfd4c7484b728d6a0158239074ff0e0c52208a5452b12b878016a519",
        when="@2022.3.6 platform=cray target=x86_64:",
    )
    resource(
        name="x86-64",
        url="file://totalview.2022.3.6-linux-x86-64.tar",
        destination=".",
        sha256="a2639c52bfd4c7484b728d6a0158239074ff0e0c52208a5452b12b878016a519",
        when="@2022.3.6 platform=linux target=x86_64:",
    )
    resource(
        name="ppcle",
        url="file://totalview_2022.3.6_linux_powerle.tar",
        destination=".",
        sha256="93771a6ce99cff6d11e8172ff57da16aed76ab8ad1804e1d18186fba6de945f7",
        when="@2022.3.6 platform=linux target=ppc64le:",
    )
    resource(
        name="aarch64",
        url="file://totalview_2022.3.6_linux_arm64.tar",
        destination=".",
        sha256="5c18a9a187196980f9bd0fbbb77bb8e5c1d51442188ca44d58a9c49329c98783",
        when="@2022.3.6 platform=linux target=aarch64:",
    )
    resource(
        name="darwinx86",
        url="file://totalview.2022.3.6-darwin-x86.tar",
        destination=".",
        sha256="f558877f7debbeeef200f587edf4cbba41b6bc8db5a0166757445cc652de8a33",
        when="@2022.3.6 platform=darwin target=x86_64:",
    )

    # Version 2022.2.13
    resource(
        name="crayx86",
        url="file://totalview_2022.2.13_linux_x86-64.tar",
        destination=".",
        sha256="aebd11b837ce18b8200859ea762caa56e2cea346daa114f2841aa0f05a422309",
        when="@2022.2.13 platform=cray target=x86_64:",
    )
    resource(
        name="x86-64",
        url="file://totalview.2022.2.13-linux-x86-64.tar",
        destination=".",
        sha256="aebd11b837ce18b8200859ea762caa56e2cea346daa114f2841aa0f05a422309",
        when="@2022.2.13 platform=linux target=x86_64:",
    )
    resource(
        name="ppcle",
        url="file://totalview_2022.2.13_linux_powerle.tar",
        destination=".",
        sha256="0136be160576b51b03e6409b06d6cc22b5535380894e0fdc6569e2238e12120e",
        when="@2022.2.13 platform=linux target=ppc64le:",
    )
    resource(
        name="aarch64",
        url="file://totalview_2022.2.13_linux_arm64.tar",
        destination=".",
        sha256="d82154222e1ae5fce0bb7abd19b6782494ecb1f76a9a5f38a19e9dcd40bd42aa",
        when="@2022.2.13 platform=linux target=aarch64:",
    )
    resource(
        name="darwinx86",
        url="file://totalview.2022.2.13-darwin-x86.tar",
        destination=".",
        sha256="abcad08e80967959f556cb9f2a7d6dfa7f38e33213fe56f7f3198ff94cd9f3fe",
        when="@2022.2.13 platform=darwin target=x86_64:",
    )

    # Version 2022.1.11
    resource(
        name="crayx86",
        url="file://totalview_2022.1.11_linux_x86-64.tar",
        destination=".",
        sha256="3ec9a7d702572dbbafa41726a036c94b549f9a5911ed6fd6aa55f7b377554bac",
        when="@2022.1.11 platform=cray target=x86_64:",
    )
    resource(
        name="x86-64",
        url="file://totalview.2022.1.11-linux-x86-64.tar",
        destination=".",
        sha256="3ec9a7d702572dbbafa41726a036c94b549f9a5911ed6fd6aa55f7b377554bac",
        when="@2022.1.11 platform=linux target=x86_64:",
    )
    resource(
        name="ppcle",
        url="file://totalview_2022.1.11_linux_powerle.tar",
        destination=".",
        sha256="4c49546508f7e0b1a91bea3ea8d71f6f9dc76989c69a4fd78012a4ae8fa44aa6",
        when="@2022.1.11 platform=linux target=ppc64le:",
    )
    resource(
        name="aarch64",
        url="file://totalview_2022.1.11_linux_arm64.tar",
        destination=".",
        sha256="89407c043679d161b6e204fc4ad5686b7ac18742081a045f19388c7294e5ddbe",
        when="@2022.1.11 platform=linux target=aarch64:",
    )
    resource(
        name="darwinx86",
        url="file://totalview.2022.1.11-darwin-x86.tar",
        destination=".",
        sha256="3a99eda8b7be225e0b7596b3c52032809378c86ea736c88e915c0a0e8efedbe4",
        when="@2022.1.11 platform=darwin target=x86_64:",
    )

    # Version 2021.4.10
    resource(
        name="crayx86",
        url="file://totalview_2021.4.10_linux_x86-64.tar",
        destination=".",
        sha256="7e5509b2cfb219100b0032304bdad7d422657c0736c386ba64bdb1bf11d10a1d",
        when="@2021.4.10 platform=cray target=x86_64:",
    )
    resource(
        name="x86-64",
        url="file://totalview.2021.4.10-linux-x86-64.tar",
        destination=".",
        sha256="7e5509b2cfb219100b0032304bdad7d422657c0736c386ba64bdb1bf11d10a1d",
        when="@2021.4.10 platform=linux target=x86_64:",
    )
    resource(
        name="ppcle",
        url="file://totalview_2021.4.10_linux_powerle.tar",
        destination=".",
        sha256="79e812d1cd600172c5ea29c4aa6fb660d293300683419af36dd0e52cd7e15d56",
        when="@2021.4.10 platform=linux target=ppc64le:",
    )
    resource(
        name="aarch64",
        url="file://totalview_2021.4.10_linux_arm64.tar",
        destination=".",
        sha256="46faaae1f33b4f4a20de345611092fbc65cd5759511c1fcf86ca71a0811c76fd",
        when="@2021.4.10 platform=linux target=aarch64:",
    )
    resource(
        name="darwinx86",
        url="file://totalview.2021.4.10-darwin-x86.tar",
        destination=".",
        sha256="adbf95f86763e3cc5ec51fd504f3172bdcbb42a7f1f4e73b17cacca002729ad2",
        when="@2021.4.10 platform=darwin target=x86_64:",
    )

    # Version 2021.3
    resource(
        name="x86_64",
        url="file://totalview_2021.3.9_linux_x86-64.tar",
        destination=".",
        sha256="6315ca855e1bee14678c640c3c9c8207b4f66c91714dcedd4aed592354112b48",
        when="@2021.3.9 platform=linux target=x86_64:",
    )
    resource(
        name="ppcle",
        url="file://totalview_2021.3.9_linux_powerle.tar",
        destination=".",
        sha256="a7657b61895805024f5d4e7550796a485f98ce297a585583cdd20fe0b9b30bbb",
        when="@2021.3.9 platform=linux target=ppc64le:",
    )

    def url_for_version(self, version):
        return "file://{0}/totalview.{1}-doc.tar".format(os.getcwd(), version)

    def setup_run_environment(self, env):
        env.prepend_path(
            "PATH",
            join_path(self.prefix, "toolworks", "totalview.{0}".format(self.version), "bin"),
        )
        env.prepend_path(
            "TVROOT", join_path(self.prefix, "toolworks", "totalview.{0}".format(self.version))
        )
        env.prepend_path("TVDSVRLAUNCHCMD", "ssh")

    def install(self, spec, prefix):
        # Assemble install line
        install_cmd = which("./Install")
        arg_list = ["-agree", "-nosymlink", "-directory", "{0}".format(prefix)]

        # Platform specification.
        if spec.target.family == "x86_64" and spec.platform == "linux":
            arg_list.extend(["-platform", "linux-x86-64"])
        elif spec.target.family == "x86_64" and spec.platform == "darwin":
            arg_list.extend(["-platform", "darwin-x86"])
        elif spec.target.family == "x86_64" and spec.platform == "cray":
            arg_list.extend(["-platform", "linux-x86-64"])
        elif spec.target.family == "x86":
            arg_list.extend(["-platform", "linux-x86"])
        elif spec.target.family == "aarch64":
            arg_list.extend(["-platform", "linux-arm64"])
        elif spec.target.family == "ppc64le":
            arg_list.extend(["-platform", "linux-powerle"])
        elif spec.target.family == "ppc64":
            arg_list.extend(["-platform", "linux-power"])
        else:
            raise InstallError("Architecture {0} not permitted!".format(spec.target.family))

        # Docs are the "base" install used with every architecture.
        install_cmd.exe.extend(arg_list)
        install_cmd("-install", "doc-pdf")

        # Run install script for totalview (which automatically installs memoryscape)
        with working_dir("./totalview.{0}".format(self.version)):
            install_cmd = which("./Install")
            arg_list.extend(["-install", "totalview"])
            # TotalView automatically installs Memoryscape, so no need to add

            install_cmd.exe.extend(arg_list)
            install_cmd()

        # If a license file was created, link to FNE_license or FNP_license
        symlink(
            join_path(self.prefix, "licenses", "tv_license_file"),
            join_path(self.prefix, "toolworks", "FNE_license", "tv_license_file"),
        )
        symlink(
            join_path(self.prefix, "licenses", "license.dat"),
            join_path(self.prefix, "toolworks", "FNP_license", "license.dat"),
        )