tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
scripts/kde: handle missing hashes gracefully
K900
8 months ago
a2f4f883
454765d7
+12
-2
1 changed file
expand all
collapse all
unified
split
maintainers
scripts
kde
generate-sources.py
+12
-2
maintainers/scripts/kde/generate-sources.py
···
2
#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.beautifulsoup4 ps.click ps.httpx ps.jinja2 ps.packaging ps.pyyaml ])" nix-update
3
import base64
4
import binascii
0
5
import json
6
import pathlib
7
import subprocess
···
112
113
url = urljoin(sources_url, link.attrs["href"])
114
115
-
hash = client.get(url + ".sha256").text.split(" ", maxsplit=1)[0]
116
-
assert hash
0
0
0
0
0
0
0
0
0
117
118
if existing := results.get(project_name):
119
old_version = existing["version"]
···
2
#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.beautifulsoup4 ps.click ps.httpx ps.jinja2 ps.packaging ps.pyyaml ])" nix-update
3
import base64
4
import binascii
5
+
import hashlib
6
import json
7
import pathlib
8
import subprocess
···
113
114
url = urljoin(sources_url, link.attrs["href"])
115
116
+
hash = client.get(url + ".sha256").text.strip()
117
+
118
+
if hash == "Hash type not supported":
119
+
print(f"{url} missing hash on CDN, downloading...")
120
+
hasher = hashlib.sha256()
121
+
with client.stream("GET", url, follow_redirects=True) as r:
122
+
for data in r.iter_bytes():
123
+
hasher.update(data)
124
+
hash = hasher.hexdigest()
125
+
else:
126
+
hash = hash.split(" ", maxsplit=1)[0]
127
128
if existing := results.get(project_name):
129
old_version = existing["version"]