提交 dfb42ed1 编写于 作者: E Eric Blake

build: check correct protocol.o file

By default, libtool builds two .o files for every .lo rule:
src/foo.o - static builds
src/.libs/foo.o - shared library builds

But since commit ad42b34b disabled static builds, src/foo.o is
no longer built by default.  On a fresh checkout, this means our
protocol check rules using pdwtags were testing a missing file,
and thanks to a lousy behavior of pdwtags happily giving no output
and 0 exit status (http://bugzilla.redhat.com/949034), we were
merely claiming that "dwarves is too old" and skipping the test.

However, if you swap between branches and do incremental builds,
such as building v0.10.2-maint and then switching back to master,
you end up with src/foo.o being leftover from its 0.10.2 state,
and then 'make check' fails because the .o file does not match
the protocol-structs file due to API additions in the meantime.

A simpler fix would be to always look in .libs for the .o to
be parsed; but since it is possible to pass ./configure options
to tell libtool to do a static-only build with no shared .o,
I went with the approach of finding the newest of the two files,
whenever both exist.

* src/Makefile.am (PDWTAGS): Ensure we test just-built file.
(cherry picked from commit 5899e09e)
上级 a243e21c
......@@ -341,9 +341,16 @@ r1 = /\* \d+ \*/
r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/
struct_prefix = (remote_|qemu_|lxc_|virNet|keepalive_)
# Depending on configure options, libtool creates one or both of
# {,.libs/}libvirt_remote_driver_la-remote_protocol.o. We want the
# newest of the two, in case configure options changed and a stale
# file is left around from an earlier build.
PDWTAGS = \
$(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \
pdwtags --verbose $(<:.lo=.$(OBJEXT)) > $(@F)-t1 2> $(@F)-t2; \
o=`ls -t $(<:.lo=.$(OBJEXT)) .libs/$(<:.lo=.$(OBJEXT)) \
2>/dev/null | sed -n 1p`; \
test -f "$$o" || { echo ".o for $< not found" >&2; exit 1; }; \
pdwtags --verbose $$o > $(@F)-t1 2> $(@F)-t2; \
if test -s $(@F)-t2; then \
rm -rf $(@F)-t?; \
echo 'WARNING: pdwtags appears broken; skipping the $@ test' >&2;\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册