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
changes/39/170939/5
Maru Newby 8 years ago
parent 21bef562c2
commit e37dcd4c76

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

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

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

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

@ -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.

@ -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

@ -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

@ -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.

@ -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

@ -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.

@ -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

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

@ -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 =

Loading…
Cancel
Save