Skip to content

Commit

Permalink
Allow ref_branch and target_repo mismatches for known branches
Browse files Browse the repository at this point in the history
Only verify that "stable" refs don't end up in beta repos and
vice-versa. For any other arbitrary ref branches it is not possible to
tell the intended target repo. So unless the ref_branch matches some
known branches that are already in use and have some significance return
"flat-manager-branch-repo" mismatch error
  • Loading branch information
bbhtt committed Nov 28, 2023
1 parent c0d3849 commit 9202528
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion flatpak_builder_lint/checks/flatmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,28 @@ def check_repo(self, path: str) -> None:
for build_ref in build_extended.get("build_refs", [])
]

ref_allowed_mismatches = ("stable", "beta")

if token_type == "app":
has_app_ref = any(ref.startswith("app/") for ref in refs)
if not has_app_ref:
self.errors.add("flat-manager-no-app-ref-uploaded")

for ref in refs:
ref_branch = ref.split("/")[-1]
if ref_branch != target_repo:

if ref_branch == "stable" and target_repo == "beta":
self.errors.add("flat-manager-stable-ref-beta-target-repo")
break

if ref_branch == "beta" and target_repo == "stable":
self.errors.add("flat-manager-beta-ref-stable-target-repo")
break

if (
ref_branch != target_repo
and ref_branch not in ref_allowed_mismatches
):
self.errors.add("flat-manager-branch-repo-mismatch")
break
else:
Expand All @@ -74,12 +88,21 @@ def check_repo(self, path: str) -> None:
appref = appref_list[0]
_, appid, _, branch = appref.split("/")

if ref_branch == "stable" and target_repo == "beta":
self.errors.add("flat-manager-stable-ref-beta-target-repo")
return

if ref_branch == "beta" and target_repo == "stable":
self.errors.add("flat-manager-beta-ref-stable-target-repo")
return

if (
not (
appid.split(".")[-1] == "BaseApp"
or appid.startswith("org.freedesktop.Platform.")
or appid == "org.winehq.Wine"
)
and branch != target_repo
and ref_branch not in ref_allowed_mismatches
):
self.errors.add("flat-manager-branch-repo-mismatch")

0 comments on commit 9202528

Please sign in to comment.