From e8230860709240b2f8461e0ef22cb45b9c0f1ba6 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 19 Jun 2008 12:56:17 +0000
Subject: [PATCH] Use a single Makefile.am instead of many

This change allows us to use cleaner dependencies between
directories. The build system is basically rewritten in large parts
and may contain bugs.

Reviewed-by: iustinp
---
 Makefile.am                  | 283 ++++++++++++++++++++++++++++++++---
 autotools/docbook-wrapper    |  31 ++++
 configure.ac                 |  16 +-
 daemons/Makefile.am          |   1 -
 devel/Makefile.am            |   9 --
 doc/Makefile.am              |  20 ---
 doc/examples/Makefile.am     |  13 --
 lib/Makefile.am              |  34 -----
 lib/hypervisor/Makefile.am   |   7 -
 man/Makefile.am              |  38 -----
 qa/Makefile.am               |  14 --
 qa/hooks/Makefile.am         |   2 -
 scripts/Makefile.am          |   1 -
 test/Makefile.am             |  18 ---
 test/ganeti.bdev_unittest.py |   5 +-
 tools/Makefile.am            |   2 -
 16 files changed, 297 insertions(+), 197 deletions(-)
 create mode 100755 autotools/docbook-wrapper
 delete mode 100644 daemons/Makefile.am
 delete mode 100644 devel/Makefile.am
 delete mode 100644 doc/Makefile.am
 delete mode 100644 doc/examples/Makefile.am
 delete mode 100644 lib/Makefile.am
 delete mode 100644 lib/hypervisor/Makefile.am
 delete mode 100644 man/Makefile.am
 delete mode 100644 qa/Makefile.am
 delete mode 100644 qa/hooks/Makefile.am
 delete mode 100644 scripts/Makefile.am
 delete mode 100644 test/Makefile.am
 delete mode 100644 tools/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 98a703598..9a194ca59 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,16 +1,266 @@
+# Ganeti makefile
+# - Indent with tabs only.
+# - Keep files sorted; one line per file.
+# - Directories in lib/ must have their own *dir variable (see hypervisor).
+# - All directories must be listed DIRS.
+# - Use autogen.sh to generate Makefile.in and configure script
+
+# Automake doesn't export these variables before version 1.10.
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+
 ACLOCAL_AMFLAGS = -I autotools
+DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
+REPLACE_VARS_SED = autotools/replace_vars.sed
+
+hypervisordir = $(pkgpythondir)/hypervisor
+toolsdir = $(pkglibdir)/tools
+docdir = $(datadir)/doc/$(PACKAGE)
+
+DIRS = \
+	autotools \
+	daemons \
+	devel \
+	doc \
+	doc/examples \
+	lib \
+	lib/hypervisor \
+	man \
+	qa \
+	qa/hooks \
+	scripts \
+	test \
+	test/data \
+	tools
+
+CLEANFILES = \
+	autotools/replace_vars.sed \
+	devel/upload \
+	doc/*.html \
+	doc/*.in \
+	doc/*.pdf \
+	doc/examples/ganeti.initd \
+	doc/examples/ganeti.cron \
+	lib/*.py[co] \
+	lib/hypervisor/*.py[co] \
+	man/*.[78] \
+	man/*.in \
+	qa/*.py[co] \
+	qa/hooks/*.py[co] \
+	test/*.py[co] \
+	stamp-directories \
+	$(nodist_pkgpython_PYTHON)
+
+nodist_pkgpython_PYTHON = \
+	lib/_autoconf.py
+
+pkgpython_PYTHON = \
+	lib/__init__.py \
+	lib/backend.py \
+	lib/bdev.py \
+	lib/bootstrap.py \
+	lib/cli.py \
+	lib/cmdlib.py \
+	lib/config.py \
+	lib/constants.py \
+	lib/errors.py \
+	lib/jqueue.py \
+	lib/locking.py \
+	lib/logger.py \
+	lib/luxi.py \
+	lib/mcpu.py \
+	lib/objects.py \
+	lib/opcodes.py \
+	lib/rpc.py \
+	lib/serializer.py \
+	lib/ssconf.py \
+	lib/ssh.py \
+	lib/utils.py
+
+hypervisor_PYTHON = \
+	lib/hypervisor/__init__.py \
+	lib/hypervisor/hv_base.py \
+	lib/hypervisor/hv_fake.py \
+	lib/hypervisor/hv_xen.py
+
+docsgml = \
+	doc/hooks.sgml \
+	doc/install.sgml \
+	doc/admin.sgml \
+	doc/iallocator.sgml
+
+doc_DATA = \
+	$(patsubst %.sgml,%.html,$(docsgml)) \
+	$(patsubst %.sgml,%.pdf,$(docsgml))
+
+dist_sbin_SCRIPTS = \
+	daemons/ganeti-noded \
+	daemons/ganeti-watcher \
+	daemons/ganeti-master \
+	daemons/ganeti-masterd \
+	scripts/gnt-backup \
+	scripts/gnt-cluster \
+	scripts/gnt-debug \
+	scripts/gnt-instance \
+	scripts/gnt-job \
+	scripts/gnt-node \
+	scripts/gnt-os
+
+dist_tools_SCRIPTS = \
+	tools/burnin \
+	tools/cfgshell \
+	tools/cfgupgrade \
+	tools/lvmstrap
+
+EXTRA_DIST = \
+	NEWS \
+	DEVNOTES \
+	autotools/docbook-wrapper \
+	devel/upload.in \
+	$(docsgml) \
+	doc/examples/ganeti.initd.in \
+	doc/examples/ganeti.cron.in \
+	doc/examples/dumb-allocator \
+	qa/hooks/datehook.py \
+	qa/hooks/loghook.py \
+	test/testutils.py \
+	test/mocks.py \
+	$(dist_TESTS) \
+	$(TEST_FILES) \
+	man/footer.sgml \
+	$(mansgml) \
+	qa/ganeti-qa.py \
+	qa/qa-sample.yaml \
+	qa/qa_cluster.py \
+	qa/qa_config.py \
+	qa/qa_daemon.py \
+	qa/qa_env.py \
+	qa/qa_error.py \
+	qa/qa_instance.py \
+	qa/qa_node.py \
+	qa/qa_os.py \
+	qa/qa_other.py \
+	qa/qa_tags.py \
+	qa/qa_utils.py
+
+man_MANS = \
+	man/ganeti.7 \
+	man/ganeti-master.8 \
+	man/ganeti-noded.8 \
+	man/ganeti-os-interface.7 \
+	man/ganeti-watcher.8 \
+	man/gnt-backup.8 \
+	man/gnt-cluster.8 \
+	man/gnt-instance.8 \
+	man/gnt-node.8 \
+	man/gnt-os.8
+
+maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
+mansgml = $(patsubst %.in,%.sgml,$(maninput))
+
+TEST_FILES = \
+	test/data/bdev-both.txt \
+	test/data/bdev-disk.txt \
+	test/data/bdev-net.txt \
+	test/data/proc_drbd8.txt
+
+dist_TESTS = \
+	test/ganeti.config_unittest.py \
+	test/ganeti.hooks_unittest.py \
+	test/ganeti.utils_unittest.py \
+	test/ganeti.bdev_unittest.py \
+	test/ganeti.ssh_unittest.py \
+	test/ganeti.locking_unittest.py \
+	test/ganeti.constants_unittest.py
+
+nodist_TESTS =
+
+TESTS = $(dist_TESTS) $(nodist_TESTS)
+
+TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
+
 
-SUBDIRS = man lib scripts daemons doc test tools qa devel
-EXTRA_DIST = NEWS DEVNOTES
+all-local: stamp-directories lib/_autoconf.py devel/upload \
+	doc/examples/ganeti.initd doc/examples/ganeti.cron
+
+devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
+	sed -f $(REPLACE_VARS_SED) < $< > $@
+	chmod u+x $@
+
+doc/examples/ganeti.%: doc/examples/ganeti.%.in stamp-directories \
+		$(REPLACE_VARS_SED)
+	sed -f $(REPLACE_VARS_SED) < $< > $@
+
+doc/%.in: doc/%.sgml stamp-directories $(REPLACE_VARS_SED)
+	sed -f $(REPLACE_VARS_SED) < $< > $@
+
+man/%.in: man/%.sgml stamp-directories $(REPLACE_VARS_SED)
+	sed -f $(REPLACE_VARS_SED) < $< > $@
+
+doc/%.pdf: doc/%.in $(DOCBOOK_WRAPPER)
+	$(DOCBOOK_WRAPPER) $< $@
+
+doc/%.html: doc/%.in $(DOCBOOK_WRAPPER)
+	$(DOCBOOK_WRAPPER) $< $@
+
+man/%.7: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
+	$(DOCBOOK_WRAPPER) $< $@
+
+man/%.8: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
+	$(DOCBOOK_WRAPPER) $< $@
+
+man/footer.sgml $(TESTS): srclinks
+
+$(TESTS): ganeti
+
+lib/_autoconf.py: Makefile stamp-directories
+	set -e; \
+	{ echo '# This file is automatically generated, do not edit!'; \
+	  echo '#'; \
+	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
+	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
+	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
+	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
+	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
+	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
+	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
+	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
+	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
+	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
+	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
+	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
+	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
+	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
+	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
+	} > $@
+
+$(REPLACE_VARS_SED): Makefile stamp-directories
+	set -e; \
+	{ echo 's#@PREFIX@#$(prefix)#g'; \
+	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
+	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
+	  echo 's#@SBINDIR@#$(sbindir)#g'; \
+	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
+	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
+	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
+	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
+	} > $@
+
+# We need to create symlinks because "make distcheck" will not install Python
+# files when building.
+#.PHONY: srclinks
+srclinks: stamp-directories
+	set -e; \
+	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON); do \
+		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
+			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
+		fi; \
+	done
 
 .PHONY: ganeti
 ganeti:
 	cd $(top_builddir) && rm -f $@ && $(LN_S) lib $@
 
-pre-check: ganeti
-	$(MAKE) -C lib $@
-	$(MAKE) -C lib/hypervisor $@
-
 # a dist hook rule for catching revision control directories
 distcheck-hook:
 	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
@@ -18,20 +268,13 @@ distcheck-hook:
 		exit 1; \
 	fi
 
-# custom rules
-depgraph: depgraph.png
-
-depgraph.png: depgraph.dot
-	dot -Tpng -o $@ $<
-
-depgraph.ps: depgraph.dot
-	dot -Tps -o $@ $<
-
-depgraph.dot: ganeti/*.py
-	pylint.python2.4 --indent-string '  ' --rcfile=/dev/null \
-	  --reports y --int-import-graph $@ --persistent n ganeti >/dev/null
-
 install-exec-local:
-	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
+	@mkdir_p@ -- "$(DESTDIR)${localstatedir}/lib/ganeti" \
 	  "$(DESTDIR)${localstatedir}/log/ganeti" \
 	  "$(DESTDIR)${localstatedir}/run/ganeti"
+
+stamp-directories: Makefile
+	@mkdir_p@ $(DIRS)
+	touch $@
+
+# vim: set noet :
diff --git a/autotools/docbook-wrapper b/autotools/docbook-wrapper
new file mode 100755
index 000000000..aedef4207
--- /dev/null
+++ b/autotools/docbook-wrapper
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+set -e
+
+input="${1}"
+output="${2}"
+
+case "${output}" in
+  *.pdf) cmd=docbook2pdf ;;
+  *.html) cmd='docbook2html --nochunks' ;;
+  *.7|*.8) cmd=docbook2man ;;
+  *)
+    echo "Unknown filetype: ${output}" >&2
+    exit 1
+  ;;
+esac
+
+tmpdir=`mktemp -d`
+trap "rm -rf ${tmpdir}" EXIT
+
+if ! ( cd `dirname ${input}` &&
+       ${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; )
+then
+  echo "Building ${output} failed." >&2
+  exit 1
+fi;
+
+mv "${tmpdir}/`basename "${output}"`" "${output}"
+
+# Needed for make to recognize output file
+touch "${output}"
diff --git a/configure.ac b/configure.ac
index c28706da2..8c3f86c0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,20 +111,6 @@ then
   AC_MSG_WARN([docbook2man not found.])
 fi
 
-AC_CONFIG_FILES([
-  Makefile
-  daemons/Makefile
-  devel/Makefile
-  doc/Makefile
-  doc/examples/Makefile
-  lib/Makefile
-  lib/hypervisor/Makefile
-  man/Makefile
-  qa/Makefile
-  qa/hooks/Makefile
-  scripts/Makefile
-  test/Makefile
-  tools/Makefile
-])
+AC_CONFIG_FILES([ Makefile ])
 
 AC_OUTPUT
diff --git a/daemons/Makefile.am b/daemons/Makefile.am
deleted file mode 100644
index 66c2216db..000000000
--- a/daemons/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-dist_sbin_SCRIPTS = ganeti-noded ganeti-watcher ganeti-master ganeti-masterd
diff --git a/devel/Makefile.am b/devel/Makefile.am
deleted file mode 100644
index fe2cc43c6..000000000
--- a/devel/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-EXTRA_DIST = upload.in
-CLEANFILES = upload
-
-all-local: upload
-upload: upload.in
-	sed \
-	  -e 's#@PREFIX@#$(prefix)#g' \
-	< $< > $@
-	chmod u+x $@
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index 9d70429bf..000000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-docdir = $(datadir)/doc/$(PACKAGE)
-
-SUBDIRS = examples
-dist_doc_DATA = \
-  hooks.html hooks.pdf \
-  install.html install.pdf \
-  admin.html admin.pdf \
-  iallocator.html iallocator.pdf
-
-EXTRA_DIST = hooks.sgml install.sgml admin.sgml iallocator.sgml
-MAINTAINERCLEANFILES = *.html *.pdf
-
-%.sgmltmp: %.sgml
-	sed -e 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g' < $< > $@
-
-%.html: %.sgmltmp
-	docbook2html --nochunks $< || rm -f $@
-
-%.pdf: %.sgmltmp
-	docbook2pdf $< || rm -f $@
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
deleted file mode 100644
index d0d39f70e..000000000
--- a/doc/examples/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-EXTRA_DIST = ganeti.initd.in ganeti.cron.in dumb-allocator
-CLEANFILES = $(nodist_EXTRA_DATA)
-
-nodist_EXTRA_DATA = ganeti.initd ganeti.cron
-
-all-local: ganeti.initd ganeti.cron
-ganeti.%: ganeti.%.in Makefile
-	sed \
-	  -e "s#@PREFIX@#$(prefix)#g" \
-	  -e "s#@SYSCONFDIR@#$(sysconfdir)#g" \
-	  -e "s#@LOCALSTATEDIR@#$(localstatedir)#g" \
-	  -e "s#@SBINDIR@#$(sbindir)#g" \
-	< $< > $@
diff --git a/lib/Makefile.am b/lib/Makefile.am
deleted file mode 100644
index 726362b34..000000000
--- a/lib/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-CLEANFILES = $(nodist_pkgpython_PYTHON) *.py[oc]
-SUBDIRS = hypervisor
-
-nodist_pkgpython_PYTHON = _autoconf.py
-pkgpython_PYTHON = __init__.py backend.py cli.py cmdlib.py config.py \
-	objects.py errors.py logger.py ssh.py utils.py rpc.py \
-	bdev.py opcodes.py mcpu.py constants.py \
-	ssconf.py locking.py luxi.py jqueue.py serializer.py \
-	bootstrap.py
-python_files = $(pkgpython_PYTHON)
-
-all-local: _autoconf.py
-
-_autoconf.py: Makefile
-	{ echo '# This file is automatically generated, do not edit!'; \
-	  echo '#'; \
-	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
-	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
-	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
-	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
-	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
-	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
-	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
-	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
-	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
-	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
-	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
-	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
-	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
-	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
-	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
-	} > $@
-
-include $(srcdir)/Makefile.libcommon
diff --git a/lib/hypervisor/Makefile.am b/lib/hypervisor/Makefile.am
deleted file mode 100644
index c26fabcb6..000000000
--- a/lib/hypervisor/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-CLEANFILES = *.py[oc]
-
-hypervisordir = $(pkgpythondir)/hypervisor
-hypervisor_PYTHON = __init__.py hv_base.py hv_fake.py hv_xen.py
-python_files = $(hypervisor_PYTHON)
-
-include $(srcdir)/../Makefile.libcommon
diff --git a/man/Makefile.am b/man/Makefile.am
deleted file mode 100644
index a0743e493..000000000
--- a/man/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-# Build man pages
-
-man_MANS = ganeti.7 ganeti-os-interface.7 gnt-cluster.8 gnt-node.8 gnt-os.8 \
-	   gnt-instance.8 ganeti-noded.8 ganeti-watcher.8 gnt-backup.8 \
-	   ganeti-master.8
-
-maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
-
-EXTRA_DIST = ganeti-os-interface.sgml gnt-cluster.sgml gnt-node.sgml \
-	     ganeti-watcher.sgml ganeti.sgml gnt-instance.sgml gnt-os.sgml \
-	     gnt-backup.sgml ganeti-noded.sgml ganeti-master.sgml \
-	     footer.sgml $(maninput)
-CLEANFILES = *.[78]
-MAINTAINERCLEANFILES = $(maninput)
-
-# Wrapper around docbook2man to control the output's filename
-%.in: %.sgml footer.sgml
-	tmpdir=`mktemp -d "./manbuildXXXXXX"` && \
-	docbook2man -o "$$tmpdir" $< && \
-	ok= && \
-	for check in `basename $< .sgml`.{7,8}; do \
-		if test -f "$$tmpdir/$$check"; then \
-			mv "$$tmpdir/$$check" $@ && \
-			ok=1 && \
-			break; \
-		fi; \
-	done; \
-	if test -z "$$ok"; then \
-		echo "Building $@ failed."; \
-		exit 1; \
-	fi; \
-	rm -rf "$$tmpdir"
-
-%.7 %.8: %.in Makefile
-	sed -e 's#@LOCALSTATEDIR@#$(localstatedir)#g' \
-	    -e 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g' \
-	    -e 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g' \
-	    < $< > $@
diff --git a/qa/Makefile.am b/qa/Makefile.am
deleted file mode 100644
index 3f080ee48..000000000
--- a/qa/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-SUBDIRS = hooks
-EXTRA_DIST = ganeti-qa.py qa-sample.yaml \
-	qa_cluster.py \
-	qa_config.py \
-	qa_daemon.py \
-	qa_env.py \
-	qa_error.py \
-	qa_instance.py \
-	qa_node.py \
-	qa_os.py \
-	qa_other.py \
-	qa_tags.py \
-	qa_utils.py
-CLEANFILES = *.py[co]
diff --git a/qa/hooks/Makefile.am b/qa/hooks/Makefile.am
deleted file mode 100644
index 2d9c75a72..000000000
--- a/qa/hooks/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTRA_DIST = datehook.py loghook.py
-CLEANFILES = *.py[co]
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
deleted file mode 100644
index ba191b979..000000000
--- a/scripts/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-dist_sbin_SCRIPTS = gnt-instance gnt-cluster gnt-node gnt-os gnt-backup gnt-debug gnt-job
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index 2dbf4880f..000000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-TESTS = \
-  ganeti.config_unittest.py \
-  ganeti.hooks_unittest.py \
-  ganeti.utils_unittest.py \
-  ganeti.bdev_unittest.py \
-  ganeti.ssh_unittest.py \
-  ganeti.locking_unittest.py \
-  ganeti.constants_unittest.py
-
-TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
-
-check-am: do-pre-check
-
-do-pre-check:
-	$(MAKE) -C $(top_builddir) pre-check
-
-EXTRA_DIST = $(TESTS) testutils.py mocks.py $(wildcard data/*.txt)
-CLEANFILES = *.py[co]
diff --git a/test/ganeti.bdev_unittest.py b/test/ganeti.bdev_unittest.py
index 8376014bf..6973f1702 100755
--- a/test/ganeti.bdev_unittest.py
+++ b/test/ganeti.bdev_unittest.py
@@ -51,7 +51,7 @@ class TestDRBD8Runner(unittest.TestCase):
 
     prefix = os.environ.get("srcdir", None)
     if prefix:
-      name = prefix + "/" + name
+      name = prefix + "/test/" + name
     fh = open(name, "r")
     try:
       data = fh.read()
@@ -59,7 +59,6 @@ class TestDRBD8Runner(unittest.TestCase):
       fh.close()
     return data
 
-
   @staticmethod
   def _has_net(data, local, remote):
     """Check network connection parameters"""
@@ -115,7 +114,7 @@ class TestDRBD8Status(unittest.TestCase):
 
   def setUp(self):
     """Read in txt data"""
-    proc_data = "data/proc_drbd8.txt"
+    proc_data = "test/data/proc_drbd8.txt"
     prefix = os.environ.get("srcdir", None)
     if prefix:
       proc_data = prefix + "/" + proc_data
diff --git a/tools/Makefile.am b/tools/Makefile.am
deleted file mode 100644
index 4dd67cb36..000000000
--- a/tools/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-toolsdir = $(pkglibdir)/tools
-dist_tools_SCRIPTS = lvmstrap burnin cfgshell cfgupgrade
-- 
GitLab