Commit 13aeae6a authored by Iustin Pop's avatar Iustin Pop

Fix recompilation of htools on regen-vcs-version

Currently, most htools code depends on Constants.hs which is generated
from constants.py and also depends on _autoconf.py. Also, _autoconf.py
depends on vcs-version, which all together means that when 'make
regen-vcs-version' is run, for example by ./devel/upload, most of the
Haskell code needs recompilation.

Since htools already has its 'optimised' vcs-version (and doesn't use
the _autoconf.VCS_VERSION constants), we can optimise this as follows:

- _autoconf.py doesn't contain the VCS_VERSION anymore, and that is
  instead moved to _vcsversion.py
- constants.py depends on and imports this new module
- _autoconf.py doesn't get regenerated at vcs-version changes, but
  only at re-running configure/changing Makefile time

The end result is that only htools/Ganeti/HTools/Version.hs is
recompiled now, which is a significant speedup (usually < 1 second
versus 10 seconds previously).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent a3ac3243
......@@ -71,6 +71,7 @@
# lib
/lib/_autoconf.py
/lib/_vcsversion.py
# man
/man/*.[0-9]
......
......@@ -151,11 +151,13 @@ BUILT_SOURCES = \
ganeti \
stamp-srclinks \
lib/_autoconf.py \
lib/_vcsversion.py \
$(all_dirfiles) \
$(PYTHON_BOOTSTRAP)
nodist_pkgpython_PYTHON = \
lib/_autoconf.py
lib/_autoconf.py \
lib/_vcsversion.py
noinst_PYTHON = \
lib/build/__init__.py \
......@@ -359,7 +361,7 @@ $(RUN_IN_TEMPDIR): | $(all_dirfiles)
# it changes
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
| lib/_autoconf.py
| lib/_autoconf.py lib/_vcsversion.py
@test -n "$(SPHINX)" || \
{ echo 'sphinx-build' not found during configure; exit 1; }
@mkdir_p@ $(dir $@)
......@@ -843,9 +845,8 @@ htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
set -e; \
{ cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
lib/_autoconf.py: Makefile vcs-version | lib/.dir
lib/_autoconf.py: Makefile | lib/.dir
set -e; \
VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
{ echo '# This file is automatically generated, do not edit!'; \
echo '#'; \
echo ''; \
......@@ -900,7 +901,6 @@ lib/_autoconf.py: Makefile vcs-version | lib/.dir
echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
echo "NODED_USER = '$(NODED_USER)'"; \
echo "NODED_GROUP = '$(NODED_GROUP)'"; \
echo "VCS_VERSION = '$$VCSVER'"; \
echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
if [ "$(HTOOLS)" ]; then \
echo "HTOOLS = True"; \
......@@ -909,6 +909,27 @@ lib/_autoconf.py: Makefile vcs-version | lib/.dir
fi; \
} > $@
lib/_vcsversion.py: Makefile vcs-version | lib/.dir
set -e; \
VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
{ echo '# This file is automatically generated, do not edit!'; \
echo '#'; \
echo ''; \
echo '"""Build-time VCS version number for Ganeti.'; \
echo '';\
echo 'This file is autogenerated by the build process.'; \
echo 'For any changes you need to re-run ./configure (and'; \
echo 'not edit by hand).'; \
echo ''; \
echo '"""'; \
echo ''; \
echo '# pylint: disable-msg=C0301,C0324'; \
echo '# because this is autogenerated, we do not want'; \
echo '# style warnings' ; \
echo ''; \
echo "VCS_VERSION = '$$VCSVER'"; \
} > $@
$(REPLACE_VARS_SED): Makefile
set -e; \
{ echo 's#@PREFIX@#$(prefix)#g'; \
......
......@@ -24,6 +24,7 @@
import re
from ganeti import _autoconf
from ganeti import _vcsversion
# various versions
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
......@@ -31,7 +32,7 @@ OS_API_V10 = 10
OS_API_V15 = 15
OS_API_V20 = 20
OS_API_VERSIONS = frozenset([OS_API_V10, OS_API_V15, OS_API_V20])
VCS_VERSION = _autoconf.VCS_VERSION
VCS_VERSION = _vcsversion.VCS_VERSION
EXPORT_VERSION = 0
RAPI_VERSION = 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment