Skip to content

Commit

Permalink
modules: Remove redundant prefix warnings
Browse files Browse the repository at this point in the history
Redundancy is harmless here and we can never promote this to an error,
keeping it as a warning has little value.

[release]
  • Loading branch information
bbhtt committed Oct 18, 2024
1 parent 29f3499 commit fd8b75f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
14 changes: 2 additions & 12 deletions flatpak_builder_lint/checks/modules.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

from . import Check


Expand Down Expand Up @@ -47,23 +45,15 @@ def check_module(self, module: dict) -> None:

if buildsystem == "autotools" and (config_opts := module.get("config-opts")):
for opt in config_opts:
if re.match(
"^--prefix=(/(usr|app)|\\$FLATPAK_DEST|\\${FLATPAK_DEST})/?$",
opt,
):
self.warnings.add(f"module-{name}-autotools-redundant-prefix")
elif opt.startswith("--enable-debug") and not opt.endswith("=no"):
if opt.startswith("--enable-debug") and not opt.endswith("=no"):
self.errors.add(f"module-{name}-autotools-non-release-build")

if buildsystem == "cmake":
self.warnings.add(f"module-{name}-buildsystem-is-plain-cmake")

cm_reg = "^-DCMAKE_INSTALL_PREFIX(:PATH)?=(/(usr|app)|\\$FLATPAK_DEST|\\${FLATPAK_DEST})/?$"
if buildsystem in ("cmake-ninja", "cmake") and (config_opts := module.get("config-opts")):
for opt in config_opts:
if re.match(cm_reg, opt):
self.warnings.add(f"module-{name}-cmake-redundant-prefix")
elif opt.startswith("-DCMAKE_BUILD_TYPE"):
if opt.startswith("-DCMAKE_BUILD_TYPE"):
split = opt.split("=")
# There is too many possible choices and customizations.
# So just make this a warning.
Expand Down
10 changes: 1 addition & 9 deletions tests/manifests/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"name": "module1",
"buildsystem": "cmake",
"config-opts": [
"-DCMAKE_BUILD_TYPE=Debug",
"-DCMAKE_INSTALL_PREFIX=/app"
"-DCMAKE_BUILD_TYPE=Debug"
],
"sources": [
{
Expand Down Expand Up @@ -36,13 +35,6 @@
"sha1": "deadbeef"
}
]
},
{
"name": "module2",
"buildsystem": "autotools",
"config-opts": [
"--prefix=/app"
]
}
]
}
2 changes: 0 additions & 2 deletions tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ def test_manifest_modules() -> None:
warnings = {
"module-module1-buildsystem-is-plain-cmake",
"module-module1-cmake-non-release-build",
"module-module2-autotools-redundant-prefix",
"module-module1-cmake-redundant-prefix",
"module-module1-source-sha1-deprecated",
}

Expand Down

0 comments on commit fd8b75f

Please sign in to comment.