summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-03-19 10:31:07 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-13 02:03:54 -0400
commit8ad8dc412f0b070df63e42e68468df08ac0f559a (patch)
treeafd78cdf15acc3d731fe59674e9843f4fba28c8a /mk
parent670c3e5c84c5b638dc6277289db3cbbc39a03c36 (diff)
downloadhaskell-8ad8dc412f0b070df63e42e68468df08ac0f559a.tar.gz
get-win32-tarballs: Improve diagnostics output
Diffstat (limited to 'mk')
-rwxr-xr-xmk/get-win32-tarballs.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mk/get-win32-tarballs.py b/mk/get-win32-tarballs.py
index 8604547f48..50a4e19965 100755
--- a/mk/get-win32-tarballs.py
+++ b/mk/get-win32-tarballs.py
@@ -5,6 +5,7 @@ from pathlib import Path
import urllib.request
import subprocess
import argparse
+from sys import stderr
TARBALL_VERSION = '0.1'
BASE_URL = "https://downloads.haskell.org/ghc/mingw/{}".format(TARBALL_VERSION)
@@ -18,11 +19,13 @@ def file_url(arch: str, fname: str) -> str:
fname=fname)
def fetch(url: str, dest: Path):
- print('Fetching', url, '=>', dest)
+ print('Fetching', url, '=>', dest, file=stderr)
urllib.request.urlretrieve(url, dest)
def fetch_arch(arch: str):
- req = urllib.request.urlopen(file_url(arch, 'MANIFEST'))
+ manifest_url = file_url(arch, 'MANIFEST')
+ print('Fetching', manifest_url, file=stderr)
+ req = urllib.request.urlopen(manifest_url)
files = req.read().decode('UTF-8').split('\n')
d = DEST / arch
if not d.is_dir():
@@ -35,6 +38,9 @@ def fetch_arch(arch: str):
verify(arch)
def verify(arch: str):
+ if not Path(DEST / arch / "SHA256SUMS").is_file():
+ raise IOError("SHA256SUMS doesn't exist; have you fetched?")
+
cmd = ['sha256sum', '--quiet', '--check', '--ignore-missing', 'SHA256SUMS']
subprocess.check_call(cmd, cwd=DEST / arch)