From: Maru Newby Date: Tue, 7 Apr 2015 15:00:25 +0000 (+0000) Subject: Remove check for bash usage X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e37dcd4c76e3ab61c585b116c34d32382c592b9f;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/plugins/openvswitch/agent/xenapi/contrib/build-rpm.sh b/neutron/plugins/openvswitch/agent/xenapi/contrib/build-rpm.sh index 81b5f3b31..750bdde2b 100755 --- a/neutron/plugins/openvswitch/agent/xenapi/contrib/build-rpm.sh +++ b/neutron/plugins/openvswitch/agent/xenapi/contrib/build-rpm.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eux diff --git a/neutron/tests/contrib/gate_hook.sh b/neutron/tests/contrib/gate_hook.sh index 0f93918a4..4c777f525 100644 --- a/neutron/tests/contrib/gate_hook.sh +++ b/neutron/tests/contrib/gate_hook.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -ex diff --git a/neutron/tests/contrib/post_test_hook.sh b/neutron/tests/contrib/post_test_hook.sh index fc11f6d2b..2c8360a47 100644 --- a/neutron/tests/contrib/post_test_hook.sh +++ b/neutron/tests/contrib/post_test_hook.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -xe diff --git a/run_tests.sh b/run_tests.sh index 6fe001f53..a32476c55 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eu diff --git a/tools/abandon_old_reviews.sh b/tools/abandon_old_reviews.sh index a91e1d1c0..2cb08a7d2 100755 --- a/tools/abandon_old_reviews.sh +++ b/tools/abandon_old_reviews.sh @@ -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. diff --git a/tools/check_unit_test_structure.sh b/tools/check_unit_test_structure.sh index 1e8a2362f..0aaa0c3ab 100755 --- a/tools/check_unit_test_structure.sh +++ b/tools/check_unit_test_structure.sh @@ -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 diff --git a/tools/clean.sh b/tools/clean.sh index 27bc219f9..b79f03526 100755 --- a/tools/clean.sh +++ b/tools/clean.sh @@ -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 diff --git a/tools/configure_for_func_testing.sh b/tools/configure_for_func_testing.sh index 736cb0207..e04b07f6d 100755 --- a/tools/configure_for_func_testing.sh +++ b/tools/configure_for_func_testing.sh @@ -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. diff --git a/tools/copy_api_tests_from_tempest.sh b/tools/copy_api_tests_from_tempest.sh index 6a3b9f209..7084451d3 100755 --- a/tools/copy_api_tests_from_tempest.sh +++ b/tools/copy_api_tests_from_tempest.sh @@ -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 diff --git a/tools/deploy_rootwrap.sh b/tools/deploy_rootwrap.sh index dbe8ef705..0009a42e2 100755 --- a/tools/deploy_rootwrap.sh +++ b/tools/deploy_rootwrap.sh @@ -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. diff --git a/tools/misc-sanity-checks.sh b/tools/misc-sanity-checks.sh index 0b18f86e2..874b32436 100644 --- a/tools/misc-sanity-checks.sh +++ b/tools/misc-sanity-checks.sh @@ -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 diff --git a/tools/with_venv.sh b/tools/with_venv.sh index dea5c5fc2..5fb07ea8c 100755 --- a/tools/with_venv.sh +++ b/tools/with_venv.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2011 OpenStack Foundation. # All Rights Reserved. # diff --git a/tox.ini b/tox.ini index c3bb17f0e..32cecacf8 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =