1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 03:19:47 +03:00

lint: raise error if linter fails (MR 2398)

Fix that pmbootstrap exits with 0 on linter failure. Let it raise an
error instead (which results in exit != 0).
This commit is contained in:
Oliver Smith 2024-09-07 17:52:19 +02:00
parent 806d9a3925
commit 9cec60e057
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -4,6 +4,7 @@ from collections.abc import Sequence
from pmb.core.chroot import Chroot
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs, pkgrepo_names, pkgrepo_relative_path
from pmb.helpers import logging
from pmb.helpers.exceptions import NonBugError
import os
import pmb.chroot
@ -57,12 +58,16 @@ def check(pkgnames: Sequence[str]):
options = pmb.config.apkbuild_custom_valid_options
# For each pkgrepo run the linter on the relevant packages
has_failed = False
for pkgrepo, apkbuild_paths in apkbuilds.items():
pmb.chroot.root(
if pmb.chroot.root(
["apkbuild-lint"] + apkbuild_paths,
check=False,
output="stdout",
output_return=True,
working_dir=dest_paths[repo.name],
env={"CUSTOM_VALID_OPTIONS": " ".join(options)},
)
):
has_failed = True
if has_failed:
raise NonBugError("Linter failed!")