Compare commits

...

2 Commits

Author SHA1 Message Date
Nathan McCarty 29505e1397
Update flake 2022-11-29 04:26:36 -05:00
Nathan McCarty 240d66807c
rewrite updater 2022-11-29 04:26:25 -05:00
9 changed files with 949 additions and 1681 deletions

View File

@ -7,7 +7,7 @@
}; };
outputs = { self, nixpkgs, utils }: outputs = { self, nixpkgs, utils }:
utils.lib.eachSystem [ "x86_64-linux" ] (system: utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let let
sources = builtins.fromJSON (builtins.readFile ./sources.json); sources = builtins.fromJSON (builtins.readFile ./sources.json);
buildAdoptLike = with import nixpkgs { system = system; }; buildAdoptLike = with import nixpkgs { system = system; };

View File

@ -1,172 +1,309 @@
{ {
"x86_64-linux": { "aarch64-linux": {
"temurin": { "semeru": {
"versions": { "versions": {
"jdk10": {
"link": "https://github.com/AdoptOpenJDK/openjdk10-binaries/releases/download/jdk-10.0.2%2B13.1/OpenJDK10U-jdk_x64_linux_hotspot_10.0.2_13.tar.gz",
"major_version": 10,
"sha256": "3998c36c7feb4bb7a565b3d33609ec67acd40f1ae5addf103378f2ef32ab377f",
"java_version": "10.0.2+13.1"
},
"jdk11": { "jdk11": {
"link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz", "link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16.1_1.tar.gz",
"major_version": 11, "major_version": 11,
"java_version": "11.0.15+10", "sha256": "5f6b513757d386352cf91514ed5859d1ab59364b4453e1f1c57152ba2039b8e2",
"early_access": false, "java_version": "11.0.16.1+1"
"sha256": "02sdnmk9zswi5skhyik1zaqm08v6cyggjc7c7ykwrw322rd4vnsz" },
"jdk12": {
"link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_linux_hotspot_12.0.2_10.tar.gz",
"major_version": 12,
"sha256": "1202f536984c28d68681d51207a84b6c76e5998579132d3fe1b8085aa6a5f21e",
"java_version": "12.0.2+10"
},
"jdk13": {
"link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jdk_x64_linux_hotspot_13.0.2_8.tar.gz",
"major_version": 13,
"sha256": "9ccc063569f19899fd08e41466f8c4cd4e05058abdb5178fa374cb365dcf5998",
"java_version": "13.0.2+8"
},
"jdk14": {
"link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz",
"major_version": 14,
"sha256": "7d5ee7e06909b8a99c0d029f512f67b092597aa5b0e78c109bd59405bbfa74fe",
"java_version": "14.0.2+12"
},
"jdk15": {
"link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7/OpenJDK15U-jdk_x64_linux_hotspot_15.0.2_7.tar.gz",
"major_version": 15,
"sha256": "94f20ca8ea97773571492e622563883b8869438a015d02df6028180dd9acc24d",
"java_version": "15.0.2+7"
}, },
"jdk16": { "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", "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, "major_version": 16,
"java_version": "16.0.2+7", "sha256": "323d6d7474a359a28eff7ddd0df8e65bd61554a8ed12ef42fd9365349e573c2c",
"early_access": false, "java_version": "16.0.2+7"
"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.4.1%2B1/OpenJDK17U-jdk_x64_linux_hotspot_17.0.4.1_1.tar.gz",
"major_version": 17, "major_version": 17,
"java_version": "17.0.3+7", "sha256": "5fbf8b62c44f10be2efab97c5f5dbf15b74fae31e451ec10abbc74e54a04ff44",
"early_access": false, "java_version": "17.0.4.1+1"
"sha256": "0wvbvv01jiwkj84kqnbnqfivjy0cca8h7d8996qgpybp239bxxc1"
}, },
"jdk18": { "jdk18": {
"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.2.1%2B1/OpenJDK18U-jdk_x64_linux_hotspot_18.0.2.1_1.tar.gz",
"major_version": 18, "major_version": 18,
"java_version": "18.0.1+10", "sha256": "7d6beba8cfc0a8347f278f7414351191a95a707d46b6586e9a786f2669af0f8b",
"early_access": false, "java_version": "18.0.2.1+1"
"sha256": "18mhq6bqhbig58w2n0iw2ssz9ir48dk9rzd10jpmgh92bzbxkc8n"
}, },
"jdk19": { "jdk19": {
"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", "link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19%2B36/OpenJDK19U-jdk_x64_linux_hotspot_19_36.tar.gz",
"major_version": 19, "major_version": 19,
"java_version": "19-beta+27-202206180349", "sha256": "d10becfc1ea6586180246455ee8d462875f97655416a7d7c5a1c60d0570dbc8f",
"early_access": true, "java_version": "19+36"
"sha256": "1p2w8ipv6nlk5h4qdl70lbjdd5xy44p5yanc0q28bnf8m9898c99"
}, },
"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/jdk8u352-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u352b08.tar.gz",
"major_version": 8, "major_version": 8,
"java_version": "1.8.0_332-b09", "sha256": "1633bd7590cb1cd72f5a1378ae8294451028b274d798e2a4ac672059a2f00fee",
"early_access": false, "java_version": "1.8.0_352-b08"
"sha256": "1nl37nyy6bcw91ym0529mpjh7chysq88zd416h57zms00l53mhdd" },
"jdk9": {
"link": "https://github.com/AdoptOpenJDK/openjdk9-binaries/releases/download/jdk-9%2B181/OpenJDK9U-jdk_x64_linux_hotspot_9_181.tar.gz",
"major_version": 9,
"sha256": "ebe1eaad73584f70ab4e587ab9367fb15af820745979e68350fe80fadf615df8",
"java_version": "9+181"
} }
}, },
"latest": { "latest": {
"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", "link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19u-2022-11-26-09-40-beta/OpenJDK19U-jdk_x64_linux_hotspot_2022-11-26-09-40.tar.gz",
"major_version": 19, "major_version": 19,
"java_version": "19-beta+27-202206180349", "sha256": "065146884aaf051f4e5fff6f2bd615865124c4db5ca1cd7c97c68b93ef9265ae",
"early_access": true, "java_version": "19.0.1-beta+10-202211260350"
"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/temurin19-binaries/releases/download/jdk19-2022-10-06-09-10-beta/OpenJDK19U-jdk_x64_linux_hotspot_2022-10-06-09-10.tar.gz",
"major_version": 18, "major_version": 19,
"java_version": "18.0.1+10", "sha256": "e3b9b64914d20fe56b881eee98e9372cf8517ec52b3c1b1f68babdd294d31182",
"early_access": false, "java_version": "19-beta+36-202210060344"
"sha256": "18mhq6bqhbig58w2n0iw2ssz9ir48dk9rzd10jpmgh92bzbxkc8n"
}, },
"lts": { "lts": {
"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/jdk17u-2022-11-25-15-05-beta/OpenJDK17U-jdk_x64_linux_hotspot_2022-11-25-15-05.tar.gz",
"major_version": 17, "major_version": 17,
"java_version": "17.0.3+7", "sha256": "a20bb727ca8477a3f1375982ebd7052c74b3e6e858f523392d0cbfba1d2b2b89",
"early_access": false, "java_version": "17.0.6-beta+4-202211250013"
"sha256": "0wvbvv01jiwkj84kqnbnqfivjy0cca8h7d8996qgpybp239bxxc1"
} }
}, },
"temurin": {
"versions": {
"jdk11": {
"link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.17_8.tar.gz",
"major_version": 11,
"sha256": "b8d46ed08ef4859476fe6421a7690d899ed83dce63f13fd894f994043177ef3c",
"java_version": "11.0.17+8"
},
"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,
"sha256": "323d6d7474a359a28eff7ddd0df8e65bd61554a8ed12ef42fd9365349e573c2c",
"java_version": "16.0.2+7"
},
"jdk17": {
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.5%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.5_8.tar.gz",
"major_version": 17,
"sha256": "482180725ceca472e12a8e6d1a4af23d608d78287a77d963335e2a0156a020af",
"java_version": "17.0.5+8"
},
"jdk18": {
"link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.2.1%2B1/OpenJDK18U-jdk_x64_linux_hotspot_18.0.2.1_1.tar.gz",
"major_version": 18,
"sha256": "7d6beba8cfc0a8347f278f7414351191a95a707d46b6586e9a786f2669af0f8b",
"java_version": "18.0.2.1+1"
},
"jdk19": {
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19.0.1%2B10/OpenJDK19U-jdk_x64_linux_hotspot_19.0.1_10.tar.gz",
"major_version": 19,
"sha256": "163da7ea140210bae97c6a4590c757858ab4520a78af0e3e33129863d4087552",
"java_version": "19.0.1+10"
},
"jdk8": {
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u352-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u352b08.tar.gz",
"major_version": 8,
"sha256": "1633bd7590cb1cd72f5a1378ae8294451028b274d798e2a4ac672059a2f00fee",
"java_version": "1.8.0_352-b08"
}
},
"latest": {
"link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk-2022-11-25-14-40-beta/OpenJDK-jdk_x64_linux_hotspot_2022-11-25-03-30.tar.gz",
"major_version": 20,
"sha256": "c94c0062160350d3a595337f3b7bd3e4e8b55e037a262317185d11c3b4ecaf66",
"java_version": "20-beta+25-202211250348"
},
"stable": {
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19u-2022-11-26-09-40-beta/OpenJDK19U-jdk_x64_linux_hotspot_2022-11-26-09-40.tar.gz",
"major_version": 19,
"sha256": "065146884aaf051f4e5fff6f2bd615865124c4db5ca1cd7c97c68b93ef9265ae",
"java_version": "19.0.1-beta+10-202211260350"
},
"lts": {
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17u-2022-11-25-15-05-beta/OpenJDK17U-jdk_x64_linux_hotspot_2022-11-25-15-05.tar.gz",
"major_version": 17,
"sha256": "a20bb727ca8477a3f1375982ebd7052c74b3e6e858f523392d0cbfba1d2b2b89",
"java_version": "17.0.6-beta+4-202211250013"
}
}
},
"x86_64-linux": {
"semeru": { "semeru": {
"versions": { "versions": {
"jdk10": { "jdk10": {
"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", "link": "https://github.com/AdoptOpenJDK/openjdk10-binaries/releases/download/jdk-10.0.2%2B13.1/OpenJDK10U-jdk_x64_linux_hotspot_10.0.2_13.tar.gz",
"major_version": 10, "major_version": 10,
"java_version": "10.0.2+13", "sha256": "3998c36c7feb4bb7a565b3d33609ec67acd40f1ae5addf103378f2ef32ab377f",
"early_access": false, "java_version": "10.0.2+13.1"
"sha256": "1lbr2y1ld57s5kbdan254mq5kf7w960yym0q15k3cbrvhnrxmw0y"
}, },
"jdk11": { "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", "link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16.1_1.tar.gz",
"major_version": 11, "major_version": 11,
"java_version": "11.0.15+10", "sha256": "5f6b513757d386352cf91514ed5859d1ab59364b4453e1f1c57152ba2039b8e2",
"early_access": false, "java_version": "11.0.16.1+1"
"sha256": "135gpvhcncw5j3n7yhfhhlcnpfzq605m4v8m1l2712q77vfdfqvh"
}, },
"jdk12": { "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", "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_linux_hotspot_12.0.2_10.tar.gz",
"major_version": 12, "major_version": 12,
"java_version": "12.0.2+10", "sha256": "1202f536984c28d68681d51207a84b6c76e5998579132d3fe1b8085aa6a5f21e",
"early_access": false, "java_version": "12.0.2+10"
"sha256": "0ab22d1603c0j40df3qamgq3cnvfhm3w22lqc1y23pqdaqhz1xp2"
}, },
"jdk13": { "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", "link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jdk_x64_linux_hotspot_13.0.2_8.tar.gz",
"major_version": 13, "major_version": 13,
"java_version": "13.0.2+8", "sha256": "9ccc063569f19899fd08e41466f8c4cd4e05058abdb5178fa374cb365dcf5998",
"early_access": false, "java_version": "13.0.2+8"
"sha256": "1415qpv9gwzrz3cxfrlkqa84ii2xgvwkqy873nw7v10c1p9zdv5f"
}, },
"jdk14": { "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", "link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz",
"major_version": 14, "major_version": 14,
"java_version": "14.0.2+12", "sha256": "7d5ee7e06909b8a99c0d029f512f67b092597aa5b0e78c109bd59405bbfa74fe",
"early_access": false, "java_version": "14.0.2+12"
"sha256": "1gpkrbk64dhry1jfkcl39ha8h877pnpnrhvfb7ralpdnrlw72vrh"
}, },
"jdk15": { "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", "link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7/OpenJDK15U-jdk_x64_linux_hotspot_15.0.2_7.tar.gz",
"major_version": 15, "major_version": 15,
"java_version": "15.0.2+7", "sha256": "94f20ca8ea97773571492e622563883b8869438a015d02df6028180dd9acc24d",
"early_access": false, "java_version": "15.0.2+7"
"sha256": "05j807m13rlfnx7xjihf210vpxvj2bzdb02vc658sphvkgbwq5am"
}, },
"jdk16": { "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", "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, "major_version": 16,
"java_version": "16.0.2+7", "sha256": "323d6d7474a359a28eff7ddd0df8e65bd61554a8ed12ef42fd9365349e573c2c",
"early_access": false, "java_version": "16.0.2+7"
"sha256": "0vl8q3v35j5229qvxz64lp25f0vk4q0shrjdk2hr3x4s3ndfnj8k"
}, },
"jdk17": { "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", "link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1%2B1/OpenJDK17U-jdk_x64_linux_hotspot_17.0.4.1_1.tar.gz",
"major_version": 17, "major_version": 17,
"java_version": "17.0.3+7", "sha256": "5fbf8b62c44f10be2efab97c5f5dbf15b74fae31e451ec10abbc74e54a04ff44",
"early_access": false, "java_version": "17.0.4.1+1"
"sha256": "1pdvj0spbsnai6hk5s3ciid9mgqbcrxmc3fn4b67b5jk7m9h9jkx"
}, },
"jdk18": { "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", "link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.2.1%2B1/OpenJDK18U-jdk_x64_linux_hotspot_18.0.2.1_1.tar.gz",
"major_version": 18, "major_version": 18,
"java_version": "18.0.1+10", "sha256": "7d6beba8cfc0a8347f278f7414351191a95a707d46b6586e9a786f2669af0f8b",
"early_access": false, "java_version": "18.0.2.1+1"
"sha256": "1spm6ypyrwa8j85kpz4v7337kad8v94wacnfr1rk2klw2q1n253f" },
"jdk19": {
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19%2B36/OpenJDK19U-jdk_x64_linux_hotspot_19_36.tar.gz",
"major_version": 19,
"sha256": "d10becfc1ea6586180246455ee8d462875f97655416a7d7c5a1c60d0570dbc8f",
"java_version": "19+36"
}, },
"jdk8": { "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", "link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u352-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u352b08.tar.gz",
"major_version": 8, "major_version": 8,
"java_version": "1.8.0_332-b09", "sha256": "1633bd7590cb1cd72f5a1378ae8294451028b274d798e2a4ac672059a2f00fee",
"early_access": false, "java_version": "1.8.0_352-b08"
"sha256": "1ivm8wccxa4j04vvmvymgfb23kd3jl33mhap4mlja9gkpj92vzxy"
}, },
"jdk9": { "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", "link": "https://github.com/AdoptOpenJDK/openjdk9-binaries/releases/download/jdk-9%2B181/OpenJDK9U-jdk_x64_linux_hotspot_9_181.tar.gz",
"major_version": 9, "major_version": 9,
"java_version": "9.0.4+12", "sha256": "ebe1eaad73584f70ab4e587ab9367fb15af820745979e68350fe80fadf615df8",
"early_access": false, "java_version": "9+181"
"sha256": "0svf3rvbpjzg85v6nxwcy6n45v5byjpihiwil2msdhagxnvl3fym"
} }
}, },
"latest": { "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", "link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19u-2022-11-26-09-40-beta/OpenJDK19U-jdk_x64_linux_hotspot_2022-11-26-09-40.tar.gz",
"major_version": 18, "major_version": 19,
"java_version": "18.0.1+10", "sha256": "065146884aaf051f4e5fff6f2bd615865124c4db5ca1cd7c97c68b93ef9265ae",
"early_access": false, "java_version": "19.0.1-beta+10-202211260350"
"sha256": "1spm6ypyrwa8j85kpz4v7337kad8v94wacnfr1rk2klw2q1n253f"
}, },
"stable": { "stable": {
"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", "link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19-2022-10-06-09-10-beta/OpenJDK19U-jdk_x64_linux_hotspot_2022-10-06-09-10.tar.gz",
"major_version": 18, "major_version": 19,
"java_version": "18.0.1+10", "sha256": "e3b9b64914d20fe56b881eee98e9372cf8517ec52b3c1b1f68babdd294d31182",
"early_access": false, "java_version": "19-beta+36-202210060344"
"sha256": "1spm6ypyrwa8j85kpz4v7337kad8v94wacnfr1rk2klw2q1n253f"
}, },
"lts": { "lts": {
"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", "link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17u-2022-11-25-15-05-beta/OpenJDK17U-jdk_x64_linux_hotspot_2022-11-25-15-05.tar.gz",
"major_version": 17, "major_version": 17,
"java_version": "17.0.3+7", "sha256": "a20bb727ca8477a3f1375982ebd7052c74b3e6e858f523392d0cbfba1d2b2b89",
"early_access": false, "java_version": "17.0.6-beta+4-202211250013"
"sha256": "1pdvj0spbsnai6hk5s3ciid9mgqbcrxmc3fn4b67b5jk7m9h9jkx" }
},
"temurin": {
"versions": {
"jdk11": {
"link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.17_8.tar.gz",
"major_version": 11,
"sha256": "b8d46ed08ef4859476fe6421a7690d899ed83dce63f13fd894f994043177ef3c",
"java_version": "11.0.17+8"
},
"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,
"sha256": "323d6d7474a359a28eff7ddd0df8e65bd61554a8ed12ef42fd9365349e573c2c",
"java_version": "16.0.2+7"
},
"jdk17": {
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.5%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.5_8.tar.gz",
"major_version": 17,
"sha256": "482180725ceca472e12a8e6d1a4af23d608d78287a77d963335e2a0156a020af",
"java_version": "17.0.5+8"
},
"jdk18": {
"link": "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18.0.2.1%2B1/OpenJDK18U-jdk_x64_linux_hotspot_18.0.2.1_1.tar.gz",
"major_version": 18,
"sha256": "7d6beba8cfc0a8347f278f7414351191a95a707d46b6586e9a786f2669af0f8b",
"java_version": "18.0.2.1+1"
},
"jdk19": {
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-19.0.1%2B10/OpenJDK19U-jdk_x64_linux_hotspot_19.0.1_10.tar.gz",
"major_version": 19,
"sha256": "163da7ea140210bae97c6a4590c757858ab4520a78af0e3e33129863d4087552",
"java_version": "19.0.1+10"
},
"jdk8": {
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u352-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u352b08.tar.gz",
"major_version": 8,
"sha256": "1633bd7590cb1cd72f5a1378ae8294451028b274d798e2a4ac672059a2f00fee",
"java_version": "1.8.0_352-b08"
}
},
"latest": {
"link": "https://github.com/adoptium/temurin20-binaries/releases/download/jdk-2022-11-25-14-40-beta/OpenJDK-jdk_x64_linux_hotspot_2022-11-25-03-30.tar.gz",
"major_version": 20,
"sha256": "c94c0062160350d3a595337f3b7bd3e4e8b55e037a262317185d11c3b4ecaf66",
"java_version": "20-beta+25-202211250348"
},
"stable": {
"link": "https://github.com/adoptium/temurin19-binaries/releases/download/jdk19u-2022-11-26-09-40-beta/OpenJDK19U-jdk_x64_linux_hotspot_2022-11-26-09-40.tar.gz",
"major_version": 19,
"sha256": "065146884aaf051f4e5fff6f2bd615865124c4db5ca1cd7c97c68b93ef9265ae",
"java_version": "19.0.1-beta+10-202211260350"
},
"lts": {
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17u-2022-11-25-15-05-beta/OpenJDK17U-jdk_x64_linux_hotspot_2022-11-25-15-05.tar.gz",
"major_version": 17,
"sha256": "a20bb727ca8477a3f1375982ebd7052c74b3e6e858f523392d0cbfba1d2b2b89",
"java_version": "17.0.6-beta+4-202211250013"
} }
} }
} }

1526
updater/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
async-std = { version = "1.10.0", features = ["std", "async-global-executor", "futures-lite", "num_cpus", "attributes"], default-features = false } async-std = { version = "1.12.0", features = ["attributes"] }
color-eyre = "0.5.11" color-eyre = "0.5.11"
isahc = "1.7.2"
serde = { version = "1.0.132", features = ["derive"] } serde = { version = "1.0.132", features = ["derive"] }
serde_json = "1.0.73" serde_json = "1.0.73"
surf = { version = "2.3.2", features = ["h1-client-rustls", "encoding"], default-features = false } urlencoding = "2.1.2"

View File

@ -67,8 +67,6 @@
}; };
devBase = with pkgs; [ devBase = with pkgs; [
# Build tools # Build tools
openssl
pkg-config
rust-analyzer rust-analyzer
cmake cmake
gnuplot gnuplot
@ -92,10 +90,7 @@
# Sourcehut # Sourcehut
hut hut
]; ];
sharedDeps = with pkgs; sharedDeps = with pkgs; [ curl openssl pkg-config ];
[
];
sharedNativeDeps = with pkgs; sharedNativeDeps = with pkgs;
[ [

View File

@ -1,216 +0,0 @@
use std::collections::BTreeMap;
use color_eyre::{
eyre::{eyre, Context, Result},
Help, SectionExt,
};
use serde::{Deserialize, Serialize};
use surf::Client;
/// Page size
pub const PAGE_SIZE: u64 = 10;
/// Response from `/v3/info/available_releases` endpoint
#[derive(Deserialize, Serialize, Debug)]
pub struct AvailableReleases {
pub available_lts_releases: Vec<u64>,
pub available_releases: Vec<u64>,
pub most_recent_feature_release: u64,
pub most_recent_feature_version: u64,
pub tip_version: u64,
}
/// Package for a particular binary
#[derive(Deserialize, Serialize, Debug)]
pub struct Package {
checksum: String,
checksum_link: String,
download_count: u64,
pub link: String,
name: String,
size: u64,
}
/// Information about a particular binary
#[derive(Deserialize, Serialize, Debug)]
pub struct Binary {
architecture: String,
download_count: u64,
heap_size: String,
image_type: String,
jvm_impl: String,
os: String,
pub package: Package,
project: String,
updated_at: String,
}
/// Information about a source
#[derive(Deserialize, Serialize, Debug)]
pub struct Source {
link: String,
name: String,
size: u64,
}
/// Version data
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq)]
pub struct VersionData {
pub build: u64,
pub major: u64,
pub minor: u64,
pub openjdk_version: String,
pub security: u64,
pub semver: String,
}
impl PartialOrd for VersionData {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
match self.major.partial_cmp(&other.major) {
Some(std::cmp::Ordering::Equal) => {}
ord => return ord,
}
match self.minor.partial_cmp(&other.minor) {
Some(std::cmp::Ordering::Equal) => {}
ord => return ord,
}
match self.security.partial_cmp(&other.security) {
Some(std::cmp::Ordering::Equal) => {}
ord => return ord,
}
self.build.partial_cmp(&other.build)
}
}
impl Ord for VersionData {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.partial_cmp(other).unwrap()
}
}
/// Information about a particular feature release
#[derive(Deserialize, Serialize, Debug)]
pub struct Release {
pub binaries: Vec<Binary>,
download_count: u64,
id: String,
release_link: String,
pub release_type: String,
source: Option<Source>,
timestamp: String,
updated_at: String,
vendor: String,
pub version_data: VersionData,
}
impl PartialEq for Release {
fn eq(&self, other: &Self) -> bool {
self.version_data == other.version_data
}
}
impl Eq for Release {}
impl PartialOrd for Release {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.version_data.partial_cmp(&other.version_data)
}
}
impl Ord for Release {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.version_data.cmp(&other.version_data)
}
}
/// Attempts to get the available releases
pub async fn get_available_releases(client: &Client) -> Result<AvailableReleases> {
let endpoint = "https://api.adoptium.net/v3/info/available_releases";
client
.get(endpoint)
.recv_json()
.await
.map_err(|e| eyre!(e))
.context("Failed to request available versions from adoptium")
.with_section(|| endpoint.to_string().header("Failed Request:"))
}
/// Release query struct
#[derive(Deserialize, Serialize, Debug)]
pub struct ReleaseQuery {
pub architecture: String,
pub heap_size: String,
pub image_type: String,
pub jvm_impl: String,
pub os: String,
pub page_size: u64,
pub project: String,
}
/// 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.adoptium.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: "hotspot".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 adoptium")
.with_section(move || query.header("Failed Request"))?;
releases.sort();
match releases.pop() {
Some(release) => Ok(release),
None => Err(eyre!("Adoptium 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 adoptium 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 adoptium 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
let release = get_release(client, version, "ea").await.with_context(|| {
format!(
"Failed to get version {} (latest) from the adoptium archive",
version
)
})?;
output.insert(version, release);
Ok(output)
}
}

246
updater/src/api.rs Normal file
View File

@ -0,0 +1,246 @@
use std::collections::BTreeMap;
use async_std::io::ReadExt;
use color_eyre::{
eyre::{Context, ContextCompat},
Result,
};
use isahc::HttpClient;
use serde::{Deserialize, Serialize};
/// Abstraction over an adoptium API instance
pub struct AdoptiumAPI {
/// Base URL
base_url: String,
/// Client
client: HttpClient,
/// Jvm_Impl string
jvm_impl: String,
}
impl AdoptiumAPI {
/// Create a new adoptium api pointing at adoptium
pub fn adoptium() -> Result<Self> {
Ok(AdoptiumAPI {
base_url: "https://api.adoptium.net".to_string(),
client: HttpClient::new().context("failed to open http client")?,
jvm_impl: "hotspot".to_string(),
})
}
/// Create a new api pointing at semeru
pub fn semeru() -> Result<Self> {
Ok(AdoptiumAPI {
base_url: "https://api.adoptopenjdk.net".to_string(),
client: HttpClient::new().context("failed to open http client")?,
jvm_impl: "openj9".to_string(),
})
}
/// Get the availble releases
pub async fn available_releases(&self) -> Result<AvailableReleases> {
let response = self
.client
.get_async(format!("{}/v3/info/available_releases", self.base_url))
.await
.context("Failed to request releases")?;
let mut body = response.into_body();
let mut contents = String::new();
body.read_to_string(&mut contents)
.await
.context("Failed to convert body to string")?;
let output = serde_json::from_str(&contents).context("Failed to parse json")?;
Ok(output)
}
/// Return the most recent version for the specified release and architecture
pub async fn release(
&self,
version: u32,
arch: impl AsRef<str>,
pre_release: bool,
) -> Result<Version> {
let release_type = if pre_release { "ea" } else { "ga" };
let arch = arch.as_ref();
let version = format!("[{version}, {})", version + 1);
let version = urlencoding::encode(&version);
let url = format!(
"{}/v3/info/release_versions?architecture={arch}&heap_size=normal&image_type=jdk&os_type=linux&project=jdk&release_type={release_type}&sort_method=DATE&sort_order=DESC&jvm_impl={}&version={version}",
self.base_url,
self.jvm_impl,
);
let mut response = self
.client
.get_async(url)
.await
.context("Failed to request release")?
.into_body();
let mut body = String::new();
response
.read_to_string(&mut body)
.await
.context("Failed to convert response to string")?;
let output: Versions = serde_json::from_str(&body).context("Failed to parse json")?;
let output = output.versions.get(0).context("No Versions")?;
Ok(output.clone())
}
/// Return latest release
pub async fn latest(
&self,
version: u32,
arch: impl AsRef<str>,
pre_release: bool,
) -> Result<Release> {
let release_type = if pre_release { "ea" } else { "ga" };
let arch = arch.as_ref();
let url = format!(
"{}/v3/assets/feature_releases/{version}/{release_type}?architecture={arch}&heap_size=normal&image_type=jdk&jvm_impl=hotspot&os=linux&page=0&page_size=10&project=jdk&sort_method=DATE&sort_order=DESC&jvm_impl={}",
self.base_url,
self.jvm_impl
);
let mut response = self
.client
.get_async(url)
.await
.context("Failed to request release")?
.into_body();
let mut body = String::new();
response
.read_to_string(&mut body)
.await
.context("Failed to convert response to string")?;
let releases: Vec<Release> = serde_json::from_str(&body).context("Failed to parse json")?;
let release = releases.get(0).context("No releases")?;
Ok(release.clone())
}
/// Get all versions
pub async fn get_all(&self, arch: impl AsRef<str>) -> Result<OutputReleases> {
let input_versions = self
.available_releases()
.await
.context("Failed to get releases")?;
let arch = arch.as_ref();
let mut versions: BTreeMap<String, OutputRelease> = BTreeMap::new();
for release in &input_versions.available_releases {
let output_release: OutputRelease = self
.latest(*release, arch, false)
.await
.context("Failed to get version")?
.into();
versions.insert(
format!("jdk{}", output_release.major_version),
output_release,
);
}
let latest: OutputRelease = self
.latest(input_versions.most_recent_feature_version, arch, true)
.await
.context("Failed to get version")?
.into();
let stable: OutputRelease = self
.latest(
input_versions.available_releases[input_versions.available_releases.len() - 1],
arch,
true,
)
.await
.context("Failed to get version")?
.into();
let lts: OutputRelease = self
.latest(
input_versions.available_lts_releases
[input_versions.available_lts_releases.len() - 1],
arch,
true,
)
.await
.context("Failed to get version")?
.into();
Ok(OutputReleases {
versions,
latest,
stable,
lts,
})
}
}
/// Output for an arch
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct OutputReleases {
versions: BTreeMap<String, OutputRelease>,
latest: OutputRelease,
stable: OutputRelease,
lts: OutputRelease,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct OutputRelease {
link: String,
major_version: u32,
sha256: String,
java_version: String,
}
impl From<Release> for OutputRelease {
fn from(release: Release) -> Self {
OutputRelease {
link: release.binaries[0].package.link.clone(),
major_version: release.version_data.major,
sha256: release.binaries[0].package.checksum.clone(),
java_version: release.version_data.openjdk_version,
}
}
}
/// `/v3/info/available_releases`
#[derive(Debug, Serialize, Deserialize)]
pub struct AvailableReleases {
pub available_releases: Vec<u32>,
pub available_lts_releases: Vec<u32>,
pub most_recent_lts: u32,
pub most_recent_feature_release: u32,
pub most_recent_feature_version: u32,
pub tip_version: u32,
}
/// `/v3/info/release_verions`
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Version {
major: u32,
minor: u32,
security: u32,
patch: Option<u32>,
pre: Option<String>,
adopt_build_number: Option<u64>,
semver: String,
openjdk_version: String,
build: Option<u64>,
optional: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Versions {
versions: Vec<Version>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Release {
version_data: Version,
binaries: Vec<Binary>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Binary {
architecture: String,
package: Package,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Package {
checksum: String,
link: String,
name: String,
}

View File

@ -1,168 +1,60 @@
use std::{collections::BTreeMap, process::Command}; use std::collections::BTreeMap;
use api::OutputReleases;
use color_eyre::{ use color_eyre::{
eyre::{eyre, Context, Result}, eyre::{Context, Result},
Section, SectionExt,
}; };
use serde::{Deserialize, Serialize};
use surf::Client;
/// Adoptium API
pub mod adoptium;
/// Semeru API
pub mod semeru;
/// Java release struct use crate::api::AdoptiumAPI;
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct Release {
link: String,
major_version: u64,
java_version: String,
early_access: bool,
sha256: String,
}
/// Sources serialization struct /// API Abstraction
#[derive(Deserialize, Serialize, Debug, Clone, Default)] pub mod api;
pub struct Sources {
versions: BTreeMap<String, Release>,
latest: Release,
stable: Release,
lts: Release,
}
/// System serialization struct
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct System {
temurin: Sources,
semeru: Sources,
}
impl TryFrom<adoptium::Release> for Release {
type Error = color_eyre::eyre::Report;
fn try_from(value: adoptium::Release) -> Result<Self> {
if value.binaries.len() == 1 {
let package = &value.binaries[0].package;
Ok(Release {
link: package.link.clone(),
major_version: value.version_data.major,
java_version: value.version_data.openjdk_version,
early_access: value.release_type == "ea",
sha256: get_sha256(&package.link).context("Failed to prefetch package")?,
})
} else {
Err(eyre!(
"Adoptium release had an incorrect number of binaries"
))
}
}
}
#[async_std::main] #[async_std::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
color_eyre::install()?; color_eyre::install()?;
// Create a client let mut output: BTreeMap<String, BTreeMap<String, OutputReleases>> = BTreeMap::new();
let client = Client::new(); // Create the api instances
// Get list of releases from adoptium, we'll use this for some other things let adoptium = AdoptiumAPI::adoptium().context("Creating api")?;
let available = adoptium::get_available_releases(&client) let semeru = AdoptiumAPI::semeru().context("Creating api")?;
// Fill in x86_64 first
{
let x86_64 = output.entry("x86_64-linux".to_string()).or_default();
x86_64.insert(
"temurin".to_string(),
adoptium
.get_all("x64")
.await .await
.context("Failed to get list of available releases")?; .context("Failed getting x86_64 adopt releases")?,
let lts_version = available );
.available_lts_releases x86_64.insert(
.iter() "semeru".to_string(),
.copied() semeru
.max() .get_all("x64")
.expect("No LTSs?"); .await
// Get adoptium releases .context("Failed getting x86_64 adopt releases")?,
let adoptium_releases = get_adoptium_releases(&client).await?; );
// Spit out to the serialization format }
let temurin = Sources { // Then aarch64
versions: adoptium_releases {
.clone() let aarch64 = output.entry("aarch64-linux".to_string()).or_default();
.into_iter() aarch64.insert(
.map(|(k, v)| (format!("jdk{}", k), v)) "temurin".to_string(),
.collect(), adoptium
latest: adoptium_releases .get_all("x64")
.get(&available.most_recent_feature_version) .await
.expect("Missing release") .context("Failed getting aarch64 adopt releases")?,
.clone(), );
stable: adoptium_releases aarch64.insert(
.get(&available.most_recent_feature_release) "semeru".to_string(),
.expect("Missing release") semeru
.clone(), .get_all("x64")
lts: adoptium_releases .await
.get(&lts_version) .context("Failed getting aarch64 adopt releases")?,
.expect("Missing release") );
.clone(), }
}; let output = serde_json::to_string_pretty(&output).context("Failed to serialize output")?;
// Get semeru releases println!("{output}");
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(&lts_version)
.expect("Missing release")
.clone(),
};
let system = System { temurin, semeru };
let mut systems = BTreeMap::new();
systems.insert("x86_64-linux".to_string(), system);
let output = serde_json::to_string_pretty(&systems).context("Failed to encode sources")?;
println!("{}", output);
Ok(()) Ok(())
} }
/// Get the releases from adoptium
pub async fn get_adoptium_releases(client: &Client) -> Result<BTreeMap<u64, Release>> {
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?
.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")
}
/// Gets the nix sha256 for a url
fn get_sha256(url: &str) -> Result<String> {
let output = Command::new("nix-prefetch-url")
.args([url, "--type", "sha256"])
.output()
.with_section(|| format!("Failed to prefetch url: {}", url).header("Prefetch Failure"))
.context("Failed to prefetch")?;
let output = String::from_utf8(output.stdout).context("Invalid utf-8 from nix pre fetch")?;
// Trim the trailing new line
Ok(output.trim().to_string())
}

View File

@ -1,95 +0,0 @@
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)
}
}