Fix copyright header, and copyright header checker exit code.
authorTom Clegg <tclegg@veritasgenetics.com>
Thu, 21 Dec 2017 18:25:18 +0000 (13:25 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Thu, 21 Dec 2017 18:27:06 +0000 (13:27 -0500)
No issue #

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

README.md
build/check-copyright-notices

index 367c3e8f60c5ccb2bb5f5490c32812ed0bbceca1..f5940da543678d1b850e5984f7d8c7ce73d4c7b2 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-[//]: # Copyright (C) The Arvados Authors. All rights reserved.
-[//]: #
-[//]: # SPDX-License-Identifier: CC-BY-SA-3.0
+[comment]: # (Copyright © The Arvados Authors. All rights reserved.)
+[comment]: # ()
+[comment]: # (SPDX-License-Identifier: CC-BY-SA-3.0)
 
 [Arvados](https://arvados.org) is a free software distributed computing platform
 for bioinformatics, data science, and high throughput analysis of massive data
index 5298371bd1591fed7178cd6b839f90715b8a56c4..f087188991c5c06a3b19a3b1e38325d9d29e5c52 100755 (executable)
@@ -49,163 +49,172 @@ EOF
 
 IFS=$'\n' read -a ignores -r -d $'\000' <.licenseignore || true
 result=0
-git ls-files -z ${@} | \
-    while read -rd $'\000' fnm
+
+coproc git ls-files -z ${@} </dev/null
+while read -rd $'\000' fnm
+do
+    grepAfter=2
+    grepBefore=0
+    cs=
+    cc=
+    ce=
+    fixer=
+    if [[ ! -f ${fnm} ]] || [[ -L ${fnm} ]] || [[ ! -s ${fnm} ]]
+    then
+        continue
+    fi
+
+    ignore=
+    for pattern in "${ignores[@]}"
     do
-        grepAfter=2
-        grepBefore=0
-        cs=
-        cc=
-        ce=
-        fixer=
-        if [[ ! -f ${fnm} ]] || [[ -L ${fnm} ]] || [[ ! -s ${fnm} ]]
+        if [[ ${fnm} == ${pattern} ]]
         then
-            continue
+            ignore=1
         fi
+    done
+    if [[ ${ignore} = 1 ]]; then continue; fi
 
-        ignore=
-        for pattern in "${ignores[@]}"
-        do
-            if [[ ${fnm} == ${pattern} ]]
+    case ${fnm} in
+        Makefile | */Makefile \
+            | *.dockerfile | */Dockerfile.* | */Dockerfile | *.dockerignore \
+            | */MANIFEST.in | */fuse.conf | */gitolite.rc \
+            | *.pl | *.pm | *.PL \
+            | *.rb | *.rb.example | *.rake | *.ru \
+            | *.gemspec | */Gemfile | */Rakefile \
+            | services/login-sync/bin/* \
+            | sdk/cli/bin/* \
+            | *.py \
+            | sdk/python/bin/arv-* \
+            | sdk/cwl/bin/* \
+            | services/nodemanager/bin/* \
+            | services/fuse/bin/* \
+            | tools/crunchstat-summary/bin/* \
+            | crunch_scripts/* \
+            | *.yaml | *.yml | *.yml.example | *.cwl \
+            | *.sh | *.service \
+            | */run | */run-service | */restart-dns-server \
+            | */nodemanager/doc/*.cfg \
+            | */nodemanager/tests/fake*.cfg.template \
+            | */nginx.conf \
+            | build/build.list)
+            fixer=fixer
+            cc="#"
+            ;;
+        *.md)
+            fixer=fixer
+            cc="[//]: #"
+            ;;
+        *.rst)
+            fixer=fixer
+            cc=".."
+            ;;
+        *.erb)
+            fixer=fixer
+            cs="<%# "
+            cc=""
+            ce=" %>"
+            ;;
+        *.liquid)
+            fixer=fixer
+            cs=$'{% comment %}\n'
+            cc=""
+            ce=$'\n{% endcomment %}'
+            grepAfter=3
+            grepBefore=1
+            ;;
+        *.textile)
+            fixer=fixer
+            cs="###. "
+            cc="...."
+            ce=
+            ;;
+        *.css)
+            fixer=fixer
+            cs="/* "
+            cc=""
+            ce=" */"
+            ;;
+        *.coffee)
+            fixer=fixer
+            cs="### "
+            cc=""
+            ce=" ###"
+            ;;
+        *.go | *.scss | *.java | *.js)
+            fixer=fixer
+            cc="//"
+            ;;
+        *.sql)
+            fixer=fixer
+            cc="--"
+            ;;
+        *.html | *.svg)
+            fixer=fixer
+            cs="<!-- "
+            cc=""
+            ce=" -->"
+            ;;
+        *)
+            cc="#"
+            hashbang=$(head -n1 ${fnm})
+            if [[ ${hashbang} = "#!/bin/sh" ]] ||  [[ ${hashbang} = "#!/bin/bash" ]]
             then
