Repository navigation
tools/checkpatch.sh: add Make vs CMake build-system parity check - #21012
Merged
xiaoxiang781216 merged 1 commit intoOct 27, 2026
Merged
Conversation
This adds an automated check in checkpatch.sh to detect when a Makefile, Make.defs, or *.mk file is created or modified without the corresponding CMakeLists.txt also being created or updated: - Checks git commit ranges (-g) and patch files (-p) - Resolves CMakeLists.txt co-located in the same directory or parent component - Allows paired build-file deletions without false positives - Diffs commits against their parent via git diff-tree to ensure reliable single-revision inspection on clean trees - Supports per-commit bypass via '[skip-cmake-parity]', '[skip-cmake-check]', or 'ci:make-only' commit message tags - Provides -k to force enable and -K to disable the check Suggested-by: Alan Carvalho de Assis <acassis@apache.org> Signed-off-by: Swatantra Yadav <maverickswatantra@gmail.com>
Swatantra-66
requested review from
liuguo09,
raiden00pl,
simbit18 and
xiaoxiang781216
as code owners
October 26, 2026 17:24
acassis
approved these changes
Oct 26, 2026
xiaoxiang781216
approved these changes
Oct 26, 2026
|
jerpelea
reviewed
Oct 28, 2026
jerpelea
left a comment
Contributor
There was a problem hiding this comment.
I think that this is an AI assisted patch and was merged without following contribution guidelines
please clarify!
Contributor
Author
|
I apologize for omitting the Assisted-by disclosure line. I have taken note of this requirement and will ensure to include in accordance with the community guidelines |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds an automated check in
tools/checkpatch.shto enforce build-system parity between GNU Make and CMake, as suggested by @acassis on apache/nuttx-apps#3920.Whenever a PR creates or modifies a
Makefile,Make.defs, or*.mkfile without also creating or updating the correspondingCMakeLists.txt,checkpatch.shfails with an actionable error message during the fast check workflow, preventing build divergence before the heavy CI matrix spins up.Key Features:
-g) or patches (-p). Excludes rootMakefile,tools/, andDocumentation/.CMakeLists.txtco-located in the same directory or parent component (including repository root).MakefileandCMakeLists.txttogether without false-positive errors.-p), parses touched paths directly from patch metadata viagit apply --numstatto catch newly added untracked files.grep -Fqx -- "$cmake_file"to avoid regex false positives.git cat-file -erather than relying solely on the current working tree.Commit message tags:
[skip-cmake-parity],[skip-cmake-check], orci:make-only(isolated per-commit).CLI flags:
-k(force enable) and-K(disable).Impact
Protects both
apache/nuttxandapache/nuttx-appsPRs from Make/CMake divergence.No impact on existing build configurations or non-build file modifications.
Testing
Verified syntax clean with
bash -n tools/checkpatch.sh(0 errors, 0 warnings).Validated command-line options
-h,-k,-K,-g, and-p.Tested failure cases on unsynced Makefiles and pass cases on paired modifications.
Verified commit message bypass isolation across multiple commits.