diff options
author | ehaupt <ehaupt@FreeBSD.org> | 2013-04-25 00:54:22 +0800 |
---|---|---|
committer | ehaupt <ehaupt@FreeBSD.org> | 2013-04-25 00:54:22 +0800 |
commit | 9f711d4598276410eab008ec1072e8f69e118b1e (patch) | |
tree | 6758160fd3d0799b50229d9ebe208192e627d442 /Tools | |
parent | 43216f34a67c2d137f86efbfbf23b0bb5c9b9294 (diff) | |
download | freebsd-ports-graphics-9f711d4598276410eab008ec1072e8f69e118b1e.tar.gz freebsd-ports-graphics-9f711d4598276410eab008ec1072e8f69e118b1e.tar.zst freebsd-ports-graphics-9f711d4598276410eab008ec1072e8f69e118b1e.zip |
- Rework 'nice people' handling
- Properly handle non-default $MCom RCS strings
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/convert-makefile-header.pl | 80 |
1 files changed, 64 insertions, 16 deletions
diff --git a/Tools/scripts/convert-makefile-header.pl b/Tools/scripts/convert-makefile-header.pl index a5d9945558c..50aca705f2e 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) { |