summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2014-06-30 14:50:47 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-06-30 16:47:00 -0500
commit682fbef52aa03bf5920ecc422b9bdb4546f31143 (patch)
tree8199648f50e6a1d61cdef2d5a4946188b61d76a5 /src/build
parent1f0b6df3fbd916b38d81294db4ed37c45920a63e (diff)
downloadtalos-hostboot-682fbef52aa03bf5920ecc422b9bdb4546f31143.tar.gz
talos-hostboot-682fbef52aa03bf5920ecc422b9bdb4546f31143.zip
Fix bugs in copyright prolog script
Add exists check to if statment Made sure current commiter is added to changes Change-Id: I1fa6f85827598cf2c755d1ded4610997ee8847c7 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11890 Reviewed-by: Brian Silver <bsilver@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/tools/addCopyright.pl27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/build/tools/addCopyright.pl b/src/build/tools/addCopyright.pl
index a49683cc9..2d42b379c 100755
--- a/src/build/tools/addCopyright.pl
+++ b/src/build/tools/addCopyright.pl
@@ -690,8 +690,17 @@ sub checkCopyrightBlock( $$ )
{
# remove everything through [+]
$_ =~ s/[^\]]*\]//;
- # remove trailing comment string */
- $_ =~ s/\*\///;
+ # remove closing comment string depening on language
+ if ( filetype($filename) eq "C")
+ {
+ # remove */
+ $_ =~ s/\*\///;
+ }
+ elsif ( filetype($filename) eq "xml" )
+ {
+ # remove -->
+ $_ =~ s/\-\-\>//;
+ }
# remove trailing and leading whitespace
$_ =~ s/^\s+|\s+$//g;
# add contributor to hash
@@ -702,8 +711,10 @@ sub checkCopyrightBlock( $$ )
# Get file contributors from git log
my %fileContributors = getFileContributors( $filename );
- # Make sure no extra or missing contributors
- if ( (keys %fileContributors) != (keys %blockFileContributors) )
+ # Make sure no extra or missing contributors by checking if the current
+ # contributor block matches the git log history
+ if ( (scalar keys %fileContributors) !=
+ (scalar keys %blockFileContributors) )
{
print STDOUT "WARNING: Extra or missing file contributors\n";
return RC_BAD_CONTRIBUTORS_BLOCK;
@@ -713,7 +724,7 @@ sub checkCopyrightBlock( $$ )
while ( my ($key, $value) = each(%fileContributors) )
{
# Block does not match file contributors
- if ( $blockFileContributors{$key} != 1)
+ if ( !exists($blockFileContributors{$key}) )
{
print STDOUT "WARNING: File contributors section not correct\n";
return RC_BAD_CONTRIBUTORS_BLOCK;
@@ -1205,6 +1216,12 @@ sub getFileContributors( $ )
# Check file for all contributors
my @gitAuthors = `git log --pretty="%aN <%aE>" -- $filename | sort | uniq`;
+ # Add current commiter, add < > around the email to follow the same format
+ # as the above array
+ my $curAuthorEmail = `git config user.email`;
+ chomp($curAuthorEmail);
+ my $curGitAuthor = "<".$curAuthorEmail.">";
+ push(@gitAuthors, $curGitAuthor);
foreach my $contributor (@gitAuthors)
{
my $companyExists = 0;
OpenPOWER on IntegriCloud