Skip to content

Commit 90bd8e9

Browse files
authored
Name a mirror for everything GNU hosts (#182)
ftp.gnu.org refused connections for over two minutes at a time through 26 and 27 August, and each time it took a whole build with it: six components come from there and gdb is downloaded by every host, so one outage is a red pipeline rather than a slow one. Three softfp builds died this way without saying anything about softfp. Each of the six now names ftpmirror.gnu.org first -- GNU's own redirector to a nearby mirror -- and keeps ftp.gnu.org behind it. ExternalProject tries them in order, and URL_HASH decides whether what came back is the right bytes, so a mirror serving something else fails the way a corrupt download does. Checked against the redirector: gdb-15.2.tar.xz comes back with the sha256 already pinned here. The test refuses a component that names one host, or that does not try the mirror first, or that has no hash to check a mirror against.
1 parent 25a0c0e commit 90bd8e9

2 files changed

Lines changed: 63 additions & 6 deletions

File tree

cmake/Components.cmake

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,20 @@ include_guard(GLOBAL)
44
# hashes together so version updates cannot accidentally mix artifacts.
55
set(GCC_VERSION 15.2.0)
66
set(GCC_HASH SHA256=438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e)
7-
set(GCC_URL https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz)
7+
# Everything below that GNU hosts is named twice: ftpmirror.gnu.org first,
8+
# which is GNU's own redirector to a nearby mirror, and ftp.gnu.org after it.
9+
# ExternalProject tries them in order and URL_HASH decides whether what came
10+
# back is the right bytes, so a mirror serving something else fails the same
11+
# way a corrupt download does.
12+
#
13+
# One host was one host too few. ftp.gnu.org refused connections for over two
14+
# minutes at a time through 26 and 27 August, and each time it took a whole
15+
# build with it -- six components come from there, and gdb is downloaded by
16+
# every host.
17+
18+
set(GCC_URL
19+
https://ftpmirror.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz
20+
https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz)
821

922
set(ZLIB_VERSION 1.3.1)
1023
set(ZLIB_HASH SHA256=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23)
@@ -20,15 +33,21 @@ set(LIBYAML_URL https://pyyaml.org/download/libyaml/yaml-${LIBYAML_VERSION}.tar.
2033

2134
set(GMP_VERSION 6.3.0)
2235
set(GMP_HASH SHA256=ac28211a7cfb609bae2e2c8d6058d66c8fe96434f740cf6fe2e47b000d1c20cb)
23-
set(GMP_URL https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2)
36+
set(GMP_URL
37+
https://ftpmirror.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2
38+
https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2)
2439

2540
set(MPFR_VERSION 4.2.2)
2641
set(MPFR_HASH SHA256=9ad62c7dc910303cd384ff8f1f4767a655124980bb6d8650fe62c815a231bb7b)
27-
set(MPFR_URL https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2)
42+
set(MPFR_URL
43+
https://ftpmirror.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2
44+
https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2)
2845

2946
set(MPC_VERSION 1.3.1)
3047
set(MPC_HASH SHA256=ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8)
31-
set(MPC_URL https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz)
48+
set(MPC_URL
49+
https://ftpmirror.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz
50+
https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz)
3251

3352
set(ISL_VERSION 0.24)
3453
set(ISL_HASH SHA256=043105cc544f416b48736fff8caf077fb0663a717d06b1113f16e391ac99ebad)
@@ -41,11 +60,15 @@ set(EXPAT_URL https://github.com/libexpat/libexpat/releases/download/R_2_3_0/exp
4160

4261
set(BINUTILS_VERSION 2.46.1)
4362
set(BINUTILS_HASH SHA256=e127a709cba24c76de8936cb7083dd768f28cd37eb010492e2f19b71eb1294e4)
44-
set(BINUTILS_URL https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz)
63+
set(BINUTILS_URL
64+
https://ftpmirror.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz
65+
https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz)
4566

4667
set(GDB_VERSION 15.2)
4768
set(GDB_HASH SHA256=83350ccd35b5b5a0cba6b334c41294ea968158c573940904f00b92f76345314d)
48-
set(GDB_URL https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz)
69+
set(GDB_URL
70+
https://ftpmirror.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz
71+
https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz)
4972

5073
set(LIBZIP_VERSION 1.11.4)
5174
set(LIBZIP_HASH SHA256=8a247f57d1e3e6f6d11413b12a6f28a9d388de110adc0ec608d893180ed7097b)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Everything GNU hosts is named twice.
2+
#
3+
# One host was one host too few: ftp.gnu.org refused connections for over two
4+
# minutes at a time through 26 and 27 August and took a whole build with it
5+
# each time. Six components come from there and gdb is downloaded by every
6+
# host, so a single outage is a red pipeline rather than a slow one.
7+
#
8+
# URL_HASH decides whether what came back is the right bytes, so a mirror
9+
# serving something else fails the way a corrupt download does.
10+
11+
cmake_minimum_required(VERSION 3.16)
12+
13+
get_filename_component(repository_root "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
14+
include("${repository_root}/cmake/Components.cmake")
15+
16+
foreach(component GCC GMP MPFR MPC BINUTILS GDB)
17+
set(urls "${${component}_URL}")
18+
list(LENGTH urls count)
19+
if(count LESS 2)
20+
message(SEND_ERROR
21+
"FAIL: ${component}_URL names one host; an outage there is a failed build")
22+
endif()
23+
list(GET urls 0 first)
24+
if(NOT first MATCHES "^https://ftpmirror\\.gnu\\.org/")
25+
message(SEND_ERROR
26+
"FAIL: ${component}_URL does not try GNU's mirror redirector first: ${first}")
27+
endif()
28+
# And the hash, without which a mirror is somebody else's word for it.
29+
if(NOT DEFINED ${component}_HASH)
30+
message(SEND_ERROR "FAIL: ${component} has no hash to check a mirror against")
31+
endif()
32+
endforeach()
33+
34+
message(STATUS "GNU download mirror tests passed")

0 commit comments

Comments
 (0)