From: madavi Date: Thu, 5 Sep 2019 08:35:14 +0000 (+0530) Subject: Resolve the regular expression issue in license scan X-Git-Tag: v7.0.0rc1~70 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b6e0266a557b25d6b791661919f537e5bb32c2a5;p=osm%2Fdevops.git Resolve the regular expression issue in license scan Change-Id: If0f9b53da16d1e291aee22d0df6adaae492afea4 Signed-off-by: madavi --- diff --git a/tools/license_scan.sh b/tools/license_scan.sh index 7bfee6f4..71d283fb 100755 --- a/tools/license_scan.sh +++ b/tools/license_scan.sh @@ -29,12 +29,12 @@ dpkg -l curl &>/dev/null ||sudo apt-get install -y curl apache=0 nolicense=0 other=0 - +exception_list="':(exclude)*.pdf' ':(exclude)*.png' ':(exclude)*.jpeg' ':(exclude)*.jpg' ':(exclude)*.gif' ':(exclude)*.json'" git fetch RE="FATAL: your file did not get passed through" -for file in $(git diff --name-only origin/$GERRIT_BRANCH -- . ':!*.pdf' ':!*.png' ':!*.jp[e]?g' ':!*.gif' ':!*.json'); do +for file in $(echo ${exception_list} | xargs git diff --name-only origin/$GERRIT_BRANCH -- . ); do if [ -f $file ]; then if [ -s $file ]; then licnse=$(curl -s -X POST -H 'Accept: text' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' -H 'Content-Type: multipart/form-data' -H 'cache-control: no-cache' -F "file_input=@\"$file\"" -F 'showheader=1' https://fossology-osm.etsi.org/?mod=agent_nomos_once |grep "A one shot license analysis shows the following license(s) in file"|sed -n 's:.*\(.*\).*:\1:p' |xargs)