[libvirt] [PATCH] build: fix autogen rule for VPATH build

* cfg.mk (gnulib_srcdir): Override maint.mk default. (_update_required): Run in correct directory. --- I noticed an error message about bootstrap.conf not found when trying to do a VPATH build for my new clang setup. This subsumes up my earlier patch to declare the correct gnulib_srcdir, as noticed by Jim, but does not advance to a newer .gnulib, as there are some other issues to fix on that front first. cfg.mk | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/cfg.mk b/cfg.mk index 105b625..a6e9204 100644 --- a/cfg.mk +++ b/cfg.mk @@ -24,6 +24,9 @@ gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE)) url_dir_list = \ ftp://$(gnu_rel_host)/gnu/coreutils +# We use .gnulib, not gnulib. +gnulib_srcdir = $(srcdir)/.gnulib + # Tests not to run as part of "make distcheck". local-checks-to-skip = \ changelog-check \ @@ -282,6 +285,7 @@ ifeq (0,$(MAKELEVEL)) # b653eda3ac4864de205419d9f41eec267cb89eeb _submodule_hash = sed 's/^[ +-]//;s/ .*//' _update_required := $(shell \ + cd '$(srcdir)'; \ actual=$$(git submodule status | $(_submodule_hash); \ git hash-object bootstrap.conf; \ git diff .gnulib); \ -- 1.6.6.1

Match the fact that docs/Makefile.am dumps libvirt-api.xml in the build dir, not the source dir. * python/Makefile.am (API_DESC): Point make to the builddir for .xml files. * python/generator.py (buildStubs): Output in correct location. --- This was the only other thing getting in the way of a successful 'make syntax-check check' in a VPATH build. python/Makefile.am | 4 ++-- python/generator.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/Makefile.am b/python/Makefile.am index eda2866..e684579 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -46,14 +46,14 @@ libvirtmod_la_LIBADD = $(mylibs) \ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) GENERATE = generator.py -API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml +API_DESC = ../docs/libvirt-api.xml libvirt-override-api.xml GENERATED= libvirt-export.c \ libvirt.c \ libvirt.h \ libvirt.py generated.stamp: $(srcdir)/$(GENERATE) $(API_DESC) - $(PYTHON) $(srcdir)/$(GENERATE) $(srcdir) + $(PYTHON) $(srcdir)/$(GENERATE) . touch $@ $(GENERATED): generated.stamp diff --git a/python/generator.py b/python/generator.py index 6f082e8..25619bf 100755 --- a/python/generator.py +++ b/python/generator.py @@ -541,14 +541,14 @@ def buildStubs(): global unknown_types try: - f = open(os.path.join(srcPref,"libvirt-api.xml")) + f = open("libvirt-api.xml") data = f.read() (parser, target) = getparser() parser.feed(data) parser.close() except IOError, msg: try: - f = open(os.path.join(srcPref,"..","docs","libvirt-api.xml")) + f = open(os.path.join("..","docs","libvirt-api.xml")) data = f.read() (parser, target) = getparser() parser.feed(data) @@ -562,7 +562,7 @@ def buildStubs(): py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject") try: - f = open(os.path.join(srcPref,"libvirt-override-api.xml")) + f = open("libvirt-override-api.xml") data = f.read() (parser, target) = getparser() parser.feed(data) -- 1.6.6.1

Eric Blake wrote:
Match the fact that docs/Makefile.am dumps libvirt-api.xml in the build dir, not the source dir.
* python/Makefile.am (API_DESC): Point make to the builddir for .xml files. * python/generator.py (buildStubs): Output in correct location.
Hi Eric, Does this fix a failure or just ensure that we use more up to date .xml files? With just your cfg.mk patch, I ran a srcdir ./autogen.sh && make distclean followed by "make check syntax-check" from a non-srcdir build dir. It succeeded. The only potential down-side I see is that this requires running Python (though only in a VPATH build?), to recreate a distributed file that is available in $(srcdir).

