Skip to content
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

build: allow overriding certain tools & sync targets with CI #6222

Merged
merged 3 commits into from
Feb 28, 2024

Conversation

kmk3
Copy link
Collaborator

@kmk3 kmk3 commented Feb 24, 2024

Allow overriding the following tools at configure-time and build-time:

  • codespell
  • cppcheck
  • gawk
  • scan-build

For example, instead of hardcoding gawk, enable overriding it at
configure-time with:

./configure GAWK=/path/to/gawk

To override it for a single make invocation:

make GAWK=/path/to/gawk

Also, add default values for the programs that are not found (rather
than leaving the variables empty), to make error messages clearer when
trying to run them:

$ make CPPCHECK= cppcheck-old
[...]
force --error-exitcode=1 --enable=warning,performance .
make: force: No such file or directory
$ make CPPCHECK=cppcheck cppcheck-old
[...]
cppcheck --force --error-exitcode=1 --enable=warning,performance .
make: cppcheck: No such file or directory

Allow overriding the following tools at configure-time and build-time:

* codespell
* cppcheck
* gawk
* scan-build

For example, instead of hardcoding `gawk`, enable overriding it at
configure-time with:

    ./configure GAWK=/path/to/gawk

To override it for a single `make` invocation:

    make GAWK=/path/to/gawk

Also, add default values for the programs that are not found (rather
than leaving the variables empty), to make error messages clearer when
trying to run them:

    $ make CPPCHECK= cppcheck-old
    [...]
    force --error-exitcode=1 --enable=warning,performance .
    make: force: No such file or directory
    $ make CPPCHECK=cppcheck cppcheck-old
    [...]
    cppcheck --force --error-exitcode=1 --enable=warning,performance .
    make: cppcheck: No such file or directory
Changes:

* Use the same command from the cppcheck CI job in the cppcheck target
* Add cppcheck-old target based on the cppcheck_old CI job
* Call the make targets in CI to avoid duplicating the commands
Changes:

* Use --status-bugs in the scan-build target to exit with an error if
  bugs are found
* Call the make target in the CI job
@kmk3
Copy link
Collaborator Author

kmk3 commented Feb 25, 2024

Cc: @reinerh @rusty-snake

Hello, you might find this interesting since you also worked on these checks.

This PR enables overrides for certain tools, which should allow more
deduplication of code between the build and CI and make it easier to run the
same CI steps locally.

@kmk3 kmk3 merged commit df2dbec into netblue30:master Feb 28, 2024
13 checks passed
@kmk3 kmk3 deleted the build-override-tools branch February 28, 2024 01:27
kmk3 added a commit that referenced this pull request Mar 1, 2024
kmk3 added a commit to kmk3/firejail that referenced this pull request May 17, 2024
Cleaning does not appear to make a difference; the same amount of files
is checked with/without cleaning.

Environment: cppcheck 2.12.0-3 on Artix Linux.

Added on commit 4e22add ("llvm scan", 2015-11-29).

This is a follow-up to netblue30#6222.
kmk3 added a commit that referenced this pull request May 20, 2024
Cleaning does not appear to make a difference; the same amount of files
is checked with/without cleaning.

Environment: cppcheck 2.12.0-3 on Artix Linux.

Added on commit 4e22add ("llvm scan", 2015-11-29).

This is a follow-up to #6222.
kmk3 added a commit to kmk3/firejail that referenced this pull request May 24, 2024
Just in case the value is not defined in config.mk and `make` is first
executed from another directory (such as in src/man) instead of the root
directory.

This amends commit 93d623f ("build: allow overriding certain tools",
2024-02-23) / PR netblue30#6222.
kmk3 added a commit to kmk3/firejail that referenced this pull request May 24, 2024
Tools:

* gzip
* install
* rm
* strip
* tar

For the programs not checked in configure.ac:

From the manual of GNU Autoconf (version 2.69):

> If you use `AC_PROG_INSTALL`, you must include `install-sh` in your
> distribution

So set `install` just in the Makefile.  Use `$(RM)` to make it easier to
spot when `-r` is used.

See commit 93d623f ("build: allow overriding certain tools",
2024-02-23) / PR netblue30#6222.
kmk3 added a commit to kmk3/firejail that referenced this pull request May 29, 2024
Tools:

* gzip
* install
* rm
* strip
* tar

For the programs not checked in configure.ac:

From the manual of GNU Autoconf (version 2.69):

> If you use `AC_PROG_INSTALL`, you must include `install-sh` in your
> distribution

So set `install` just in the Makefile.  Use `$(RM)` to ensure that `-f`
is always used and to make it easier to spot when `-r` is used.

See commit 93d623f ("build: allow overriding certain tools",
2024-02-23) / PR netblue30#6222.
kmk3 added a commit to kmk3/firejail that referenced this pull request May 29, 2024
Tools:

* gzip
* install
* rm
* strip
* tar

For the programs not checked in configure.ac:

From the manual of GNU Autoconf (version 2.71):

> If you use `AC_PROG_INSTALL`, you must include `install-sh` in your
> distribution

So set `install` just in the Makefile.  Use `$(RM)` to ensure that `-f`
is always used and to make it easier to spot when `-r` is used.

See commit 93d623f ("build: allow overriding certain tools",
2024-02-23) / PR netblue30#6222.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (on RELNOTES)
Development

Successfully merging this pull request may close these issues.

3 participants