diff --git a/ubuntu_lint/cli.py b/ubuntu_lint/cli.py index 99fa050..e5e8445 100644 --- a/ubuntu_lint/cli.py +++ b/ubuntu_lint/cli.py @@ -66,8 +66,8 @@ def set_linter( del self._action_by_name[name] except KeyError: pass - finally: - return + + return self._checks_by_name[name] = fn self._action_by_name[name] = failure_action diff --git a/ubuntu_lint/context.py b/ubuntu_lint/context.py index 09ab9e7..ea9d898 100644 --- a/ubuntu_lint/context.py +++ b/ubuntu_lint/context.py @@ -51,6 +51,7 @@ def __init__( if not any((self._changes, self._changelog)): raise ValueError("context requires at least one of changes or changelog") + self._lp: Launchpad | None = None if launchpad_handle is not None: self._lp = launchpad_handle @@ -95,4 +96,7 @@ def is_stable_release(self) -> bool: else: raise ValueError("missing required context, require changelog or changes") - return dist in distro_info.UbuntuDistroInfo().supported() + di = distro_info.UbuntuDistroInfo() + stable = set(di.supported() + di.supported_esm()) - set([di.devel()]) + + return dist in stable diff --git a/ubuntu_lint/linters.py b/ubuntu_lint/linters.py index e66bc40..7612ef5 100644 --- a/ubuntu_lint/linters.py +++ b/ubuntu_lint/linters.py @@ -71,11 +71,16 @@ def check_missing_git_ubuntu_references(context: Context): if missing: context.lint_fail("changes file is missing {}".format(", ".join(missing))) - r = requests.get(f"{vcs_git}/patch/?h={vcs_git_ref}") - if r.ok and r.text.startswith(f"From {vcs_git_commit} "): - return + url = f"{vcs_git}/patch/?h={vcs_git_ref}" + r = requests.get(url) + if not r.ok: + if r.status_code == 404: + context.lint_fail(f"{url} does not exist") + else: + context.lint_fail(f"failed to check {url} (status_code={r.status_code})") - context.lint_fail("Vcs-Git fields in changes file do not match the remote") + if not r.text.startswith(f"From {vcs_git_commit} "): + context.lint_fail("Vcs-Git fields in changes file do not match the remote") def check_missing_pending_changelog_entry(context: Context):