On 04/28/2010 04:29 AM, Jim Meyering wrote:
Eric Blake wrote:
Match the fact that docs/Makefile.am dumps libvirt-api.xml in the build dir, not the source dir.
* python/Makefile.am (API_DESC): Point make to the builddir for .xml files. * python/generator.py (buildStubs): Output in correct location.
Hi Eric,
Does this fix a failure or just ensure that we use more up to date .xml files?
It was an actual VPATH build failure. <goes to look in scrollback buffer...> make[3]: Entering directory `/home/eblake/libvirt/build-rawhide/python' make[3]: *** No rule to make target `../../docs/libvirt-api.xml', needed by `generated.stamp'. Stop.
With just your cfg.mk patch, I ran a srcdir ./autogen.sh && make distclean followed by "make check syntax-check" from a non-srcdir build dir. It succeeded.
The only potential down-side I see is that this requires running Python (though only in a VPATH build?), to recreate a distributed file that is available in $(srcdir).
That chunk of python/Makefile.am is guarded by WITH_PYTHON. So before the patch, the file libvirt-override-api.xml was only available in $(srcdir) if python was present _and_ builddir=srcdir; after the patch, it is only available in $(builddir) if python is present. But since docs/libvirt-api.xml was only available in $(builddir), we might as well be consistent on the two .xml files. Should we be distributing a pre-built libvirt-api.xml and libvirt-override-api.xml? If so, then we should ditch this patch and instead do a patch to stick docs/libvirt-api.xml into $(srcdir) instead of $(builddir). If not, then I need to tweak this patch to remove libvirt-override-api.xml from EXTRA_DIST. Either way, I guess I need to test 'make dist' before proposing v2 of this patch. Thoughts? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
On 04/28/2010 04:29 AM, Jim Meyering wrote:
Eric Blake wrote:
Match the fact that docs/Makefile.am dumps libvirt-api.xml in the build dir, not the source dir.
* python/Makefile.am (API_DESC): Point make to the builddir for .xml files. * python/generator.py (buildStubs): Output in correct location.
Hi Eric,
Does this fix a failure or just ensure that we use more up to date .xml files?
It was an actual VPATH build failure. <goes to look in scrollback buffer...>
make[3]: Entering directory `/home/eblake/libvirt/build-rawhide/python' make[3]: *** No rule to make target `../../docs/libvirt-api.xml', needed by `generated.stamp'. Stop.
With just your cfg.mk patch, I ran a srcdir ./autogen.sh && make distclean followed by "make check syntax-check" from a non-srcdir build dir. It succeeded.
The only potential down-side I see is that this requires running Python (though only in a VPATH build?), to recreate a distributed file that is available in $(srcdir).
That chunk of python/Makefile.am is guarded by WITH_PYTHON. So before the patch, the file libvirt-override-api.xml was only available in $(srcdir) if python was present _and_ builddir=srcdir; after the patch, it is only available in $(builddir) if python is present. But since docs/libvirt-api.xml was only available in $(builddir), we might as well be consistent on the two .xml files.
Should we be distributing a pre-built libvirt-api.xml and libvirt-override-api.xml? If so, then we should ditch this patch and
I doubt we've documented the criteria libvirt uses for deciding whether to distribute generated files. However, one good reason to distribute such files (generated by python scripts) is to be able to provide the API xml files even to people who lack python support and to those who choose to configure --without-python.
instead do a patch to stick docs/libvirt-api.xml into $(srcdir) instead of $(builddir). If not, then I need to tweak this patch to remove libvirt-override-api.xml from EXTRA_DIST. Either way, I guess I need to test 'make dist' before proposing v2 of this patch. Thoughts?

