summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/oracle-instant-client/package.py
blob: d331447c7446310d0b476ef11e70becbf686af43 (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
# Copyright 2013-2024 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 glob

from spack.package import *


def oracleclient_releases():
    releases = [
        {
            "version": "21.1.0.0.0",
            "components": {
                "basic": [
                    "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-basic-linux.x64-21.1.0.0.0.zip",
                    "9b63e264c01ac54a0f0e61bd638576aed6f04a36b305bcd17847755e7b9855ce",
                ],
                "sqlplus": [
                    "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-sqlplus-linux.x64-21.1.0.0.0.zip",
                    "3220f486940e82f1a7825e8f0875729d63abd57cc708f1908e2d5f2163b93937",
                ],
                "tools": [
                    "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-tools-linux.x64-21.1.0.0.0.zip",
                    "ff652d5bbfeaaa2403cbc13c5667f52e1d648aa2a5c59a50f4c9f84e6d2bba74",
                ],
                "sdk": [
                    "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-sdk-linux.x64-21.1.0.0.0.zip",
                    "80a465530a565ed327ab9ae0d9fc067ed42338536c7e8721cf2c26e474f4f75f",
                ],
                "jdbc": [
                    "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-jdbc-linux.x64-21.1.0.0.0.zip",
                    "76c866272712f2b432cc4be675605b22deca02f7a88a292b5ed8d29212d79dc7",
                ],
                "odbc": [
                    "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-odbc-linux.x64-21.1.0.0.0.zip",
                    "ec7722b522684f0a3f63481573d0eb3537764224eabed6223f33699dd940bf20",
                ],
            },
        },
        {
            "version": "19.10.0.0.0",
            "components": {
                "basic": [
                    "https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.x64-19.10.0.0.0dbru.zip",
                    "c2eeea093d70f5416f8a8560f9fa5b57707a76ac9775906dbc4aaa778fdee84f",
                ],
                "sqlplus": [
                    "https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sqlplus-linux.x64-19.10.0.0.0dbru.zip",
                    "eee44825f348966796166beb8c0d8cc8f61929bae05229b65b34794e0f05659a",
                ],
                "tools": [
                    "https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-tools-linux.x64-19.10.0.0.0dbru.zip",
                    "93bf58d2e15bb3ca98f8e5f579a93760571a37e0d9312187f6a5f228d492c863",
                ],
                "sdk": [
                    "https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sdk-linux.x64-19.10.0.0.0dbru.zip",
                    "2c4ae1b77fe32f3d3bf86a4ef560dc3a5dcbf5d11d742b4afeca414e5388ff2f",
                ],
                "jdbc": [
                    "https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-jdbc-linux.x64-19.10.0.0.0dbru.zip",
                    "3fabbc4a86b8c5b4b29c4d76524c7d7e5bfab33cdbfa73f1199fc5582ed25df6",
                ],
                "odbc": [
                    "https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-odbc-linux.x64-19.10.0.0.0dbru.zip",
                    "1c7ae3ea5913af9647ae68e2053cdaf9154ef6c9aa07e8b7d91e1ead9d5e675a",
                ],
            },
        },
    ]

    return releases


class OracleInstantClient(Package):
    """Oracle instant client"""

    homepage = "https://www.oracle.com/database/technologies/instant-client.html"
    url = "https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-basic-linux.x64-21.1.0.0.0.zip"

    releases = oracleclient_releases()
    for release in releases:
        oracle_version = release["version"]
        main_pkg = release["components"]["basic"]
        url, sha256 = main_pkg
        version(oracle_version, sha256=sha256, url=url)
        for rname, atts in release["components"].items():
            if rname == "basic":
                continue
            url, sha256 = atts
            condition = "@{0}".format(oracle_version)
            resource(name=rname, url=url, sha256=sha256, when=condition, placement=rname)

    depends_on("libaio", type="link")

    # TODO: add URLs for macOS. Unfortunately still no native M1 support.
    # https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html
    conflicts("platform=darwin")

    def install(self, spec, prefix):
        mkdirp(prefix.bin)
        mkdirp(prefix.include)
        mkdirp(prefix.lib)
        mkdirp(prefix.doc)

        for dirn, fns in {
            ".": ("adrci", "genezi", "uidrvci"),
            "sqlplus": ("glogin.sql", "sqlplus"),
            "odbc": ("odbc_update_ini.sh",),
            "tools": ("exp", "expdp", "imp", "impdp", "sqlldr", "wrc"),
        }.items():
            for fn in fns:
                install(join_path(dirn, fn), prefix.bin)

        for fn in glob.glob(join_path(self.stage.source_path, "*.so*")):
            install(fn, prefix.lib)

        for fn in glob.glob(join_path(self.stage.source_path, "*.jar")):
            install(fn, prefix.lib)

        for fn in glob.glob(join_path(self.stage.source_path, "sqlplus", "*.so*")):
            install(fn, prefix.lib)

        for fn in glob.glob(join_path(self.stage.source_path, "jdbc", "*.so*")):
            install(fn, prefix.lib)

        for fn in glob.glob(join_path(self.stage.source_path, "odbc", "*.so*")):
            install(fn, prefix.lib)

        for fn in glob.glob(join_path(self.stage.source_path, "tools", "*.so*")):
            install(fn, prefix.lib)

        for fn in glob.glob(join_path(self.stage.source_path, "jdbc", "*.jar")):
            install(fn, prefix.lib)

        install_tree("network", prefix.lib)

        for dirn, fns in {
            ".": ("BASIC_LICENSE", "BASIC_README"),
            "sqlplus": ("SQLPLUS_LICENSE", "SQLPLUS_README"),
            "jdbc": ("JDBC_LICENSE", "JDBC_README"),
            "odbc": ("ODBC_LICENSE", "ODBC_README"),
            "sdk": ("SDK_LICENSE", "SDK_README"),
            "tools": ("TOOLS_LICENSE", "TOOLS_README"),
        }.items():
            for fn in fns:
                install(join_path(dirn, fn), prefix.doc)

        install_tree(join_path("odbc", "help"), prefix.doc)
        install_tree(join_path("sdk", "sdk", "include"), prefix.include)