Skip to content

Commit

Permalink
Update check_spdx.sh to return 1 on failure (#4277)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 committed Feb 10, 2024
1 parent 286523c commit 6829f4c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scapy/tools/check_spdx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ROOT_DIR=$SCRIPT_DIR/../..

# http://mywiki.wooledge.org/BashFAQ/024
# This documents an absolutely WTF behavior of bash.
set +m
shopt -s lastpipe

function check_path() {
cd $ROOT_DIR
RCODE=0
for ext in "${@:2}"; do
find $1 -name "*.$ext" -exec bash -c '[[ -z $(grep "SPDX" {}) ]] && echo "{}"' \;
find $1 -name "*.$ext" | while read f; do
if [[ -z $(grep "SPDX" $f) ]]; then
echo "$f"
RCODE=1
fi
done
done
return $RCODE
}

check_path scapy py
check_path scapy py || exit $?

0 comments on commit 6829f4c

Please sign in to comment.