From 7fc0c04dc4f46acfd8bc0d73b3116cd07ce32d7a Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Mar 29 2021 07:16:12 +0000 Subject: configure: Make rpmlint optional Distributions may want to run comprehensive fastcheck or lint tasks, but rpmlint tool is mandatory for these targets while some platforms don't have it at all. With this change the rpmlint becomes optional for fastcheck, devcheck and lint make targets. Note: rpmlint option is disabled by default. To enable: ./configure --enable-rpmlint To explicitly disable: ./configure --disable-rpmlint Fixes: https://pagure.io/freeipa/issue/8768 Signed-off-by: Stanislav Levin Reviewed-By: Rob Crittenden Reviewed-By: Alexander Bokovoy --- diff --git a/Makefile.am b/Makefile.am index 0377808..b423337 100644 --- a/Makefile.am +++ b/Makefile.am @@ -194,7 +194,10 @@ endif WITH_PYLINT if WITH_JSLINT JSLINT_TARGET = jslint endif WITH_JSLINT -lint: acilint apilint $(POLINT_TARGET) $(PYLINT_TARGET) $(JSLINT_TARGET) rpmlint yamllint +if WITH_RPMLINT +RPMLINT_TARGET = rpmlint +endif # WITH_RPMLINT +lint: acilint apilint $(POLINT_TARGET) $(PYLINT_TARGET) $(JSLINT_TARGET) $(RPMLINT_TARGET) yamllint .PHONY: devcheck devcheck: all @@ -210,12 +213,12 @@ endif @ # just tests, aci, api and pylint on Python 3 PATH=$(abspath ipatests):$$PATH PYTHONPATH=$(abspath $(top_srcdir)) \ $(PYTHON) ipatests/ipa-run-tests --ipaclient-unittests - $(MAKE) $(AM_MAKEFLAGS) acilint apilint polint pylint jslint rpmlint yamllint check + $(MAKE) $(AM_MAKEFLAGS) acilint apilint polint pylint jslint $(RPMLINT_TARGET) yamllint check @echo "All tests passed." .PHONY: fastcheck fasttest fastlint fastcheck: - @$(MAKE) -j1 $(AM_MAKEFLAGS) fastlint rpmlint yamllint fasttest apilint acilint + @$(MAKE) -j1 $(AM_MAKEFLAGS) fastlint $(RPMLINT_TARGET) yamllint fasttest apilint acilint fasttest: $(GENERATED_PYTHON_FILES) ipasetup.py @ # --ignore doubles speed of total test run compared to pytest.skip() @@ -297,8 +300,10 @@ polint: validate-src-strings validate-po test-gettext .PHONY: rpmlint +if WITH_RPMLINT rpmlint: freeipa.spec - rpmlint ./$< + @RPMLINT@ ./$< +endif # WITH_RPMLINT # Try to load yml/yaml files via safe_load, which recognizes only standard # YAML tags and cannot construct an arbitrary Python object. diff --git a/configure.ac b/configure.ac index 640fbb5..39f00f9 100644 --- a/configure.ac +++ b/configure.ac @@ -559,6 +559,23 @@ AS_CASE([$JSLINT], AC_SUBST([JSLINT]) AM_CONDITIONAL([WITH_JSLINT], [test "x${JSLINT}" != "xno"]) + +AC_ARG_ENABLE( + [rpmlint], + [AC_HELP_STRING([--enable-rpmlint], [Enable rpmlint for the rpm spec])], + [case "${enableval}" in + yes) ENABLE_RPMLINT=yes ;; + no) ENABLE_RPMLINT=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-rpmlint]) ;; + esac], + [ENABLE_RPMLINT=no]) +AS_IF([test "x$ENABLE_RPMLINT" = "xyes"], + [AC_PATH_PROG([RPMLINT], [rpmlint]) + AS_IF([test "x$RPMLINT" = "x"], + [AC_MSG_ERROR([Could not find rpmlint])])], +) +AM_CONDITIONAL([WITH_RPMLINT], [test "x$ENABLE_RPMLINT" = "xyes"]) + AM_CONDITIONAL([HAVE_UNSHARE], [test "x${ac_cv_func_unshare}" = "xyes" -a "x${ac_cv_func_chroot}" = "xyes"]) @@ -672,6 +689,7 @@ echo " Python: ${PYTHON} (${PYTHON_VERSION}) pylint: ${PYLINT} jslint: ${JSLINT} + rpmlint: ${ENABLE_RPMLINT} LDAP libs: ${LDAP_LIBS} OpenSSL crypto libs: ${CRYPTO_LIBS} KRB5 libs: ${KRB5_LIBS}