X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/4fd029cf7f5a8c9c8492149aab31391868d17ae8..d5506465b53089cc3c3d126fc42fc26c971271b7:/Makefile.am?ds=sidebyside diff --git a/Makefile.am b/Makefile.am index 76be174..deaebf7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,14 +9,20 @@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +# Use bash in order to be able to use pipefail +SHELL=/bin/bash + ACLOCAL_AMFLAGS = -I autotools BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code CHECK_MAN = $(top_srcdir)/autotools/check-man CHECK_VERSION = $(top_srcdir)/autotools/check-version +CHECK_NEWS = $(top_srcdir)/autotools/check-news +DOCPP = $(top_srcdir)/autotools/docpp REPLACE_VARS_SED = autotools/replace_vars.sed +# Note: the variable must be named after the directory + 'dir' suffix clientdir = $(pkgpythondir)/client hypervisordir = $(pkgpythondir)/hypervisor httpdir = $(pkgpythondir)/http @@ -28,11 +34,17 @@ watcherdir = $(pkgpythondir)/watcher impexpddir = $(pkgpythondir)/impexpd utilsdir = $(pkgpythondir)/utils toolsdir = $(pkglibdir)/tools +iallocatorsdir = $(pkglibdir)/iallocators docdir = $(datadir)/doc/$(PACKAGE) # Delete output file if an error occurred while building it .DELETE_ON_ERROR: +HTOOLS_DIRS = \ + htools \ + htools/Ganeti \ + htools/Ganeti/HTools + DIRS = \ autotools \ daemons \ @@ -41,6 +53,7 @@ DIRS = \ doc/examples \ doc/examples/hooks \ doc/examples/gnt-debug \ + $(HTOOLS_DIRS) \ lib \ lib/client \ lib/build \ @@ -88,8 +101,11 @@ maintainer-clean-local: CLEANFILES = \ $(addsuffix /*.py[co],$(DIRS)) \ + $(addsuffix /*.hi,$(HTOOLS_DIRS)) \ + $(addsuffix /*.o,$(HTOOLS_DIRS)) \ $(all_dirfiles) \ $(PYTHON_BOOTSTRAP) \ + epydoc.conf \ autotools/replace_vars.sed \ daemons/daemon-util \ daemons/ensure-dirs \ @@ -103,8 +119,10 @@ CLEANFILES = \ doc/examples/hooks/ipsec \ $(man_MANS) \ $(manhtml) \ + tools/kvm-ifup \ stamp-srclinks \ - $(nodist_pkgpython_PYTHON) + $(nodist_pkgpython_PYTHON) \ + $(HALLPROGS) $(HSRCS2) # BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise # it'll cause the target to rebuild every time. @@ -119,7 +137,8 @@ nodist_pkgpython_PYTHON = \ lib/_autoconf.py noinst_PYTHON = \ - lib/build/__init__.py + lib/build/__init__.py \ + lib/build/sphinx_ext.py pkgpython_PYTHON = \ lib/__init__.py \ @@ -213,7 +232,18 @@ server_PYTHON = \ utils_PYTHON = \ lib/utils/__init__.py \ - lib/utils/algo.py + lib/utils/algo.py \ + lib/utils/filelock.py \ + lib/utils/hash.py \ + lib/utils/io.py \ + lib/utils/log.py \ + lib/utils/mlock.py \ + lib/utils/nodesetup.py \ + lib/utils/process.py \ + lib/utils/retry.py \ + lib/utils/text.py \ + lib/utils/wrapper.py \ + lib/utils/x509.py docrst = \ doc/admin.rst \ @@ -221,9 +251,13 @@ docrst = \ doc/design-2.1.rst \ doc/design-2.2.rst \ doc/design-2.3.rst \ + doc/design-htools-2.3.rst \ + doc/design-2.4.rst \ + doc/design-draft.rst \ doc/design-oob.rst \ doc/design-query2.rst \ doc/cluster-merge.rst \ + doc/design-shared-storage.rst \ doc/devnotes.rst \ doc/glossary.rst \ doc/hooks.rst \ @@ -239,10 +273,53 @@ docrst = \ doc/upgrade.rst \ doc/walkthrough.rst +HPROGS = \ + htools/hbal \ + htools/hscan \ + htools/hail \ + htools/hspace + +HALLPROGS = $(HPROGS) htools/test +HSRCPROGS = $(patsubst %,%.hs,$(HALLPROGS)) +# we don't add -Werror by default +HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools +HEXTRA = + +HSRCS = \ + htools/Ganeti/HTools/CLI.hs \ + htools/Ganeti/HTools/Cluster.hs \ + htools/Ganeti/HTools/Container.hs \ + htools/Ganeti/HTools/ExtLoader.hs \ + htools/Ganeti/HTools/Group.hs \ + htools/Ganeti/HTools/IAlloc.hs \ + htools/Ganeti/HTools/Instance.hs \ + htools/Ganeti/HTools/Loader.hs \ + htools/Ganeti/HTools/Luxi.hs \ + htools/Ganeti/HTools/Node.hs \ + htools/Ganeti/HTools/PeerMap.hs \ + htools/Ganeti/HTools/QC.hs \ + htools/Ganeti/HTools/Rapi.hs \ + htools/Ganeti/HTools/Simu.hs \ + htools/Ganeti/HTools/Text.hs \ + htools/Ganeti/HTools/Types.hs \ + htools/Ganeti/HTools/Utils.hs \ + htools/Ganeti/Jobs.hs \ + htools/Ganeti/Luxi.hs \ + htools/Ganeti/OpCodes.hs + +HSRCS2 = htools/Ganeti/HTools/Version.hs +HSRCS2IN = $(patsubst %,%.in,$(HSRCS2)) + $(RUN_IN_TEMPDIR): | $(all_dirfiles) +# Note: we use here an order-only prerequisite, as the contents of +# _autoconf.py are not actually influencing the html build output: it +# has to exist in order for the sphinx module to be loaded +# successfully, but we certainly don't want the docs to be rebuilt if +# it changes doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \ - $(RUN_IN_TEMPDIR) + $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \ + | lib/_autoconf.py @test -n "$(SPHINX)" || \ { echo 'sphinx-build' not found during configure; exit 1; } @mkdir_p@ $(dir $@) @@ -327,6 +404,20 @@ qa_scripts = \ qa/qa_tags.py \ qa/qa_utils.py +bin_SCRIPTS = +iallocators_SCRIPTS = +if WANT_HTOOLS +bin_SCRIPTS += $(filter-out htools/hail,$(HPROGS)) +iallocators_SCRIPTS += $(filter htools/hail,$(HPROGS)) +endif + +$(HALLPROGS): %: %.hs $(HSRCS) $(HSRCS2) Makefile + BINARY=$(@:htools/%=%); \ + $(GHC) --make \ + $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \ + -osuf $$BINARY.o -hisuf $$BINARY.hi \ + $@ + dist_sbin_SCRIPTS = \ tools/ganeti-listrunner @@ -352,17 +443,21 @@ pkglib_python_scripts = \ pkglib_SCRIPTS = \ daemons/daemon-util \ daemons/ensure-dirs \ + tools/kvm-ifup \ $(pkglib_python_scripts) EXTRA_DIST = \ NEWS \ UPGRADE \ + epydoc.conf.in \ pylintrc \ autotools/build-bash-completion \ autotools/check-python-code \ autotools/check-man \ + autotools/check-news \ autotools/check-tar \ autotools/check-version \ + autotools/docpp \ autotools/gen-coverage \ autotools/testrunner \ $(RUN_IN_TEMPDIR) \ @@ -371,6 +466,7 @@ EXTRA_DIST = \ daemons/ganeti-cleaner.in \ $(pkglib_python_scripts) \ devel/upload.in \ + tools/kvm-ifup.in \ $(docdot) \ $(docpng) \ $(docrst) \ @@ -380,7 +476,6 @@ EXTRA_DIST = \ doc/examples/ganeti-kvm-poweroff.initd.in \ doc/examples/ganeti.cron.in \ doc/examples/gnt-config-backup.in \ - doc/examples/dumb-allocator \ doc/examples/ganeti.default \ doc/examples/ganeti.default-debug \ doc/examples/hooks/ethers \ @@ -396,7 +491,9 @@ EXTRA_DIST = \ $(manrst) \ $(maninput) \ qa/qa-sample.json \ - $(qa_scripts) + $(qa_scripts) \ + $(HSRCS) $(HSRCS2IN) \ + $(HSRCPROGS) man_MANS = \ man/ganeti.7 \ @@ -415,14 +512,19 @@ man_MANS = \ man/gnt-instance.8 \ man/gnt-job.8 \ man/gnt-node.8 \ - man/gnt-os.8 + man/gnt-os.8 \ + man/hail.1 \ + man/hbal.1 \ + man/hscan.1 \ + man/hspace.1 -manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))) +manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))) manhtml = $(patsubst %.rst,%.html,$(manrst)) +mangen = $(patsubst %.rst,%.gen,$(manrst)) maninput = \ - $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \ + $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \ $(patsubst %.html,%.html.in,$(manhtml)) \ - man/footer.man man/footer.html + man/footer.man man/footer.html $(mangen) TEST_FILES = \ test/data/bdev-drbd-8.0.txt \ @@ -442,6 +544,7 @@ python_tests = \ test/ganeti.backend_unittest.py \ test/ganeti.bdev_unittest.py \ test/ganeti.cli_unittest.py \ + test/ganeti.client.gnt_cluster_unittest.py \ test/ganeti.client.gnt_instance_unittest.py \ test/ganeti.daemon_unittest.py \ test/ganeti.cmdlib_unittest.py \ @@ -480,7 +583,17 @@ python_tests = \ test/ganeti.ssh_unittest.py \ test/ganeti.uidpool_unittest.py \ test/ganeti.utils.algo_unittest.py \ - test/ganeti.utils_mlockall_unittest.py \ + test/ganeti.utils.filelock_unittest.py \ + test/ganeti.utils.hash_unittest.py \ + test/ganeti.utils.io_unittest.py \ + test/ganeti.utils.log_unittest.py \ + test/ganeti.utils.mlock_unittest.py \ + test/ganeti.utils.nodesetup_unittest.py \ + test/ganeti.utils.process_unittest.py \ + test/ganeti.utils.retry_unittest.py \ + test/ganeti.utils.text_unittest.py \ + test/ganeti.utils.wrapper_unittest.py \ + test/ganeti.utils.x509_unittest.py \ test/ganeti.utils_unittest.py \ test/ganeti.workerpool_unittest.py \ test/cfgupgrade_unittest.py \ @@ -531,10 +644,12 @@ srclink_files = \ test/daemon-util_unittest.bash \ test/ganeti-cleaner_unittest.bash \ test/import-export_unittest.bash \ - $(all_python_code) + $(all_python_code) \ + $(HSRCS) $(HSRCPROGS) check_python_code = \ $(BUILD_BASH_COMPLETION) \ + $(DOCPP) \ $(all_python_code) lint_python_code = \ @@ -544,12 +659,17 @@ lint_python_code = \ $(dist_tools_SCRIPTS) \ $(pkglib_python_scripts) \ $(BUILD_BASH_COMPLETION) \ + $(DOCPP) \ $(PYTHON_BOOTSTRAP) test/daemon-util_unittest.bash: daemons/daemon-util test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner +tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED) + sed -f $(REPLACE_VARS_SED) < $< > $@ + chmod +x $@ + devel/upload: devel/upload.in $(REPLACE_VARS_SED) sed -f $(REPLACE_VARS_SED) < $< > $@ chmod u+x $@ @@ -582,19 +702,26 @@ man/footer.html: man/footer.rst { echo 'pandoc' not found during configure; exit 1; } $(PANDOC) -f rst -t html -o $@ $< -man/%.7.in man/%.8.in: man/%.rst man/footer.man +man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py + PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ + +man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man @test -n "$(PANDOC)" || \ { echo 'pandoc' not found during configure; exit 1; } + set -o pipefail ; \ $(PANDOC) -s -f rst -t man -A man/footer.man $< | \ sed -e 's/\\@/@/g' > $@ if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi -man/%.html.in: man/%.rst man/footer.html +man/%.html.in: man/%.gen man/footer.html @test -n "$(PANDOC)" || \ { echo 'pandoc' not found during configure; exit 1; } + set -o pipefail ; \ $(PANDOC) -s -f rst -t html -A man/footer.html $< | \ sed -e 's/\\@/@/g' > $@ +man/%.1: man/%.1.in $(REPLACE_VARS_SED) + sed -f $(REPLACE_VARS_SED) < $< > $@ man/%.7: man/%.7.in $(REPLACE_VARS_SED) sed -f $(REPLACE_VARS_SED) < $< > $@ @@ -605,6 +732,9 @@ man/%.8: man/%.8.in $(REPLACE_VARS_SED) man/%.html: man/%.html.in $(REPLACE_VARS_SED) sed -f $(REPLACE_VARS_SED) < $< > $@ +epydoc.conf: epydoc.conf.in Makefile + sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@ + vcs-version: if test -d .git; then \ git describe > $@; \ @@ -621,6 +751,11 @@ regen-vcs-version: $(MAKE) vcs-version; \ fi +htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version + set -e; \ + VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \ + sed -e "s/%ver%/$$VCSVER/" < $< > $@ + lib/_autoconf.py: Makefile vcs-version | lib/.dir set -e; \ VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \ @@ -655,6 +790,8 @@ lib/_autoconf.py: Makefile vcs-version | lib/.dir echo "XEN_INITRD = '$(XEN_INITRD)'"; \ echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \ echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \ + echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \ + echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \ echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \ echo "KVM_PATH = '$(KVM_PATH)'"; \ echo "SOCAT_PATH = '$(SOCAT)'"; \ @@ -777,11 +914,15 @@ check-dirs: $(BUILT_SOURCES) check-local: check-dirs $(CHECK_PYTHON_CODE) $(check_python_code) $(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS + $(CHECK_NEWS) < $(top_srcdir)/NEWS .PHONY: lint lint: $(BUILT_SOURCES) @test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; } $(PYLINT) $(LINT_OPTS) $(lint_python_code) + cd $(top_srcdir)/qa && \ + PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \ + --rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts)) # a dist hook rule for updating the vcs-version file; this is # hardcoded due to where it needs to build the file...