CI: Stop using 'pmbootstrap lint' for lint job
Needs https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2679 Closes https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/3665 Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2566 Closes https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues/3274 Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2591 Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6979>
This commit is contained in:
parent
35ee13f094
commit
8321019c7f
2 changed files with 46 additions and 11 deletions
|
|
@ -1,14 +1,12 @@
|
|||
#!/bin/sh -e
|
||||
# Description: run apkbuild-lint on modified APKBUILDs
|
||||
# Options: native
|
||||
# Use 'native' because it requires git commit history.
|
||||
# Options: with-dot-git
|
||||
# https://postmarketos.org/pmb-ci
|
||||
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
set -x
|
||||
wget "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
|
||||
sh ./install_pmbootstrap.sh
|
||||
exec su "${TESTUSER:-pmos}" -c "sh -e $0"
|
||||
apk add atools git python3
|
||||
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||
fi
|
||||
|
||||
.ci/lib/apkbuild_linting.py
|
||||
|
|
|
|||
|
|
@ -2,10 +2,45 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import common
|
||||
import os.path
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import tomllib
|
||||
|
||||
|
||||
custom_valid_options = [
|
||||
"!pmb:crossdirect",
|
||||
"!pmb:kconfigcheck",
|
||||
"pmb:cross-native",
|
||||
"pmb:cross-native2",
|
||||
"pmb:drm",
|
||||
"pmb:gpu-accel", # deprecated
|
||||
"pmb:strict",
|
||||
"pmb:systemd",
|
||||
"pmb:systemd-never",
|
||||
]
|
||||
|
||||
|
||||
def get_kconfigcheck_categories() -> None:
|
||||
with open("kconfigcheck.toml", "rb") as kconfigcheck_config:
|
||||
kconfigcheck_data = tomllib.load(kconfigcheck_config)
|
||||
|
||||
kconfigcheck_categories = []
|
||||
|
||||
for alias_name in kconfigcheck_data["aliases"]:
|
||||
kconfigcheck_categories.append(f"pmb:kconfigcheck-{alias_name}")
|
||||
|
||||
for category_name in kconfigcheck_data["aliases"][alias_name]:
|
||||
kconfigcheck_categories.append(category_name)
|
||||
|
||||
return [item.replace("category:", "pmb:kconfigcheck-") for item in kconfigcheck_categories]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
kconfigcheck_categories = get_kconfigcheck_categories()
|
||||
custom_valid_options += kconfigcheck_categories
|
||||
os.environ["CUSTOM_VALID_OPTIONS"] = " ".join(custom_valid_options)
|
||||
|
||||
common.add_upstream_git_remote()
|
||||
apkbuilds = {file for file in common.get_changed_files(removed=False)
|
||||
if os.path.basename(file) == "APKBUILD"}
|
||||
|
|
@ -13,14 +48,16 @@ if __name__ == "__main__":
|
|||
print("No APKBUILDs to lint")
|
||||
sys.exit(0)
|
||||
|
||||
packages = []
|
||||
apkbuilds_filtered = []
|
||||
for apkbuild in apkbuilds:
|
||||
if apkbuild.startswith("temp/") or apkbuild.startswith("cross/"):
|
||||
print(f"NOTE: Skipping linting of {apkbuild}")
|
||||
continue
|
||||
packages.append(os.path.basename(os.path.dirname(apkbuild)))
|
||||
if len(packages) < 1:
|
||||
apkbuilds_filtered.append(apkbuild)
|
||||
if len(apkbuilds_filtered) < 1:
|
||||
print("No APKBUILDs to lint")
|
||||
sys.exit(0)
|
||||
|
||||
common.run_pmbootstrap(["-q", "lint"] + packages)
|
||||
try:
|
||||
subprocess.run(["apkbuild-lint", *apkbuilds_filtered], text=True, check=True)
|
||||
except subprocess.CalledProcessError as exception:
|
||||
sys.exit(exception.returncode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue