]> git.proxmox.com Git - ovs.git/commitdiff
Makefiles: Fail build for flake8 only when configured with --enable-Werror.
authorBen Pfaff <blp@ovn.org>
Thu, 6 Jul 2017 22:12:00 +0000 (15:12 -0700)
committerBen Pfaff <blp@ovn.org>
Fri, 7 Jul 2017 16:21:40 +0000 (09:21 -0700)
flake8 checking is useful.  Until now, it always failed the build for any
flake8 errors.  This is too aggressive, for the same reason that always
failing the build for any compiler warnings is too aggressive: compilers
change over time and asynchronously from OVS itself.  Thus, if we release
some version of OVS today, even if it's flake8-clean today, it might not
be flake8-clean tomorrow, even with the same settings.  We don't want to
have to track flake8 warnings on every release branch.

Thus, this adopts the same policy for compiler warnings: always report
them, but only fail the build if --enable-Werror was configured.  Usually
just developers use that configure option, and they're prepared to deal
with the fallout.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
Makefile.am
acinclude.m4

index d810a5e72c72e436762ec3147154a6fdcaefcaa6..7e11e04ac748881e1f514038d146b931e33697e6 100644 (file)
@@ -365,7 +365,7 @@ ALL_LOCAL += flake8-check
 FLAKE8_SELECT = H231,H232,H233,H238
 FLAKE8_IGNORE = E121,E123,E125,E126,E127,E128,E129,E131,W503,F811,D,H,I
 flake8-check: $(FLAKE8_PYFILES)
-       $(AM_V_GEN) \
+       $(FLAKE8_WERROR)$(AM_V_GEN) \
          src='$^' && \
          flake8 $$src --select=$(FLAKE8_SELECT) $(FLAKE8_FLAGS) && \
          flake8 $$src --ignore=$(FLAKE8_IGNORE) $(FLAKE8_FLAGS) && \
index 7d7b6832bc2e45a0538ea4035c44a934e5c6f488..b8b43d9c377a40f3a94a2f9a5c842d32fd03e357 100644 (file)
@@ -23,7 +23,16 @@ AC_DEFUN([OVS_ENABLE_WERROR],
    AC_CONFIG_COMMANDS_PRE(
      [if test "X$enable_Werror" = Xyes; then
         OVS_CFLAGS="$OVS_CFLAGS -Werror"
-      fi])])
+      fi])
+
+   # Unless --enable-Werror is specified, report but do not fail the build
+   # for errors reported by flake8.
+   if test "X$enable_Werror" = Xyes; then
+     FLAKE8_WERROR=
+   else
+     FLAKE8_WERROR=-
+   fi
+   AC_SUBST([FLAKE8_WERROR])])
 
 dnl OVS_CHECK_LINUX
 dnl