Remove check for bash usage

Arbitrarily restricting ourselves from using bash because developers on
platforms like netbsd don't want to install bash from ports doesn't
make sense.  Any non-trivial shell script is likely to use features
like arrays or string manipulation that are poorly supported (if at
all) by sh, and the continued bumping of the number of expected bash
scripts is an indication that the check is not serving its purpose
anyway.

Along with removing the check, all shebang references to /bin/bash
have been replaced with /usr/bin/env bash in an attempt to be more
compatible across different hosts.

Change-Id: Ief72dc380cc88af38959c330897e2c127e33c332
Closes-Bug: #1440824
This commit is contained in:
Maru Newby 2015-04-07 15:00:25 +00:00
parent 21bef562c2
commit e37dcd4c76
13 changed files with 14 additions and 29 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eux

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -ex

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -xe

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This script identifies the unit test modules that do not correspond
# directly with a module in the code tree. See TESTING.rst for the

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
rm -rf ./*.deb ./*.tar.gz ./*.dsc ./*.changes
rm -rf */*.deb
rm -rf ./plugins/**/build/ ./plugins/**/dist

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# This script is intended to allow repeatable migration of the neutron
# api tests from tempest. The intention is to allow development to

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@ -23,22 +23,6 @@ trap "rm -rf $TMPDIR" EXIT
FAILURES=$TMPDIR/failures
check_opinionated_shell () {
# The purpose of this function is to avoid casual introduction of more
# bash dependency. Please consider alternatives before committing code
# which uses bash specific features.
# Check that shell scripts are not bash opinionated (ignore comments though)
# If you cannot avoid the use of bash, please change the EXPECTED var below.
OBSERVED=$(grep -E '^([[:space:]]*[^#[:space:]]|#!).*bash' \
tox.ini tools/* | wc -l)
EXPECTED=8
if [ ${EXPECTED} -ne ${OBSERVED} ]; then
echo "Bash usage has been detected!" >>$FAILURES
fi
}
check_no_symlinks_allowed () {
# Symlinks break the package build process, so ensure that they
# do not slip in, except hidden symlinks.
@ -74,7 +58,6 @@ check_identical_policy_files () {
}
# Add your checks here...
check_opinionated_shell
check_no_symlinks_allowed
check_pot_files_errors
check_identical_policy_files

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#

View File

@ -82,7 +82,9 @@ commands=
flake8
sh ./tools/coding-checks.sh --pylint '{posargs}'
neutron-db-manage check_migration
whitelist_externals = sh
whitelist_externals =
sh
bash
[testenv:cover]
commands =