-                ignore=1
-            fi
-        done
-        if [[ ${ignore} = 1 ]]; then continue; fi
-
-        case ${fnm} in
-            Makefile | */Makefile \
-                | *.dockerfile | */Dockerfile.* | */Dockerfile | *.dockerignore \
-                | */MANIFEST.in | */fuse.conf | */gitolite.rc \
-                | *.pl | *.pm | *.PL \
-                | *.rb | *.rb.example | *.rake | *.ru \
-                | *.gemspec | */Gemfile | */Rakefile \
-                | services/login-sync/bin/* \
-                | sdk/cli/bin/* \
-                | *.py \
-                | sdk/python/bin/arv-* \
-                | sdk/cwl/bin/* \
-                | services/nodemanager/bin/* \
-                | services/fuse/bin/* \
-                | tools/crunchstat-summary/bin/* \
-                | crunch_scripts/* \
-                | *.yaml | *.yml | *.yml.example | *.cwl \
-                | *.sh | *.service \
-                | */run | */run-service | */restart-dns-server \
-                | */nodemanager/doc/*.cfg \
-                | */nodemanager/tests/fake*.cfg.template \
-                | */nginx.conf \
-                | build/build.list)
-                fixer=fixer
-                cc="#"
-                ;;
-            *.md)
-                fixer=fixer
-                cc="[//]: #"
-                ;;
-            *.rst)
-                fixer=fixer
-                cc=".."
-                ;;
-            *.erb)
-                fixer=fixer
-                cs="<%# "
-                cc=""
-                ce=" %>"
-                ;;
-            *.liquid)
-                fixer=fixer
-                cs=$'{% comment %}\n'
-                cc=""
-                ce=$'\n{% endcomment %}'
-                grepAfter=3
-                grepBefore=1
-                ;;
-            *.textile)
-                fixer=fixer
-                cs="###. "
-                cc="...."
-                ce=
-                ;;
-            *.css)
-                fixer=fixer
-                cs="/* "
-                cc=""
-                ce=" */"
-                ;;
-            *.coffee)
                 fixer=fixer
-                cs="### "
-                cc=""
-                ce=" ###"
-                ;;
-            *.go | *.scss | *.java | *.js)
-                fixer=fixer
-                cc="//"
-                ;;
-            *.sql)
-                fixer=fixer
-                cc="--"
-                ;;
-            *.html | *.svg)
-                fixer=fixer
-                cs="<!-- "
-                cc=""
-                ce=" -->"
-                ;;
-            *)
-                cc="#"
-                hashbang=$(head -n1 ${fnm})
-                if [[ ${hashbang} = "#!/bin/sh" ]] ||  [[ ${hashbang} = "#!/bin/bash" ]]
-                then
-                    fixer=fixer
-                fi
-                ;;
-        esac
-        wantGPL="${cs:-${cc}${cc:+ }}Copyright (C) The Arvados Authors. All rights reserved.
+            fi
+            ;;
+    esac
+    wantGPL="${cs:-${cc}${cc:+ }}Copyright (C) The Arvados Authors. All rights reserved.
 ${cc}
 ${cc}${cc:+ }SPDX-License-Identifier: AGPL-3.0${ce}"
