update_copyrights revision 168cf0ede1cf13a095e48af6749d88fbc432f096
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# Copyright (C) 2004-2010, 2012-2015 Internet Systems Consortium, Inc. ("ISC")
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Copyright (C) 1998-2001 Internet Software Consortium.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Permission to use, copy, modify, and/or distribute this software for any
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# purpose with or without fee is hereby granted, provided that the above
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# copyright notice and this permission notice appear in all copies.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# PERFORMANCE OF THIS SOFTWARE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinrequire 5.002;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Map copyright owners to the files containing copyright messages.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# The first line of the copyright message is not in the file;
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# it is constructed by this script.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Map each copyright owner name to a reference to an array containing
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the lines of the copyright message.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Usermy $keyword_pat = '\$(Id:.*|Revision:.*|Id|Revision)\$';
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User open(COPYRIGHT, "<$f") || die "can't open $f: $!";
af40ebed6257e4ac1996144530b3de317cf4da11Tinderbox User($dummy,$dummy,$dummy,$dummy,$this_month,$this_year,$dummy,$dummy,$dummy) = localtime(time());
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User if (defined($years_list) && $years_list =~ /^PARENT:/) {
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews $parent =~ s/\.[^.]*$/.docbook/;
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $result = "$result <year>$_</year>\n" foreach (@_);
9c6a5d1f22f972232d7a9fd5c5fa64f10bacbdffAutomatic Updater $result = "$result <holder>$holder</holder>\n";
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews my $a = copyright("Internet Systems Consortium, Inc. (\"ISC\")",
9c6a5d1f22f972232d7a9fd5c5fa64f10bacbdffAutomatic Updater my $b = copyright("Internet Software Consortium.",
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # copyright notice is now generated from the source.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein my ($type, $owner) = split(/\./, $typeandowner);
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print "$file: unknown copyright owner $owner\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if ($file eq "./CHANGES" || $file eq "./EXCLUDED" ||
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein open(SOURCE, "<$file") || die "can't open $file: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Remove 1-7 spaces followed by a tab into a single
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein s/^(\s{0,3}\d*\.)\s(\[\w{1,5}\])\s+(\S+)/$1\t$2\t\t$3/;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein s/^(\s{0,3}\d*\.)\s(\[\w{6,}\])\s+(\S+)/$1\t$2\t$3/;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Convert 8 spaces into tabs if at start of line
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein s/[ \t]*$//;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein open(TARGET, ">$file.new") || die "can't open $file.new: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH|RNC)$/) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $start_comment = "############################################################################\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $end_comment = "############################################################################\n"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $start_comment = "############################################################################\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $end_comment = "############################################################################\n"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print "$file: type '$type' not supported yet; skipping\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein open(SOURCE, "<$file") || die "can't open $file: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein last if $_ =~ /\*\//;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein } elsif ($python_comment || $python_bin_comment) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $_ = <SOURCE> if $_ eq "############################################################################\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $_ = <SOURCE> if $_ eq "############################################################################\n";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein } elsif (($m4_comment || $zone_comment || $man_comment) &&
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein while (/^<!DOCTYPE/ || /^<!ENTITY/ || /^<\?xml-stylesheet/ || /^<\?xml /) {
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User last if s/.*-->//;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews last if s/.*--->//;
af40ebed6257e4ac1996144530b3de317cf4da11Tinderbox User # Not very maintainable, but ok enough for now.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User open(TARGET, ">$file.new") || die "can't open $file.new: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print TARGET $before_copyright if $before_copyright;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if ($last_year != 0 && $year == $last_year + 1) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $years .= $last_year == 0 ? "$year" : ", $year";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if ($last_year != 0 && $year == $last_year + 1) {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $years .= $last_year == 0 ? "$year" : ", $year";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein $noid = 1 if ($year > 2012 || ($year == 2012 && $this_month >= 5) );
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if ($last_year != 0 && $year == $last_year + 1) {
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $years .= $last_year == 0 ? "$year" : ", $year";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ($firstline, $secondline, @otherlines) = @$textp;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein s:modify, and distribute:modify, and/or distribute: if ($andor);
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User print TARGET (/^$/ ? $nonspaceprefix : $prefix);
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein # Remove 1-7 spaces followed by a tab into a single
$_ = $body;
$_ = $body;
undef $/;
$_ = <SOURCE>;
s:<articleinfo>.*?</articleinfo>:<articleinfo>\n$r </articleinfo>:s;