Skip to content

Instantly share code, notes, and snippets.

@asinghvi17
Created May 3, 2024 14:27
Show Gist options
  • Save asinghvi17/9021a2ed4562786913f52c88303908b0 to your computer and use it in GitHub Desktop.
Save asinghvi17/9021a2ed4562786913f52c88303908b0 to your computer and use it in GitHub Desktop.
A simple utility to update all archivesources (with some manual editing)
using SHA
function archive_source_string(prefix_name, prefix, suffix, oldhash::String; joinchar = "", unpack_target = nothing)
url = join((prefix, suffix,), joinchar)
hash = bytes2hex(get_hash(url))
print("ArchiveSource(\"\$($(prefix_name))$(joinchar)$(suffix)\", \"$(hash)\"")
if !isnothing(unpack_target)
print("; unpack_target = \"$(unpack_target)\")")
else
print(")")
end
println(",")
end
get_hash(real_url) = open(io -> SHA.sha256(read(io)), download(real_url), "r")
version = v"20.12.2"
url_prefix = "https://nodejs.org/dist/v$version/node-v$version"
[
archive_source_string("url_prefix", url_prefix, "-linux-x64.tar.gz", "bf3a779bef19452da90fb88358ec2c57e0d2f882839b20dc6afc297b6aafc0d7"; unpack_target = "x86_64-linux-gnu"),
archive_source_string("url_prefix", url_prefix, "-linux-arm64.tar.gz", "e34ab2fc2726b4abd896bcbff0250e9b2da737cbd9d24267518a802ed0606f3b"; unpack_target = "aarch64-linux-gnu"),
archive_source_string("url_prefix", url_prefix, "-linux-ppc64le.tar.gz", "9823305ac3a66925a9b61d8032f6bbb4c3e33c28e7f957ebb27e49732feffb23"; unpack_target = "powerpc64le-linux-gnu"),
archive_source_string("url_prefix", url_prefix, "-linux-armv7l.tar.gz", "e42791f76ece283c7a4b97fbf716da72c5128c54a9779f10f03ae74a4bcfb8f6"; unpack_target = "arm-linux-gnueabihf"),
archive_source_string("url_prefix", url_prefix, "-linux-x64.tar.gz", "bf3a779bef19452da90fb88358ec2c57e0d2f882839b20dc6afc297b6aafc0d7"; unpack_target = "x86_64-linux-musl"),
archive_source_string("url_prefix", url_prefix, "-linux-arm64.tar.gz", "e34ab2fc2726b4abd896bcbff0250e9b2da737cbd9d24267518a802ed0606f3b"; unpack_target = "aarch64-linux-musl"),
archive_source_string("url_prefix", url_prefix, "-linux-armv7l.tar.gz", "e42791f76ece283c7a4b97fbf716da72c5128c54a9779f10f03ae74a4bcfb8f6"; unpack_target = "arm-linux-musleabihf"),
archive_source_string("url_prefix", url_prefix, "-darwin-x64.tar.gz", "c52e7fb0709dbe63a4cbe08ac8af3479188692937a7bd8e776e0eedfa33bb848"; unpack_target = "x86_64-apple-darwin14"),
archive_source_string("url_prefix", url_prefix, "-darwin-arm64.tar.gz", "e0065c61f340e85106a99c4b54746c5cee09d59b08c5712f67f99e92aa44995d"; unpack_target = "aarch64-apple-darwin20"),
archive_source_string("url_prefix", url_prefix, "-win-x64.zip", "bc032628d77d206ffa7f133518a6225a9c5d6d9210ead30d67e294ff37044bda"; unpack_target = "x86_64-w64-mingw32"),
archive_source_string("url_prefix", url_prefix, "-win-x86.zip", "b98e95f78416d1359b647cfa09ba2a48b76d41b56a776df822bf36ffe8e76a2d"; unpack_target = "i686-w64-mingw32"),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment