Skip to content

Commit

Permalink
Don't warn on prefixes which are subpaths of /app or /usr
Browse files Browse the repository at this point in the history
flatpak-builder only passes those two by default. Any subpaths being
used may have significance to the module being built, so ignore them
  • Loading branch information
bbhtt authored and barthalion committed Dec 5, 2023
1 parent 81f593b commit 7b23ad3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flatpak_builder_lint/checks/modules.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from . import Check


Expand Down Expand Up @@ -47,7 +49,7 @@ def check_module(self, module: dict) -> None:
if buildsystem == "autotools":
if config_opts := module.get("config-opts"):
for opt in config_opts:
if opt.startswith("--prefix="):
if re.match("^--prefix=(/(usr|app)|\\${FLATPAK_DEST})/?$", opt):
self.warnings.add(f"module-{name}-autotools-redundant-prefix")
elif opt.startswith("--enable-debug") and not opt.endswith("=no"):
self.errors.add(f"module-{name}-autotools-non-release-build")
Expand All @@ -58,7 +60,10 @@ def check_module(self, module: dict) -> None:
if buildsystem in ("cmake-ninja", "cmake"):
if config_opts := module.get("config-opts"):
for opt in config_opts:
if opt.startswith("-DCMAKE_INSTALL_PREFIX"):
if re.match(
"^-DCMAKE_INSTALL_PREFIX(:PATH)?=(/(usr|app)|\\${FLATPAK_DEST})/?$",
opt,
):
self.warnings.add(f"module-{name}-cmake-redundant-prefix")
elif opt.startswith("-DCMAKE_BUILD_TYPE"):
split = opt.split("=")
Expand Down

0 comments on commit 7b23ad3

Please sign in to comment.