Files
pmaports-rtwo/.ci/lib/deviceinfo_linting.py
T
Luca Weiss 1ab8eefdd5 CI: Run dint job on all files on deviceinfo_schema.toml change
Similar to kconfigcheck.toml, let's run the dint job on all deviceinfo
files when the spec itself is changed. This allows to catch possible new
warnings and errors early and fix them.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8139>
2026-03-20 01:57:32 +00:00

29 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
# Copyright 2025 Stefan Hansson
# SPDX-License-Identifier: GPL-3.0-or-later
import common
import glob
import os.path
import subprocess
import sys
if __name__ == "__main__":
if common.commit_message_has_string("[ci:skip-dint]"):
print("WARNING: not linting deviceinfo files ([ci:skip-dint])")
exit(0)
if "deviceinfo_schema.toml" in common.get_changed_files():
print("deviceinfo_schema.toml changed -> checking all deviceinfo files")
pmaports_dir = common.get_pmaports_dir()
deviceinfo_files = set(glob.glob(pmaports_dir + "/device/*/*/deviceinfo"))
else:
# only lint deviceinfo files in the devices repo
deviceinfo_files = {file for file in common.get_changed_files()
if os.path.basename(file) == "deviceinfo" and file.startswith("device/")}
try:
subprocess.run(["dint", "check", *deviceinfo_files], text=True, check=True)
except subprocess.CalledProcessError as exception:
sys.exit(exception.returncode)