[libvirt] [PATCH] build: avoid non-srcdir "make distcheck" failure (test_conf.sh)

Jim Meyering jim at meyering.net
Wed Feb 24 14:01:24 UTC 2010


"make distcheck" from a non-srcdir build dir was failing the "test_conf.sh" test

    TEST: test_conf.sh
          Failed to process /t/libvirt/.j/libvirt-0.7.6/tests/confdata/*.conf
    diff: /t/libvirt/.j/libvirt-0.7.6/tests/confdata/*.out: No such file or directory!                                        1   FAILED

due to the fact that tests/confdata/Makefile.am
was specifying its files via this:

  EXTRA_DIST = $(wildcard *.conf) $(wildcard *.out)

That led to a distribution tarball that lacked those files,
which are required by the test_conf.sh test.

Automake normally warns us not to use $(wildcard ...), but we've
suppressed the warning.  This is one case in which using $(wildcard...)
really should be avoided.

In a non-srcdir build, each of those expands to the empty string,
since the actual files are not in that directory, but in $(srcdir).

My first reflex was to just hard-code the 4 file names:

  -EXTRA_DIST = $(wildcard *.conf) $(wildcard *.out)
  +EXTRA_DIST =   \
  +  fc4.conf     \
  +  fc4.out      \
  +  libvirtd.conf      \
  +  libvirtd.out

But that'd make for more maintenance overhead if/when
we add more files.  Here it doesn't really matter, but in the
next patch you'll see that it really does, in general.

So here's a better way:
Account for the fact that the files are available in $(srcdir):

EXTRA_DIST = \
   $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/*.out $(srcdir)/*.conf))

>From ecce58c9432e83386f2a9ee275c873775577152b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 24 Feb 2010 15:01:11 +0100
Subject: [PATCH] build: avoid non-srcdir "make distcheck" failure (test_conf.sh)

* tests/confdata/Makefile.am (EXTRA_DIST): Apply $(wildcard... to
$(srcdir)/..., and then remove the prefix.
---
 tests/confdata/Makefile.am |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/confdata/Makefile.am b/tests/confdata/Makefile.am
index 5e97605..eaaadbc 100644
--- a/tests/confdata/Makefile.am
+++ b/tests/confdata/Makefile.am
@@ -1,2 +1,2 @@
-
-EXTRA_DIST = $(wildcard *.conf) $(wildcard *.out)
+EXTRA_DIST = \
+   $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/*.out $(srcdir)/*.conf))
--
1.7.0.367.g566c3




More information about the libvir-list mailing list