From 387863a5d4c6ca5c393d572a59b9ccd6053ec3a4 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 18 May 2012 12:23:26 +0200
Subject: [PATCH] Add checks from wrong hard-coded paths in manpages

This is trivial, but should prevent such things in the future.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 Makefile.am                     | 6 ++++++
 autotools/wrong-hardcoded-paths | 3 +++
 2 files changed, 9 insertions(+)
 create mode 100644 autotools/wrong-hardcoded-paths

diff --git a/Makefile.am b/Makefile.am
index f5e418b6f..7a2d35952 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -637,6 +637,7 @@ EXTRA_DIST = \
 	autotools/docpp \
 	autotools/gen-coverage \
 	autotools/testrunner \
+	autotools/wrong-hardcoded-paths \
 	$(RUN_IN_TEMPDIR) \
 	daemons/daemon-util.in \
 	daemons/ganeti-cleaner.in \
@@ -999,6 +1000,11 @@ man/footer.html: man/footer.rst
 
 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
 	lib/build/shell_example_lexer.py
+	@echo "Checking $< for hardcoded paths..."
+	@if grep -nEf autotools/wrong-hardcoded-paths $<; then \
+	  echo "Man page $< has harcoded paths (see above)!" 1>&2 ; \
+	  exit 1; \
+	fi
 	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
 
 man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
diff --git a/autotools/wrong-hardcoded-paths b/autotools/wrong-hardcoded-paths
new file mode 100644
index 000000000..b6d0ef3e2
--- /dev/null
+++ b/autotools/wrong-hardcoded-paths
@@ -0,0 +1,3 @@
+/etc/ganeti
+/usr/(local/)?lib/ganeti
+/(usr/local/)?var/(lib|run|log)/ganeti
-- 
GitLab