Skip to content

ci: Check U-Boot and Linux patch format - #688

Open
huaqianli wants to merge 2 commits into
masterfrom
lee/ci-patches
Open

ci: Check U-Boot and Linux patch format#688
huaqianli wants to merge 2 commits into
masterfrom
lee/ci-patches

Conversation

@huaqianli

Copy link
Copy Markdown
Collaborator

Summary

Add CI checks for the format of U-Boot and Linux kernel patches used by
the recipes.

The reusable checker is located at
scripts/host/check-patch-format.sh,
and the GitHub Actions workflow is defined in
.github/workflows/patch-check.yml.

Motivation

PR #687 showed that incorrectly generated patches can pass unnoticed
until review. In particular, whitespace-only metadata lines before the
diffstat separator are not produced by the documented git format-patch
command.

This change moves the validation into CI so that malformed patches are
detected before review or merge.

Checks

The CI job performs the following checks:

  • Parse each patch with git mailinfo, matching the parser used by
    git am.
  • Require the zero commit ID generated by --zero-commit.
  • Reject numbered patch subjects such as [PATCH 1/2], matching
    --no-numbered.
  • Reject diff index hashes longer than 12 characters, matching
    --abbrev=12.
  • Reject Git patch signatures, matching --no-signature.
  • Require the format-patch diffstat separator.
  • Reject whitespace-only lines in patch metadata before the separator.
  • Run the upstream U-Boot checkpatch.pl for U-Boot patches.
  • Run the upstream Linux CIP checkpatch.pl for Linux patches.

Trailing whitespace diagnostics are ignored because blank lines in a
unified diff legitimately contain a leading space.

Scope

The check covers patches in:

  • meta/recipes-bsp/u-boot/files/
  • meta/recipes-kernel/linux/files/patches/

The upstream cleanpatch utility was considered but is not included in
CI because it modifies patch files and is intended as a cleanup tool,
not as a read-only validation tool.

Validation

  • All existing U-Boot patches pass the new checks.
  • All existing Linux kernel patches pass the new checks.
  • U-Boot and Linux patches are checked with their respective upstream
    checkpatch.pl implementations.
  • The workflow and shell script pass editor diagnostics.

@huaqianli
huaqianli force-pushed the lee/ci-patches branch 2 times, most recently from 2941cb4 to 806f950 Compare August 11, 2026 02:30
@huaqianli
huaqianli requested a review from BaochengSu August 11, 2026 02:32
Validate U-Boot and Linux recipe patches with their respective upstream
checkpatch.pl implementations and git mailinfo.

Check the patch metadata required by CONTRIBUTING.md, including
zero-commit, non-numbered subjects, abbreviated diff indexes, and the
absence of format-patch signatures.

Also reject whitespace-only metadata lines before the diffstat
separator, which catches the formatting issue identified by PR #687.

Signed-off-by: Li Hua Qian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant