Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ubuntu_lint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion ubuntu_lint/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
13 changes: 9 additions & 4 deletions ubuntu_lint/linters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down