Skip to content

Commit

Permalink
metainfo: Allow all exportable values in launchable tag
Browse files Browse the repository at this point in the history
We check if the file named by the value is present in the next check
`appstream-launchable-file-missing` anyways so it doesn't hurt to allow
typos and fail on the next check instead of blocking all exportable
patterns altogether.

[release]
  • Loading branch information
bbhtt committed Dec 5, 2024
1 parent 201935c commit c5f42ce
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions flatpak_builder_lint/checks/metainfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,15 @@ def _validate(self, path: str, appid: str) -> None:
if not appstream.get_launchable(appstream_path):
self.errors.add("metainfo-missing-launchable-tag")

launchable_value = None
launchable_file_path = None
if appstream.get_launchable(appstream_path):
launchable_value = appstream.get_launchable(appstream_path)[0]
launchable_file_path = f"{launchable_dir}/{launchable_value}"
else:
launchable_value = None
launchable_file_path = None

# Don't allow all exportable combinations to avoid issues
# like typos. This must match the main desktop file named by
# appid.desktop and must not have multiple launchables in
# metainfo per the spec
if launchable_value is not None and launchable_value != appid + ".desktop":
launchable_file_path = os.path.join(launchable_dir, launchable_value)

if launchable_value is not None and not re.match(
rf"^{appid}([-.].*)?[.]desktop$", launchable_value
):
self.errors.add("metainfo-launchable-tag-wrong-value")
self.info.add(
"metainfo-launchable-tag-wrong-value: The value of launchable tag in Metainfo"
Expand Down

0 comments on commit c5f42ce

Please sign in to comment.