1#!/usr/bin/perl -w 2# 3# Copyright (C) 2017 and later: Unicode, Inc. and others. 4# License & terms of use: http://www.unicode.org/copyright.html 5# 6# *********************************************************************** 7# * COPYRIGHT: 8# * Copyright (c) 2002-2011, International Business Machines Corporation 9# * and others. All Rights Reserved. 10# *********************************************************************** 11# 12# Search for files modified this year, that need to have copyright indicating 13# this current year on them. 14# 15use strict; 16use warnings; 17use Time::localtime; 18use File::stat; 19use File::Find; 20 21# Add script directory to Perl PATH. 22use FindBin qw($Bin); 23use lib $Bin; 24 25use Cpy; 26 27my $icu_src = $ARGV[0] || "."; 28die "Can't open ICU directory: $icu_src" unless -d $icu_src; 29my $year = localtime->year + 1900; 30 31find({ 32 wanted => sub { # $_ is the full path to the file 33 return unless -f; 34 return if (localtime(stat($_)->mtime)->year + 1900) < $year; 35 return if should_ignore($_); 36 # file is recent and shouldn't be ignored. find copyright. 37 38 # if file contains a line with "copyright" and current year on the 39 # same line, we're good. 40 open F, "<$_" or die "Error opening '$_'."; 41 my $result = any { $_ =~ /copyright.*$year/i } <F>; 42 close F; 43 44 print "$_\n" unless $result; 45 }, 46 no_chdir => 1, 47 }, $icu_src); 48