[openssl-commits] [openssl] master update
Rich Salz
rsalz at openssl.org
Wed Apr 20 18:47:29 UTC 2016
The branch master has been updated
via c2f312f5c2379e1dcb6b3678bda27f7544508ee6 (commit)
from 9bf6eff7fe756d06af42f74c3eb1d9d08b544681 (commit)
- Log -----------------------------------------------------------------
commit c2f312f5c2379e1dcb6b3678bda27f7544508ee6
Author: Rich Salz <rsalz at openssl.org>
Date: Tue Apr 19 22:25:27 2016 -0400
Copyright consolidation script
With Richard Levitte.
Reviewed-by: Richard Levitte <levitte at openssl.org>
-----------------------------------------------------------------------
Summary of changes:
util/copyright.pl | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 util/copyright.pl
diff --git a/util/copyright.pl b/util/copyright.pl
new file mode 100644
index 0000000..bdaa9c1
--- /dev/null
+++ b/util/copyright.pl
@@ -0,0 +1,72 @@
+#! /usr/bin/env perl
+# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License"). You may not use
+# this file except in compliance with the License. You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
+# Add new copyright and delete old ones. Used as
+# find . -name '*.[ch]' -type f -exec perl -i.bak util/copyright.pl '{}' ';'
+# This does not do everything that's needed for the consolidation.
+
+use strict;
+use warnings;
+
+# Read a multi-line comments. If it matches a "fingerprint" of a legacy
+# copyright block, then just delete it.
+sub check_comment()
+{
+ my @lines = ( @_ );
+ my $skipit = 0;
+
+ if ($lines[$#lines] !~ m@\*/@) {
+ while ( <> ) {
+ push @lines, $_;
+ last if m@\*/@;
+ $skipit = 1 if /Copyright remains Eric Young's/i;
+ $skipit = 1 if /Copyright.*The OpenSSL Project/i;
+ $skipit = 1 if /Written by.*for the OpenSSL Project/i;
+ }
+ }
+
+ print @lines unless $skipit;
+}
+
+# Look for leading copyright blocks and process (print/swallow) them.
+while ( <> ) {
+ if ($. == 1) {
+ my $DATE;
+ # Look for special copyright EAY line at line one.
+ if ( /Copyright.*(199.)-.*Eric Young/ ) {
+ $DATE = $1;
+ } else {
+ # Nope, use when it first existed in git.
+ $DATE=`git log '--pretty=format:%cI' $ARGV | tail -1`;
+ $DATE =~ s/-.*//;
+ }
+ my $YEAR = $DATE ? $DATE : 1995;
+ my $SPAN = $YEAR == 2016 ? "2016" : "${YEAR}-2016";
+ print <<EOF;
+/*
+ * Copyright ${SPAN} The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+EOF
+ }
+ next if m@^$@;
+ last if not m@/\*@;
+ &check_comment($_);
+}
+
+if (defined($_)) {
+ print unless m@\*/@;
+
+ # Print rest of file.
+ print while ( <> );
+}
More information about the openssl-commits
mailing list