]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2539] hammer.py: warn if there is no Release file
authorAndrei Pavel <andrei@isc.org>
Tue, 6 Sep 2022 13:38:44 +0000 (16:38 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 7 Oct 2022 12:08:03 +0000 (15:08 +0300)
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.

hammer.py

index ee750646b12f21aa687612a598542436095cc5d0..bf2dcebcc5b84f8bdfef9121d9df4938e37e8304 100755 (executable)
--- 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)