From 2750b299eaeefd1e462cdb4b9835107f43f2a26e Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 4 Nov 2010 15:56:13 +0100
Subject: [PATCH] Revert commit e7e23e73, work around Automake bug
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

After commit e7e23e73 the build would fail in distcheck on systems with
Automake 1.10. An investigation identified Automake bug #533[1] as the
cause. Applying the changes in Automake commit 3a12ed5e[2] to the
generated Makefile.in file made distcheck work again.

The underlying problem is that in our case both doc/html and
doc/html/.dir were included in the distributed files. When distcheck
copied the former from the source to the staging directory, it was
marked as read-only (distcheck makes the whole source read-only). It
then tried to copy doc/html/.dir from the build directory, which failed.
Automake 1.11 and newer avoid this problem by adjusting the permissions.

Since depending on Automake 1.11 or above is not an option at this time,
a work-around was found by not using a β€œ.dir” file in doc/html, but
using β€œindex.html” as a flag for creating the directory.

[1] http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view&database=automake&pr=533
[2] http://git.savannah.gnu.org/gitweb/?p=automake.git;a=commit;h=3a12ed5e97dc193a38dd14e031658cbd329b50ca

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 Makefile.am | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 56a8500a5..b4e111b91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,10 +57,13 @@ DIRS = \
 	test/data \
 	tools
 
-BUILDTIME_DIRS = \
+BUILDTIME_DIR_AUTOCREATE = \
 	scripts \
 	doc/api \
-	doc/coverage \
+	doc/coverage
+
+BUILDTIME_DIRS = \
+	$(BUILDTIME_DIR_AUTOCREATE) \
 	doc/html
 
 DIRCHECK_EXCLUDE = \
@@ -68,7 +71,7 @@ DIRCHECK_EXCLUDE = \
 	ganeti-[0-9]*.[0-9]*.[0-9]* \
 	doc/html/_*
 
-all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIRS))
+all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
 
 MAINTAINERCLEANFILES = \
 	$(docpng) \
@@ -226,9 +229,10 @@ docrst = \
 $(RUN_IN_TEMPDIR): | $(all_dirfiles)
 
 doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
-	$(RUN_IN_TEMPDIR) | doc/html/.dir
+	$(RUN_IN_TEMPDIR)
 	@test -n "$(SPHINX)" || \
 	    { echo 'sphinx-build' not found during configure; exit 1; }
+	@mkdir_p@ $(dir $@)
 	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
 	    -d . \
 	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
@@ -732,7 +736,6 @@ dist-hook:
 	$(MAKE) regen-vcs-version && \
 	rm -f $(top_distdir)/vcs-version && \
 	cp -p $(srcdir)/vcs-version $(top_distdir)
-	rm $(top_distdir)/doc/html/.dir
 
 # a distcheck hook rule for catching revision control directories
 distcheck-hook:
-- 
GitLab