From cf874bf5603b3f0c40588c32d999431d1d95de7e Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Tue, 19 Jul 2016 07:21:04 -0700 Subject: [PATCH] Migration report: validate that bc is installed Without this the tool reports: gkotton@ubuntu:~/neutron-lib$ ./tools/migration_report.sh ../vmware-nsx/ You have 2517 total imports You imported Neutron 477 times You imported Neutron-Lib 108 times ./tools/migration_report.sh: line 30: bc: command not found ./tools/migration_report.sh: line 31: bc: command not found ./tools/migration_report.sh: line 33: [: : integer expression expected Closes-bug: #1604438 Change-Id: Ib8236ae214d423c993d9e22035f70af1821af944 --- tools/migration_report.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/migration_report.sh b/tools/migration_report.sh index bef8da14c..e358df26b 100755 --- a/tools/migration_report.sh +++ b/tools/migration_report.sh @@ -14,6 +14,8 @@ else your_project="$1" fi +command -v bc >/dev/null 2>&1 || { echo "I require bc but it's not installed. Aborting." >&2; exit 1; } + total_imports=$(egrep -R -w "^(import|from)" --exclude-dir=".*tox" $your_project | wc -l) neutron_imports=$(count_imports neutron $your_project) lib_imports=$(count_imports neutron_lib $your_project)