forked from Mirror/pmbootstrap
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:
parent
806d9a3925
commit
9cec60e057
1 changed files with 8 additions and 3 deletions
|
@ -4,6 +4,7 @@ from collections.abc import Sequence
|
||||||
from pmb.core.chroot import Chroot
|
from pmb.core.chroot import Chroot
|
||||||
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs, pkgrepo_names, pkgrepo_relative_path
|
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs, pkgrepo_names, pkgrepo_relative_path
|
||||||
from pmb.helpers import logging
|
from pmb.helpers import logging
|
||||||
|
from pmb.helpers.exceptions import NonBugError
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pmb.chroot
|
import pmb.chroot
|
||||||
|
@ -57,12 +58,16 @@ def check(pkgnames: Sequence[str]):
|
||||||
options = pmb.config.apkbuild_custom_valid_options
|
options = pmb.config.apkbuild_custom_valid_options
|
||||||
|
|
||||||
# For each pkgrepo run the linter on the relevant packages
|
# For each pkgrepo run the linter on the relevant packages
|
||||||
|
has_failed = False
|
||||||
for pkgrepo, apkbuild_paths in apkbuilds.items():
|
for pkgrepo, apkbuild_paths in apkbuilds.items():
|
||||||
pmb.chroot.root(
|
if pmb.chroot.root(
|
||||||
["apkbuild-lint"] + apkbuild_paths,
|
["apkbuild-lint"] + apkbuild_paths,
|
||||||
check=False,
|
check=False,
|
||||||
output="stdout",
|
output="stdout",
|
||||||
output_return=True,
|
|
||||||
working_dir=dest_paths[repo.name],
|
working_dir=dest_paths[repo.name],
|
||||||
env={"CUSTOM_VALID_OPTIONS": " ".join(options)},
|
env={"CUSTOM_VALID_OPTIONS": " ".join(options)},
|
||||||
)
|
):
|
||||||
|
has_failed = True
|
||||||
|
|
||||||
|
if has_failed:
|
||||||
|
raise NonBugError("Linter failed!")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue