-
Notifications
You must be signed in to change notification settings - Fork 142
Draft: To test the the GitHub pipeline #1905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Draft: To test the the GitHub pipeline #1905
Conversation
Wiring up coccinelle in the build, depends on running git commands to get the list of files to operate on. Reasonable, for a feature mainly used by people developing on git. If building git itself from a tarball distribution of git's own source code, one likely does not need to run coccinelle. But running those git commands failed, and caused the build to error out, if `spatch` was installed -- because the build assumed that its presence indicated a desire to use it on this source tree. Instead, we can expand the conditional to check for both `spatch` and the `.git` file or directory. Meson's `opt.require()` method allows us to add a prerequisite for the feature option. If the prerequisite fails, then the option either: - converts autodetection to disabled - emits an informative error if the feature was set to enabled: ``` ERROR: Feature coccinelle cannot be enabled: coccinelle can only be run from a git checkout ``` Signed-off-by: Eli Schwartz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
To bridge the remaining gaps between Makefile and Meson, this patch series adds 'hdr-check' to Meson to compliment the Makefile's 'hdr-check'. We also introduce 'headers-check' as an alias to 'hdr-check' as a better named replacement in both Meson and make and add a note to deprecate 'hdr-check' in the future. The first two commits are small cleanups, where we re-organize existing variables to make it easier to add the target. The third commit adds the 'hdr-check' target to Meson. The last commit introduces the 'headers-check' alias to both Meson and the makefile and marks 'hdr-check' to be deprecated. This is based on master 9d22ac5 (The third batch, 2025-04-07) with 'es/meson-build-skip-coccinelle' merged in. --- Changes in v5: - EDITME: describe what is new in this series revision. - EDITME: use bulletpoints and terse descriptions. - Link to v4: https://lore.kernel.org/r/20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com Changes in v4: - Rename headers to headers_to_check, since these headers are only used for static analysis. - Added a commit to rename third_party_sources -> third_party_excludes and remove a duplicate. - Fix a typo 'gcrpyt' -> 'gcrypt' - Remove 'generated_headers', since we use 'git ls-files' and that would already ignore files within '.gitignore'. - Link to v3: https://lore.kernel.org/r/20250414-505-wire-up-sparse-via-meson-v3-0-edc6e7f26745@gmail.com Changes in v3: - Some renames: - headers_generated -> generated_headers - meson -> Meson - headers-check -> check-headers - headers_check_exclude -> exclude_from_check_headers - Rewrite 'headers_check_exclude' to also contain dirs so we can skip listing individual header files. - Move 'xdiff/*' to 'third_party_sources' and cleanup 'exclude_from_check_headers'. - Use 'echo' instead of 'echo -n'. - Use `fs.replace_suffix` instead of `str.replace`. - Link to v2: https://lore.kernel.org/r/20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com Changes in v2: - Add 'hdr-check' to meson, while introducing 'headers-check' as a replacement alias. Schedule 'hdr-check' to be deprecated in the future. - Link to v1: https://lore.kernel.org/r/20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 5, "change-id": "20250330-505-wire-up-sparse-via-meson-2e32dd31208b", "prefixes": [], "history": { "v1": [ "20250408-505-wire-up-sparse-via-meson-v1-0-17476e5cea3f@gmail.com" ], "v2": [ "20250410-505-wire-up-sparse-via-meson-v2-0-acb45cc8a2e5@gmail.com" ], "v3": [ "20250414-505-wire-up-sparse-via-meson-v3-0-edc6e7f26745@gmail.com" ], "v4": [ "20250420-505-wire-up-sparse-via-meson-v4-0-66e14134e822@gmail.com" ] } } }
There are issues in commit 99b4d9a: |
1 similar comment
There are issues in commit 99b4d9a: |
8a696be
to
e3e392f
Compare
There are issues in commit 99b4d9a: |
e3e392f
to
b741f71
Compare
There are issues in commit 99b4d9a: |
b741f71
to
828e3ee
Compare
There are issues in commit 99b4d9a: |
828e3ee
to
d2edb40
Compare
There are issues in commit 99b4d9a: |
d2edb40
to
0cd7dca
Compare
There are issues in commit 99b4d9a: |
0cd7dca
to
b4567ca
Compare
There are issues in commit 99b4d9a: |
1 similar comment
There are issues in commit 99b4d9a: |
There are issues in commit bc3eb41: |
bc3eb41
to
7bf0471
Compare
There are issues in commit 99b4d9a: |
There are issues in commit 7bf0471: |
The GitHub CI workflow uses 'actions/checkout@v4' to checkout the repository. This action defaults to using the GitHub REST API to obtain the repository if the `git` executable isn't available. The REST API downloads a tar of the repository sans the '.git' folder. Since we don't install Git before this step, using the REST API is the current behavior. The following commits will add the 'hdr-check' static check to meson. The check will use 'git ls-files' to obtain the set of header files. This will fail if the repository doesn't contain the Git directory. So install Git before running the 'actions/checkout@v4' action. Signed-off-by: Karthik Nayak <[email protected]>
In Meson, included subdirs export their variables to top level Meson builds. In 'contrib/coccinelle/meson.build', we define two such variables `sources` and `headers`. While these variables are specific to the checks in the 'contrib/coccinelle/' directory, they also pollute the top level 'meson.build'. Rename them to be more specific, this ensures that they aren't mistakenly used in the upper levels and avoid variable name collisions. While here, change the empty list denotation to be consistent with other places. Signed-off-by: Karthik Nayak <[email protected]>
The Meson build for coccinelle static analysis lists all headers to analyse. Due to the way Meson exports variables between subdirs, this variable is also available in the root Meson build. An upcoming commit, will add a new check complimenting 'hdr-check' in the Makefile. This would require the list of headers. So move the 'coccinelle_headers' to the root Meson build and rename it to 'headers', remove the root path being appended to each header and retain that in the coccinelle Meson build since it is specific to the coccinelle build. Also move the 'third_party_sources' variable to the root Meson build since it is also a dependency for the 'headers' variable. This also makes it easier to understand as the variable is now propagated from the top level to the bottom. Signed-off-by: Karthik Nayak <[email protected]>
The 'third_party_sources' variable was moved to the root 'meson.build' file in the previous commit. The variable is actually used to exclude third party sources, so rename it accordingly to 'third_party_excludes' to avoid confusion. While here, remove a duplicate from the list. Signed-off-by: Karthik Nayak <[email protected]>
The Makefile supports a target called 'hdr-check', which checks if individual header files can be independently compiled. Let's port this functionality to Meson, our new build system too. The implementation resembles that of the Makefile and provides the same check. Since meson builds are out-of-tree, header dependencies are not automatically met. So unlike the Makefile version, we also need to add the required dependencies. Also add the 'xdiff/' dir to the list of 'third_party_sources' as those headers must be skipped from the checks too. This also skips the folder from the 'coccinelle' checks, this is okay, since this code is an external dependency. Signed-off-by: Karthik Nayak <[email protected]>
The 'hdr-check' target in Meson and makefile is used to check if headers can be compiled individually. The naming however isn't readable as 'hdr' is not a common shortforme for 'header', neither is it an abbreviation. Let's introduce 'check-headers' as an alternative target for 'hdr-check' and add a `TODO` to deprecate the latter after 2 releases. Since this is an internal tool, we can use a shorter deprecation cycle. Change existing usage of 'hdr-check' in 'ci/run-static-analysis.sh' to also use 'check-headers'. Signed-off-by: Karthik Nayak <[email protected]>
7bf0471
to
632f78c
Compare
There are issues in commit 99b4d9a: |
There are issues in commit 99b4d9a: |
There are issues in commit 79424fa: |
No description provided.