Skip to content
Snippets Groups Projects
Commit 980e1270 authored by Tamar Christina's avatar Tamar Christina Committed by Ben Gamari
Browse files

Windows: Update the mirror script to generate hashes and use mirror fallback

This fixes the mirror script so it correctly queries haskell.org and if
packages aren't found check repo.msys2.org.

Also the mirror functionality now generates the md5 hashes after a
mirror fetch that can be placed in the md5sums file.

Test Plan:
 mk/get-win32-tarballs.sh fetch mirror

 and ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D4118
parent 2a4c24e4
No related branches found
No related tags found
No related merge requests found
......@@ -22,11 +22,11 @@ download_file() {
if ! test -f "${dest_file}"
then
local curl_cmd="curl -L ${file_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
local curl_cmd="curl -f -L ${file_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
if test -n "${backup_url}"; then
local curl_cmd_bnk="curl -L ${backup_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
local curl_cmd_bnk="curl -f -L ${backup_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}"
else
local curl_cmd_bnk="echo 1"
local curl_cmd_bnk="true"
fi
if test "$download" = "0"
......@@ -37,9 +37,10 @@ download_file() {
return
else
echo "Downloading ${description} to ${dest_dir}..."
$curl_cmd || $curl_cmd_bnk || {
$curl_cmd || echo "Checking repo.msys2.org instead of Haskell.org..." && $curl_cmd_bnk || {
rm -f "${dest_file}"
fail "ERROR: Download failed."
exit 1
}
fi
fi
......@@ -48,10 +49,16 @@ download_file() {
if test "$sigs" = "1" -a ! -f "$sig_file"
then
echo "Downloading ${description} (signature) to ${dest_dir}..."
local curl_cmd="curl -L ${file_url}.sig -o ${sig_file} --create-dirs -# ${extra_curl_opts}"
$curl_cmd || {
local curl_cmd="curl -f -L ${file_url}.sig -o ${sig_file} --create-dirs -# ${extra_curl_opts}"
if test -n "${backup_url}"; then
local curl_cmd_bnk="curl -f -L ${backup_url} -o ${sig_file} --create-dirs -# ${extra_curl_opts}"
else
local curl_cmd_bnk="true"
fi
$curl_cmd || echo "Checking repo.msys2.org instead of Haskell.org..." && $curl_cmd_bnk || {
rm -f "${dest_file}.sig"
fail "ERROR: Download failed."
exit 1
}
fi
......@@ -72,6 +79,7 @@ download_mingw() {
-e 's/-sources-/-/' \
-e 's/-libwinpthread-git-/-winpthreads-git-/' `
local mingw_url="${mingw_base_url_primary}/${mingw_url_tmp}"
local mingw_url_backup="${mingw_base_url_secondary}/${mingw_url_tmp}"
else
local mingw_url="${mingw_base_url_primary}/$1"
local mingw_url_backup="${mingw_base_url_secondary}/$1"
......@@ -165,6 +173,10 @@ sync_binaries_and_sources() {
done
}
show_hashes_for_binaries() {
$FIND ghc-tarballs/ -iname "*.*" | xargs md5sum | grep -v "\.sig" | sed -s "s/\*//"
}
usage() {
echo "$0 - Download GHC mingw toolchain tarballs"
echo
......@@ -175,6 +187,7 @@ usage() {
echo " download download the necessary tarballs for the given architecture"
echo " fetch download the necessary tarballs for the given architecture but doesn't verify their md5."
echo " verify verify the existence and correctness of the necessary tarballs"
echo " hash generate md5 hashes for inclusion in win32-tarballs.md5sum"
echo " sync upload packages downloaded with 'fetch mirror' to haskell.org"
echo ""
echo "and <arch> is one of i386, x86_64,all or mirror (which includes sources)"
......@@ -199,6 +212,10 @@ case $1 in
verify=0
sync=1
;;
hash)
show_hashes_for_binaries
exit 1
;;
*)
usage
exit 1
......@@ -222,6 +239,7 @@ case $2 in
download_x86_64
verify=0
download_sources
show_hashes_for_binaries
;;
*)
if test "$sync" = "1"; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment