update_copyrights revision e2653c8e8437a0af130346b471c337ca3aa8910c
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrence# Copyright (C) 2004-2010, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrence# Copyright (C) 1998-2001 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# Permission to use, copy, modify, and/or distribute this software for any
15a44745412679c30a6d022733925af70a38b715David Lawrence# purpose with or without fee is hereby granted, provided that the above
15a44745412679c30a6d022733925af70a38b715David Lawrence# copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
15a44745412679c30a6d022733925af70a38b715David Lawrence# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15a44745412679c30a6d022733925af70a38b715David Lawrence# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15a44745412679c30a6d022733925af70a38b715David Lawrence# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrence# PERFORMANCE OF THIS SOFTWARE.
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrencerequire 5.002;
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrence# Map copyright owners to the files containing copyright messages.
8f3dd8f8e73e4465221a5297819db70e6b383138Mark Andrews# The first line of the copyright message is not in the file;
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# it is constructed by this script.
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff# Map each copyright owner name to a reference to an array containing
3d776d762914d1b675b4fd49728ce353ccf6f77eBrian Wellington# the lines of the copyright message.
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrencemy $keyword_pat = '\$(Id:.*|Revision:.*|Id|Revision)\$';
91306d962f9d147d94b82fb14edb28f8d907cae7Andreas Gustafsson open(COPYRIGHT, "<$f") || die "can't open $f: $!";
91306d962f9d147d94b82fb14edb28f8d907cae7Andreas Gustafsson $owner2text{$owner} = [ @copyright_text ];
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrence($dummy,$dummy,$dummy,$dummy,$this_month,$this_year,$dummy,$dummy,$dummy) = localtime(time());
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley if (defined($years_list) && $years_list =~ /^PARENT:/) {
8e06cea14c857429ab7e7299af2dce5eeeaa5ff0Michael Graff $parent =~ s/\.[^.]*$/.docbook/;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence $result = "$result <year>$_</year>\n" foreach (@_);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence $result = "$result <holder>$holder</holder>\n";
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence my $a = copyright("Internet Systems Consortium, Inc. (\"ISC\")",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence my $b = copyright("Internet Software Consortium.",
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence # copyright notice is now generated from the source.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence my ($type, $owner) = split(/\./, $typeandowner);
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence print "$file: unknown copyright owner $owner\n";
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence if ($file eq "./CHANGES" || $file eq "./EXCLUDED" ||
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence open(SOURCE, "<$file") || die "can't open $file: $!";
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence # Remove 1-7 spaces followed by a tab into a single
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence # tab if at start of line or proceeded by tabs.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence s/^(\t*) {1,7}\t/$1\t/ while (/^\t* {1,7}\t/);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence s/^(\s{0,3}\d*\.)\s(\[\w{1,5}\])\s+(\S+)/$1\t$2\t\t$3/;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence s/^(\s{0,3}\d*\.)\s(\[\w{6,}\])\s+(\S+)/$1\t$2\t$3/;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence # Convert 8 spaces into tabs if at start of line
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence open(TARGET, ">$file.new") || die "can't open $file.new: $!";
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH|RNC)$/) {
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson $start_comment = "############################################################################\n";
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson $end_comment = "############################################################################\n"
6fcb2f0faad67a6d2cb2e30ec57157d75fbfe58fAndreas Gustafsson } elsif ($type eq "ZONE" || $type eq "MC") {
47fd46791da765e3dbedd987e9b263b3bee25986Brian Wellington } elsif ($type eq "HTML" || $type eq "SGML") {
8f3dd8f8e73e4465221a5297819db70e6b383138Mark Andrews print "$file: type '$type' not supported yet; skipping\n";
754cca729dd82ae8363917dc00ad44f9d900635bMark Andrews open(SOURCE, "<$file") || die "can't open $file: $!";
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson print "$file: unexpected yacc file start ",
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson last if $_ =~ /\*\//;
13faa8b6a2d0d45e0659049983928366252ab3faMichael Graff $_ = <SOURCE> if $_ eq "############################################################################\n";
a0ad323da3597f942881eb2112a82c21450a9d0dBrian Wellington } elsif (($m4_comment || $zone_comment || $man_comment) &&
5989aea4bbe79e09290792f04aeb557e2b2da02eAndreas Gustafsson while (/^<!DOCTYPE/ || /^<\?xml-stylesheet/ || /^<\?xml /) {
5989aea4bbe79e09290792f04aeb557e2b2da02eAndreas Gustafsson $before_copyright = "$before_copyright$_";
5989aea4bbe79e09290792f04aeb557e2b2da02eAndreas Gustafsson $before_copyright = "$before_copyright$_";
08a768e82ad64ede97f640c88e02984b59122753Michael Graff last if s/.*-->//;
fee5012c43744322c1785e5c3e0c322443faa304Brian Wellington last if s/.*--->//;
a14613fce99dee3cad5bf842fd6be78f8e463582Brian Wellington # Not very maintainable, but ok enough for now.
af5ad488cbf17988fbd36a25c908737412ccd382Brian Wellington open(TARGET, ">$file.new") || die "can't open $file.new: $!";
f317c00e0d5978f29285ea062b34ec73dc419095Brian Wellington print TARGET $before_copyright if $before_copyright;
f317c00e0d5978f29285ea062b34ec73dc419095Brian Wellington print TARGET $start_comment if $start_comment;
9a2574531e3d2ced31072200b416467fdee0c29cDavid Lawrence if ($last_year != 0 && $year == $last_year + 1) {
e2b585787f4779f49bd0982562acbbb7d0b65a95Andreas Gustafsson $years .= $last_year == 0 ? "$year" : ", $year";
9d266ed4d7630d8366fea0a4a627d8c3873821c5Brian Wellington if ($last_year != 0 && $year == $last_year + 1) {
e2b585787f4779f49bd0982562acbbb7d0b65a95Andreas Gustafsson $years .= $last_year == 0 ? "$year" : ", $year";
e2b585787f4779f49bd0982562acbbb7d0b65a95Andreas Gustafsson # Internet Systems Consortium: 2004 onwards.
9a2574531e3d2ced31072200b416467fdee0c29cDavid Lawrence $noid = 1 if ($year > 2012 || ($year == 2012 && $this_month >= 5) );
9a2574531e3d2ced31072200b416467fdee0c29cDavid Lawrence if ($last_year != 0 && $year == $last_year + 1) {
9a2574531e3d2ced31072200b416467fdee0c29cDavid Lawrence $years .= $last_year == 0 ? "$year" : ", $year";
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson ($firstline, $secondline, @otherlines) = @$textp;
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson $secondline =~ s/\@SFTYEARS\@/$sftyears/;
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson s:modify, and distribute:modify, and/or distribute: if ($andor);
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson print TARGET (/^$/ ? $nonspaceprefix : $prefix);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson print TARGET $end_comment if $end_comment;
e2b585787f4779f49bd0982562acbbb7d0b65a95Andreas Gustafsson if (($type eq "C" || $type eq "CONF-C") &&
c356cd618dacb13d47ee9bee78d22a9802d4645eBrian Wellington # Remove 1-7 spaces followed by a tab into a single
c356cd618dacb13d47ee9bee78d22a9802d4645eBrian Wellington # tab if at start of line or proceeded by tabs.
c356cd618dacb13d47ee9bee78d22a9802d4645eBrian Wellington s/^(\t*) {1,7}\t/$1\t/ while (/^\t* {1,7}\t/);
c356cd618dacb13d47ee9bee78d22a9802d4645eBrian Wellington # Convert 8 spaces into tabs if at start of line
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence if ($type eq 'SGML' && m:<articleinfo>.*?</articleinfo>:s) {
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson s:<articleinfo>.*?</articleinfo>:<articleinfo>\n$r </articleinfo>:s;
489b76292622f5bc18bf1a18845f8166a73bd797Brian Wellington if ($type eq 'SGML' && m:<docinfo>.*?</docinfo>:s) {
2271edc0b4ba96e69a283eced420b94ffb678beeBrian Wellington s:<docinfo>.*?</docinfo>:<docinfo>\n$r </docinfo>:s;
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson if ($type eq 'SGML' && m:<bookinfo>.*?</bookinfo>:s) {
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson $r .= " <xi:include href=\"releaseinfo.xml\"/>\n";
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson s:<bookinfo>.*?</bookinfo>:<bookinfo>\n$r </bookinfo>:s;
9ceaa92a8ca8a0270ba296d44599e94d95033759Andreas Gustafsson ($end = $end_comment) =~ s/^\s*(.*)\n/ $1\n/;
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson if (!$noid && $first !~ /$keyword_pat/ &&
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson (!defined($_) || $_ !~ /$keyword_pat/)) {
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson $end = "\n$nonspaceprefix" if ($type eq "MAN");
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson print TARGET $first if $first !~ /^\s*$/;
a1884b96ef53efc8b4e14be173aaee552ca0213aAndreas Gustafsson if (system("cmp -s $file.new $file") == 0) {