From 4b01acf1ec717db6f7abcb1dc235ba9789f7e7c3 Mon Sep 17 00:00:00 2001 From: Aelin Date: Tue, 3 Feb 2026 23:40:24 +0100 Subject: [PATCH] ci: Lint when LLVM is not used for a new or moved mainline kernel package Part-of: --- .ci/grep.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.ci/grep.sh b/.ci/grep.sh index 001526380..7dbae29f3 100755 --- a/.ci/grep.sh +++ b/.ci/grep.sh @@ -6,7 +6,7 @@ exit_code=0 if [ "$(id -u)" = 0 ]; then set -x - apk -q add grep + apk -q add git grep exec su "${TESTUSER:-build}" -c "sh -e $0" fi @@ -117,4 +117,18 @@ if grep -qr '# Maintainer:' -- *; then exit_code=1 fi +if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then + # Find all moved or new kernel APKBUILDs in main, community or testing + MOVED_OR_NEW_MAINLINE_KERNEL_PACKAGES=$(git show --pretty="" --name-only --diff-filter=AR "$CI_MERGE_REQUEST_DIFF_BASE_SHA"..HEAD | grep "device/\(main\|community\|testing\)/linux-.*/APKBUILD" || true) + + if [ -n "$MOVED_OR_NEW_MAINLINE_KERNEL_PACKAGES" ]; then + if [ -n "$(grep -L LLVM=1 $MOVED_OR_NEW_MAINLINE_KERNEL_PACKAGES || true)" ]; then + echo "ERROR: An added or moved close-to-mainline kernel package is not being built with LLVM." + echo "See https://postmarketos.org/edge/2025/11/11/kernels-llvm/ for more details" + grep --color=always -L LLVM=1 $MOVED_OR_NEW_MAINLINE_KERNEL_PACKAGES + exit_code=1 + fi + fi +fi + exit "$exit_code"