summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorSangeetha T S <sangeet2@in.ibm.com>2016-09-30 07:50:19 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-10-03 06:08:05 -0400
commitf7da280498b9600185a47316ffbb59bea7e114c0 (patch)
tree477597548397b4182fac1c86375e374bc0af9b6f /src/tools
parent369312ea11f291f4f61a29d5a2dd03b163dba5cf (diff)
downloadtalos-sbe-f7da280498b9600185a47316ffbb59bea7e114c0.tar.gz
talos-sbe-f7da280498b9600185a47316ffbb59bea7e114c0.zip
Generate file containing commit authors (for FSP CI)
Change-Id: I9965bf1e440af1f2e3cb4012fc2da2aac063f66e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30598 Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/tools')
-rwxr-xr-xsrc/tools/utils/sbeGitTool.pl60
1 files changed, 38 insertions, 22 deletions
diff --git a/src/tools/utils/sbeGitTool.pl b/src/tools/utils/sbeGitTool.pl
index 649434fe..44c755af 100755
--- a/src/tools/utils/sbeGitTool.pl
+++ b/src/tools/utils/sbeGitTool.pl
@@ -44,6 +44,7 @@ my $sbname = "";
my $sbrc = "";
my $release = "";
my $bbuild = "";
+my $authorFile = "git_author_emails.csv";
# We do not want hooks to run in this tool
$ENV{MIRROR} = 1;
@@ -212,19 +213,6 @@ sub execute_get_commits
# Set CI environemnt
git_ci_init($release);
- # Obtain the list of patches
-# retrivePatchList();
-
- # Fetch the commits for the patches
-# fetchCommits();
-
- # Prepare commit string
-# my $commitStr = prepareCommitStr();
-
-# print "The set of commits: $commitStr" if $debug;
-# print $commitStr;
-# return $commitStr;
-
# Use gitRelease tool to discover all associated commits
chdir $globals{tool_path};
print `./src/tools/utils/gitRelease.pl gerrit-commit --patches $patches --branch $globals{branch}`;
@@ -244,15 +232,6 @@ sub execute_extract
# Set CI environment
git_ci_init();
- # Obtain the list of patches
-# retrivePatchList();
-
- # Fetch the references for the patches
-# fetchRefs();
-
- # Apply the patches on the GIT repo
-# applyRefs();
-
print "Extracting Code for $globals{sandbox}\n";
system("./src/tools/utils/gitRelease.pl fsp-ci --level $sbname --patches $patches --branch $globals{branch} --basestr \"gerrit/$globals{branch}\" --bbuild-Rel $globals{Build_Rel}");
die "sbeRelease tool failed\n" if($?);
@@ -322,6 +301,10 @@ sub git_ci_init
print "\nConverted release:\n" if $debug;
print " Release=$release -> branch=$globals{branch}\n\n" if $debug;
die "Gerrit branch missing" if $globals{branch} eq "";
+
+ # Create commit author file
+ create_author_file($patches);
+
}
# sub parse_release_notes
@@ -373,6 +356,39 @@ sub release_to_branch
chomp($globals{branch});
}
+# sub create_author_file
+#
+# Get patches from gerrit and create a CSV file with author emails
+# for FSP-CI notification purposes.
+#
+# @param[in] patches - List of patches to determine authors of
+#
+sub create_author_file
+{
+ my ($patches) = @_;
+
+ # Get commits via gitRelease.pl tool
+ my $commitsCSV = `./src/tools/utils/gitRelease.pl gerrit-commit --patches $patches --branch $globals{branch}`;
+ chomp($commitsCSV);
+ my @commits = split(',',$commitsCSV);
+ print Dumper \@commits if $debug;
+
+ # Write author email to file
+ system("mkdir -p $globals{sandbox}/logs");
+ my $file = $globals{sandbox}."/logs/".$authorFile;
+ print "Creating CSV author file - $file\n" if $debug;
+ open(FILE, ">", $file) or die("Cannot open: $file: $!");
+ foreach my $commit (@commits)
+ {
+ my $email = `git log -n1 --pretty="%ae" $commit`;
+ chomp ($email);
+ print FILE $email;
+ print FILE "," if ($commit != $commits[-1]);
+ }
+ system("chmod 755 $file");
+ close FILE;
+}
+
# sub compileAndCopy
#
# utility that builds and copies the SBE image.
OpenPOWER on IntegriCloud