Skip to content

Commit

Permalink
Better handling of end-of-year mirrored commits
Browse files Browse the repository at this point in the history
The rules in the validate weren't coming up with the same
answer as the rules in the update was using so we ended up
in a circular fail.

Change-Id: If851f9a45589633d20292ceb3e39a8618267517e
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/92239
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Feb 25, 2020
1 parent d45a939 commit 4a69880
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/build/tools/addCopyright
Expand Up @@ -65,7 +65,6 @@ use Cwd;
#------------------------------------------------------------------------------
my $ReleaseYear = `date +%Y`;
chomp( $ReleaseYear );
$ReleaseYear = $ENV{'DATE_OVERRIDE'} if defined $ENV{'DATE_OVERRIDE'};

my $copyrightSymbol = "";
# my $copyrightSymbol = "(C)"; # Uncomment if unable to use  character.
Expand Down Expand Up @@ -126,6 +125,7 @@ use constant RC_NO_LICENSE_PROLOG_FILE => 6;
#------------------------------------------------------------------------------
my $opt_help = 0;
my $opt_debug = 0;
my $mirror_mode = 0; #Update is being run inside of a mirror
my $operation = "";
my $opt_logfile = "";

Expand Down Expand Up @@ -165,6 +165,7 @@ GetOptions( "help|?" => \$opt_help,
"copyright-check" => \$copyright_check,
"log-failed-files=s" => \$opt_logfile,
"debug" => \$opt_debug,
"mirror" => \$mirror_mode,
);

## scan through remaining args and store all files in @Files
Expand Down Expand Up @@ -715,7 +716,7 @@ sub createYearString($)
## new files will not have a log, so the "git log" call above will
## return nothing.
## Push any year we find onto the @years array
my $cmd = "git log -- $filename | grep Date: | tail -n 1";
my $cmd = 'git log -n1 -- $filename | grep "Date" ';
## print "run $cmd\n";
my @logstrings = split( " ", `$cmd` );
if ( $? ) { die "ERROR $? : Could not run $cmd $!\n"; }
Expand Down
11 changes: 3 additions & 8 deletions src/build/tools/copyright-check.sh
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2011,2016
# Contributors Listed Below - COPYRIGHT 2011,2020
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -34,18 +34,13 @@ export ADDCOPYRIGHT=${WORKSPACE_DIR}/src/build/tools/addCopyright

## run git show to get a list of checked in files
CHECKINFILES=`git show --pretty=format: --name-only -n1 | tr '\n' ' '`
## use git log to determine the year of the commit.
## Since commits have their copyright updated at the time they are
## committed, a commit might have a copyright date in its prolog of
## last year. Set the DATE_OVERRIDE variable to the 'validate' to allow
## slightly-old prologs (ie. ones corresponding to the date in the msg).
export DATE_OVERRIDE=`git log -n1 --date=short | grep "Date" | sed "s/Date: *//" | sed "s/-.*//"`

echo "========================================================================"

echo " Checking Copyright blocks for checked-in files:"
echo " Checking Copyright blocks for checked-in files (with $ADDCOPYRIGHT):"
echo " $CHECKINFILES"
echo
echo $ADDCOPYRIGHT validate $CHECKINFILES --copyright-check
$ADDCOPYRIGHT validate $CHECKINFILES --copyright-check

if [ $? -eq 0 ]; then
Expand Down

0 comments on commit 4a69880

Please sign in to comment.