mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 01:24:09 +01:00
scripts/kde: handle missing hashes gracefully
This commit is contained in:
parent
454765d7f5
commit
a2f4f88315
1 changed files with 12 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.beautifulsoup4 ps.click ps.httpx ps.jinja2 ps.packaging ps.pyyaml ])" nix-update
|
||||
import base64
|
||||
import binascii
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
|
@ -112,8 +113,17 @@ def main(pkgset: str, version: str, nixpkgs: pathlib.Path, sources_url: str | No
|
|||
|
||||
url = urljoin(sources_url, link.attrs["href"])
|
||||
|
||||
hash = client.get(url + ".sha256").text.split(" ", maxsplit=1)[0]
|
||||
assert hash
|
||||
hash = client.get(url + ".sha256").text.strip()
|
||||
|
||||
if hash == "Hash type not supported":
|
||||
print(f"{url} missing hash on CDN, downloading...")
|
||||
hasher = hashlib.sha256()
|
||||
with client.stream("GET", url, follow_redirects=True) as r:
|
||||
for data in r.iter_bytes():
|
||||
hasher.update(data)
|
||||
hash = hasher.hexdigest()
|
||||
else:
|
||||
hash = hash.split(" ", maxsplit=1)[0]
|
||||
|
||||
if existing := results.get(project_name):
|
||||
old_version = existing["version"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue