From: Andrei Pavel Date: Tue, 6 Sep 2022 13:38:44 +0000 (+0300) Subject: [#2539] hammer.py: warn if there is no Release file X-Git-Tag: Kea-2.3.2~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f773fbfc0c6e883c707d8dd481bc1cdfbc4574e;p=thirdparty%2Fkea.git [#2539] hammer.py: warn if there is no Release file It solves errors that appear on the first time a Debian package is uploaded like: E: The repository 'https://packages.aws.isc.org/repository/kea-2.3-debian-11-ci kea Release' does not have a Release file. --- diff --git a/hammer.py b/hammer.py index ee750646b1..bf2dcebcc5 100755 --- a/hammer.py +++ b/hammer.py @@ -2273,11 +2273,27 @@ def _build_deb(system, revision, features, tarball_path, env, check_times, dry_r if system == 'debian' and revision == '9': # debian 9 does not support apt-installing over https, so install proper transport install_pkgs('apt-transport-https', env=env, check_times=check_times) + + # See if a .deb package had been previously uploaded. + _, output = execute("curl -o /dev/null -s -w '%{{http_code}}' {}/dists/kea/Release 2>/dev/null".format(repo_url), capture=True) + http_code = output.rstrip() + release_file_exists = (http_code == '200') + if release_file_exists: + log.info(f'{repo_url}/dists/kea/Release exists.') + else: + repo_name = 'kea-%s-%s-%s' % (pkg_version.rsplit('.', 1)[0], system, revision) + log.error(f'{repo_url}/dists/kea/Release does not exist. ' + f'This is usually caused by no package existing in {repo_name}. ' + 'You can solve this by uploading the freeradius-client packages ' + 'which are also needed further to build packages. ' + 'Continuing, but the build will likely fail.') + # install our freeradius-client but now from deb execute("echo 'deb %s kea main' | sudo tee /etc/apt/sources.list.d/isc.list" % repo_url) key_url = "%s/repository/repo-keys/repo-key.gpg" % repository_url execute('wget -qO- %s | sudo apt-key add -' % key_url, env=env, check_times=check_times) + # try apt update for up to 10 times if there is an error for _ in range(10): _, out = _apt_update(system, revision, capture=True)