Browse Source

Fix issues found by bashate and include in gating

Cleanup shell scripts to pass bashate testing.
Add bashate check to pep8 check target.

Change-Id: I49b9ab1e352378a43f82a4e1f5db02a8dae99d27
changes/58/114758/4
Andreas Jaeger 7 years ago
parent
commit
94849df097
6 changed files with 41 additions and 23 deletions
  1. +1
    -1
      bin/doc-tools-check-languages
  2. +3
    -3
      build_environment/bin/package.sh
  3. +7
    -7
      build_environment/files/fetch.sh
  4. +21
    -12
      os_doc_tools/scripts/markdown-docbook.sh
  5. +1
    -0
      test-requirements.txt
  6. +8
    -0
      tox.ini

+ 1
- 1
bin/doc-tools-check-languages View File

@ -92,7 +92,7 @@ fi
source $CONF_FILE
if [[ -z $(declare -p BOOKS 2> /dev/null | grep 'declare -A BOOKS') || \
-z $(declare -p DIRECTORIES 2> /dev/null | grep 'declare -A DIRECTORIES') || \
-z $(declare -p DIRECTORIES 2> /dev/null | grep 'declare -A DIRECTORIES') || \
-z $DOC_DIR ]]; then
echo "Error: the configuration file '$CONF_FILE' is invalid"
exit 1


+ 3
- 3
build_environment/bin/package.sh View File

@ -12,6 +12,6 @@ rm -f working.tar.bz2
touch working/.placeholder
tar cjf working.tar.bz2 working
vagrant package \
--output=openstack-manuals-$version.box \
--vagrantfile=Vagrantfile.box \
--include working.tar.bz2
--output=openstack-manuals-$version.box \
--vagrantfile=Vagrantfile.box \
--include working.tar.bz2

+ 7
- 7
build_environment/files/fetch.sh View File

@ -6,11 +6,11 @@ set -x
# to build the documents.
for repository in $(ls -d -1 /home/vagrant/repositories/*); do
cd $repository
for document in $(find . -name pom.xml); do
pushd ${document%/*};
mvn clean generate-sources
mvn clean
popd
done
cd $repository
for document in $(find . -name pom.xml); do
pushd ${document%/*};
mvn clean generate-sources
mvn clean
popd
done
done

+ 21
- 12
os_doc_tools/scripts/markdown-docbook.sh View File

@ -1,27 +1,34 @@
#!/bin/bash -ex
# Documentation can be submitted in markdown and then converted to docbook
# so it can be built with the maven plugin. This is used by Jenkins when
# invoking certain docs jobs and the resulting output is made available to maven.
# Documentation can be submitted in markdown and then converted to
# docbook so it can be built with the maven plugin. This is used by
# Jenkins when invoking certain docs jobs and the resulting output is
# made available to maven.
# In case we start doing something more sophisticated with other refs
# later (such as tags).
BRANCH=$ZUUL_REFNAME
shopt -s extglob
# This function figures out the location of the original script (as opposed to any chain of
# symlinks pointing to it). Source:
# This function figures out the location of the original script (as
# opposed to any chain of symlinks pointing to it). Source:
# http://muffinresearch.co.uk/archives/2008/10/10/bash-resolving-symlinks-to-shellscripts/
function resolve_symlink {
SCRIPT=$1 NEWSCRIPT=''
until [ "$SCRIPT" = "$NEWSCRIPT" ]; do
if [ "${SCRIPT:0:1}" = '.' ]; then SCRIPT=$PWD/$SCRIPT; fi
if [ "${SCRIPT:0:1}" = '.' ]; then
SCRIPT=$PWD/$SCRIPT;
fi
cd $(dirname $SCRIPT)
if [ ! "${SCRIPT:0:1}" = '.' ]; then SCRIPT=$(basename $SCRIPT); fi
if [ ! "${SCRIPT:0:1}" = '.' ]; then
SCRIPT=$(basename $SCRIPT);
fi
SCRIPT=${NEWSCRIPT:=$SCRIPT}
NEWSCRIPT=$(ls -l $SCRIPT | awk '{ print $NF }')
done
if [ ! "${SCRIPT:0:1}" = '/' ]; then SCRIPT=$PWD/$SCRIPT; fi
if [ ! "${SCRIPT:0:1}" = '/' ]; then
SCRIPT=$PWD/$SCRIPT;
fi
echo $(dirname $SCRIPT)
}
DIR=$(resolve_symlink $0)
@ -36,10 +43,12 @@ else
exit 1
fi
# Need to get the file name to insert here so it can be reused for multiple projects
# Filenames for the known repos that could do this are openstackapi-programming.mdown
# and images-api-v2.0.md and openstackapi-programming and images-api-v2.0 are the names
# for the ID and xml filename.
# Need to get the file name to insert here so it can be reused for
# multiple projects Filenames for the known repos that could do this
# are openstackapi-programming.mdown and images-api-v2.0.md and
# openstackapi-programming and images-api-v2.0 are the names for the
# ID and xml filename.
FILENAME=$1
FILEPATH=`find ./ -regextype posix-extended -regex ".*${FILENAME}\.(md|markdown|mdown)"`
DIRPATH=`dirname $FILEPATH`


+ 1
- 0
test-requirements.txt View File

@ -1,3 +1,4 @@
bashate >= 0.2
doc8
# Hacking already pins down pep8, pyflakes and flake8
hacking>=0.9.2,<0.10


+ 8
- 0
tox.ini View File

@ -18,6 +18,14 @@ commands =
# HACKING.rst is the only file that is not referenced from
# doc/source, so add it explicitely.
doc8 -e txt -e rst doc/source/ HACKING.rst
# Run bashate during pep8 runs to ensure violations are caught by
# the check and gate queues.
bashate autogenerate_config_docs/autohelp-wrapper \
autogenerate_config_docs/test/genconfs.sh \
bin/doc-tools-check-languages \
build_environment/files/fetch.sh build_environment/bin/package.sh \
cleanup/remove_trailing_whitespaces.sh \
os_doc_tools/scripts/markdown-docbook.sh
[testenv:pylint]
commands = pylint os_doc_tools cleanup


Loading…
Cancel
Save