[libvirt] [PATCH] build: fix testing of augeas files in VPATH builds

Eric Blake eblake at redhat.com
Tue May 29 19:28:09 UTC 2012


Without this fix, a VPATH build fails with messages like:

make[3]: Entering directory `/home/remote/eblake/libvirt-tmp2/build/daemon'
../../build-aux/augeas-gentest.pl libvirtd.conf ../../daemon/test_libvirtd.aug.in test_libvirtd.aug
cannot read libvirtd.conf: No such file or directory at ../../build-aux/augeas-gentest.pl line 38.

* daemon/Makefile.am (AUG_GENTEST): Factor out definition.
(test_libvirtd.aug): Look for correct file.
* src/Makefile.am (AUG_GENTEST): Use $(PERL).
(qemu/test_libvirtd_qemu.aug, lxc/test_libvirtd_lxc.aug)
(locking/test_libvirt_sanlock.aug): Ensure destination dir exists.
---

This is one alternative for a fix for a build-breaker, but I'm not
pushing it without a review.  In particular, I still have a question:

Should the various test_*.aug files be in the tarball?  Right now,
they are listed under EXTRA_DIST (so they are shipped pre-built),
but also listed under CLEANFILES (so 'make clean' must regenerate
them).  Generating the files requires perl, which is a non-standard
requirement.  Either we require end-users to have perl in order to
build from a libvirt tarball, and change the tarball to exclude
files that perl can generate; or we fix the use of CLEANFILES to
instead be DISTCLEANFILES or even MAINTAINERCLEANFILES (end users
need not have perl if they don't alter any sources, but we should
then be generating the files into $(srcdir) rather than into the
build tree).

For another example of a perl-generated file, remote_protocol.h is
currently shipped in the tarball, and requires perl for generation,
but it is generated into the $(srcdir) and only cleaned by
MAINTAINERCLEANFILES.

 daemon/Makefile.am |    6 ++++--
 src/Makefile.am    |   20 +++++++++++++-------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index daf24ea..8dd019d 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -351,8 +351,10 @@ libvirtd.service: libvirtd.service.in $(top_builddir)/config.status

 check-local: check-augeas

-test_libvirtd.aug: test_libvirtd.aug.in libvirtd.conf
-	$(AM_V_GEN)$(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl libvirtd.conf $< $@
+AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl
+
+test_libvirtd.aug: test_libvirtd.aug.in $(srcdir)/libvirtd.conf
+	$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/libvirtd.conf $< $@

 check-augeas: test_libvirtd.aug
 	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
diff --git a/src/Makefile.am b/src/Makefile.am
index 533e78a..0bbccb2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1119,11 +1119,13 @@ check-local: check-augeas

 check-augeas: check-augeas-qemu check-augeas-lxc check-augeas-sanlock

-AUG_GENTEST = $(top_srcdir)/build-aux/augeas-gentest.pl
+AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl

 if WITH_QEMU
-qemu/test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in qemu/qemu.conf $(AUG_GENTEST)
-	$(AM_V_GEN)$(AUG_GENTEST) qemu/qemu.conf $< $@
+qemu/test_libvirtd_qemu.aug: qemu/test_libvirtd_qemu.aug.in \
+		$(srcdir)/qemu/qemu.conf $(AUG_GENTEST)
+	$(AM_V_GEN)$(MKDIR_P) qemu && \
+	  $(AUG_GENTEST) $(srcdir)/qemu/qemu.conf $< $@

 check-augeas-qemu: qemu/test_libvirtd_qemu.aug
 	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
@@ -1135,8 +1137,10 @@ check-augeas-qemu:
 endif

 if WITH_LXC
-lxc/test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in lxc/lxc.conf $(AUG_GENTEST)
-	$(AM_V_GEN)$(AUG_GENTEST) lxc/lxc.conf $< $@
+lxc/test_libvirtd_lxc.aug: lxc/test_libvirtd_lxc.aug.in \
+		$(srcdir)/lxc/lxc.conf $(AUG_GENTEST)
+	$(AM_V_GEN)$(MKDIR_P) lxc && \
+	  $(AUG_GENTEST) $(srcdir)/lxc/lxc.conf $< $@

 check-augeas-lxc: lxc/test_libvirtd_lxc.aug
 	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
@@ -1147,8 +1151,10 @@ else
 check-augeas-lxc:
 endif

-locking/test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in locking/qemu-sanlock.conf $(AUG_GENTEST)
-	$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-sanlock.conf $< $@
+locking/test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
+		locking/qemu-sanlock.conf $(AUG_GENTEST)
+	$(AM_V_GEN)$(MKDIR_P) locking && \
+	  $(AUG_GENTEST) locking/qemu-sanlock.conf $< $@

 check-augeas-sanlock: locking/test_libvirt_sanlock.aug
 	$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
-- 
1.7.7.6




More information about the libvir-list mailing list