The rule of thumb for generated files: If they are distributed, they should be generated in $(srcdir); otherwise, they should be built by the end user in $(builddir). Since our .xml docs are built with python, and we want them available even to end users that don't build with python, we want them distributed; hence, they must live in $(srcdir). Tested with 'make distcheck' in both an in-tree build and a VPATH build. * docs/Makefile.am (EXTRA_DIST): Remove redundant listing of xml files. ($(devhelphtml)): Since we distribute .xml, build it in srcdir. (html/%-%.html, html/%-virterror.html, %-api.xml, %-refs.xml): Rewrite with... (python_generated_files): ...new macro. (libvirt-api.xml, libvirt-refs.xml): ...longhand. (api, web, html/index.html, maintainer-clean-local): (html/index.html, %.html.tmp, %.html): Update location. (dot_html_in, patches): Massage wildcard correctly. * docs/apibuild.py (docBuilder.serialize): Put output in srcdir. (docBuilder.serialize_xrefs_references): Update location. (rebuild): Look for built libvirt.h in builddir. * .gitignore: Ignore 'make distcheck' crumbs. ---
Should we be distributing a pre-built libvirt-api.xml and libvirt-override-api.xml?
I doubt we've documented the criteria libvirt uses for deciding whether to distribute generated files. However, one good reason to distribute such files (generated by python scripts) is to be able to provide the API xml files even to people who lack python support and to those who choose to configure --without-python.
This patch replaces 2/2 of v1 of the series (1/2 of the original series is already pushed). It took me a lot longer than originally anticipated, because the docs/Makefile.am was playing quite fast and loose when it came to builddir vs. srcdir. This is my first time ever writing a patch that involves python source. But as stated in the commit message, I proved to myself that it works by doing 'make distcheck' from a VPATH build. .gitignore | 1 + docs/Makefile.am | 52 +++++++++++++++++++++++++++++++--------------------- docs/apibuild.py | 18 +++++++++++++----- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 8c275f4..76c8986 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ cscope.files cscope.out gnulib/ libtool +/libvirt-[0-9]* libvirt-*.tar.gz libvirt.pc libvirt.spec diff --git a/docs/Makefile.am b/docs/Makefile.am index a18821b..91ae13e 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -53,10 +53,10 @@ gif = \ architecture.gif \ node.gif -dot_html_in = $(wildcard *.html.in) +dot_html_in = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/*.html.in)) dot_html = $(dot_html_in:%.html.in=%.html) -patches = $(wildcard api_extension/*.patch) +patches = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/api_extension/*.patch)) xml = \ libvirt-api.xml \ @@ -70,8 +70,8 @@ fig = \ libvirt-object-model.fig EXTRA_DIST= \ - libvirt-api.xml libvirt-refs.xml apibuild.py \ - site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ + apibuild.py \ + site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ $(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \ $(xml) $(fig) $(png) \ @@ -83,9 +83,10 @@ MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml) all: web -api: libvirt-api.xml libvirt-refs.xml +api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml -web: $(dot_html) html/index.html devhelp/index.html +web: $(srcdir)/$(dot_html) $(srcdir)/html/index.html \ + $(srcdir)/devhelp/index.html ChangeLog.xml: ../ChangeLog ChangeLog.awk awk -f ChangeLog.awk < $< > $@ @@ -99,7 +100,7 @@ ChangeLog.html.in: ChangeLog.xml ChangeLog.xsl %.png: %.fig convert -rotate 90 $< $@ -%.html.tmp: %.html.in site.xsl page.xsl sitemap.html.in +%.html.tmp: $(srcdir)/%.html.in site.xsl page.xsl sitemap.html.in @(if [ -x $(XSLTPROC) ] ; then \ echo "Generating $@"; \ name=`echo $@ | sed -e 's/.tmp//'`; \ @@ -107,16 +108,20 @@ ChangeLog.html.in: ChangeLog.xml ChangeLog.xsl %.html: %.html.tmp @(if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ - if $(XMLCATALOG) /etc/xml/catalog "-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \ + if $(XMLCATALOG) /etc/xml/catalog \ + "-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \ echo "Validating $@" ; \ - $(XMLLINT) --nonet --format --valid $< > $@ || (rm $@ && exit 1) ; \ + $(XMLLINT) --nonet --format --valid $< > $@ \ + || (rm $@ && exit 1) ; \ else echo "missing XHTML1 DTD" ; fi ; fi ); -html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in +$(srcdir)/html/index.html: $(srcdir)/libvirt-api.xml newapi.xsl page.xsl \ + sitemap.html.in -@(if [ -x $(XSLTPROC) ] ; then \ echo "Rebuilding the HTML pages from the XML API" ; \ - $(XSLTPROC) --nonet $(srcdir)/newapi.xsl libvirt-api.xml ; fi ) + $(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml; \ + fi ) -@(if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ if $(XMLCATALOG) /etc/xml/catalog "-//W3C//DTD XHTML 1.0 Strict//EN" \ > /dev/null ; then \ @@ -124,25 +129,30 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in $(XMLLINT) --nonet --valid --noout html/*.html ; \ else echo "missing XHTML1 DTD" ; fi ; fi ); -$(devhelphtml): libvirt-api.xml $(devhelpxsl) +$(devhelphtml): $(srcdir)/libvirt-api.xml $(devhelpxsl) -@(echo Rebuilding devhelp files) -@(if [ -x $(XSLTPROC) ] ; then \ $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \ - $(top_srcdir)/docs/devhelp/devhelp.xsl libvirt-api.xml ; fi ); - -html/%-%.html html/%-virterror.html %-api.xml %-refs.xml: $(srcdir)/apibuild.py - -srcdir=$(srcdir) $(srcdir)/apibuild.py - -html/%-%.html html/%-virterror.html %-api.xml %-refs.xml: \ - $(srcdir)/../include/%/*.h \ - $(srcdir)/../src/%.c \ + $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; \ + fi ); + +python_generated_files = \ + $(srcdir)/html/libvirt-libvirt.html \ + $(srcdir)/html/libvirt-virterror.html \ + $(srcdir)/libvirt-api.xml \ + $(srcdir)/libvirt-refs.xml + +$(python_generated_files): $(srcdir)/apibuild.py \ + $(srcdir)/../include/libvirt/*.h \ + $(srcdir)/../src/libvirt.c \ $(srcdir)/../src/util/virterror.c + -srcdir=$(srcdir) $(srcdir)/apibuild.py clean-local: rm -f *~ *.bak *.hierarchy *.signals *-unused.txt maintainer-clean-local: clean-local - rm -rf libvirt-api.xml libvirt-refs.xml + rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml rebuild: api all diff --git a/docs/apibuild.py b/docs/apibuild.py index 2dda4df..da50afb 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -11,6 +11,13 @@ import os, sys import string import glob +if __name__ == "__main__": + # launched as a script + srcPref = os.path.dirname(sys.argv[0]) +else: + # imported + srcPref = os.path.dirname(__file__) + debug=0 debugsym=None @@ -1983,7 +1990,7 @@ class docBuilder: idf = self.idx.identifiers[id] module = idf.header output.write(" <reference name='%s' href='%s'/>\n" % (id, - 'html/' + self.basename + '-' + + srcPref + '/html/' + self.basename + '-' + self.modulename_file(module) + '.html#' + id)) @@ -2057,7 +2064,7 @@ class docBuilder: def serialize(self): filename = "%s-api.xml" % self.name print "Saving XML description %s" % (filename) - output = open(filename, "w") + output = open(os.path.join(srcPref,filename), "w") output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n') output.write("<api name='%s'>\n" % self.name) output.write(" <files>\n") @@ -2093,7 +2100,7 @@ class docBuilder: filename = "%s-refs.xml" % self.name print "Saving XML Cross References %s" % (filename) - output = open(filename, "w") + output = open(os.path.join(srcPref,filename), "w") output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n') output.write("<apirefs name='%s'>\n" % self.name) self.serialize_xrefs(output) @@ -2109,10 +2116,11 @@ def rebuild(): builder = docBuilder("libvirt", [srcdir + "/../src", srcdir + "/../src/util", - srcdir + "/../include/libvirt"], + srcdir + "/../include/libvirt", + "../include/libvirt"], []) elif glob.glob("src/libvirt.c") != [] : - print "Rebuilding API description for libvir" + print "Rebuilding API description for libvirt" builder = docBuilder("libvirt", ["src", "src/util", "include/libvirt"], []) else: -- 1.6.6.1

On 04/28/2010 07:37 PM, Eric Blake wrote:
The rule of thumb for generated files: If they are distributed, they should be generated in $(srcdir); otherwise, they should be built by the end user in $(builddir).
A minor clarification: a generated file must be machine-independent before it is a candidate for distribution. (For an obvious example, .o files are generated, but are definitely machine-dependent, hence they must live in $(builddir) and be built by the end user. As another example, configure and Makefile.in are generated but machine-independent, while config.status and Makefile are generated but machine-dependent, so only the former set belongs in the tarball.) The tools used for generating files are only optional if the tool is only needed for generating files into $(srcdir) (back to our example, cc is an end user prerequisite, but python can be optional for the end user because in the case of ./configure --without-python, the only files generated by python are already in the distribution). Finally, remember that tools that are optional for the end user are still mandatory for the person running 'make dist', hence our bootstrap.conf should be sure to list them to avoid a broken tarball just because the developer providing the package was missing some optional prerequisites. On a related point, in the case of libvirt, files generated by rpcgen blur the boundary. We allow the user to run their native rpcgen, meaning that the end file can be somewhat machine-dependent, but the version we ship in $(srcdir) must be generated by a particular flavor of rpcgen which is known to produce machine-independent files. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
The rule of thumb for generated files: If they are distributed, they should be generated in $(srcdir); otherwise, they should be built by the end user in $(builddir). Since our .xml docs are built with python, and we want them available even to end users that don't build with python, we want them distributed; hence, they must live in $(srcdir).
Tested with 'make distcheck' in both an in-tree build and a VPATH build.
* docs/Makefile.am (EXTRA_DIST): Remove redundant listing of xml files. ($(devhelphtml)): Since we distribute .xml, build it in srcdir. (html/%-%.html, html/%-virterror.html, %-api.xml, %-refs.xml): Rewrite with... (python_generated_files): ...new macro. (libvirt-api.xml, libvirt-refs.xml): ...longhand. (api, web, html/index.html, maintainer-clean-local): (html/index.html, %.html.tmp, %.html): Update location. (dot_html_in, patches): Massage wildcard correctly. * docs/apibuild.py (docBuilder.serialize): Put output in srcdir. (docBuilder.serialize_xrefs_references): Update location. (rebuild): Look for built libvirt.h in builddir. * .gitignore: Ignore 'make distcheck' crumbs.
This all looks good. Thanks! ACK.

On Wed, Apr 28, 2010 at 07:37:02PM -0600, Eric Blake wrote:
The rule of thumb for generated files: If they are distributed, they should be generated in $(srcdir); otherwise, they should be built by the end user in $(builddir). Since our .xml docs are built with python, and we want them available even to end users that don't build with python, we want them distributed; hence, they must live in $(srcdir).
Actually there is a couple more points, as I wanted those xml to be part of the docs, if someone installs the package (with or without python) and online. Now the web space is rebuilt so they are not in git anymore but it used to be in the SCM for this. Having the libvirt-api.xml installed as part of the package documentation is still IMHO a good justification to have it part of the dist tarball too. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Wed, Apr 28, 2010 at 07:37:02PM -0600, Eric Blake wrote:
diff --git a/docs/Makefile.am b/docs/Makefile.am index a18821b..91ae13e 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -53,10 +53,10 @@ gif = \ architecture.gif \ node.gif
-dot_html_in = $(wildcard *.html.in) +dot_html_in = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/*.html.in)) dot_html = $(dot_html_in:%.html.in=%.html)
-patches = $(wildcard api_extension/*.patch) +patches = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/api_extension/*.patch))
xml = \ libvirt-api.xml \ @@ -70,8 +70,8 @@ fig = \ libvirt-object-model.fig
EXTRA_DIST= \ - libvirt-api.xml libvirt-refs.xml apibuild.py \ - site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ + apibuild.py \ + site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ $(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \ $(xml) $(fig) $(png) \
We explicitly wanted the libvirt-api.xml libvirt-refs.xml files in the tar.gz, even though they are generated, since this allows people to build libvirt without python. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 04/29/2010 09:59 AM, Daniel P. Berrange wrote:
- libvirt-api.xml libvirt-refs.xml apibuild.py \ - site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ + apibuild.py \ + site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ $(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \ $(xml) $(fig) $(png) \
We explicitly wanted the libvirt-api.xml libvirt-refs.xml files in the tar.gz, even though they are generated, since this allows people to build libvirt without python.
They still are, under $(apihtml) and $(devhelphtml). In other words, they were listed twice, and my patch only cut the duplicates. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Try to avoid future regressions on the VPATH front. * autobuild.sh: Uncomment VPATH use. Suggested by Daniel P. Berrange. --- Suggested in IRC; I'm still in the midst of testing it out on a fresh git clone. autobuild.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index d3934ea..5861b43 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -10,9 +10,9 @@ test -n "$1" && RESULTS=$1 || RESULTS=results.log test -f Makefile && make -k distclean || : rm -rf coverage -#rm -rf build -#mkdir build -#cd build +rm -rf build +mkdir build +cd build ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ --enable-test-coverage \ -- 1.6.6.1

On 04/30/2010 08:55 AM, Eric Blake wrote:
+++ b/autobuild.sh @@ -10,9 +10,9 @@ test -n "$1" && RESULTS=$1 || RESULTS=results.log test -f Makefile && make -k distclean || : rm -rf coverage
-#rm -rf build -#mkdir build -#cd build +rm -rf build +mkdir build +cd build
./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
Obviously, this line needs to change to invoke ../autogen.sh. Just goes to show how far I'd gotten into my testing when I posted this... -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

* docs/Makefile.am (ChangeLog.html.in, %.html.tmp, %.html) (html/index.html, $(devhelphtml)): Avoid spurious subshells. --- This is pretty trivial; I noticed it while building the previous patch. docs/Makefile.am | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 91ae13e..634d456 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -92,49 +92,51 @@ ChangeLog.xml: ../ChangeLog ChangeLog.awk awk -f ChangeLog.awk < $< > $@ ChangeLog.html.in: ChangeLog.xml ChangeLog.xsl - @(if [ -x $(XSLTPROC) ] ; then \ + @if [ -x $(XSLTPROC) ] ; then \ echo "Generating $@"; \ name=`echo $@ | sed -e 's/.tmp//'`; \ - $(XSLTPROC) --nonet $(top_srcdir)/docs/ChangeLog.xsl $< > $@ || (rm $@ && exit 1) ; fi ) + $(XSLTPROC) --nonet $(top_srcdir)/docs/ChangeLog.xsl $< > $@ \ + || { rm $@ && exit 1; }; fi %.png: %.fig convert -rotate 90 $< $@ %.html.tmp: $(srcdir)/%.html.in site.xsl page.xsl sitemap.html.in - @(if [ -x $(XSLTPROC) ] ; then \ + @if [ -x $(XSLTPROC) ] ; then \ echo "Generating $@"; \ name=`echo $@ | sed -e 's/.tmp//'`; \ - $(XSLTPROC) --stringparam pagename $$name --nonet --html $(top_srcdir)/docs/site.xsl $< > $@ || (rm $@ && exit 1) ; fi ) + $(XSLTPROC) --stringparam pagename $$name --nonet --html \ + $(top_srcdir)/docs/site.xsl $< > $@ \ + || { rm $@ && exit 1; }; fi %.html: %.html.tmp - @(if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ + @if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ if $(XMLCATALOG) /etc/xml/catalog \ "-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \ echo "Validating $@" ; \ $(XMLLINT) --nonet --format --valid $< > $@ \ - || (rm $@ && exit 1) ; \ - else echo "missing XHTML1 DTD" ; fi ; fi ); - + || { rm $@ && exit 1; }; \ + else echo "missing XHTML1 DTD" ; fi ; fi $(srcdir)/html/index.html: $(srcdir)/libvirt-api.xml newapi.xsl page.xsl \ sitemap.html.in - -@(if [ -x $(XSLTPROC) ] ; then \ + -@if [ -x $(XSLTPROC) ] ; then \ echo "Rebuilding the HTML pages from the XML API" ; \ $(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml; \ - fi ) - -@(if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ + fi + -@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ if $(XMLCATALOG) /etc/xml/catalog "-//W3C//DTD XHTML 1.0 Strict//EN" \ > /dev/null ; then \ echo "Validating the resulting XHTML pages" ; \ $(XMLLINT) --nonet --valid --noout html/*.html ; \ - else echo "missing XHTML1 DTD" ; fi ; fi ); + else echo "missing XHTML1 DTD" ; fi ; fi $(devhelphtml): $(srcdir)/libvirt-api.xml $(devhelpxsl) - -@(echo Rebuilding devhelp files) - -@(if [ -x $(XSLTPROC) ] ; then \ + -@echo Rebuilding devhelp files + -@if [ -x $(XSLTPROC) ] ; then \ $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \ $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; \ - fi ); + fi python_generated_files = \ $(srcdir)/html/libvirt-libvirt.html \ -- 1.6.6.1

On 04/29/2010 04:12 AM, Jim Meyering wrote:
Eric Blake wrote:
* docs/Makefile.am (ChangeLog.html.in, %.html.tmp, %.html) (html/index.html, $(devhelphtml)): Avoid spurious subshells.
Thanks. I've made similar changes in the vicinity. ACK.
I've gone ahead and pushed just this patch from the original series, to make it easier to resolve other VPATH issues that I am still trying to figure out. I have VPATH 'make' working nicely, but 'make install' is still giving me grief. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
* cfg.mk (gnulib_srcdir): Override maint.mk default. (_update_required): Run in correct directory. ---
I noticed an error message about bootstrap.conf not found when trying to do a VPATH build for my new clang setup.
This subsumes up my earlier patch to declare the correct gnulib_srcdir, as noticed by Jim, but does not advance to a newer .gnulib, as there are some other issues to fix on that front first.
cfg.mk | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/cfg.mk b/cfg.mk index 105b625..a6e9204 100644 --- a/cfg.mk +++ b/cfg.mk @@ -24,6 +24,9 @@ gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE)) url_dir_list = \ ftp://$(gnu_rel_host)/gnu/coreutils
+# We use .gnulib, not gnulib. +gnulib_srcdir = $(srcdir)/.gnulib + # Tests not to run as part of "make distcheck". local-checks-to-skip = \ changelog-check \ @@ -282,6 +285,7 @@ ifeq (0,$(MAKELEVEL)) # b653eda3ac4864de205419d9f41eec267cb89eeb _submodule_hash = sed 's/^[ +-]//;s/ .*//' _update_required := $(shell \ + cd '$(srcdir)'; \ actual=$$(git submodule status | $(_submodule_hash); \ git hash-object bootstrap.conf; \ git diff .gnulib); \
ACK. FYI, I never encountered a need for that "cd" before, in testing VPATH builds, because my first step was always to run ./autogen.sh && distclean from the srcdir, not realizing that e.g., ../autogen.sh (from the build dir) was supposed to work, too.

