Support multiple mirrors for each source file

If multiple URLs are entered in a sources listing for the same file,
each will be tried in turn, until either one succeeds, or we fail
having run out of mirrors.
This commit is contained in:
Gábor Stefanik 2024-04-14 00:10:03 +02:00
parent 86e1a5e7f6
commit 89a4d18ff0
3 changed files with 52 additions and 5 deletions

View file

@ -12,6 +12,7 @@ import hashlib
import os
import shutil
import tarfile
import traceback
import requests
# pylint: disable=too-many-instance-attributes
@ -305,7 +306,12 @@ this script the next time")
def get_packages(self):
"""Prepare remaining sources"""
for line in self.source_manifest:
path = self.download_file(line[2], line[1], line[3])
try:
path = self.download_file(line[2], line[1], line[3])
except requests.HTTPError:
print(traceback.format_exc())
for line in self.source_manifest:
path = os.path.join(line[1], line[3])
self.check_file(path, line[0])
@classmethod