mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
oracle-instantclient: 21.10.0.0.0 -> 23.26.3.0.0, add update script (#509869)
This commit is contained in:
@@ -17,8 +17,6 @@ assert odbcSupport -> unixodbc != null;
|
||||
let
|
||||
inherit (lib) optional optionalString;
|
||||
|
||||
throwSystem = "unsupported";
|
||||
|
||||
# assemble list of components
|
||||
components = [
|
||||
"basic"
|
||||
@@ -28,59 +26,11 @@ let
|
||||
]
|
||||
++ optional odbcSupport "odbc";
|
||||
|
||||
# determine the version number, there might be different ones per architecture
|
||||
version =
|
||||
{
|
||||
x86_64-linux = "21.10.0.0.0";
|
||||
aarch64-linux = "19.10.0.0.0";
|
||||
aarch64-darwin = "23.3.0.23.09";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or throwSystem;
|
||||
sources =
|
||||
(lib.importJSON ./sources.json).${stdenv.hostPlatform.system}
|
||||
or (throw "Unsupported platform: ${stdenv.hostPlatform.system}");
|
||||
|
||||
directory =
|
||||
{
|
||||
x86_64-linux = "2110000";
|
||||
aarch64-linux = "191000";
|
||||
aarch64-darwin = "233023";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or throwSystem;
|
||||
|
||||
# hashes per component and architecture
|
||||
hashes =
|
||||
{
|
||||
x86_64-linux = {
|
||||
basic = "sha256-uo0QBOmx7TQyroD+As60IhjEkz//+0Cm1tWvLI3edaE=";
|
||||
sdk = "sha256-TIBFi1jHLJh+SUNFvuL7aJpxh61hG6gXhFIhvdPgpts=";
|
||||
sqlplus = "sha256-mF9kLjhZXe/fasYDfmZrYPL2CzAp3xDbi624RJDA4lM=";
|
||||
tools = "sha256-ay8ynzo1fPHbCg9GoIT5ja//iZPIZA2yXI/auVExiRY=";
|
||||
odbc = "sha256-3M6/cEtUrIFzQay8eHNiLGE+L0UF+VTmzp4cSBcrzlk=";
|
||||
};
|
||||
aarch64-linux = {
|
||||
basic = "sha256-DNntH20BAmo5kOz7uEgW2NXaNfwdvJ8l8oMnp50BOsY=";
|
||||
sdk = "sha256-8VpkNyLyFMUfQwbZpSDV/CB95RoXfaMr8w58cRt/syw=";
|
||||
sqlplus = "sha256-iHcyijHhAvjsAqN9R+Rxo2R47k940VvPbScc2MWYn0Q=";
|
||||
tools = "sha256-4QY0EwcnctwPm6ZGDZLudOFM4UycLFmRIluKGXVwR0M=";
|
||||
odbc = "sha256-T+RIIKzZ9xEg/E72pfs5xqHz2WuIWKx/oRfDrQbw3ms=";
|
||||
};
|
||||
aarch64-darwin = {
|
||||
basic = "sha256-G83bWDhw9wwjLVee24oy/VhJcCik7/GtKOzgOXuo1/4=";
|
||||
sdk = "sha256-PerfzgietrnAkbH9IT7XpmaFuyJkPHx0vl4FCtjPzLs=";
|
||||
sqlplus = "sha256-khOjmaExAb3rzWEwJ/o4XvRMQruiMw+UgLFtsOGn1nY=";
|
||||
tools = "sha256-gA+SbgXXpY12TidpnjBzt0oWQ5zLJg6wUpzpSd/N5W4=";
|
||||
odbc = "sha256-JzoSdH7mJB709cdXELxWzpgaNTjOZhYH/wLkdzKA2N0=";
|
||||
};
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or throwSystem;
|
||||
|
||||
# rels per component and architecture, optional
|
||||
rels =
|
||||
{
|
||||
aarch64-darwin = {
|
||||
basic = "1";
|
||||
tools = "1";
|
||||
};
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or { };
|
||||
inherit (sources) version directory hashes;
|
||||
|
||||
# convert platform to oracle architecture names
|
||||
arch =
|
||||
@@ -89,7 +39,7 @@ let
|
||||
aarch64-linux = "linux.arm64";
|
||||
aarch64-darwin = "macos.arm64";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or throwSystem;
|
||||
.${stdenv.hostPlatform.system};
|
||||
|
||||
shortArch =
|
||||
{
|
||||
@@ -97,32 +47,27 @@ let
|
||||
aarch64-linux = "linux";
|
||||
aarch64-darwin = "mac";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or throwSystem;
|
||||
.${stdenv.hostPlatform.system};
|
||||
|
||||
suffix =
|
||||
{
|
||||
aarch64-darwin = ".dmg";
|
||||
}
|
||||
.${stdenv.hostPlatform.system} or "dbru.zip";
|
||||
.${stdenv.hostPlatform.system} or ".zip";
|
||||
|
||||
# calculate the filename of a single zip file
|
||||
srcFilename =
|
||||
component: arch: version: rel:
|
||||
"instantclient-${component}-${arch}-${version}" + (optionalString (rel != "") "-${rel}") + suffix;
|
||||
srcFilename = component: "instantclient-${component}-${arch}-${version}${suffix}";
|
||||
|
||||
# fetcher for the non clickthrough artifacts
|
||||
fetcher =
|
||||
srcFilename: hash:
|
||||
fetchurl {
|
||||
url = "https://download.oracle.com/otn_software/${shortArch}/instantclient/${directory}/${srcFilename}";
|
||||
sha256 = hash;
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
# assemble srcs
|
||||
srcs = map (
|
||||
component:
|
||||
(fetcher (srcFilename component arch version rels.${component} or "") hashes.${component} or "")
|
||||
) components;
|
||||
srcs = map (component: fetcher (srcFilename component) hashes.${component}) components;
|
||||
|
||||
isDarwinAarch64 = stdenv.hostPlatform.system == "aarch64-darwin";
|
||||
|
||||
@@ -151,11 +96,15 @@ stdenv.mkDerivation {
|
||||
"lib"
|
||||
];
|
||||
|
||||
unpackCmd = if isDarwinAarch64 then "7zz x $curSrc -aoa -oinstantclient" else "unzip $curSrc";
|
||||
unpackCmd =
|
||||
if isDarwinAarch64 then
|
||||
"7zz x $curSrc -aoa -oinstantclient -x!META-INF"
|
||||
else
|
||||
"unzip $curSrc -x 'META-INF/*'";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/"{bin,include,lib,"share/java","share/${pname}-${version}/demo/"} $lib/lib
|
||||
install -Dm755 {adrci,genezi,uidrvci,sqlplus,exp,expdp,imp,impdp} $out/bin
|
||||
install -Dm755 {adrci,genezi,uidrvci,sqlplus,exp,expdp,imp,impdp,sqlldr,wrc} $out/bin
|
||||
|
||||
# cp to preserve symlinks
|
||||
cp -P *${extLib}* $lib/lib
|
||||
@@ -168,6 +117,8 @@ stdenv.mkDerivation {
|
||||
ln -sfn $out/bin/sqlplus $out/bin/sqlplus64
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
postFixup = optionalString stdenv.hostPlatform.isDarwin ''
|
||||
for exe in "$out/bin/"* ; do
|
||||
if [ ! -L "$exe" ]; then
|
||||
|
||||
35
pkgs/by-name/or/oracle-instantclient/sources.json
Normal file
35
pkgs/by-name/or/oracle-instantclient/sources.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"aarch64-darwin": {
|
||||
"version": "23.26.2.0.0",
|
||||
"directory": "2326200",
|
||||
"hashes": {
|
||||
"basic": "sha256-w8T843pVcZIyJxfBqEIv4Jj8gppB84L1eiiLJK1roR4=",
|
||||
"sdk": "sha256-XuDf/n/wrFXuoZjvaWgcxyn8f98XzJCJ+L/V2TxRQT4=",
|
||||
"sqlplus": "sha256-w7EFNxlKUmej7RjQn92uH4ZBkeDeJa14BClAu4JJYpQ=",
|
||||
"tools": "sha256-cEHZFl/jcMxM51mF2xzxT+0heotePiz+nM4GljUns40=",
|
||||
"odbc": "sha256-N3IFU346SndwqjhdSLpOZ7BJUMV7I76IdYdfd+qiyYQ="
|
||||
}
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"version": "23.26.3.0.0",
|
||||
"directory": "2326300",
|
||||
"hashes": {
|
||||
"basic": "sha256-dLB0TXvxvij2DD2QoTXl2arKGUa6sK3MDI21+8LMl1g=",
|
||||
"sdk": "sha256-X7A7RhXYbKemRTpBozT8J9ysbYOd1+VBF3MiqvOe4xg=",
|
||||
"sqlplus": "sha256-w8Dvwac0ZV5ITHHzFkYEGKBrpapa8AxV0e2h2racbak=",
|
||||
"tools": "sha256-0lzr6PX96IYT7PKcvI99OpMB8SxHPAseFvzTFlLLrME=",
|
||||
"odbc": "sha256-YlsMBi3tSjyGdjb5QRsny58aGJmWvxDKCxbw4UIEbEQ="
|
||||
}
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"version": "23.26.3.0.0",
|
||||
"directory": "2326300",
|
||||
"hashes": {
|
||||
"basic": "sha256-/OSFNhMykn+DKOpLaNmJaMaw6hJOYkcN6MnQzviAEw4=",
|
||||
"sdk": "sha256-esE1h7qKc0rnzAbPQnU7v9vmmDna+HvVk1pJyD3szP0=",
|
||||
"sqlplus": "sha256-ZXDXk5hWdnzbtUm1HhQj1qX1MUPFfDDAFWaXBvZaYyo=",
|
||||
"tools": "sha256-aAtubzt64Tly1MOVmz3E870HWgvtUeXVshkV1VNfNQs=",
|
||||
"odbc": "sha256-Jjz8d7uruWSEcg7fF+g6+5bJF9lvBTrnYhhvCrzm9Aw="
|
||||
}
|
||||
}
|
||||
}
|
||||
65
pkgs/by-name/or/oracle-instantclient/update.sh
Executable file
65
pkgs/by-name/or/oracle-instantclient/update.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnugrep gnused coreutils jq nix git
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Scrapes the Oracle Instant Client download pages for the latest release on
|
||||
# each platform and regenerates sources.json.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
sources="$(git rev-parse --show-toplevel)/pkgs/by-name/or/oracle-instantclient/sources.json"
|
||||
|
||||
components=(basic sdk sqlplus tools odbc)
|
||||
|
||||
# platform -> "<download page> <oracle arch> <suffix>"
|
||||
declare -A platforms=(
|
||||
[x86_64-linux]="linux-x86-64-downloads linux.x64 zip"
|
||||
[aarch64-linux]="linux-arm-aarch64-downloads linux.arm64 zip"
|
||||
[aarch64-darwin]="macos-arm64-downloads macos.arm64 dmg"
|
||||
)
|
||||
|
||||
result="{}"
|
||||
|
||||
for platform in $(printf '%s\n' "${!platforms[@]}" | sort); do
|
||||
read -r page arch suffix <<<"${platforms[$platform]}"
|
||||
|
||||
html="$(curl -fsSL -A Mozilla/5.0 "https://www.oracle.com/database/technologies/instant-client/${page}.html")"
|
||||
|
||||
# Pick the newest plain release, skipping the dbru/el9 variants of older series.
|
||||
# Sort on the version alone, as the directory names vary in length.
|
||||
url="$(
|
||||
{ grep -oE "https://download\.oracle\.com/otn_software/[a-z]+/instantclient/[0-9]+/instantclient-basic-${arch//./\\.}-[0-9.]+\.${suffix}" <<<"$html" || true; } \
|
||||
| sed -E "s|^.*-([0-9.]+)\.${suffix}\$|\1 &|" \
|
||||
| sort -uV -k1,1 | tail -1 | cut -d' ' -f2
|
||||
)"
|
||||
|
||||
if [[ -z "$url" ]]; then
|
||||
echo "No release found for $platform" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
directory="$(basename "$(dirname "$url")")"
|
||||
version="$(basename "$url" ".${suffix}")"
|
||||
version="${version#"instantclient-basic-${arch}-"}"
|
||||
|
||||
echo "Updating $platform to $version"
|
||||
|
||||
hashes="{}"
|
||||
for component in "${components[@]}"; do
|
||||
componentUrl="$(dirname "$url")/instantclient-${component}-${arch}-${version}.${suffix}"
|
||||
hash="$(nix-prefetch-url --type sha256 "$componentUrl")"
|
||||
hash="$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$hash")"
|
||||
hashes="$(jq --arg c "$component" --arg h "$hash" '. + {($c): $h}' <<<"$hashes")"
|
||||
done
|
||||
|
||||
result="$(
|
||||
jq \
|
||||
--arg p "$platform" \
|
||||
--arg v "$version" \
|
||||
--arg d "$directory" \
|
||||
--argjson h "$hashes" \
|
||||
'. + {($p): {version: $v, directory: $d, hashes: $h}}' <<<"$result"
|
||||
)"
|
||||
done
|
||||
|
||||
echo "$result" >"$sources"
|
||||
Reference in New Issue
Block a user