Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2013-01-21 07:55:55 +0400
committerChristopher Faylor <me@cgf.cx>2013-01-21 07:55:55 +0400
commiteb0876b22f1ea035959416cb1780236df011222a (patch)
tree9a3e65bdc64fcf145893927df8696036ee3ff406
parent0413f0bd404d61e8a7807f356346b2c522d81dd9 (diff)
* update-copyright: Silently skip nonexistent files. Display filename on
update. Don't update non-Red Hat copyrights.
-rw-r--r--winsup/cygwin/ChangeLog5
-rwxr-xr-xwinsup/cygwin/update-copyright25
2 files changed, 22 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e61c45108..5ababd9bc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2013-01-20 Christopher Faylor <me.cygwin2013@cgf.cx>
+ * update-copyright: Silently skip nonexistent files. Display filename
+ on update. Don't update non-Red Hat copyrights.
+
+2013-01-20 Christopher Faylor <me.cygwin2013@cgf.cx>
+
* update-copyright: Update standard copyright information based on cvs
log and current sandbox status.
diff --git a/winsup/cygwin/update-copyright b/winsup/cygwin/update-copyright
index 1ea2a5376..47ab14f32 100755
--- a/winsup/cygwin/update-copyright
+++ b/winsup/cygwin/update-copyright
@@ -21,7 +21,8 @@ while (<$cvs>) {
} elsif (/^date: (\d+)/o) {
$files{$file}{$1} = 1;
} elsif (/^=+$/o) {
- update_maybe($file, %{delete $files{$file}});
+ my $rec = delete $files{$file};
+ update_maybe($file, %{$rec}) if -e $file;
}
}
close $cvs;
@@ -29,8 +30,9 @@ close $cvs;
exit 0;
sub addwrap($$) {
- my $copyright = shift;
my $indent = shift;
+ my $copyright = shift;
+ $copyright =~ s/Red Hat\n/Red Hat, Inc.\n/so;
return $copyright if length($copyright) <= 80;
my @lines;
while (length($copyright) > 80) {
@@ -39,7 +41,7 @@ sub addwrap($$) {
substr($copyright, 0, $i + 1) = $indent;
}
push @lines, $copyright unless $copyright =~ /^\s*$/o;
- return @lines;
+ return join('', @lines);
}
sub update_maybe($%) {
@@ -48,26 +50,33 @@ sub update_maybe($%) {
my %dates = @_;
my @file = ();
my $copyright = '';
- my $modified = 1;
+ my $modified = 0;
while (<>) {
if ($copyright) {
push @file, $_;
} elsif (/^\s*Copyright/o) {
$copyright = $_;
$copyright .= scalar <> while $copyright =~ /,\s*$/o;
+ if ($copyright !~ /Red Hat, Inc\.\n/o) {
+ push @file, $copyright;
+ next;
+ }
for my $date ($copyright =~ /(\d+)/g) {
$dates{$date} = 1;
}
my $indent = ($copyright =~ /\A(\s*)/o)[0];
- $copyright = $indent . 'Copyright ' .
- (join ', ', sort {$a <=> $b} sort keys %dates) .
- " Red Hat\n";
- push @file, addwrap($copyright, $indent);
+ my $newcopyright = addwrap $indent,
+ $indent . 'Copyright ' .
+ (join ', ', sort {$a <=> $b} sort keys %dates) .
+ " Red Hat, Inc.\n";
+ push @file, $newcopyright;
+ $modified = $newcopyright ne $copyright;
} else {
push @file, $_;
}
}
if ($modified) {
+ print "updating $f\n";
my $fcopy = "$f.copyright";
rename $f, $fcopy or die "$0: couldn't rename $f -> $fcopy - $!\n";
my $st = stat($fcopy);