[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] build: fix 'make dist' on virgin checkout



'make dist' was depending on *protocol-structs files, which are
stored in git but in turn depended on generated files.  We still
want to ship the protocol-structs files, but by renaming the
tests to something not matching a file name, we separate 'make
check' (which depends on the generated file) from 'make dist'
(which only depends on the git files).  After all, the tarball
should never depend on a generated file not stored in git.

I found one more case of a git file depending on a generated
file, in a bogus virkeycode.c listing; but at least this one
had no associated rules so it never broke 'make dist'.

Reported by Wen Congyang.  Latent bug has been present since
commit 62dee6f, but only recently exposed by commit 7bff56a.

* src/Makefile.am ($(srcdir)/util/virkeycode.c): Drop useless
dependency.
(BUILT_SOURCES): ...and build virkeymaps.h sooner.
(PROTOCOL_STRUCTS): Rather than depend on the struct file...
(check-local): ...convert things into a phony target of...
(check-protocol): ...a new check.
($(srcdir)/remote_protocol-struct): Rename to isolate the distributed
file from the conditional test.
(PDWTAGS): Deal with rename.  Swap to compare 'expected actual'.
---

Posting now for a review.  I'm still planning on running a 'make
distcheck' on a virgin repository, if that passes and correctly
runs the protocol syntax checks, then I will check this in under
the build-breaker rule.  Or, if someone ACKs this first...

 src/Makefile.am |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 60f5442..2bcebcf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,12 +113,12 @@ UTIL_SOURCES =							\
 EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
 		$(srcdir)/util/virkeycode-mapgen.py

+BUILT_SOURCES += $(srcdir)/util/virkeymaps.h
+
 $(srcdir)/util/virkeymaps.h: $(srcdir)/util/keymaps.csv	\
 		$(srcdir)/util/virkeycode-mapgen.py
 	$(AM_V_GEN)$(PYTHON) $(srcdir)/util/virkeycode-mapgen.py <$(srcdir)/util/keymaps.csv >$@

-$(srcdir)/util/virkeycode.c: $(srcdir)/util/virkeycode.h $(srcdir)/util/virkeymaps.h
-
 EXTRA_DIST += util/threads-pthread.c util/threads-win32.c

 # Internal generic driver infrastructure
@@ -293,7 +293,7 @@ PDWTAGS = \
 		-e '}'							\
 		< $(@F)-t1 > $(@F)-t3;					\
 	    case $$? in 8) rm -f $(@F)-t?; exit 0;; 0) ;; *) exit 1;; esac;\
-	    diff -u $(@F)-t3 $@; st=$$?; rm -f $(@F)-t?; exit $$st;	\
+	    diff -u $(@)s $(@F)-t3; st=$$?; rm -f $(@F)-t?; exit $$st;	\
 	  fi;								\
 	else								\
 	  echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2;	\
@@ -306,21 +306,24 @@ PROTOCOL_STRUCTS = \
 	$(srcdir)/virnetprotocol-structs \
 	$(srcdir)/virkeepaliveprotocol-structs
 if WITH_REMOTE
+check-protocol: $(PROTOCOL_STRUCTS) $(PROTOCOL_STRUCTS:structs=struct)
+
 # The .o file that pdwtags parses is created as a side effect of running
 # libtool; but from make's perspective we depend on the .lo file.
-$(srcdir)/%_protocol-structs: libvirt_driver_remote_la-%_protocol.lo
-	$(PDWTAGS)
-$(srcdir)/virnetprotocol-structs: libvirt_net_rpc_la-virnetprotocol.lo
+$(srcdir)/remote_protocol-struct $(srcdir)/qemu_protocol-struct: \
+		$(srcdir)/%-struct: libvirt_driver_remote_la-%.lo
 	$(PDWTAGS)
-$(srcdir)/virkeepaliveprotocol-structs: libvirt_net_rpc_la-virkeepaliveprotocol.lo
+$(srcdir)/virnetprotocol-struct $(srcdir)/virkeepaliveprotocol-struct: \
+		$(srcdir)/%-struct: libvirt_net_rpc_la-%.lo
 	$(PDWTAGS)
 else !WITH_REMOTE
-# These generated files must live in git, because they cannot be re-generated
-# when configured --without-remote.
-$(PROTOCOL_STRUCTS):
+# The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be
+# re-generated when configured --without-remote.
+check-protocol:
 endif
 EXTRA_DIST += $(PROTOCOL_STRUCTS)
-check-local: $(PROTOCOL_STRUCTS)
+check-local: check-protocol
+.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)

 # Mock driver, covering domains, storage, networks, etc
 TEST_DRIVER_SOURCES =						\
-- 
1.7.10.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]