Compare commits
5 Commits
e69cb04ba8
...
4ade2ae9e9
Author | SHA1 | Date |
---|---|---|
Nathan McCarty | 4ade2ae9e9 | |
Nathan McCarty | 908fc2fd5e | |
Nathan McCarty | f5fd32d4b1 | |
Nathan McCarty | f94133c5ec | |
Nathan McCarty | 8e53bfead6 |
16
flake.nix
16
flake.nix
|
@ -71,7 +71,8 @@
|
||||||
# breaks building OpenJDK (#114495).
|
# breaks building OpenJDK (#114495).
|
||||||
for bin in $( find "$out" -executable -type f -not -name jspawnhelper ); do
|
for bin in $( find "$out" -executable -type f -not -name jspawnhelper ); do
|
||||||
if patchelf --print-interpreter "$bin" &> /dev/null; then
|
if patchelf --print-interpreter "$bin" &> /dev/null; then
|
||||||
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}"
|
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" \
|
||||||
|
--prefix PATH : ${lib.makeBinPath [ pkgs.util-linux ]}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
@ -97,6 +98,19 @@
|
||||||
packages.temurin-stable = self.packages.${system}.temurin.stable;
|
packages.temurin-stable = self.packages.${system}.temurin.stable;
|
||||||
packages.temurin-lts = self.packages.${system}.temurin.lts;
|
packages.temurin-lts = self.packages.${system}.temurin.lts;
|
||||||
|
|
||||||
|
packages.semeru = (builtins.mapAttrs
|
||||||
|
(name: value:
|
||||||
|
buildAdoptLike name value)
|
||||||
|
sources.${system}.semeru.versions) // {
|
||||||
|
latest = buildAdoptLike "latest" sources.${system}.semeru.latest;
|
||||||
|
stable = buildAdoptLike "stable" sources.${system}.semeru.stable;
|
||||||
|
lts = buildAdoptLike "lts" sources.${system}.semeru.lts;
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.semeru-latest = self.packages.${system}.semeru.latest;
|
||||||
|
packages.semeru-stable = self.packages.${system}.semeru.stable;
|
||||||
|
packages.semeru-lts = self.packages.${system}.semeru.lts;
|
||||||
|
|
||||||
defaultPackage = self.packages.${system}.stable;
|
defaultPackage = self.packages.${system}.stable;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
132
sources.json
132
sources.json
|
@ -9,6 +9,13 @@
|
||||||
"early_access": false,
|
"early_access": false,
|
||||||
"sha256": "02sdnmk9zswi5skhyik1zaqm08v6cyggjc7c7ykwrw322rd4vnsz"
|
"sha256": "02sdnmk9zswi5skhyik1zaqm08v6cyggjc7c7ykwrw322rd4vnsz"
|
||||||
},
|
},
|
||||||
|
"jdk16": {
|
||||||
|
"link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz",
|
||||||
|
"major_version": 16,
|
||||||
|
"java_version": "16.0.2+7",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "0b1wayg38rckzm1fy4pdm1a1bmjvwvw0vpbxzy7a4nd3fis6sg9j"
|
||||||
|
},
|
||||||
"jdk17": {
|
"jdk17": {
|
||||||
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.3_7.tar.gz",
|
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.3_7.tar.gz",
|
||||||
"major_version": 17,
|
"major_version": 17,
|
||||||
|
@ -24,18 +31,11 @@
|
||||||
"sha256": "18mhq6bqhbig58w2n0iw2ssz9ir48dk9rzd10jpmgh92bzbxkc8n"
|
"sha256": "18mhq6bqhbig58w2n0iw2ssz9ir48dk9rzd10jpmgh92bzbxkc8n"
|
||||||
},
|
},
|
||||||
"jdk19": {
|
"jdk19": {
|
||||||
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-2022-06-09-19-11-beta/OpenJDK-jdk_x64_linux_hotspot_2022-06-09-03-31.tar.gz",
|
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19-2022-06-18-19-28-beta/OpenJDK19-jdk_x64_linux_hotspot_2022-06-18-19-28.tar.gz",
|
||||||
"major_version": 19,
|
"major_version": 19,
|
||||||
"java_version": "19-beta+25-202206090350",
|
"java_version": "19-beta+27-202206180349",
|
||||||
"early_access": true,
|
"early_access": true,
|
||||||
"sha256": "0bdyx7dj9n6qmja3qqaznc6kfg1x8g56b91hmdv8nyhxik720cid"
|
"sha256": "1p2w8ipv6nlk5h4qdl70lbjdd5xy44p5yanc0q28bnf8m9898c99"
|
||||||
},
|
|
||||||
"jdk16": {
|
|
||||||
"link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz",
|
|
||||||
"major_version": 16,
|
|
||||||
"java_version": "16.0.2+7",
|
|
||||||
"early_access": false,
|
|
||||||
"sha256": "0b1wayg38rckzm1fy4pdm1a1bmjvwvw0vpbxzy7a4nd3fis6sg9j"
|
|
||||||
},
|
},
|
||||||
"jdk8": {
|
"jdk8": {
|
||||||
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u332b09.tar.gz",
|
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u332b09.tar.gz",
|
||||||
|
@ -46,11 +46,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"latest": {
|
"latest": {
|
||||||
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-2022-06-09-19-11-beta/OpenJDK-jdk_x64_linux_hotspot_2022-06-09-03-31.tar.gz",
|
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19-2022-06-18-19-28-beta/OpenJDK19-jdk_x64_linux_hotspot_2022-06-18-19-28.tar.gz",
|
||||||
"major_version": 19,
|
"major_version": 19,
|
||||||
"java_version": "19-beta+25-202206090350",
|
"java_version": "19-beta+27-202206180349",
|
||||||
"early_access": true,
|
"early_access": true,
|
||||||
"sha256": "0bdyx7dj9n6qmja3qqaznc6kfg1x8g56b91hmdv8nyhxik720cid"
|
"sha256": "1p2w8ipv6nlk5h4qdl70lbjdd5xy44p5yanc0q28bnf8m9898c99"
|
||||||
},
|
},
|
||||||
"stable": {
|
"stable": {
|
||||||
"link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz",
|
"link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.1%2B10/OpenJDK18U-jdk_x64_linux_hotspot_18.0.1_10.tar.gz",
|
||||||
|
@ -68,27 +68,105 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"semeru": {
|
"semeru": {
|
||||||
"versions": {},
|
"versions": {
|
||||||
"latest": {
|
"jdk10": {
|
||||||
"link": "",
|
"link": "https://github.com/AdoptOpenJDK/openjdk10-openj9-releases/releases/download/jdk-10.0.2%2B13_openj9-0.9.0/OpenJDK10-OPENJ9_x64_Linux_jdk-10.0.2.13_openj9-0.9.0.tar.gz",
|
||||||
"major_version": 0,
|
"major_version": 10,
|
||||||
"java_version": "",
|
"java_version": "10.0.2+13",
|
||||||
"early_access": false,
|
"early_access": false,
|
||||||
"sha256": ""
|
"sha256": "1lbr2y1ld57s5kbdan254mq5kf7w960yym0q15k3cbrvhnrxmw0y"
|
||||||
|
},
|
||||||
|
"jdk11": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/semeru11-binaries/releases/download/jdk-11.0.15%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_11.0.15_10_openj9-0.32.0.tar.gz",
|
||||||
|
"major_version": 11,
|
||||||
|
"java_version": "11.0.15+10",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "135gpvhcncw5j3n7yhfhhlcnpfzq605m4v8m1l2712q77vfdfqvh"
|
||||||
|
},
|
||||||
|
"jdk12": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10_openj9-0.15.1/OpenJDK12U-jdk_x64_linux_openj9_12.0.2_10_openj9-0.15.1.tar.gz",
|
||||||
|
"major_version": 12,
|
||||||
|
"java_version": "12.0.2+10",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "0ab22d1603c0j40df3qamgq3cnvfhm3w22lqc1y23pqdaqhz1xp2"
|
||||||
|
},
|
||||||
|
"jdk13": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8_openj9-0.18.0/OpenJDK13U-jdk_x64_linux_openj9_13.0.2_8_openj9-0.18.0.tar.gz",
|
||||||
|
"major_version": 13,
|
||||||
|
"java_version": "13.0.2+8",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "1415qpv9gwzrz3cxfrlkqa84ii2xgvwkqy873nw7v10c1p9zdv5f"
|
||||||
|
},
|
||||||
|
"jdk14": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12_openj9-0.21.0/OpenJDK14U-jdk_x64_linux_openj9_14.0.2_12_openj9-0.21.0.tar.gz",
|
||||||
|
"major_version": 14,
|
||||||
|
"java_version": "14.0.2+12",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "1gpkrbk64dhry1jfkcl39ha8h877pnpnrhvfb7ralpdnrlw72vrh"
|
||||||
|
},
|
||||||
|
"jdk15": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7_openj9-0.24.0/OpenJDK15U-jdk_x64_linux_openj9_15.0.2_7_openj9-0.24.0.tar.gz",
|
||||||
|
"major_version": 15,
|
||||||
|
"java_version": "15.0.2+7",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "05j807m13rlfnx7xjihf210vpxvj2bzdb02vc658sphvkgbwq5am"
|
||||||
|
},
|
||||||
|
"jdk16": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/semeru16-binaries/releases/download/jdk-16.0.2%2B7_openj9-0.27.0/ibm-semeru-open-jdk_x64_linux_16.0.2_7_openj9-0.27.0.tar.gz",
|
||||||
|
"major_version": 16,
|
||||||
|
"java_version": "16.0.2+7",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "0vl8q3v35j5229qvxz64lp25f0vk4q0shrjdk2hr3x4s3ndfnj8k"
|
||||||
|
},
|
||||||
|
"jdk17": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/semeru17-binaries/releases/download/jdk-17.0.3%2B7_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_17.0.3_7_openj9-0.32.0.tar.gz",
|
||||||
|
"major_version": 17,
|
||||||
|
"java_version": "17.0.3+7",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "1pdvj0spbsnai6hk5s3ciid9mgqbcrxmc3fn4b67b5jk7m9h9jkx"
|
||||||
|
},
|
||||||
|
"jdk18": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.1%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_18.0.1_10_openj9-0.32.0.tar.gz",
|
||||||
|
"major_version": 18,
|
||||||
|
"java_version": "18.0.1+10",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "1spm6ypyrwa8j85kpz4v7337kad8v94wacnfr1rk2klw2q1n253f"
|
||||||
|
},
|
||||||
|
"jdk8": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/semeru8-binaries/releases/download/jdk8u332-b09_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_8u332b09_openj9-0.32.0.tar.gz",
|
||||||
|
"major_version": 8,
|
||||||
|
"java_version": "1.8.0_332-b09",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "1ivm8wccxa4j04vvmvymgfb23kd3jl33mhap4mlja9gkpj92vzxy"
|
||||||
|
},
|
||||||
|
"jdk9": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/openjdk9-openj9-releases/releases/download/jdk-9.0.4%2B12_openj9-0.9.0/OpenJDK9-OPENJ9_x64_Linux_jdk-9.0.4.12_openj9-0.9.0.tar.gz",
|
||||||
|
"major_version": 9,
|
||||||
|
"java_version": "9.0.4+12",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "0svf3rvbpjzg85v6nxwcy6n45v5byjpihiwil2msdhagxnvl3fym"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"latest": {
|
||||||
|
"link": "https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.1%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_18.0.1_10_openj9-0.32.0.tar.gz",
|
||||||
|
"major_version": 18,
|
||||||
|
"java_version": "18.0.1+10",
|
||||||
|
"early_access": false,
|
||||||
|
"sha256": "1spm6ypyrwa8j85kpz4v7337kad8v94wacnfr1rk2klw2q1n253f"
|
||||||
},
|
},
|
||||||
"stable": {
|
"stable": {
|
||||||
"link": "",
|
"link": "https://github.com/AdoptOpenJDK/semeru18-binaries/releases/download/jdk-18.0.1%2B10_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_18.0.1_10_openj9-0.32.0.tar.gz",
|
||||||
"major_version": 0,
|
"major_version": 18,
|
||||||
"java_version": "",
|
"java_version": "18.0.1+10",
|
||||||
"early_access": false,
|
"early_access": false,
|
||||||
"sha256": ""
|
"sha256": "1spm6ypyrwa8j85kpz4v7337kad8v94wacnfr1rk2klw2q1n253f"
|
||||||
},
|
},
|
||||||
"lts": {
|
"lts": {
|
||||||
"link": "",
|
"link": "https://github.com/AdoptOpenJDK/semeru17-binaries/releases/download/jdk-17.0.3%2B7_openj9-0.32.0/ibm-semeru-open-jdk_x64_linux_17.0.3_7_openj9-0.32.0.tar.gz",
|
||||||
"major_version": 0,
|
"major_version": 17,
|
||||||
"java_version": "",
|
"java_version": "17.0.3+7",
|
||||||
"early_access": false,
|
"early_access": false,
|
||||||
"sha256": ""
|
"sha256": "1pdvj0spbsnai6hk5s3ciid9mgqbcrxmc3fn4b67b5jk7m9h9jkx"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use color_eyre::{
|
use color_eyre::{
|
||||||
eyre::{eyre, Context, Result},
|
eyre::{eyre, Context, Result},
|
||||||
|
@ -27,7 +27,6 @@ pub struct Package {
|
||||||
checksum_link: String,
|
checksum_link: String,
|
||||||
download_count: u64,
|
download_count: u64,
|
||||||
pub link: String,
|
pub link: String,
|
||||||
metadata_link: String,
|
|
||||||
name: String,
|
name: String,
|
||||||
size: u64,
|
size: u64,
|
||||||
}
|
}
|
||||||
|
@ -43,7 +42,6 @@ pub struct Binary {
|
||||||
os: String,
|
os: String,
|
||||||
pub package: Package,
|
pub package: Package,
|
||||||
project: String,
|
project: String,
|
||||||
scm_ref: String,
|
|
||||||
updated_at: String,
|
updated_at: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,12 +138,13 @@ pub async fn get_available_releases(client: &Client) -> Result<AvailableReleases
|
||||||
/// Release query struct
|
/// Release query struct
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
pub struct ReleaseQuery {
|
pub struct ReleaseQuery {
|
||||||
architecture: String,
|
pub architecture: String,
|
||||||
heap_size: String,
|
pub heap_size: String,
|
||||||
image_type: String,
|
pub image_type: String,
|
||||||
os: String,
|
pub jvm_impl: String,
|
||||||
page_size: u64,
|
pub os: String,
|
||||||
project: String,
|
pub page_size: u64,
|
||||||
|
pub project: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to get the release info for a particular version
|
/// Attempts to get the release info for a particular version
|
||||||
|
@ -163,6 +162,7 @@ pub async fn get_release(client: &Client, version: u64, release_type: &str) -> R
|
||||||
os: "linux".to_string(),
|
os: "linux".to_string(),
|
||||||
page_size: PAGE_SIZE,
|
page_size: PAGE_SIZE,
|
||||||
project: "jdk".to_string(),
|
project: "jdk".to_string(),
|
||||||
|
jvm_impl: "hotspot".to_string(),
|
||||||
})
|
})
|
||||||
.map_err(|e| eyre!(e))
|
.map_err(|e| eyre!(e))
|
||||||
.context("Failed to build request")?
|
.context("Failed to build request")?
|
||||||
|
@ -182,11 +182,11 @@ pub async fn get_release(client: &Client, version: u64, release_type: &str) -> R
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to get all the versions
|
/// Attempts to get all the versions
|
||||||
pub async fn get_releases(client: &Client) -> Result<HashMap<u64, Release>> {
|
pub async fn get_releases(client: &Client) -> Result<BTreeMap<u64, Release>> {
|
||||||
let available = get_available_releases(client)
|
let available = get_available_releases(client)
|
||||||
.await
|
.await
|
||||||
.context("Failed to list adoptium releases")?;
|
.context("Failed to list adoptium releases")?;
|
||||||
let mut output = HashMap::new();
|
let mut output = BTreeMap::new();
|
||||||
// Get the generally available version of all the available releases
|
// Get the generally available version of all the available releases
|
||||||
for version in available.available_releases {
|
for version in available.available_releases {
|
||||||
let release = get_release(client, version, "ga").await.with_context(|| {
|
let release = get_release(client, version, "ga").await.with_context(|| {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{collections::HashMap, process::Command};
|
use std::{collections::BTreeMap, process::Command};
|
||||||
|
|
||||||
use color_eyre::{
|
use color_eyre::{
|
||||||
eyre::{eyre, Context, Result},
|
eyre::{eyre, Context, Result},
|
||||||
|
@ -9,6 +9,8 @@ use surf::Client;
|
||||||
|
|
||||||
/// Adoptium API
|
/// Adoptium API
|
||||||
pub mod adoptium;
|
pub mod adoptium;
|
||||||
|
/// Semeru API
|
||||||
|
pub mod semeru;
|
||||||
|
|
||||||
/// Java release struct
|
/// Java release struct
|
||||||
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
|
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
|
||||||
|
@ -23,7 +25,7 @@ pub struct Release {
|
||||||
/// Sources serialization struct
|
/// Sources serialization struct
|
||||||
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
|
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
|
||||||
pub struct Sources {
|
pub struct Sources {
|
||||||
versions: HashMap<String, Release>,
|
versions: BTreeMap<String, Release>,
|
||||||
latest: Release,
|
latest: Release,
|
||||||
stable: Release,
|
stable: Release,
|
||||||
lts: Release,
|
lts: Release,
|
||||||
|
@ -75,7 +77,7 @@ async fn main() -> Result<()> {
|
||||||
// Get adoptium releases
|
// Get adoptium releases
|
||||||
let adoptium_releases = get_adoptium_releases(&client).await?;
|
let adoptium_releases = get_adoptium_releases(&client).await?;
|
||||||
// Spit out to the serialization format
|
// Spit out to the serialization format
|
||||||
let adoptium = Sources {
|
let temurin = Sources {
|
||||||
versions: adoptium_releases
|
versions: adoptium_releases
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -94,11 +96,31 @@ async fn main() -> Result<()> {
|
||||||
.expect("Missing release")
|
.expect("Missing release")
|
||||||
.clone(),
|
.clone(),
|
||||||
};
|
};
|
||||||
let system = System {
|
// Get semeru releases
|
||||||
temurin: adoptium,
|
|
||||||
..Default::default()
|
let semeru_releases = get_semeru_releases(&client).await?;
|
||||||
|
// Spit out to the serialization format
|
||||||
|
let semeru = Sources {
|
||||||
|
versions: semeru_releases
|
||||||
|
.clone()
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (format!("jdk{}", k), v))
|
||||||
|
.collect(),
|
||||||
|
latest: semeru_releases
|
||||||
|
.get(&available.most_recent_feature_release)
|
||||||
|
.expect("Missing release")
|
||||||
|
.clone(),
|
||||||
|
stable: semeru_releases
|
||||||
|
.get(&available.most_recent_feature_release)
|
||||||
|
.expect("Missing release")
|
||||||
|
.clone(),
|
||||||
|
lts: semeru_releases
|
||||||
|
.get(<s_version)
|
||||||
|
.expect("Missing release")
|
||||||
|
.clone(),
|
||||||
};
|
};
|
||||||
let mut systems = HashMap::new();
|
let system = System { temurin, semeru };
|
||||||
|
let mut systems = BTreeMap::new();
|
||||||
systems.insert("x86_64-linux".to_string(), system);
|
systems.insert("x86_64-linux".to_string(), system);
|
||||||
let output = serde_json::to_string_pretty(&systems).context("Failed to encode sources")?;
|
let output = serde_json::to_string_pretty(&systems).context("Failed to encode sources")?;
|
||||||
println!("{}", output);
|
println!("{}", output);
|
||||||
|
@ -106,8 +128,22 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the releases from adoptium
|
/// Get the releases from adoptium
|
||||||
pub async fn get_adoptium_releases(client: &Client) -> Result<HashMap<u64, Release>> {
|
pub async fn get_adoptium_releases(client: &Client) -> Result<BTreeMap<u64, Release>> {
|
||||||
let releases: Result<HashMap<u64, Release>> = adoptium::get_releases(&client)
|
let releases: Result<BTreeMap<u64, Release>> = adoptium::get_releases(client)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.map(|(key, val)| match val.try_into() {
|
||||||
|
Ok(val) => Ok((key, val)),
|
||||||
|
Err(err) => Err(err),
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
releases.context("Failed getting release from adoptium")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the releases from semeru
|
||||||
|
pub async fn get_semeru_releases(client: &Client) -> Result<BTreeMap<u64, Release>> {
|
||||||
|
let releases: Result<BTreeMap<u64, Release>> = semeru::get_releases(client)
|
||||||
.await?
|
.await?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(key, val)| match val.try_into() {
|
.map(|(key, val)| match val.try_into() {
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
use color_eyre::{
|
||||||
|
eyre::{eyre, Context, Result},
|
||||||
|
Help, SectionExt,
|
||||||
|
};
|
||||||
|
use surf::Client;
|
||||||
|
|
||||||
|
use crate::adoptium::{AvailableReleases, Release, ReleaseQuery};
|
||||||
|
|
||||||
|
/// Page size
|
||||||
|
pub const PAGE_SIZE: u64 = 10;
|
||||||
|
|
||||||
|
/// Attempts to get the available releases
|
||||||
|
pub async fn get_available_releases(client: &Client) -> Result<AvailableReleases> {
|
||||||
|
let endpoint = "https://api.adoptopenjdk.net/v3/info/available_releases?jvm_impl=openj9";
|
||||||
|
client
|
||||||
|
.get(endpoint)
|
||||||
|
.recv_json()
|
||||||
|
.await
|
||||||
|
.map_err(|e| eyre!(e))
|
||||||
|
.context("Failed to request available versions from semeru")
|
||||||
|
.with_section(|| endpoint.to_string().header("Failed Request:"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Attempts to get the release info for a particular version
|
||||||
|
pub async fn get_release(client: &Client, version: u64, release_type: &str) -> Result<Release> {
|
||||||
|
let endpoint = format!(
|
||||||
|
"https://api.adoptopenjdk.net/v3/assets/feature_releases/{}/{}",
|
||||||
|
version, release_type
|
||||||
|
);
|
||||||
|
let request = client
|
||||||
|
.get(endpoint)
|
||||||
|
.query(&ReleaseQuery {
|
||||||
|
architecture: "x64".to_string(),
|
||||||
|
heap_size: "normal".to_string(),
|
||||||
|
image_type: "jdk".to_string(),
|
||||||
|
os: "linux".to_string(),
|
||||||
|
page_size: PAGE_SIZE,
|
||||||
|
project: "jdk".to_string(),
|
||||||
|
jvm_impl: "openj9".to_string(),
|
||||||
|
})
|
||||||
|
.map_err(|e| eyre!(e))
|
||||||
|
.context("Failed to build request")?
|
||||||
|
.build();
|
||||||
|
let query = request.url().as_str().to_string();
|
||||||
|
let mut releases: Vec<Release> = client
|
||||||
|
.recv_json(request)
|
||||||
|
.await
|
||||||
|
.map_err(|e| eyre!(e))
|
||||||
|
.context("Failed to get release information from semeru")
|
||||||
|
.with_section(move || query.header("Failed Request"))?;
|
||||||
|
releases.sort();
|
||||||
|
match releases.pop() {
|
||||||
|
Some(release) => Ok(release),
|
||||||
|
None => Err(eyre!("Semeru endpoint did not return any valid releases")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Attempts to get all the versions
|
||||||
|
pub async fn get_releases(client: &Client) -> Result<BTreeMap<u64, Release>> {
|
||||||
|
let available = get_available_releases(client)
|
||||||
|
.await
|
||||||
|
.context("Failed to list semeru releases")?;
|
||||||
|
let mut output = BTreeMap::new();
|
||||||
|
// Get the generally available version of all the available releases
|
||||||
|
for version in available.available_releases {
|
||||||
|
let release = get_release(client, version, "ga").await.with_context(|| {
|
||||||
|
format!("Failed to get version {} from the semeru archive", version)
|
||||||
|
})?;
|
||||||
|
output.insert(version, release);
|
||||||
|
}
|
||||||
|
// See if we already have the latest version
|
||||||
|
if output.contains_key(&available.most_recent_feature_version) {
|
||||||
|
// Go ahead and return
|
||||||
|
Ok(output)
|
||||||
|
} else {
|
||||||
|
let version = available.most_recent_feature_version;
|
||||||
|
// Otherwise try to get an EA version of it
|
||||||
|
|
||||||
|
match get_release(client, version, "ea").await {
|
||||||
|
Ok(release) => {
|
||||||
|
output.insert(version, release);
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!(
|
||||||
|
"Failed to get version {} (latest) from the semeru archive: {:?}",
|
||||||
|
version, e
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(output)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue