]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove check for bash usage
authorMaru Newby <marun@redhat.com>
Tue, 7 Apr 2015 15:00:25 +0000 (15:00 +0000)
committerMaru Newby <marun@redhat.com>
Tue, 7 Apr 2015 15:15:33 +0000 (15:15 +0000)
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

13 files changed:
neutron/plugins/openvswitch/agent/xenapi/contrib/build-rpm.sh
neutron/tests/contrib/gate_hook.sh
neutron/tests/contrib/post_test_hook.sh
run_tests.sh
tools/abandon_old_reviews.sh
tools/check_unit_test_structure.sh
tools/clean.sh
tools/configure_for_func_testing.sh
tools/copy_api_tests_from_tempest.sh
tools/deploy_rootwrap.sh
tools/misc-sanity-checks.sh
tools/with_venv.sh
tox.ini

index 81b5f3b316b9c0855a68b659e8655b3692ad87e9..750bdde2b0a6c1245144a3490c0e67958fb69425 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -eux
 
index 0f93918a4be1dd35bc6bbad023c812375015013f..4c777f5251ef4d7488786c47d50c4c361360d905 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 
 set -ex
index fc11f6d2bdfe85c5ff44b01f12342dfaecb24ba2..2c8360a47a7eb3611484b5f0018114ce90d17f9a 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -xe
 
index 6fe001f5381d5652c64ff20cf292d4fcfab667d3..a32476c5543e25ab1ea44bb19460412b1ac0cd34 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -eu
 
index a91e1d1c064f386de9cff32f3c348db324fd15e5..2cb08a7d2df3b2d162a7cea3264d7bb5af8a362d 100755 (executable)
@@ -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.
index 1e8a2362f75c95107bffbbba6559e3ba8c4035a5..0aaa0c3ab3624397c6b29998dad0d3ec12b773bf 100755 (executable)
@@ -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
index 27bc219f9ca4f3b9ba8a17b388f8060963626fdd..b79f03526921d6987436fff28d88a4a44fea5839 100755 (executable)
@@ -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
index 736cb0207939f3a3f66c3dd80758762f22a98c96..e04b07f6dd48f0cc03f9097201440458a9ecc9bc 100755 (executable)
@@ -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.
index 6a3b9f2091bfdb1e9d84e4fe1c78f2d58d285225..7084451d334e6acd16bddd19ac8f43e79d1376f1 100755 (executable)
@@ -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
index dbe8ef705e4081529f31f32250edd37fabe205b2..0009a42e2b9a17fa3c22062de5bc7076fbff4a3a 100755 (executable)
@@ -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.
index 0b18f86e222d93562936fe572a63450518dcdd92..874b324368232ba20b5cd4d12ba86182a3ceded4 100644 (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
index dea5c5fc2be69b72fabc7ded796dc3c89dd8ab31..5fb07ea8ccbfa74ddfc33fa4ac17d7feec20e342 100755 (executable)
@@ -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 c3bb17f0e4ec1ff3753579f2dfe1c940ff405e57..32cecacf8f1bbae724e2bd358c1576b9587f5105 100644 (file)
--- 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 =