On Mon, Aug 24, 2009 at 11:56:39AM +0200, Michael Hanselmann wrote:
>
> Completion for tools/burnin is not yet implemented. It needs to be
> converted to definition-based options handling first.
> ---
> Makefile.am | 29 ++-
> autotools/build-bash-completion | 505 ++++++++++++++++++++++++++++++++++++
> doc/examples/bash_completion.in | 543
> ---------------------------------------
> 3 files changed, 527 insertions(+), 550 deletions(-)
> create mode 100755 autotools/build-bash-completion
> delete mode 100644 doc/examples/bash_completion.in
>
> diff --git a/Makefile.am b/Makefile.am
> index d9422ff..7f8fc4d 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -11,6 +11,7 @@ abs_top_srcdir = @abs_top_srcdir@
>
> ACLOCAL_AMFLAGS = -I autotools
> DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
> +BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
> REPLACE_VARS_SED = autotools/replace_vars.sed
>
> hypervisordir = $(pkgpythondir)/hypervisor
> @@ -148,12 +149,7 @@ docpng = $(patsubst %.dot,%.png,$(docdot))
>
> noinst_DATA = $(manhtml) doc/html
>
> -dist_sbin_SCRIPTS = \
> - daemons/ganeti-noded \
> - daemons/ganeti-watcher \
> - daemons/ganeti-masterd \
> - daemons/ganeti-confd \
> - daemons/ganeti-rapi \
> +gnt_scripts = \
> scripts/gnt-backup \
> scripts/gnt-cluster \
> scripts/gnt-debug \
> @@ -162,6 +158,14 @@ dist_sbin_SCRIPTS = \
> scripts/gnt-node \
> scripts/gnt-os
>
> +dist_sbin_SCRIPTS = \
> + daemons/ganeti-noded \
> + daemons/ganeti-watcher \
> + daemons/ganeti-masterd \
> + daemons/ganeti-confd \
> + daemons/ganeti-rapi \
> + $(gnt_scripts)
> +
> dist_tools_SCRIPTS = \
> tools/burnin \
> tools/cfgshell \
> @@ -179,7 +183,6 @@ EXTRA_DIST = \
> $(docrst) \
> doc/conf.py \
> doc/html \
> - doc/examples/bash_completion.in \
> doc/examples/ganeti.initd.in \
> doc/examples/ganeti.cron.in \
> doc/examples/dumb-allocator \
> @@ -266,6 +269,18 @@ doc/examples/%: doc/examples/%.in stamp-directories \
> $(REPLACE_VARS_SED)
> sed -f $(REPLACE_VARS_SED) < $< > $@
>
> +doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) lib/_autoconf.py \
> + lib/cli.py $(gnt_scripts) tools/burnin
> + TMPDIR=`mktemp -d ./buildtmpXXXXXX` && \
> + 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
> @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
> $(DOT) -Tpng -o $@ $<
> diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion
> new file mode 100755
> index 0000000..0e1d4d1
> --- /dev/null
> +++ b/autotools/build-bash-completion
> @@ -0,0 +1,505 @@
> +#!/usr/bin/python
> +#
> +
> +# Copyright (C) 2009 Google Inc.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful, but
> +# WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> +# General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +# 02110-1301, USA.
> +
> +
> +import imp
> +import optparse
> +import os
> +import sys
> +import re
> +from cStringIO import StringIO
> +
> +from ganeti import constants
> +from ganeti import cli
> +from ganeti import utils
> +
> +
> +SCRIPTS = [
> + "scripts/gnt-backup",
> + "scripts/gnt-cluster",
> + "scripts/gnt-debug",
> + "scripts/gnt-instance",
> + "scripts/gnt-job",
> + "scripts/gnt-node",
> + "scripts/gnt-os",
> + ]
This is already available in the Makefile as gnt-scripts, could we write
it out to _autoconf.py somehow and import it here? Otherwise, please add
comment here and in the makefile to keep these two in sync.
Otherwise, LGTM. I looked briefly over the completion-generation script,
and seems good overall. Note that I didn't go in detail over it.
iustin