]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CI: Introduce and use TCPDUMP_CMAKE_TAINTED
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 30 Nov 2022 11:05:07 +0000 (12:05 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 30 Nov 2022 11:05:58 +0000 (12:05 +0100)
The new environment variable provides means to declare all or some libpcap
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.

build.sh
build_matrix.sh

index a24c8db78c3438065f5a9882ae80cba26a901494..db34527251a732ccd45d05fa94bdc35e24120f6d 100755 (executable)
--- 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
index 4df235d20adcc906c50c72e49132d5d1fa56324f..3089bad9227630a952252de643a9709e04993885 100755 (executable)
 : "${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() {