aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-03-23 14:44:29 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-03-24 15:05:59 +0100
commit9a8b3b3e131359aea1cac650fb6ac331fbe2047c (patch)
tree1446d8ae1e3126d4e7678da04542244c9fe17899 /scripts
parent18c7084c7dd393f344cb4f4b9698264283d9353a (diff)
copyright: fix out-of-date copyright ranges and missing headers
Reported by the new script 'scripts/copyright.pl'. The script has a regex whitelist for the files that don't need copyright headers. Removed three (mostly usesless) README files from docs/ Closes #5141
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am2
-rwxr-xr-xscripts/completion.pl21
-rwxr-xr-xscripts/contrithanks.sh2
-rwxr-xr-xscripts/copyright.pl187
-rwxr-xr-xscripts/coverage.sh21
-rw-r--r--scripts/installcheck.sh21
-rwxr-xr-xscripts/log2changes.pl21
-rwxr-xr-xscripts/travis/before_script.sh21
-rwxr-xr-xscripts/travis/iconv-env.sh21
-rwxr-xr-xscripts/travis/script.sh21
-rwxr-xr-xscripts/updatemanpages.pl2
11 files changed, 337 insertions, 3 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 297b8d29b..e56938da9 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
diff --git a/scripts/completion.pl b/scripts/completion.pl
index 1c41755b4..c717c6d43 100755
--- a/scripts/completion.pl
+++ b/scripts/completion.pl
@@ -1,4 +1,25 @@
#!/usr/bin/env perl
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
use strict;
use warnings;
diff --git a/scripts/contrithanks.sh b/scripts/contrithanks.sh
index 44e461455..641259216 100755
--- a/scripts/contrithanks.sh
+++ b/scripts/contrithanks.sh
@@ -6,7 +6,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 2013-2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 2013 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
diff --git a/scripts/copyright.pl b/scripts/copyright.pl
new file mode 100755
index 000000000..bdf23dd7a
--- /dev/null
+++ b/scripts/copyright.pl
@@ -0,0 +1,187 @@
+#!/usr/bin/perl
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+#
+# Invoke script in the root of the git checkout. Scans all files in git unless
+# given a specific single file.
+#
+# Usage: copyright.pl [file]
+#
+
+# regexes of files to not scan
+my @whitelist=(
+ '^tests\/data\/test(\d+)$', # test case data
+ '^docs\/cmdline-opts\/[a-z]+(.*)\.d$', # curl.1 pieces
+ '(\/|^)[A-Z0-9_.-]+$', # all uppercase file name, possibly with dot and dash
+ '(\/|^)[A-Z0-9_-]+\.md$', # all uppercase file name with .md extension
+ '.gitignore', # whereever they are
+ '.gitattributes', # whereever they are
+ '^tests/certs/.*', # generated certs
+ '^tests/stunnel.pem', # generated cert
+ '^tests/valgrind.supp', # valgrind suppressions
+ '^projects/Windows/.*.dsw$', # generated MSVC file
+ '^projects/Windows/.*.sln$', # generated MSVC file
+ '^projects/Windows/.*.tmpl$', # generated MSVC file
+ '^projects/Windows/.*.vcxproj.filters$', # generated MSVC file
+ '^m4/ax_compile_check_sizeof.m4$', # imported, leave be
+ '^.mailmap', # git control file
+ '^winbuild/BUILD.WINDOWS.txt$', # instructions
+ '\/readme',
+ '^.github/', # github instruction files
+
+ # docs/ files we're okay with without copyright
+ 'INSTALL.cmake',
+ 'TheArtOfHttpScripting',
+ 'page-footer',
+ 'curl_multi_socket_all.3',
+ 'curl_strnequal.3',
+ 'symbols-in-versions',
+
+ # macos-framework files
+ '^lib\/libcurl.plist',
+ '^lib\/libcurl.vers.in',
+
+ # symbian build files we know little about
+ '^packages\/Symbian\/bwins\/libcurlu.def',
+ '^packages\/Symbian\/eabi\/libcurlu.def',
+ '^packages\/Symbian\/group\/bld.inf',
+ '^packages\/Symbian\/group\/curl.iby',
+ '^packages\/Symbian\/group\/curl.mmp',
+ '^packages\/Symbian\/group\/curl.pkg',
+ '^packages\/Symbian\/group\/libcurl.iby',
+ '^packages\/Symbian\/group\/libcurl.mmp',
+ '^packages\/Symbian\/group\/libcurl.pkg',
+
+ # vms files
+ '^packages\/vms\/build_vms.com',
+ '^packages\/vms\/curl_release_note_start.txt',
+ '^packages\/vms\/curlmsg.sdl',
+ '^packages\/vms\/macro32_exactcase.patch',
+
+ # XML junk
+ '^projects\/wolfssl_override.props',
+
+ # macos framework generated files
+ '^src\/macos\/curl.mcp.xml.sit.hqx',
+ '^src\/macos\/src\/curl_GUSIConfig.cpp',
+
+ );
+
+sub scanfile {
+ my ($f) = @_;
+ my $line=1;
+ my $found = 0;
+ open(F, "<$f") ||
+ print ERROR "can't open $f\n";
+ while (<F>) {
+ chomp;
+ my $l = $_;
+ # check for a copyright statement and save the years
+ if($l =~ /.* +copyright .* *\d\d\d\d/i) {
+ while($l =~ /([\d]{4})/g) {
+ push @copyright, {
+ year => $1,
+ line => $line,
+ col => index($l, $1),
+ code => $l
+ };
+ $found++;
+ }
+ }
+ # allow within the first 100 lines
+ if(++$line > 100) {
+ last;
+ }
+ }
+ close(F);
+ return $found;
+}
+
+sub checkfile {
+ my ($file) = @_;
+ my $fine = 0;
+ @copyright=();
+ my $found = scanfile($file);
+
+ if(!$found) {
+ print "$file: missing copyright range\n";
+ return 2;
+ }
+
+ my $commityear = undef;
+ @copyright = sort {$$b{year} cmp $$a{year}} @copyright;
+
+ # if the file is modified, assume commit year this year
+ if(`git status -s -- $file` =~ /^ [MARCU]/) {
+ $commityear = (localtime(time))[5] + 1900;
+ }
+ else {
+ # min-parents=1 to ignore wrong initial commit in truncated repos
+ my $grl = `git rev-list --max-count=1 --min-parents=1 --timestamp HEAD -- $file`;
+ if($grl) {
+ chomp $grl;
+ $commityear = (localtime((split(/ /, $grl))[0]))[5] + 1900;
+ }
+ }
+
+ if(defined($commityear) && scalar(@copyright) &&
+ $copyright[0]{year} != $commityear) {
+ print "$file: copyright year out of date, should be $commityear, " .
+ "is $copyright[0]{year}\n";
+ }
+ else {
+ $fine = 1;
+ }
+ return $fine;
+}
+
+my @all;
+if($ARGV[0]) {
+ push @all, $ARGV[0];
+}
+else {
+ @all = `git ls-files`;
+}
+for my $f (@all) {
+ chomp $f;
+ my $skipped = 0;
+ for my $skip (@whitelist) {
+ #print "$f matches $skip ?\n";
+ if($f =~ /$skip/) {
+ $whitelisted++;
+ $skipped = 1;
+ #print "$f: SKIPPED ($skip)\n";
+ last;
+ }
+ }
+ if(!$skipped) {
+ my $r = checkfile($f);
+ $missing++ if($r == 2);
+ $wrong++ if(!$r);
+ }
+}
+
+print STDERR "$missing files have no copyright\n" if($missing);
+print STDERR "$wrong files have wrong copyright year\n" if ($wrong);
+print STDERR "$whitelisted files are whitelisted\n" if ($whitelisted);
+
+exit 1 if($missing || $wrong);
diff --git a/scripts/coverage.sh b/scripts/coverage.sh
index 86cd7a122..cae5e028f 100755
--- a/scripts/coverage.sh
+++ b/scripts/coverage.sh
@@ -1,4 +1,25 @@
#!/bin/sh
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
./buildconf
mkdir -p cvr
diff --git a/scripts/installcheck.sh b/scripts/installcheck.sh
index b26ba60f6..83d12936a 100644
--- a/scripts/installcheck.sh
+++ b/scripts/installcheck.sh
@@ -1,4 +1,25 @@
#!/bin/bash
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
PREFIX=$1
diff --git a/scripts/log2changes.pl b/scripts/log2changes.pl
index 3aa326a07..fa6cefcc3 100755
--- a/scripts/log2changes.pl
+++ b/scripts/log2changes.pl
@@ -1,4 +1,25 @@
#!/usr/bin/env perl
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
# git log --pretty=fuller --no-color --date=short --decorate=full
diff --git a/scripts/travis/before_script.sh b/scripts/travis/before_script.sh
index 60b63ece3..3baa86c43 100755
--- a/scripts/travis/before_script.sh
+++ b/scripts/travis/before_script.sh
@@ -1,4 +1,25 @@
#!/bin/bash
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
set -eo pipefail
./buildconf
diff --git a/scripts/travis/iconv-env.sh b/scripts/travis/iconv-env.sh
index bb7dcf422..129eb10a9 100755
--- a/scripts/travis/iconv-env.sh
+++ b/scripts/travis/iconv-env.sh
@@ -1 +1,22 @@
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
export CPPFLAGS="-DCURL_DOES_CONVERSIONS -DHAVE_ICONV -DCURL_ICONV_CODESET_OF_HOST='\"ISO8859-1\"'"
diff --git a/scripts/travis/script.sh b/scripts/travis/script.sh
index 5bfd84b84..57625fc6d 100755
--- a/scripts/travis/script.sh
+++ b/scripts/travis/script.sh
@@ -1,4 +1,25 @@
#!/bin/bash
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
set -eo pipefail
./buildconf
diff --git a/scripts/updatemanpages.pl b/scripts/updatemanpages.pl
index e144bad11..21a7df174 100755
--- a/scripts/updatemanpages.pl
+++ b/scripts/updatemanpages.pl
@@ -6,7 +6,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms