github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/tools/check-copyright.sh (about) 1 #!/usr/bin/env bash 2 # Copyright 2020 syzkaller project authors. All rights reserved. 3 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 4 5 FILES=0 6 FAILED="" 7 for F in $(find . -name "*.go" -o -name "*.sh" -o -name "*.cc" -o -name "*.h" \ 8 -o -name "*.S" -o -name "*.py" -o -name "*.yml" -o -name "*.yaml" -o -name "*.fbs" \ 9 -o \( -path "./sys/*/*.txt" \) | egrep -v "/_include/|/vendor/|/gen/|/testdata/"); do 10 ((FILES+=1)) 11 cat $F | tr '\n' '_' | egrep "(//|#) Copyright 20[0-9]{2}(/20[0-9]{2})? syzkaller project authors\. All rights reserved\._(//|#) Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file\." >/dev/null 12 if [ $? -eq 0 ]; then continue; fi 13 # Ignore auto-generated files. 14 egrep "^(//|#) Code generated .* DO NOT EDIT\\.|(WARNING: This file is machine generated)|automatically generated by the FlatBuffers compiler" $F >/dev/null 15 if [ $? -eq 0 ]; then continue; fi 16 # Ignore untracked files. 17 git ls-files --error-unmatch $F >/dev/null 2>&1 18 if [ $? -ne 0 ]; then continue; fi 19 echo "$F:1:1: The file does not have the standard copyright statement (please add)." 20 FAILED="1" 21 done 22 if [ "$FAILED" != "" ]; then exit 1; fi 23 echo "$FILES files checked for copyright statement"