From 135c18aadb0147f93d3e2658e42fc7a479b9ad04 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 18 Feb 2020 16:02:42 +0100 Subject: tools: add script that checks copyright headers Fixes #1604 --- tools/check-copyright.sh | 21 +++++++++++++++++++++ tools/create-openbsd-gce-ci.sh | 3 +-- tools/create-openbsd-vmm-worker.sh | 3 +-- tools/syz-trace2syz/proggen/call_selector.go | 3 +++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100755 tools/check-copyright.sh (limited to 'tools') diff --git a/tools/check-copyright.sh b/tools/check-copyright.sh new file mode 100755 index 000000000..86067564c --- /dev/null +++ b/tools/check-copyright.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# 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="" +for F in $(find -name "*.go" -o -name "*.sh" -o \( -path "./sys/*/*.txt" \) | egrep -v "/vendor/|/gen/"); do + ((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. + egrep "(//|#) AUTOGENERATED FILE|(WARNING: This file is machine generated)" $F >/dev/null + 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 + echo "$F: does not have standard copyright statement" + FAILED="1" +done +if [ "$FAILED" != "" ]; then exit 1; fi +echo "$FILES files checked for copyright statement" diff --git a/tools/create-openbsd-gce-ci.sh b/tools/create-openbsd-gce-ci.sh index 5f1e5d960..22364d2e9 100755 --- a/tools/create-openbsd-gce-ci.sh +++ b/tools/create-openbsd-gce-ci.sh @@ -1,8 +1,7 @@ #!/bin/bash # Copyright 2018 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. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. # Produces GCE image of syz-ci running on OpenBSD. diff --git a/tools/create-openbsd-vmm-worker.sh b/tools/create-openbsd-vmm-worker.sh index d0d01fe11..4e0eaf466 100755 --- a/tools/create-openbsd-vmm-worker.sh +++ b/tools/create-openbsd-vmm-worker.sh @@ -1,8 +1,7 @@ #!/bin/bash # Copyright 2018 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. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. # Produces a very minimal image for running syzkaller fuzzers running on OpenBSD. diff --git a/tools/syz-trace2syz/proggen/call_selector.go b/tools/syz-trace2syz/proggen/call_selector.go index 5ace0fd2a..886c82636 100644 --- a/tools/syz-trace2syz/proggen/call_selector.go +++ b/tools/syz-trace2syz/proggen/call_selector.go @@ -1,3 +1,6 @@ +// Copyright 2018 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. + package proggen import ( -- cgit mrf-deployment