diff --git a/autogenerate_config_docs/autohelp-wrapper b/autogenerate_config_docs/autohelp-wrapper index 4eba1c08..e58128eb 100755 --- a/autogenerate_config_docs/autohelp-wrapper +++ b/autogenerate_config_docs/autohelp-wrapper @@ -27,6 +27,7 @@ PROJECTS="aodh ceilometer cinder glance heat ironic keystone manila \ MANUALS_PROJECTS="openstack-manuals" BRANCH=master FAST=0 +QUIET=0 usage() { echo "Wrapper for autohelp.py" @@ -100,7 +101,7 @@ setup_tools() { pip install -rrequirements.txt } -while getopts :b:g:e:v:cf opt; do +while getopts :b:g:e:v:cfq opt; do case $opt in b) BRANCH=$OPTARG @@ -117,6 +118,9 @@ while getopts :b:g:e:v:cf opt; do f) FAST=1 ;; + q) + QUIET=1 + ;; v) AUTOOPT="-v" if [ $OPTARG = 2 ]; then @@ -139,8 +143,13 @@ fi ACTION=$1 shift +if [ $QUIET -eq 1 ]; then + exec 3>&1 >/dev/null + exec 4>&2 2>/dev/null +fi + case $ACTION in - update|docbook|rst|setup) ;; + update|docbook|rst|dump|setup) ;; *) usage exit 1 @@ -256,5 +265,17 @@ for project in $PROJECTS; do $extra_flags $AUTOOPT fi ;; + dump) + if [ $QUIET -eq 1 ]; then + exec 1>&3 + exec 2>&4 + fi + if [ "$project" = "swift" ]; then + $EXTRACT_SWIFT dump -m $MANUALSREPO -s $SOURCESDIR/swift + else + $AUTOHELP dump $project -i $SOURCESDIR/$project/$project \ + $extra_flags $AUTOOPT + fi + ;; esac done diff --git a/autogenerate_config_docs/diff_branches.py b/autogenerate_config_docs/diff_branches.py index a39b299a..917fa158 100755 --- a/autogenerate_config_docs/diff_branches.py +++ b/autogenerate_config_docs/diff_branches.py @@ -22,14 +22,15 @@ import pickle import subprocess import sys -import git import jinja2 -PROJECTS = ['ceilometer', 'cinder', 'glance', 'heat', 'ironic', 'keystone', - 'manila', 'neutron', 'nova', 'sahara', 'swift', 'trove'] +PROJECTS = ['aodh', 'ceilometer', 'cinder', 'glance', 'heat', 'ironic', + 'keystone', 'manila', 'neutron', 'nova', 'sahara', 'swift', + 'trove'] MASTER_RELEASE = 'Mitaka' -CODENAME_TITLE = {'ceilometer': 'Telemetry', +CODENAME_TITLE = {'aodh': 'Alarming', + 'ceilometer': 'Telemetry', 'cinder': 'Block Storage', 'glance': 'Image service', 'heat': 'Orchestration', @@ -69,43 +70,23 @@ def _get_packages(project, branch): return packages -def get_options(project, branch, args): +def get_options(project, branch): """Get the list of known options for a project.""" print("Working on %(project)s (%(branch)s)" % {'project': project, 'branch': branch}) # And run autohelp script to get a serialized dict of the discovered # options - dirname = os.path.abspath(os.path.join('venv', - branch.replace('/', '_'), - project)) + dirname = os.path.join('venv', branch.replace('/', '_')) + args = ["./autohelp-wrapper", "-q", "-b", branch, "-e", dirname, + "dump", project] - if project == 'swift': - cmd = ("python extract_swift_flags.py dump " - "-s %(sources)s/swift -m %(sources)s/openstack-manuals" % - {'sources': args.sources}) - if branch == 'stable/liberty': - cmd += " -f docbook" - repo_path = args.sources - else: - packages = _get_packages(project, branch) - autohelp_args = "" - for package in packages: - repo_path = os.path.join(args.sources, project) - repo = git.Repo(repo_path) - repo.heads[branch].checkout() - autohelp_args += (" -i %s/%s" % - (repo_path, package.replace('-', '_'))) - cmd = ("python autohelp.py dump %(project)s %(args)s" % - {'project': project, 'args': autohelp_args}) path = os.environ.get("PATH") bin_path = os.path.abspath(os.path.join(dirname, "bin")) path = "%s:%s" % (bin_path, path) - serialized = subprocess.check_output(cmd, shell=True, + serialized = subprocess.check_output(args, env={'VIRTUAL_ENV': dirname, 'PATH': path}) - sys.path.insert(0, repo_path) ret = pickle.loads(serialized) - sys.path.pop(0) return ret @@ -295,8 +276,8 @@ def main(): setup_venv(args.projects, args.new_branch, args.novenvupdate) for project in args.projects: - old_list = get_options(project, args.old_branch, args) - new_list = get_options(project, args.new_branch, args) + old_list = get_options(project, args.old_branch) + new_list = get_options(project, args.new_branch) release = args.new_branch.replace('stable/', '') env = get_env(project, release, old_list, new_list) diff --git a/autogenerate_config_docs/requirements.txt b/autogenerate_config_docs/requirements.txt index c66e1fd2..39abf122 100644 --- a/autogenerate_config_docs/requirements.txt +++ b/autogenerate_config_docs/requirements.txt @@ -1,6 +1,5 @@ docutils jinja2 -GitPython>=0.3.2.RC1 lxml oslo.config oslo.i18n