From 6faaa82a18224c16b4789d532d970df243ba005f Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 8 Aug 2022 10:56:08 +0100 Subject: [PATCH] Consistently default stable-only to true Previously, gnomechecker would default stable-only to true, but anityachecker and pypichecker defaulted it to false. true is the sensible default, in my opinion: it is more common to want stable release only than it is to track prereleases. Update the test suite to exercise all three paths: true, false and unset. (We don't actually make any assertions about what the default is; it is hard to do so without a mock anitya.) --- README.md | 3 ++- src/checkers/anityachecker.py | 2 +- src/checkers/pypichecker.py | 2 +- tests/org.flatpak.Flatpak.yml | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d5dbde78..9f21817c 100644 --- a/README.md +++ b/README.md @@ -368,7 +368,8 @@ and add a template for source download URL. "url-template": "https://github.com/flatpak/flatpak/releases/download/$version/flatpak-$version.tar.xz" } ``` -Set `stable-only` to `true` to retrieve latest stable version (as recognized by Anitya). + +Set `stable-only` to `false` to include unstable releases (as recognized by Anitya). The [`versions`](#version-constraining) property is supported. diff --git a/src/checkers/anityachecker.py b/src/checkers/anityachecker.py index 1cc4b165..164607cb 100644 --- a/src/checkers/anityachecker.py +++ b/src/checkers/anityachecker.py @@ -48,7 +48,7 @@ async def check(self, external_data: ExternalBase): "baseurl", "https://release-monitoring.org" ) versions_url = URL(instance_url) / "api/v2/versions/" - stable_only = external_data.checker_data.get("stable-only", False) + stable_only = external_data.checker_data.get("stable-only", True) constraints = external_data.checker_data.get("versions", {}).items() query = {"project_id": external_data.checker_data["project-id"]} diff --git a/src/checkers/pypichecker.py b/src/checkers/pypichecker.py index 90d63ab4..83048a67 100644 --- a/src/checkers/pypichecker.py +++ b/src/checkers/pypichecker.py @@ -73,7 +73,7 @@ async def check(self, external_data: ExternalBase): (o, Version(v)) for o, v in external_data.checker_data.get("versions", {}).items() ] - stable_only = external_data.checker_data.get("stable-only", False) + stable_only = external_data.checker_data.get("stable-only", True) async with self.session.get(f"{PYPI_INDEX}/{package_name}/json") as response: pypi_data = await response.json() diff --git a/tests/org.flatpak.Flatpak.yml b/tests/org.flatpak.Flatpak.yml index e1603bb4..a799d0e4 100644 --- a/tests/org.flatpak.Flatpak.yml +++ b/tests/org.flatpak.Flatpak.yml @@ -20,6 +20,7 @@ modules: x-checker-data: type: anitya project-id: 6377 + stable-only: false versions: ==: "1.10.1" url-template: https://github.com/flatpak/flatpak/releases/download/$version/flatpak-$version.tar.xz @@ -43,6 +44,7 @@ modules: x-checker-data: type: anitya project-id: 1157 + # Leaving stable-only unset to at least exercise the default path url-template: https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$version0$version1$version2/ghostscript-$version.tar.xz - name: gnuradio-iqbal