From 9f711d4598276410eab008ec1072e8f69e118b1e Mon Sep 17 00:00:00 2001 From: ehaupt Date: Wed, 24 Apr 2013 16:54:22 +0000 Subject: - Rework 'nice people' handling - Properly handle non-default $MCom RCS strings --- Tools/scripts/convert-makefile-header.pl | 80 +++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 16 deletions(-) (limited to 'Tools') diff --git a/Tools/scripts/convert-makefile-header.pl b/Tools/scripts/convert-makefile-header.pl index a5d9945558cf..50aca705f2eb 100755 --- a/Tools/scripts/convert-makefile-header.pl +++ b/Tools/scripts/convert-makefile-header.pl @@ -28,7 +28,51 @@ Usage: $bn [OPTION] PORT _ENOUSAGE } -my $nicepeople="((\\s|<|^)(araujo|az|avilla|bapt|bdrewery|beat|brooks|crees|eadler|flo|flz|garga|kuriyama|linimon|makc|rm|tabthorpe|wxs)\@freebsd.org|cvs-src\@yandex\.ru|makc\@issp\.ac\.ru|villa\.alberto@|pgollucci\@p6m7g8\.com|bsdkaffee@|baptiste\.daroussin\@gmail.com)"; +# You may add yourself to the following list if you agree to waive on the +# "Created by" attribution +sub get_nice_people() { + my $committers=[ + 'araujo', + 'az', + 'avilla', + 'bapt', + 'bdrewery', + 'beat', + 'brooks', + 'crees', + 'ehaupt', + 'eadler', + 'flo', + 'flz', + 'garga', + 'kuriyama', + 'linimon', + 'makc', + 'rm', + 'tabthorpe', + 'wxs' + ]; + + # append FreeBSD.org domain to the list of committers + map ($_ .= '\@FreeBSD\.org', @$committers); + + my $maintainers=[ + 'cvs-src\@yandex\.ru', + 'makc\@issp\.ac\.ru', + 'villa\.alberto\@', + 'pgollucci\@p6m7g8\.com', + 'bsdkaffee\@', + 'baptiste\.daroussin\@gmail\.com' + ]; + + # merge committer and maintainer addresses + my @nice_people=(@$committers, @$maintainers); + + # prepend regex + map ($_ = '(\\s|<|^)' . $_, @nice_people); + + return \@nice_people; +} sub get_creator($) { my $header=shift; @@ -43,20 +87,10 @@ sub get_creator($) { return $creator; } -sub get_mcom($) { - my $header=shift; - my $mcom; - for my $line (@$header) { - if ($line=~m'\$MCom:'i) { - return $line; - } - } - return ""; -} - MAIN: { # get options my $opt={}; + my $nice_people=get_nice_people(); GetOptions($opt, 'help|h', 'rcsonly|r', 'createdby|c', 'nowrite|n'); if(defined($opt->{help})) { @@ -71,6 +105,7 @@ MAIN: { for my $arg (@ARGV) { my @header; my @makefile; + my @header_exception; my $in_header=1; if(-f "$arg/Makefile") { my $mf=$arg . "/Makefile"; @@ -83,6 +118,11 @@ MAIN: { $in_header=0; push(@makefile, $line); } + + # tolerate $MCom RCS tags + if($line=~m'\$MCom') { + push(@header_exception, $line); + } } close(F); @@ -99,16 +139,24 @@ MAIN: { print $outh "# \$FreeBSD\$\n"; } elsif(defined($opt->{createdby}) || !defined($opt->{rcsonly})) { my $creator=get_creator(\@header); - my $mcom=get_mcom(\@header); if(defined($creator)) { - if ($creator!~m"$nicepeople"i) { - print $outh "# Created by: $creator\n"; + my $is_nice=0; + for my $c (@$nice_people) { + if($creator=~m"${c}") { + $is_nice=1; + last; + } } + print $outh "# Created by: $creator\n" if(!$is_nice); } else { print STDERR "$mf creator not found. Reverting to RCS string only.\n"; } print $outh "# \$FreeBSD\$\n"; - print $outh $mcom; + + # append header exceptions + for my $h (@header_exception) { + print $outh $h . "\n"; + } } for my $line (@makefile) { -- cgit