-        wantApache="${cs:-${cc}${cc:+ }}Copyright (C) The Arvados Authors. All rights reserved.
+    wantApache="${cs:-${cc}${cc:+ }}Copyright (C) The Arvados Authors. All rights reserved.
 ${cc}
 ${cc}${cc:+ }SPDX-License-Identifier: Apache-2.0${ce}"
-        wantBYSA="${cs:-${cc}${cc:+ }}Copyright (C) The Arvados Authors. All rights reserved.
+    wantBYSA="${cs:-${cc}${cc:+ }}Copyright (C) The Arvados Authors. All rights reserved.
 ${cc}
 ${cc}${cc:+ }SPDX-License-Identifier: CC-BY-SA-3.0${ce}"
-        found=$(head -n20 "$fnm" | egrep -A${grepAfter} -B${grepBefore} 'Copyright.*Arvados' || true)
-        case ${fnm} in
-            Makefile | build/* | lib/* | tools/* | apps/* | services/* | sdk/cli/bin/crunch-job)
-                want=${wantGPL}
-                ;;
-            crunch_scripts/* | backports/* | docker/* | sdk/*)
-                want=${wantApache}
-                ;;
-            README.md | doc/*)
-                want=${wantBYSA}
-                ;;
-            *)
-                want=
-                ;;
-        esac
-        case "$found" in
-            "$wantGPL")
-                ;;
-            "$wantApache")
-                ;;
-            "$wantBYSA")
-                ;;
-            "")
-                if [[ -z ${found} ]] && [[ -n ${want} ]] && [[ $fix = true ]] && [[ $fixer != "" ]]
-                then
-                    ${fixer} ${fnm}
-                else
-                    echo "missing copyright notice: $fnm"
-                    result=1
-                fi
-                ;;
-            *)
-                echo "nonstandard copyright notice: $fnm '${found}'"
+    wantBYSAmd="[comment]: # (Copyright © The Arvados Authors. All rights reserved.)
+[comment]: # ()
+[comment]: # (SPDX-License-Identifier: CC-BY-SA-3.0)"
+    found=$(head -n20 "$fnm" | egrep -A${grepAfter} -B${grepBefore} 'Copyright.*Arvados' || true)
+    case ${fnm} in
+        Makefile | build/* | lib/* | tools/* | apps/* | services/* | sdk/cli/bin/crunch-job)
+            want=${wantGPL}
+            ;;
+        crunch_scripts/* | backports/* | docker/* | sdk/*)
+            want=${wantApache}
+            ;;
+        doc/*)
+            want=${wantBYSA}
+            ;;
+        README.md)
+            want=${wantBYSAmd}
+            ;;
+        *)
+            want=
+            ;;
+    esac
+    case "$found" in
+        "$wantGPL")
+            ;;
+        "$wantApache")
+            ;;
+        "$wantBYSA")
+            ;;
+        "$wantBYSAmd")
+            ;;
+        "")
+            if [[ -z ${found} ]] && [[ -n ${want} ]] && [[ $fix = true ]] && [[ $fixer != "" ]]
+            then
+                ${fixer} ${fnm}
+            else
+                echo "missing copyright notice: $fnm"
                 result=1
-                ;;
-        esac
-    done
+            fi
+            ;;
+        *)
+            echo "nonstandard copyright notice: $fnm '${found}'"
+            result=1
+            ;;
+    esac
+done <&${COPROC[0]}
 exit $result