blob: e7259dc202f9d239de0e6b996e8fb0a814e7956a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/env python3
#
# Calculate checksums for GitHub release artifacts/assets.
#
# Use the direct links rather than getting the tarball URLs from
# the GitHub API since the latter uses the git-sha1 rather than the tag
# in its zipped up content, causing checksum mismatches.
#
import sys
import requests
import hashlib
if __name__ == '__main__':
if len(sys.argv) != 2:
print("Usage: {} <tag>".format(sys.argv[0]))
sys.exit(1)
tag = sys.argv[1]
print("## Checksums")
print("Release asset checksums:")
for ftype in ["zip", "tar.gz"]:
url = "https://github.com/edenhill/librdkafka/archive/{}.{}".format(
tag, ftype)
h = hashlib.sha256()
r = requests.get(url, stream=True)
while True:
buf = r.raw.read(100 * 1000)
if len(buf) == 0:
break
h.update(buf)
print(" * {}.{} SHA256 `{}`".format(tag, ftype, h.hexdigest()))
|