From 5d7218b7a1ccbbaed25c4acb354e84c5603556ea Mon Sep 17 00:00:00 2001 From: Derek Date: Wed, 31 Oct 2018 14:21:41 -0700 Subject: [PATCH] tools: fix check repositories script for macs (#4914) Fix check_repositories script when running on a mac. The version of grep that comes as part of OSX does not support the -P flag. This will instead utilize git grep to pattern match. Risk Level: Low Testing: Manually ran the script on my machine. See attached output below. Docs Changes: N/A Release Notes: N/A Signed-off-by: Derek Schaller --- tools/check_repositories.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/check_repositories.sh b/tools/check_repositories.sh index 2811a598ce50..d333ccc332eb 100755 --- a/tools/check_repositories.sh +++ b/tools/check_repositories.sh @@ -12,8 +12,8 @@ fi # Check whether number of defined `url =` or `urls =` and `sha256 =` kwargs in # repository definitions is equal. -urls_count=$(grep -IPnrs "url(s)? =" --include=*.bzl . | wc -l) -sha256sums_count=$(grep -nr "sha256 =" --include=*.bzl . | wc -l) +urls_count=$(git grep -E "url(s)? =" -- '*.bzl' | wc -l) +sha256sums_count=$(git grep -E "sha256 =" -- '*.bzl' | wc -l) if [[ $urls_count != $sha256sums_count ]]; then echo "Found more defined repository URLs than SHA256 sums, which means that there are some repositories without sums."