Swatantra-66 opened a new pull request, #21012:
URL: https://github.com/apache/nuttx/pull/21012

   ## Summary
   This adds an automated check in `tools/checkpatch.sh` to 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 `*.mk` file 
without also creating or updating the corresponding `CMakeLists.txt`, 
`checkpatch.sh` fails with an actionable error message during the fast check 
workflow, preventing build divergence before the heavy CI matrix spins up.
   
   ### Key Features:
   1. **Scope:** Automatically triggered when inspecting commits (`-g`) or 
patches (`-p`). Excludes root `Makefile`, `tools/`, and `Documentation/`.
   2. **Flexible CMake Resolution:** Resolves `CMakeLists.txt` co-located in 
the same directory or parent component (including repository root).
   3. **Paired Build-File Deletions:** Allows deleting both `Makefile` and 
`CMakeLists.txt` together without false-positive errors.
   4. **Reliable Path Extraction:** In patch mode (`-p`), parses touched paths 
directly from patch metadata via `git apply --numstat` to catch newly added 
untracked files.
   5. **Exact Literal Matching:** Uses `grep -Fqx -- "$cmake_file"` to avoid 
regex false positives.
   6. **Commit Tree Resolution:** Evaluates file existence in the commit's 
snapshot via `git cat-file -e` rather than relying solely on the current 
working tree.
   7. **Bypass Mechanism:** 
      Commit message tags: `[skip-cmake-parity]`, `[skip-cmake-check]`, or 
`ci:make-only` (isolated per-commit).
      CLI flags: `-k` (force enable) and `-K` (disable).
   
   ## Impact
   Protects both `apache/nuttx` and `apache/nuttx-apps` PRs 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to