Skip to content

Commit c6a55b8

Browse files
committed
feat: add support for IBM Semeru Runtimes Open Edition for Java 25
1 parent 2a7d956 commit c6a55b8

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

bin/semeru25.bash

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
set -Euo pipefail
4+
5+
TEMP_DIR=$(mktemp -d)
6+
trap 'rm -rf ${TEMP_DIR}' EXIT
7+
8+
if [[ "$#" -lt 2 ]]
9+
then
10+
echo "Usage: ${0} metadata-directory checksum-directory"
11+
exit 1
12+
fi
13+
14+
# shellcheck source=bin/functions.bash
15+
source "$(dirname "${0}")/functions.bash"
16+
17+
VENDOR='semeru'
18+
METADATA_DIR="${1}/${VENDOR}"
19+
CHECKSUM_DIR="${2}/${VENDOR}"
20+
21+
ensure_directory "${METADATA_DIR}"
22+
ensure_directory "${CHECKSUM_DIR}"
23+
24+
function normalize_release_type {
25+
case "${1}" in
26+
*) echo 'ga'
27+
;;
28+
esac
29+
}
30+
31+
function download {
32+
local tag_name="${1}"
33+
local asset_name="${2}"
34+
local filename="${asset_name}"
35+
36+
local url="https://github.com/ibmruntimes/semeru24-binaries/releases/download/${tag_name}/${asset_name}"
37+
local metadata_file="${METADATA_DIR}/${filename}.json"
38+
local archive="${TEMP_DIR}/${filename}"
39+
40+
if [[ -f "${metadata_file}" ]]
41+
then
42+
echo "Skipping ${filename}"
43+
else
44+
download_file "${url}" "${archive}" || return 1
45+
46+
local JAVA_VERSION=""
47+
local OPENJ9_VERSION=""
48+
#local RPM_VERSION=""
49+
local RELEASE_TYPE="ga"
50+
local IMAGE_TYPE=""
51+
local OS=""
52+
local ARCH=""
53+
local EXT=""
54+
local regex
55+
56+
# shellcheck disable=SC2016
57+
version_regex='s/^jdk-(.*)_openj9-(.*)$/JAVA_VERSION="$1" OPENJ9_VERSION="$2"/g'
58+
eval "$(perl -pe "${version_regex}" <<< "${tag_name}")"
59+
local VERSION="${JAVA_VERSION}_openj9-${OPENJ9_VERSION}"
60+
61+
if [[ "${filename}" =~ \.rpm$ ]]
62+
then
63+
OS='linux'
64+
EXT='rpm'
65+
66+
# shellcheck disable=SC2016
67+
regex='s/^ibm-semeru-open-[0-9]+-(jre|jdk)-(.+)\.(x86_64|s390x|ppc64|ppc64le|aarch64)\.rpm$/IMAGE_TYPE="$1" RPM_VERSION="$2" ARCH="$3"/g'
68+
else
69+
# shellcheck disable=SC2016
70+
regex='s/^ibm-semeru-open-(jre|jdk)_(x64|x86-32|s390x|ppc64|ppc64le|aarch64)_(aix|linux|mac|windows)_.+_openj9-.+\.(tar\.gz|zip|msi)$/IMAGE_TYPE="$1" ARCH="$2" OS="$3" EXT="$4"/g'
71+
fi
72+
73+
# Parse meta-data from file name
74+
eval "$(perl -pe "${regex}" <<< "${asset_name}")"
75+
76+
local json
77+
json="$(metadata_json \
78+
"${VENDOR}" \
79+
"${filename}" \
80+
"$(normalize_release_type "${RELEASE_TYPE}")" \
81+
"${VERSION}" \
82+
"${JAVA_VERSION}" \
83+
'openj9' \
84+
"$(normalize_os "${OS}")" \
85+
"$(normalize_arch "${ARCH}")" \
86+
"${EXT}" \
87+
"${IMAGE_TYPE}" \
88+
'' \
89+
"${url}" \
90+
"$(hash_file 'md5' "${archive}" "${CHECKSUM_DIR}")" \
91+
"$(hash_file 'sha1' "${archive}" "${CHECKSUM_DIR}")" \
92+
"$(hash_file 'sha256' "${archive}" "${CHECKSUM_DIR}")" \
93+
"$(hash_file 'sha512' "${archive}" "${CHECKSUM_DIR}")" \
94+
"$(file_size "${archive}")" \
95+
"${filename}"
96+
)"
97+
98+
echo "${json}" > "${metadata_file}"
99+
rm -f "${archive}"
100+
fi
101+
}
102+
103+
RELEASE_FILE="${TEMP_DIR}/releases-${VENDOR}-25.json"
104+
download_github_releases 'ibmruntimes' 'semeru25-binaries' "${RELEASE_FILE}"
105+
106+
versions=$(jq -r '.[].tag_name' "${RELEASE_FILE}" | sort -V)
107+
for version in ${versions}
108+
do
109+
assets=$(jq -r ".[] | select(.prerelease == false) | select(.tag_name == \"${version}\") | .assets[] | select(.name | endswith(\"zip\") or endswith(\"tar.gz\") or endswith(\"msi\") or endswith(\"rpm\")) | select(.name | contains(\"debugimage\") | not) | select(.name | contains(\"testimage\") | not) | select(.name | contains(\"certified\") | not) | .name" "${RELEASE_FILE}")
110+
for asset in ${assets}
111+
do
112+
download "${version}" "${asset}" || echo "Cannot download ${asset}"
113+
done
114+
done
115+
116+
jq -s -S . "${METADATA_DIR}"/ibm-semeru-open-*.json > "${METADATA_DIR}/all.json"

bin/update.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ vendors=(
3737
"$(cmd 'semeru22')"
3838
"$(cmd 'semeru23')"
3939
"$(cmd 'semeru24')"
40+
"$(cmd 'semeru25')"
4041
"$(cmd 'semeru11-certified')"
4142
"$(cmd 'semeru17-certified')"
4243
"$(cmd 'semeru21-certified')"

0 commit comments

Comments
 (0)