[libvirt] [PATCH v2] Produce more verbose error if cppi not found

Michal Privoznik mprivozn at redhat.com
Mon Jun 17 12:13:11 UTC 2019


It's fairly easy (especially for new contributors) to not spot
the 'cppi not installed' line in the syntax-check output. Turn it
into a banner that is more visible and at the same time add it as
a build dependency. Unfortunately, RHEL doesn't ship cppi so we
can add the dependency only for Fedora.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---

Diff to v1:
- Instead of requiring cppi, produce more visible error
- Require cppi in specfile

 cfg.mk          | 9 +++++++--
 libvirt.spec.in | 4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 5074ef611a..2ee860a2c5 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -695,6 +695,11 @@ sc_require_whitespace_in_translation:
 	  { echo '$(ME): missing whitespace at line split' 1>&2; \
 	    exit 1; } || :
 
+cppi_banner = \
+	" *****************************************************\n" \
+	"* cppi not installed, some checks have been skipped *\n" \
+	"*****************************************************"
+
 # Enforce recommended preprocessor indentation style.
 sc_preprocessor_indentation:
 	@if cppi --version >/dev/null 2>&1; then \
@@ -702,7 +707,7 @@ sc_preprocessor_indentation:
 	    || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
 		exit 1; }; \
 	else \
-	  echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
+	  echo -e "$(ME): skipping test $@:\n"$(cppi_banner) 1>&2; \
 	fi
 
 # Enforce similar spec file indentation style, by running cppi on a
@@ -719,7 +724,7 @@ sc_spec_indentation:
 	    || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
 		exit 1; }; \
 	else \
-	  echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
+	  echo -e "$(ME): skipping test $@:\n"$(cppi_banner) 1>&2; \
 	fi
 
 # Nested conditionals are easier to understand if we enforce that endifs
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 59a2a0cb24..1a9e92c4bc 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -271,6 +271,10 @@ BuildRequires: perl
 %endif
 BuildRequires: %{python}
 BuildRequires: systemd-units
+# For 'make syntax-check'
+%if 0%{?fedora}
+BuildRequires: cppi
+%endif
 %if %{with_libxl}
 BuildRequires: xen-devel
 %endif
-- 
2.21.0




More information about the libvir-list mailing list