diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-10-14 00:57:14 +0530 |
---|---|---|
committer | L. E. Segovia <amy@centricular.com> | 2024-10-15 14:32:34 -0300 |
commit | e3e20f08f891172c08098234958ef2d42808802a (patch) | |
tree | ab3aa82b1a0f733c6a733c6526f382adfa0f06e3 | |
parent | 8ae0b49e9843017906254c69792910f1ecd4488e (diff) |
cerbero: Switch from wget to curl on Fedora 40 and newer
Fedora 40 switched from wget to wget2, and doesn't backport critical
bugfixes such as returning a non-zero status code on error, which can
happen due to any number of reasons, such as certificate
incompatibilities, network issues, domain not existing, server issues,
etc.
In these cases we get a success code and we don't try the fallback URL
and we fail in extract() with a confusing error message saying that
the downloaded tarball was not found.
Switch to curl, which doesn't have such issues.
(cherry picked from commit 412c7642a88ff0c5398c38660e202bd29edca665)
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1591>
-rw-r--r-- | cerbero/bootstrap/linux.py | 18 | ||||
-rw-r--r-- | cerbero/utils/shell.py | 20 |
2 files changed, 23 insertions, 15 deletions
diff --git a/cerbero/bootstrap/linux.py b/cerbero/bootstrap/linux.py index d7ab0836..b3f70d82 100644 --- a/cerbero/bootstrap/linux.py +++ b/cerbero/bootstrap/linux.py @@ -164,7 +164,6 @@ class RedHatBootstrapper(UnixBootstrapper): 'libXi-devel', 'perl-XML-Simple', 'gperf', - 'wget', 'libXrandr-devel', 'libXtst-devel', 'git', @@ -178,13 +177,22 @@ class RedHatBootstrapper(UnixBootstrapper): def __init__(self, config, offline, assume_yes): UnixBootstrapper.__init__(self, config, offline, assume_yes) + dv = self.config.distro_version - if self.config.distro_version < DistroVersion.FEDORA_23: + if dv < 'fedora_23': self.tool = ['yum'] - elif self.config.distro_version in [DistroVersion.REDHAT_6, DistroVersion.REDHAT_7]: + elif dv in [DistroVersion.REDHAT_6, DistroVersion.REDHAT_7]: self.tool = ['yum'] - elif self.config.distro_version == DistroVersion.REDHAT_8: - self.tool = ['yum', '--enablerepo=PowerTools'] + elif dv.startswith('redhat_8'): + if dv < 'redhat_8.3': + self.tool = ['yum', '--enablerepo=PowerTools'] + else: + self.tool = ['dnf', '--enablerepo=powertools'] + + if dv.startswith('fedora_') and dv > 'fedora_39': + self.packages.append('curl') + else: + self.packages.append('wget') if self.config.target_platform == Platform.WINDOWS: if self.config.arch == Architecture.X86_64: diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index dc290d5f..ad302943 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -427,16 +427,6 @@ async def download(url, dest, check_cert=True, overwrite=False, logfile=None, mi f'Invoke-WebRequest -UserAgent {user_agent} -OutFile {dest} ' '-Method Get -Uri %s', ] - elif shutil.which('wget2'): - cmd = ['wget2', '--user-agent', user_agent, '--tries=2', '--timeout=20', '-O', dest] - if not check_cert: - cmd += ['--no-check-certificate'] - cmd += ['%s'] - elif shutil.which('wget'): - cmd = ['wget', '--user-agent', user_agent, '--tries=2', '--timeout=20', '--progress=dot:giga', '-O', dest] - if not check_cert: - cmd += ['--no-check-certificate'] - cmd += ['%s'] elif shutil.which('curl'): cmd = [ 'curl', @@ -455,6 +445,16 @@ async def download(url, dest, check_cert=True, overwrite=False, logfile=None, mi if not check_cert: cmd += ['-k'] cmd += ['%s'] + elif shutil.which('wget2'): + cmd = ['wget2', '--user-agent', user_agent, '--tries=2', '--timeout=20', '-O', dest] + if not check_cert: + cmd += ['--no-check-certificate'] + cmd += ['%s'] + elif shutil.which('wget'): + cmd = ['wget', '--user-agent', user_agent, '--tries=2', '--timeout=20', '--progress=dot:giga', '-O', dest] + if not check_cert: + cmd += ['--no-check-certificate'] + cmd += ['%s'] else: raise FatalError('Need either wget or curl to download things') |