Commit b959138f authored by Michael Hanselmann's avatar Michael Hanselmann

Add script to run build commands in temporary directory

Python always compiles imported modules. By running these targets
in a temporary directory we don't pollute the source tree.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent dc7d2c49
...@@ -12,6 +12,7 @@ abs_top_srcdir = @abs_top_srcdir@ ...@@ -12,6 +12,7 @@ abs_top_srcdir = @abs_top_srcdir@
ACLOCAL_AMFLAGS = -I autotools ACLOCAL_AMFLAGS = -I autotools
DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
REPLACE_VARS_SED = autotools/replace_vars.sed REPLACE_VARS_SED = autotools/replace_vars.sed
hypervisordir = $(pkgpythondir)/hypervisor hypervisordir = $(pkgpythondir)/hypervisor
...@@ -183,6 +184,7 @@ EXTRA_DIST = \ ...@@ -183,6 +184,7 @@ EXTRA_DIST = \
DEVNOTES \ DEVNOTES \
pylintrc \ pylintrc \
autotools/docbook-wrapper \ autotools/docbook-wrapper \
autotools/run-in-tempdir \
devel/upload.in \ devel/upload.in \
$(docdot) \ $(docdot) \
$(docrst) \ $(docrst) \
...@@ -274,17 +276,9 @@ doc/examples/%: doc/examples/%.in stamp-directories \ ...@@ -274,17 +276,9 @@ doc/examples/%: doc/examples/%.in stamp-directories \
$(REPLACE_VARS_SED) $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@ sed -f $(REPLACE_VARS_SED) < $< > $@
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) \ doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
lib/cli.py $(gnt_scripts) tools/burnin lib/cli.py $(gnt_scripts) tools/burnin
TMPDIR=`mktemp -d ./buildtmpXXXXXX` && \ PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
cp -r scripts lib tools $$TMPDIR && \
( \
CDIR=`pwd` && \
cd $$TMPDIR && \
mv lib ganeti && \
PYTHONPATH=. $$CDIR/$(BUILD_BASH_COMPLETION) > $$CDIR/$@; \
); \
rm -rf $$TMPDIR
doc/%.png: doc/%.dot doc/%.png: doc/%.dot
@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; } @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
...@@ -388,18 +382,11 @@ stamp-directories: Makefile ...@@ -388,18 +382,11 @@ stamp-directories: Makefile
touch $@ touch $@
.PHONY: apidoc .PHONY: apidoc
apidoc: apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
test -e doc/api || mkdir doc/api test -e doc/api || mkdir doc/api
TMPDIR=`mktemp -d ` && { \ $(RUN_IN_TEMPDIR) epydoc -v \
cp -r scripts daemons lib $$TMPDIR && \ --conf $(CURDIR)/epydoc.conf \
( \ --output $(CURDIR)/doc/api
CDIR=`pwd` && \
cd $$TMPDIR && \
mv lib ganeti && \
epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
) ; \
rm -rf $$TMPDIR ; \
}
.PHONY: TAGS .PHONY: TAGS
TAGS: TAGS:
......
#!/bin/bash
set -e
tmpdir=$(mktemp -d -t gntbuild.XXXXXXXX)
trap "rm -rf $tmpdir" EXIT
cp -r scripts lib tools test $tmpdir
mv $tmpdir/lib $tmpdir/ganeti
cd $tmpdir && "$@"
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