pmaports/.ci/lib/apkbuild_linting.py
Oliver Smith da52dace85
CI: adjust .ci/common.py users to pmbootstrap ci (MR 3608)
Adjust all CI scripts that make use of .ci/common.py to
'pmbootstrap ci'. Move all scripts that are not direct entry points to
running CI scripts to .ci/lib.

Comment out the dtb check, as it is failing. Apparently it didn't run
properly before. Let's fix this after this CI change is done.
2022-11-17 19:10:56 +01:00

31 lines
937 B
Python
Executable file

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
import common
import os.path
import sys
if __name__ == "__main__":
common.add_upstream_git_remote()
apkbuilds = {file for file in common.get_changed_files(removed=False)
if os.path.basename(file) == "APKBUILD"}
if len(apkbuilds) < 1:
print("No APKBUILDs to lint")
sys.exit(0)
packages = []
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:
print("No APKBUILDs to lint")
sys.exit(0)
result = common.run_pmbootstrap(["-q", "lint"] + packages, output_return=True)
if len(result) > 0:
print("Linting issues found:")
print(result)
sys.exit(1)