Fix aliases in bash completion
[ganeti-local] / Makefile.am
index 7c44969..95733e0 100644 (file)
@@ -9,12 +9,16 @@
 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
 REPLACE_VARS_SED = autotools/replace_vars.sed
 
 clientdir = $(pkgpythondir)/client
@@ -90,6 +94,7 @@ CLEANFILES = \
        $(addsuffix /*.py[co],$(DIRS)) \
        $(all_dirfiles) \
        $(PYTHON_BOOTSTRAP) \
+       epydoc.conf \
        autotools/replace_vars.sed \
        daemons/daemon-util \
        daemons/ensure-dirs \
@@ -103,6 +108,7 @@ CLEANFILES = \
        doc/examples/hooks/ipsec \
        $(man_MANS) \
        $(manhtml) \
+       tools/kvm-ifup \
        stamp-srclinks \
        $(nodist_pkgpython_PYTHON)
 
@@ -216,11 +222,15 @@ utils_PYTHON = \
        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/wrapper.py \
+       lib/utils/x509.py
 
 docrst = \
        doc/admin.rst \
@@ -228,6 +238,7 @@ docrst = \
        doc/design-2.1.rst \
        doc/design-2.2.rst \
        doc/design-2.3.rst \
+       doc/design-2.4.rst \
        doc/design-oob.rst \
        doc/design-query2.rst \
        doc/cluster-merge.rst \
@@ -359,15 +370,18 @@ 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/gen-coverage \
@@ -378,6 +392,7 @@ EXTRA_DIST = \
        daemons/ganeti-cleaner.in \
        $(pkglib_python_scripts) \
        devel/upload.in \
+       tools/kvm-ifup.in \
        $(docdot) \
        $(docpng) \
        $(docrst) \
@@ -387,7 +402,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 \
@@ -489,10 +503,15 @@ python_tests = \
        test/ganeti.utils.algo_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 \
@@ -562,6 +581,10 @@ 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 $@
@@ -597,6 +620,7 @@ man/footer.html: man/footer.rst
 man/%.7.in man/%.8.in: man/%.rst 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
@@ -604,10 +628,10 @@ man/%.7.in man/%.8.in: man/%.rst man/footer.man
 man/%.html.in: man/%.rst 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/%.7: man/%.7.in $(REPLACE_VARS_SED)
        sed -f $(REPLACE_VARS_SED) < $< > $@
 
@@ -617,6 +641,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
+       sed -e 's#@MODULES@#$(lint_python_code)#g' < $< > $@
+
 vcs-version:
        if test -d .git; then \
          git describe > $@; \
@@ -687,6 +714,7 @@ lib/_autoconf.py: Makefile vcs-version | lib/.dir
          echo "CONFD_USER = '$(CONFD_USER)'"; \
          echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
          echo "NODED_USER = '$(NODED_USER)'"; \
+         echo "NODED_GROUP = '$(NODED_GROUP)'"; \
          echo "VCS_VERSION = '$$VCSVER'"; \
          echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
        } > $@
@@ -741,7 +769,9 @@ $(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
          echo '# Temporarily alias commands until bash completion'; \
          echo '# generator is changed'; \
          echo 'if hasattr(main, "commands"):'; \
-               echo '  commands = main.commands # pylint: disable-msg=E1101'; \
+         echo '  commands = main.commands # pylint: disable-msg=E1101'; \
+         echo 'if hasattr(main, "aliases"):'; \
+         echo '  aliases = main.aliases # pylint: disable-msg=E1101'; \
          echo; \
          echo 'if __name__ == "__main__":'; \
          echo '  sys.exit(main.Main())'; \
@@ -789,11 +819,20 @@ 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
+       expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
+       if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
+               echo "Incorrect version in README, expected $$expver"; \
+               exit 1; \
+       fi
 
 .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...