summaryrefslogtreecommitdiffstats
path: root/sbe/build/tools
diff options
context:
space:
mode:
authorSangeetha T S <sangeet2@in.ibm.com>2016-08-18 02:27:04 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-08-18 05:48:58 -0400
commit509e19ecb1ea7976a0879825924616501a79a89b (patch)
treeae9a90e364a5c438a9a9dcd9160151e25ea56e06 /sbe/build/tools
parent8c609948ae3a6f531507dc2da136fb442e3d7691 (diff)
downloadtalos-sbe-509e19ecb1ea7976a0879825924616501a79a89b.tar.gz
talos-sbe-509e19ecb1ea7976a0879825924616501a79a89b.zip
Fixes to make sure merged commit's CI succeed
Change-Id: I06b0157ad450a7be31714e2f683e0352fd7f4046 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28441 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'sbe/build/tools')
-rw-r--r--sbe/build/tools/perl.modules/gitUtil.pm38
-rwxr-xr-xsbe/build/tools/sbeGitTool.pl13
2 files changed, 46 insertions, 5 deletions
diff --git a/sbe/build/tools/perl.modules/gitUtil.pm b/sbe/build/tools/perl.modules/gitUtil.pm
index d97ae481..603868df 100644
--- a/sbe/build/tools/perl.modules/gitUtil.pm
+++ b/sbe/build/tools/perl.modules/gitUtil.pm
@@ -497,7 +497,7 @@ sub gerritQueryReference
# If all patchsets queried, search all of them for the commit
foreach my $patchset (@{$result->{patchSets}})
{
- if ($patchNumber eq "")
+ if ($patchNumber eq " ")
{
return $patchset->{currentPatchSet}->{ref};
}
@@ -555,3 +555,39 @@ sub gerritQueryCommit
}
die "Cannot find $changeId in $project";
}
+
+# Function : patchMergeStatus
+#
+# @brief : Check if given patch is merged into repository
+#
+# @param[in] changeId : Change id of the patch
+#
+# @return mergeStatus : 1 if merged; else 0
+#
+sub patchMergeStatus
+{
+ my $mergeStatus = 1;
+
+ my $changeId = shift;
+
+ my $project = configProject();
+
+ my $query_result = gerritQuery("$changeId project:$project");
+
+ foreach my $result (@{$query_result})
+ {
+ if ($result->{id} eq $changeId)
+ {
+ if ($result->{status} eq "MERGED" || $result->{status} eq "merged")
+ {
+ $mergeStatus = 1;
+ }
+ else
+ {
+ $mergeStatus = 0;
+ }
+ return $mergeStatus;
+ }
+ }
+ die "Cannot find $changeId in $project";
+}
diff --git a/sbe/build/tools/sbeGitTool.pl b/sbe/build/tools/sbeGitTool.pl
index 6f7a2b26..6e23896e 100755
--- a/sbe/build/tools/sbeGitTool.pl
+++ b/sbe/build/tools/sbeGitTool.pl
@@ -209,23 +209,28 @@ sub retrivePatchList
sub fetchRefs
{
my $currentRef = "";
+ my $validPatchCount = 0;
foreach my $patch (@patchList)
{
my ($changeId,$patchSet) = split(":",$patch);
if (gitUtil::gerritIsPatch($changeId))
{
+ $validPatchCount = $validPatchCount + 1;
print "Fetching reference for the patch : $patch \n" if $debug;
- my $currentRef = gitUtil::gerritQueryReference($changeId, $patchSet);
- push @references, $currentRef;
- print "(patchset -> reference) = $patch -> $currentRef\n" if $debug;
+ if (gitUtil::patchMergeStatus($changeId) == 0)
+ {
+ my $currentRef = gitUtil::gerritQueryReference($changeId, $patchSet);
+ push @references, $currentRef;
+ print "(patchset -> reference) = $patch -> $currentRef\n" if $debug;
+ }
}
else
{
print "\n Warning : Patchset $patch is invalid.. Continuing to check if there is any other valid patch \n";
}
}
- die "ERROR: No valid patches given..\n" if (scalar @references == 0);
+ die "ERROR: No valid patches given..\n" if ($validPatchCount == 0);
}
sub applyRefs
OpenPOWER on IntegriCloud