2020-02-23 23:55:55 +00:00
#!/usr/bin/env bash
2020-02-18 15:02:42 +00:00
# Copyright 2020 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.
FILES = 0
FAILED = ""
2020-02-24 00:00:47 +00:00
for F in $( find . -name "*.go" -o -name "*.sh" -o -name "*.cc" -o -name "*.h" \
2020-05-14 11:33:22 +00:00
-o -name "*.S" -o -name "*.py" -o -name "*.yml" -o -name "*.yaml" \
-o \( -path "./sys/*/*.txt" \) | egrep -v "/vendor/|/gen/" ) ; do
2020-02-18 15:02:42 +00:00
( ( FILES += 1) )
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
if [ $? -eq 0 ] ; then continue ; fi
# Ignore auto-generated files.
2020-07-29 11:35:50 +00:00
egrep "^(//|#) Code generated .* DO NOT EDIT\\.|(WARNING: This file is machine generated)" $F >/dev/null
2020-02-18 15:02:42 +00:00
if [ $? -eq 0 ] ; then continue ; fi
# Ignore untracked files.
git ls-files --error-unmatch $F >/dev/null 2>& 1
if [ $? -ne 0 ] ; then continue ; fi
2020-05-14 11:37:52 +00:00
echo " $F :1:1: The file does not have the standard copyright statement (please add). "
2020-02-18 15:02:42 +00:00
FAILED = "1"
done
if [ " $FAILED " != "" ] ; then exit 1; fi
echo " $FILES files checked for copyright statement "