]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check copyright lines against log
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 28 Mar 2005 23:05:37 +0000 (23:05 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 28 Mar 2005 23:05:37 +0000 (23:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@10268 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/common/scripts/copyright.pl [new file with mode: 0644]

diff --git a/deal.II/common/scripts/copyright.pl b/deal.II/common/scripts/copyright.pl
new file mode 100644 (file)
index 0000000..b01d1ec
--- /dev/null
@@ -0,0 +1,62 @@
+######################################################################
+# $Id$
+#
+# Copyright
+#
+######################################################################
+# Check the copyright line of a file against cvs log
+#
+# Call: perl copyright.pl <filename>
+######################################################################
+
+use strict;
+
+my $file = $ARGV[0];
+
+print "# $file\n";
+
+my @log = `cvs log $file`;
+my %years;
+
+foreach (@log)
+{
+    next unless (m/^date: (\d\d\d\d)/);
+    my $year = $1;
+    $years{$year} = 1;
+}
+
+my $copystring;
+
+foreach (sort keys %years)
+{
+    if ($copystring)
+    {
+       $copystring .= ", $_";
+    } else {
+       $copystring = "$_";
+    }
+}
+
+my $copyreg = "Copyright \\(C\\) $copystring by the deal.II authors";
+$copystring = "Copyright (C) $copystring by the deal.II authors";
+
+my $found = 0;
+my $ok = 0;
+
+while(<>)
+{
+    next unless (m/(Copyright.*)/);
+    my $copyfile = $1;
+    $found = 1;
+    if (m/$copyreg/)
+    {
+       $ok = 1;
+    } else { 
+       print "perl -pi~ -e 's/$copyfile/$copystring/;' $file\n";
+    }
+}
+
+print "# OK: $copystring\n" if ($ok);
+
+print "# no copyright found\n" unless ($found);
+

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.