Skip to content

Commit

Permalink
Skip and don't add duplicate errors
Browse files Browse the repository at this point in the history
Extract `files/share` for screenshot check like everywhere elese and remove
the "appstream-missing-appinfo" error. Instead raise an exception like
we do everywhere else.
  • Loading branch information
bbhtt committed Jun 24, 2024
1 parent 81ace49 commit 71da849
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
13 changes: 0 additions & 13 deletions flatpak_builder_lint/checks/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,11 @@ def _validate(self, path: str, appid: str) -> None:
return None

if not os.path.exists(appstream_path):
self.errors.add("appstream-missing-appinfo-file")
self.info.add(
"appstream-missing-appinfo-file: Appstream catalogue file is missing."
+ " Perhaps no Metainfo file was installed with correct name"
)
return None

if len(appstream.components(appstream_path)) != 1:
self.errors.add("appstream-multiple-components")
return None

if not appstream.is_valid_component_type(appstream_path):
self.errors.add("appstream-unsupported-component-type")
self.info.add(
"appstream-unsupported-component-type: Component type must be one of"
+ " addon, console-application, desktop, desktop-application or runtime"
)

if appstream.component_type(appstream_path) not in (
"desktop",
"desktop-application",
Expand Down
24 changes: 3 additions & 21 deletions flatpak_builder_lint/checks/screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,17 @@ def check_repo(self, path: str) -> None:
refs = refs_cmd["stdout"].splitlines()

with tempfile.TemporaryDirectory() as tmpdir:
ret = ostree.extract_subpath(path, ref, "files/share/app-info", tmpdir)
ret = ostree.extract_subpath(path, ref, "files/share", tmpdir)
if ret["returncode"] != 0:
self.errors.add("appstream-missing-appinfo")
self.info.add(
"appstream-missing-appinfo: files/share/app-info directory is missing"
+ " Perhaps no Metainfo file was supplied"
)
return
raise RuntimeError("Failed to extract ostree repo")

appstream_path = f"{tmpdir}/xmls/{appid}.xml.gz"
appstream_path = f"{tmpdir}/app-info/xmls/{appid}.xml.gz"
if not os.path.exists(appstream_path):
self.errors.add("appstream-missing-appinfo-file")
self.info.add(
"appstream-missing-appinfo-file: Appstream catalogue file is missing."
+ " Perhaps no Metainfo file was installed with correct name"
)
return

if len(appstream.components(appstream_path)) != 1:
self.errors.add("appstream-multiple-components")
return

if not appstream.is_valid_component_type(appstream_path):
self.errors.add("appstream-unsupported-component-type")
self.info.add(
"appstream-unsupported-component-type: Component type must be one of"
+ " addon, console-application, desktop, desktop-application or runtime"
)

if appstream.component_type(appstream_path) not in (
"desktop",
"desktop-application",
Expand Down

0 comments on commit 71da849

Please sign in to comment.