X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e2cd53d9007d56e1de4816f6aeab4bd769271162..2a97a35394b560daa52eef95616429603dfeb8b5:/build/check-copyright-notices diff --git a/build/check-copyright-notices b/build/check-copyright-notices index aef14fa6ad..d52c043bb8 100755 --- a/build/check-copyright-notices +++ b/build/check-copyright-notices @@ -41,7 +41,10 @@ EOF done fixer() { - want="${want}" perl -pi~ -e 'if ($. == 1) { s{^(\#\!.*\n)?}{${1}$ENV{want}\n\n} }' "${1}" + want="${want}" perl -pi~ - "${1}" <<'EOF' +BEGIN { undef $/ } +s{^((\#\!.*?\n|\n*---\n.*?\n\.\.\.\n)\n?)?}{${2}$ENV{want}\n\n}ms +EOF } IFS=$'\n' read -a ignores -r -d $'\000' <.licenseignore || true @@ -105,27 +108,27 @@ git ls-files -z ${@} | \ ;; *.erb) fixer=fixer - cs="<%#" + cs="<%# " cc="" ce=" %>" ;; *.liquid) fixer=fixer cs=$'{% comment %}\n' - cc= - ce=$'\n%{% endcomment %}' + cc="" + ce=$'\n{% endcomment %}' grepAfter=3 grepBefore=1 ;; *.textile) fixer=fixer - cs="###." + cs="###. " cc="...." ce= ;; *.css) fixer=fixer - cs="/*" + cs="/* " cc="" ce=" */" ;; @@ -140,7 +143,7 @@ git ls-files -z ${@} | \ *.html | *.svg) fixer=fixer cs="" ;; *) @@ -152,16 +155,16 @@ git ls-files -z ${@} | \ fi ;; esac - wantGPL="${cs:-${cc}} Copyright (C) The Arvados Authors. All rights reserved. + 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}} 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}} 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 "$fnm" | egrep -A${grepAfter} -B${grepBefore} 'Copyright.*Arvados' || true) + found=$(head -n20 "$fnm" | egrep -A${grepAfter} -B${grepBefore} 'Copyright.*Arvados' || true) case ${fnm} in Makefile | build/* | lib/* | tools/* | apps/* | services/*) want=${wantGPL}