survive a transient lookup while assembling the sysroot
The gate failed on name resolution for the package archive after apt had already succeeded in the same job -- intermittent, not configuration.
This commit is contained in:
parent
d277802180
commit
0c95bb6758
1 changed files with 14 additions and 4 deletions
|
|
@ -23,6 +23,7 @@ import re
|
|||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
MIRROR = "http://ports.ubuntu.com/ubuntu-ports"
|
||||
|
|
@ -55,11 +56,20 @@ SKIP = {"gcc", "gcc-13", "libgcc-13-dev", "libc-dev", "libc6-dev-arm64-cross",
|
|||
"pkg-config", "pkgconf", "debconf", "dpkg", "install-info"}
|
||||
|
||||
|
||||
def fetch(url):
|
||||
# The archive rejects urllib's default agent with 403.
|
||||
def fetch(url, attempts=4):
|
||||
# The archive rejects urllib's default agent with 403. The retry is for
|
||||
# transient name resolution: a build that reconstructs 155 packages over
|
||||
# the network should survive one bad lookup rather than failing the gate.
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "viewtop-sysroot/1"})
|
||||
with urllib.request.urlopen(req, timeout=120) as r:
|
||||
return r.read()
|
||||
for attempt in range(attempts):
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=120) as r:
|
||||
return r.read()
|
||||
except urllib.error.URLError as exc:
|
||||
if attempt == attempts - 1:
|
||||
raise
|
||||
print(f" retrying {url.rsplit('/', 1)[-1]} after {exc.reason}", file=sys.stderr)
|
||||
time.sleep(3 * (attempt + 1))
|
||||
|
||||
|
||||
def load_index(suite, component):
|
||||
|
|
|
|||
Loading…
Reference in a new issue