From: Francois-Xavier Le Bail Date: Wed, 30 Nov 2022 11:05:07 +0000 (+0100) Subject: CI: Introduce and use TCPDUMP_CMAKE_TAINTED X-Git-Tag: tcpdump-4.99.3~36 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/d9acf8cb11e30b7d7744cb0dd05e628109cb73f0 CI: Introduce and use TCPDUMP_CMAKE_TAINTED The new environment variable provides means to declare all or some tcpdump cmake run of a specific environment (CI or a working copy) as tainted. Add explicit conditions to exempt the cmake run that emit warnings now and request the compiler to treat warnings as errors *iff* the cmake run is not tainted. This way if a cmake run that is warning-free now degrades later, CI will fail it. The treat warnings as errors cmake option used is: -Werror=dev Make developer warnings errors. Make warnings that are meant for the author of the CMake- Lists.txt files errors. By default this will also turn on depre- cated warnings as errors. (cherry picked from commit 625657ada89f6ab9056e3f918edb7052d3067438) --- diff --git a/build.sh b/build.sh index a24c8db7..db345272 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,7 @@ : "${CRYPTO:=no}" : "${SMB:=no}" : "${TCPDUMP_TAINTED:=no}" +: "${TCPDUMP_CMAKE_TAINTED:=no}" : "${MAKE_BIN:=make}" . ./build_common.sh @@ -42,6 +43,12 @@ esac [ "$TCPDUMP_TAINTED" != yes ] && CFLAGS=`cc_werr_cflags` +# If necessary, set TCPDUMP_CMAKE_TAINTED here to exempt particular cmake from +# warnings. Use as specific terms as possible (e.g. some specific version and +# some specific OS). + +[ "$TCPDUMP_CMAKE_TAINTED" != yes ] && CMAKE_OPTIONS='-Werror=dev' + if [ "$CMAKE" = no ]; then if [ "$BUILD_LIBPCAP" = yes ]; then echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH" @@ -59,13 +66,15 @@ else run_after_echo mkdir build run_after_echo cd build if [ "$BUILD_LIBPCAP" = yes ]; then - run_after_echo cmake -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \ + run_after_echo cmake "$CMAKE_OPTIONS" \ + -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \ ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \ -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" .. LD_LIBRARY_PATH="$PREFIX/lib" export LD_LIBRARY_PATH else - run_after_echo cmake -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \ + run_after_echo cmake "$CMAKE_OPTIONS" \ + -DWITH_CRYPTO="$CRYPTO" -DENABLE_SMB="$SMB" \ ${CFLAGS:+-DEXTRA_CFLAGS="$CFLAGS"} \ -DCMAKE_INSTALL_PREFIX="$PREFIX" .. fi diff --git a/build_matrix.sh b/build_matrix.sh index 4df235d2..3089bad9 100755 --- a/build_matrix.sh +++ b/build_matrix.sh @@ -13,6 +13,12 @@ : "${MATRIX_CMAKE:=no yes}" : "${MATRIX_CRYPTO:=no yes}" : "${MATRIX_SMB:=no yes}" +# Set this variable to "yes" before calling this script to disregard all cmake +# warnings in a particular environment (CI or a local working copy). Set it +# to "yes" in this script or in build.sh when a matrix subset is known to be +# not cmake warning-free because of the version or whatever other factor +# that the scripts can detect both in and out of CI. +: "${TCPDUMP_CMAKE_TAINTED:=no}" # Set this variable to "yes" before calling this script to disregard all # warnings in a particular environment (CI or a local working copy). Set it # to "yes" in this script or in build.sh when a matrix subset is known to be @@ -33,6 +39,7 @@ if [ -z "$PREFIX" ]; then fi COUNT=0 export TCPDUMP_TAINTED +export TCPDUMP_CMAKE_TAINTED export MAKE_BIN build_tcpdump() {