On Wed, Apr 28, 2010 at 12:17:43PM +0200, Jim Meyering wrote:
Eric Blake wrote:
+ cd '$(srcdir)'; \ actual=$$(git submodule status | $(_submodule_hash); \ git hash-object bootstrap.conf; \ git diff .gnulib); \
ACK. FYI, I never encountered a need for that "cd" before, in testing VPATH builds, because my first step was always to run ./autogen.sh && distclean from the srcdir, not realizing that e.g., ../autogen.sh (from the build dir) was supposed to work, too.
BTW since we have auto* experts around, I tend to use the CDPATH environment variable to make navigation within my tree easier, but has a tendency to break some of the auto* target, because as a result the cd command outputs the target directory instead of being silent. This used to break for example "make dist" in subtle ways. If you see the Makefile.am rpm target that I use commonly, I added the unset there, but it may be nicer to actually fix auto* :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 04/28/2010 07:00 AM, Daniel Veillard wrote:
ACK.
Given Jim's ACK, and my discussion below, I've pushed 1/2 as-is. I'll wait for further comments and a v2 of my 2/2 patch before pushing it.
BTW since we have auto* experts around, I tend to use the CDPATH environment variable to make navigation within my tree easier, but has a tendency to break some of the auto* target, because as a result the cd command outputs the target directory instead of being silent. This used to break for example "make dist" in subtle ways.
Yeah, that can be an issue. If you like CDPATH (and I do; I use it regularly), I recommend: - do _not_ export it to the environment. Set it as a shell-local variable in .bashrc, and not an environment variable, so that child shells spawned by make don't see it set - consider explicitly putting . in CDPATH, since some shells like older zsh did not follow POSIX rules of implicitly trying . after exhausting CDPATH Meanwhile, there's a couple things to remember about when CDPATH will interfere with cd. 'cd name' and even 'cd name/sub' must produce output if CDPATH assisted in the resolution, but 'cd /abs-name' and 'cd ./anchored-name' must be silent because CDPATH cannot participate in the resolution. So if you are sure name is absolute, you can use 'cd $(name)' without worries; if you are sure it is relative, you can use 'cd ./$(name)' without worries, and if you are unsure, then yes, you have to unset CDPATH first. Please do point out any particular places where we might be using cd on a name that might be relative. The autotools have had bugs in the past, but are hopefully clean right now; but the problem is that you often get uses of cd outside of stuff provided by the autotools. But for my patch, "cd $(srcdir)" is reasonably safe, because even if it is relative, it will normally be anchored ('.' for builddir=srcdir, or some form of '../name' if you build in a subdir or sibling dir, which is the only two forms of VPATH builds that I use). The only case where it would not be anchored is if someone builds in the parent dir, but that is a very unusual build setup. If you are paranoid, though, I could change that to "cd '$(abs_srcdir)'" to avoid the issue even for someone building in the parent dir. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake
-
Jim Meyering