summaryrefslogtreecommitdiffstats
path: root/sbe
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2016-08-10 09:26:17 -0500
committerStephen M. Cprek <smcprek@us.ibm.com>2016-08-15 12:03:10 -0400
commit76a765b837148c21701f4358250ac6af5f444463 (patch)
tree2b5ef8ebef2fb1a138b1f075c716160f0d722e0c /sbe
parent422a358cbe5ed82c4c0a1a8e5158d94549a532fa (diff)
downloadtalos-sbe-76a765b837148c21701f4358250ac6af5f444463.tar.gz
talos-sbe-76a765b837148c21701f4358250ac6af5f444463.zip
Enable the import tree to have PPE prologs
Removed suffix from addCopyright script Made several other copyright fixes that other teams have made Change-Id: Id5abfaf2f38672e5dc7c7cfea410f0543c0f9b24 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28103 Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'sbe')
-rwxr-xr-xsbe/build/citest/copyright-check.sh4
-rwxr-xr-xsbe/build/tools/hooks/addCopyright (renamed from sbe/build/tools/hooks/addCopyright.pl)101
-rwxr-xr-xsbe/build/tools/hooks/pre-commit18
-rwxr-xr-xsbe/build/tools/hooks/pre-commit-actions2
-rwxr-xr-xsbe/build/tools/hooks/pre-commit-prologs2
-rwxr-xr-xsbe/build/tools/hooks/verify-commit2
6 files changed, 36 insertions, 93 deletions
diff --git a/sbe/build/citest/copyright-check.sh b/sbe/build/citest/copyright-check.sh
index 6df7dd55..c565beff 100755
--- a/sbe/build/citest/copyright-check.sh
+++ b/sbe/build/citest/copyright-check.sh
@@ -25,12 +25,12 @@
# IBM_PROLOG_END_TAG
#
-# Front end to addCopyright.pl - script to check for copyright block during
+# Front end to addCopyright - script to check for copyright block during
# Gerrit checkin.
#
export WORKSPACE_DIR=`pwd`
-export ADDCOPYRIGHT=${WORKSPACE_DIR}/sbe/build/tools/hooks/addCopyright.pl
+export ADDCOPYRIGHT=${WORKSPACE_DIR}/sbe/build/tools/hooks/addCopyright
## run git show to get a list of checked in files
CHECKINFILES=`git show --pretty=format: --name-only -n1 | tr '\n' ' '`
diff --git a/sbe/build/tools/hooks/addCopyright.pl b/sbe/build/tools/hooks/addCopyright
index c72198d7..4cc6e33a 100755
--- a/sbe/build/tools/hooks/addCopyright.pl
+++ b/sbe/build/tools/hooks/addCopyright
@@ -28,7 +28,7 @@
# Author: Mark Jerde (mjerde@us.ibm.com) #
# Date: Fri Mar 19 17:40:32 2010 UTC #
# #
-# addCopyright.pl will automatically insert appropriate copyright statements #
+# addCopyright will automatically insert appropriate copyright statements #
# in source files following the IBM copyright guidelines (and templates) #
# referenced below : #
# FSP ClearCase Architecture #
@@ -45,8 +45,8 @@
# make clean # remove autogenerated files #
# find src -path 'src/build' -prune -o ! -type d -print | tr '\n' ' ' #
# #
-# addCopyright.pl does not support piping, but you can send these #
-# to a file, add "addCopyright.pl update" to the beginning of the line, #
+# addCopyright does not support piping, but you can send these #
+# to a file, add "addCopyright update" to the beginning of the line, #
# and run the file to update all #
###############################################################################
@@ -236,7 +236,7 @@ foreach ( @Files )
##
## Special case is this file, just return 0 and add copyright manually.
##
- if ( m/addCopyright\.pl/ )
+ if ( m/addCopyright/ )
{
print STDOUT "---------------------------------------------------------\n";
print STDOUT "Skipping special case file: $_\n";
@@ -283,18 +283,6 @@ foreach ( @Files )
}
##
- ## We do not want to modify the prologs of files mirrored from EKB
- ## Eventually we will enhance to allow different prologs, but at the time
- ## this breaks the mirror tool.
- if (m/^import/)
- {
- print STDOUT "---------------------------------------------------------\n";
- print STDOUT "Skipping file mirrored from EKB: $_\n";
- print STDOUT "---------------------------------------------------------\n";
- next;
- }
-
- ##
## Check if any parent directory below $projectRoot has a LICENSE_PROLOG file
## Backtrack from the directory where the file lives and find the first
## custom LICENSE_PROLOG file.
@@ -314,13 +302,6 @@ foreach ( @Files )
}
} while ($path ne $projectRoot);
- ## extract the existing copyright block
- # Check if file from EKB in import tree
- if (mirrored_file($_))
- {
- # Remove copyright prefix as EKB does not have it
- $copyrightStr =~ s/$copyrightPrefix//;
- }
$CopyrightBlock = extractCopyrightBlock( $_ );
##
@@ -381,7 +362,7 @@ if ( $opt_logfile ne "" )
#######################################
sub usage
{
- print STDOUT "Usage: addCopyright.pl { update | validate } \n";
+ print STDOUT "Usage: addCopyright { update | validate } \n";
print STDOUT " [ --log-failed-files ]\n";
print STDOUT " [ --debug ] \n";
print STDOUT " file1 file2 ...\n";
@@ -389,43 +370,6 @@ sub usage
}
#######################################
-## checks if file was mirrored from EKB
-## param[in] $filename to check
-## returns 1 mirrored from EKB
-#######################################
-sub mirrored_file
-{
- my $filename = shift;
-
- if ($filename =~ m/^$importPrefix/)
- {
- # Import tree expects to have EKB in the prolog
- $projectName = "EKB";
- return 1;
- }
- return 0;
-}
-
-#######################################
-## Converts mirrored filename to match its original in EKB
-## Mirroring prefixes the name with the import tree.
-## param[in] $filename to check
-## returns new $filename with prefix removed
-#######################################
-sub convert_mirror_file
-{
- my $filename = shift;
-
- if (mirrored_file($filename))
- {
- # Remove $importPrefix as EKB does not have it
- $filename =~ s/^$importPrefix//;
- }
-
- return $filename
-}
-
-#######################################
## validate the file
## param[in] $filename to validate
## returns 0 success, nonzero failure
@@ -442,8 +386,7 @@ sub validate
return RC_NO_COPYRIGHT_BLOCK;
}
- my $converted_file = convert_mirror_file($filename);
- $rc = checkCopyrightBlock( $CopyrightBlock, $converted_file);
+ $rc = checkCopyrightBlock( $CopyrightBlock, $filename);
# good file
return $rc;
@@ -687,7 +630,7 @@ sub checkCopyrightBlock
close($licenseHndl);
print STDOUT "\nERROR> Prolog not correct for $filename.\n";
- print STDOUT "To fix run: git show --pretty=\"format:\" --name-only | xargs addCopyright.pl update\n";
+ print STDOUT "To fix run: git show --pretty=\"format:\" --name-only | xargs addCopyright update\n";
print STDOUT "\nDiff:\n";
print STDOUT `diff $blockFile $licenseFile`;
my $relLicensePath = $LicenseFile;
@@ -1094,8 +1037,7 @@ sub fillinEmptyCopyrightBlock
my $copyrightYear = createYearString( $filename );
## define the final copyright block template here.
- my $converted_file = convert_mirror_file($filename);
- my $IBMCopyrightBlock = genCopyrightBlock($converted_file,$filetype);
+ my $IBMCopyrightBlock = genCopyrightBlock($filename,$filetype);
## Modify file in place with temp file Perl Cookbook 7.8
my $savedbgfile = "$filename.fillin";
@@ -1159,23 +1101,26 @@ sub getFileContributors
my $gitAuthors = `git log --follow --find-copies-harder -C85% -M85% --pretty="%aN <%aE>" -- $filename | sort | uniq`;
my @gitAuthors = split('\n', $gitAuthors);
- # Add current commiter.
- # If running copyright_check run 'git log' as a commit is not taking place
- # Otherwise check using 'git config' as this is a pre-commit hook
- my $curAuthorEmail = "";
- if ($copyright_check)
+ # Get commit's author
+ # # If running copyright_check run 'git log' as a commit is not taking place
+ # # Else we currently have no way of getting the current author. Because
+ # # this is a pre-commit hook, the commit staged to be committed does not
+ # # show up in 'git log' until commit has completed. We cannot look up
+ # # current user's info because the user pushing the commit may not be
+ # # the author.
+
+ if($copyright_check)
{
- $curAuthorEmail = `git log -n1 --pretty=format:"%aN <%aE>"`;
+ my $curAuthorEmail = `git log -n1 --pretty=format:"%aN <%aE>"`;
chomp($curAuthorEmail);
+ push(@gitAuthors, $curAuthorEmail);
}
- else
+ # Internal mirror, add IBM as contributor
+ elsif (defined $ENV{'MIRROR'})
{
- my $curAuthorName = `git config user.name`;
- $curAuthorEmail = `git config user.email`;
- chomp($curAuthorEmail);
- $curAuthorEmail = "$curAuthorName <".$curAuthorEmail.">";
+ push(@gitAuthors, "\@ibm.com>");
}
- push(@gitAuthors, $curAuthorEmail);
+
foreach my $contributor (@gitAuthors)
{
my $companyExists = 0;
diff --git a/sbe/build/tools/hooks/pre-commit b/sbe/build/tools/hooks/pre-commit
index 324cd3c1..9cdc7b7c 100755
--- a/sbe/build/tools/hooks/pre-commit
+++ b/sbe/build/tools/hooks/pre-commit
@@ -28,14 +28,12 @@
# maintained same as that of Hoostboot except for minor changes to
# suit the PPE environment.
-if [ -z $MIRROR ]; then
- if [ -f $TOOLSDIR/pre-commit-actions ]; then
- $TOOLSDIR/pre-commit-actions
- # Legacy support for older releases
- elif [ -f $TOOLSDIR/pre-commit-prologs ]; then
- $TOOLSDIR/pre-commit-prologs
- else
- echo "Missing pre-commit files"
- exit -1
- fi
+if [ -f $TOOLSDIR/pre-commit-actions ]; then
+ $TOOLSDIR/pre-commit-actions
+# Legacy support for older releases
+elif [ -f $TOOLSDIR/pre-commit-prologs ]; then
+ $TOOLSDIR/pre-commit-prologs
+else
+ echo "Missing pre-commit files"
+ exit -1
fi
diff --git a/sbe/build/tools/hooks/pre-commit-actions b/sbe/build/tools/hooks/pre-commit-actions
index 348b0d0b..3e941ad9 100755
--- a/sbe/build/tools/hooks/pre-commit-actions
+++ b/sbe/build/tools/hooks/pre-commit-actions
@@ -26,7 +26,7 @@
# This hook is used to add or update copyright prolog statements and run
# the code beautifier astyle.
-my $copyrightScript = "addCopyright.pl";
+my $copyrightScript = "addCopyright";
## Make up a list of all staged files ( --cached --name-only )
## Filter for only Added or Modified ( --diff-filter=AM )
diff --git a/sbe/build/tools/hooks/pre-commit-prologs b/sbe/build/tools/hooks/pre-commit-prologs
index 95ae1874..2dc19f41 100755
--- a/sbe/build/tools/hooks/pre-commit-prologs
+++ b/sbe/build/tools/hooks/pre-commit-prologs
@@ -25,7 +25,7 @@
# IBM_PROLOG_END_TAG
# This hook is used to add or update copyright prolog statements
-my $script = "addCopyright.pl";
+my $script = "addCopyright";
## Make up a list of all staged files ( --cached --name-only )
## Filter for only Added or Modified ( --diff-filter=AM )
diff --git a/sbe/build/tools/hooks/verify-commit b/sbe/build/tools/hooks/verify-commit
index c29ba9ac..97226453 100755
--- a/sbe/build/tools/hooks/verify-commit
+++ b/sbe/build/tools/hooks/verify-commit
@@ -193,7 +193,7 @@ sub verifyFileLine
if ($line =~ m/Confidential/i && $projectName =~ m/HostBoot/i && !$mirror)
{
unless (($file =~ m/verify-commit/) ||
- ($file =~ m/addCopyright.pl/))
+ ($file =~ m/addCopyright/))
{
error($file,$line,$count,
"File contains 'Confidential'.");
OpenPOWER on IntegriCloud