support multiple copyright messages, in particular the joint

NAI/ISC one; update_copyrights no longer takes the name of the copyright
message file as a command line argument
This commit is contained in:
Andreas Gustafsson
2000-06-09 19:32:32 +00:00
parent b90f80957a
commit 5a6e6c2c9b
3 changed files with 47 additions and 20 deletions

View File

@@ -1,3 +1,5 @@
Copyright (C) @YEARS@ Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

View File

@@ -1,4 +1,4 @@
Portions Copyright (C) 1999, 2000 Internet Software Consortium.
Portions Copyright (C) @YEARS@ Internet Software Consortium.
Portions Copyright (C) 1995-2000 by Network Associates, Inc.
Permission to use, copy, modify, and distribute this software for any

View File

@@ -15,16 +15,32 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
if (@ARGV == 0) {
die "usage: update_copyrights <copyright_text>";
require 5.002;
# Map copyright owners to the files containing copyright messages.
# The first line of the copyright message is not in the file;
# it is constructed by this script.
my %owner2filename = (
"" => "util/COPYRIGHT",
"NAI" => "util/COPYRIGHT.NAI"
);
# Map each copyright owner name to a reference to an array containing
# the lines of the copyright message.
my %owner2text = ();
foreach $owner (keys %owner2filename) {
my $f = $owner2filename{$owner};
open(COPYRIGHT, "<$f") || die "can't open $f: $!";
@copyright_text = <COPYRIGHT>;
close(COPYRIGHT);
$owner2text{$owner} = [ @copyright_text ];
}
@copyright_text = ();
open(COPYRIGHT, "<$ARGV[0]") || die "can't open $ARGV[0]: $!";
@copyright_text = <>;
close(COPYRIGHT);
while (<>) {
($file, $type, $years_list) = split(/\s+/);
($file, $typeandowner, $years_list) = split(/\s+/);
@years = split(/,/, $years_list);
if ( ! -f $file ) {
@@ -32,15 +48,18 @@ while (<>) {
next;
}
next if $type eq "X";
my ($type, $owner) = split(/\./, $typeandowner);
$owner = "" if !defined $owner;
if ($type =~ /\.NAI$/) {
# XXX Not handled yet; co-copyrighted with Network Associates.
# lib/isc/commandline.c should probably also have special handling.
print "$file: co-copyrighted with Network Associates; ",
"update manually\n";
$textp = $owner2text{$owner};
if (!defined $textp) {
print "$file: unknown copyright owner $owner\n";
next;
}
next if $type eq "X";
# XXXTALE lib/isc/commandline.c should probably also have special handling.
$before_copyright = "";
$c_comment = 0;
@@ -121,18 +140,24 @@ while (<>) {
if ($c_comment) {
print TARGET "/*\n";
}
print TARGET "${prefix}Copyright (C) ";
$years = "";
$first_year = 1;
foreach $year (@years) {
if (! $first_year) {
print TARGET ", ";
$years .= ", ";
}
print TARGET "$year";
$years .= "$year";
$first_year = 0;
}
print TARGET " Internet Software Consortium.\n";
print TARGET "$prefix\n";
foreach $_ (@copyright_text) {
($firstline, @otherlines) = @$textp;
$firstline =~ s/\@YEARS\@/$years/;
print TARGET "$prefix$firstline";
foreach $_ (@otherlines) {
print TARGET "${prefix}$_";
}
if ($c_comment) {