libsignal-service-java/update-hashes.py

30 lines
891 B
Python
Raw Normal View History

#!/usr/bin/env python3
import requests
import hashlib
import json
2022-02-12 07:18:25 +00:00
VERSION = "0.12.3"
TARGETS = [
"aarch64-unknown-linux-gnu",
"arm-unknown-linux-gnueabi",
"arm-unknown-linux-gnueabihf",
"armv7-unknown-linux-gnueabihf",
2022-03-04 21:00:03 +00:00
"x86-64-unknown-linux-gnu",
"x86-64-apple-darwin"
]
2022-02-12 07:18:25 +00:00
urlFormat = "https://gitlab.com/api/v4/groups/6853927/-/packages/maven/org/signald/signal-client-java-{target}/{version}/signal-client-java-{target}-{version}.{ext}"
output = {}
for target in TARGETS:
output[target] = {}
for ext in ["jar", "module"]:
url = urlFormat.format(target=target, version=VERSION, ext=ext)
print("fetching {}".format(url))
r = requests.get(url, allow_redirects=True)
r.raise_for_status()
output[target][ext] = hashlib.sha256(r.content).hexdigest()
with open('hashes.json', 'w') as f:
json.dump(output, f, indent=4)