2023-03-16 21:49:12 +01:00
|
|
|
#!/usr/bin/env python3
|
2024-06-30 18:33:09 +02:00
|
|
|
# Copyright 2024 Oliver Smith
|
2023-03-16 21:49:12 +01:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import tempfile
|
|
|
|
import sys
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
# Same dir
|
|
|
|
import common
|
|
|
|
|
|
|
|
|
2024-06-30 18:33:09 +02:00
|
|
|
def check_kconfig(pkgnames):
|
2023-03-16 21:49:12 +01:00
|
|
|
last_failed = None
|
|
|
|
for i in range(len(pkgnames)):
|
|
|
|
pkgname = pkgnames[i]
|
|
|
|
print(f" ({i+1}/{len(pkgnames)}) {pkgname}")
|
|
|
|
|
2024-06-30 18:33:09 +02:00
|
|
|
p = subprocess.run(["pmbootstrap", "kconfig", "check", pkgname],
|
|
|
|
check=False)
|
2023-03-16 21:49:12 +01:00
|
|
|
|
2024-06-30 18:33:09 +02:00
|
|
|
if p.returncode:
|
2023-03-16 21:49:12 +01:00
|
|
|
last_failed = pkgname
|
|
|
|
|
|
|
|
return last_failed
|
|
|
|
|
|
|
|
|
|
|
|
def show_error(last_failed):
|
2024-06-30 18:33:09 +02:00
|
|
|
print("")
|
|
|
|
print("---")
|
2023-03-16 21:49:12 +01:00
|
|
|
print("")
|
|
|
|
print("Please adjust your kernel config. This is required for getting your"
|
|
|
|
" patch merged.")
|
|
|
|
print("")
|
|
|
|
print("Edit your kernel config:")
|
|
|
|
print(f" pmbootstrap kconfig edit {last_failed}")
|
|
|
|
print("")
|
|
|
|
print("Test this kernel config again:")
|
|
|
|
print(f" pmbootstrap kconfig check {last_failed}")
|
|
|
|
print("")
|
|
|
|
print("Run this check again (on all kernels you modified):")
|
|
|
|
print(" pmbootstrap ci kconfig")
|
|
|
|
print("")
|
2024-06-30 18:33:09 +02:00
|
|
|
print("---")
|
|
|
|
print("")
|
2023-03-16 21:49:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
common.add_upstream_git_remote()
|
|
|
|
pkgnames = common.get_changed_kernels()
|
|
|
|
print(f"Changed kernels: {pkgnames}")
|
|
|
|
|
|
|
|
if len(pkgnames) == 0:
|
|
|
|
print("No kernels changed in this branch")
|
|
|
|
exit(0)
|
|
|
|
|
2024-06-30 18:33:09 +02:00
|
|
|
last_failed = check_kconfig(pkgnames)
|
2023-03-16 21:49:12 +01:00
|
|
|
|
|
|
|
if last_failed:
|
|
|
|
show_error(last_failed)
|
|
|
|
exit(1)
|