summaryrefslogtreecommitdiffstats
path: root/src/tools/utils/CommitSbeImageToCMVC.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/utils/CommitSbeImageToCMVC.py')
-rwxr-xr-xsrc/tools/utils/CommitSbeImageToCMVC.py167
1 files changed, 84 insertions, 83 deletions
diff --git a/src/tools/utils/CommitSbeImageToCMVC.py b/src/tools/utils/CommitSbeImageToCMVC.py
index c177e72f..f5394e46 100755
--- a/src/tools/utils/CommitSbeImageToCMVC.py
+++ b/src/tools/utils/CommitSbeImageToCMVC.py
@@ -41,6 +41,7 @@
#-------------------------
# Imports
#-------------------------
+from __future__ import print_function
import getopt
import os, sys, glob
import shutil
@@ -58,37 +59,37 @@ def main():
# Usage tool option
#------------------------------------------
def usage():
- print " ---------------------------------------------------------------------------------------------------"
- print " :: Command line USAGE options for Uploading FW SBE image to CMVC :: \n"
- print " CommitSbeImageToCMVC.py -d <cmvc defect/feature id> -r <fips release> -p <SBE repo Path> -i <file1,file2.file3>"
-
- print " \n"
- print " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- print " | By default user MUST pass CMVC/Release/Path input. |"
- print " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- print " \n ***** Options Supported *****"
- print " \t -d,--defect = Defect CMVC number"
- print " \t -f,--feature = Feature CMVC number"
- print " \t -r,--release = FW fips release string EX: fips910"
- print " \t -p,--path = Absolute path of the SBE repo"
- print " \t -i,--input = [ Optional ] List of image or file to upload"
- print " \t -b,--bvt = BVT xml file for CI"
- print " \t -h,--help = Help"
- print " ------------------------------------------------------------------------------------"
+ print(" ---------------------------------------------------------------------------------------------------")
+ print(" :: Command line USAGE options for Uploading FW SBE image to CMVC :: \n")
+ print(" CommitSbeImageToCMVC.py -d <cmvc defect/feature id> -r <fips release> -p <SBE repo Path> -i <file1,file2.file3>")
+
+ print(" \n")
+ print(" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
+ print(" | By default user MUST pass CMVC/Release/Path input. |")
+ print(" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
+ print(" \n ***** Options Supported *****")
+ print(" \t -d,--defect = Defect CMVC number")
+ print(" \t -f,--feature = Feature CMVC number")
+ print(" \t -r,--release = FW fips release string EX: fips910")
+ print(" \t -p,--path = Absolute path of the SBE repo")
+ print(" \t -i,--input = [ Optional ] List of image or file to upload")
+ print(" \t -b,--bvt = BVT xml file for CI")
+ print(" \t -h,--help = Help")
+ print(" ------------------------------------------------------------------------------------")
#------------------------------------------
# Exit from this Main
#------------------------------------------
def exit_main(rc):
if rc == errorcode.HELP_EXIT:
- print " [ HELP DOCUMENTATION ]\n"
+ print(" [ HELP DOCUMENTATION ]\n")
sys.exit(0)
if rc:
- print "\n [ ERROR - MAIN ] Exiting with error code = ", rc
+ print("\n [ ERROR - MAIN ] Exiting with error code = ", rc)
sys.exit(rc)
else:
- print "\n SBE Image Upload to CMVC completed [ OK ] "
+ print("\n SBE Image Upload to CMVC completed [ OK ] ")
sys.exit(0)
#------------------------------------------
@@ -128,10 +129,10 @@ def main():
#----------------------------------
# Preping the data for Image Upload
#----------------------------------
- print " \n"
- print " ******************************************************"
- print " ****** Stagging PPE image Files Upload to CMVC ******"
- print " ******************************************************"
+ print(" \n")
+ print(" ******************************************************")
+ print(" ****** Stagging PPE image Files Upload to CMVC ******")
+ print(" ******************************************************")
#------------------------------------------------------
# Make sure that it has passed atleast one arg with it
@@ -144,45 +145,45 @@ def main():
# Check user inputs and display
#-------------------------------------------------------------
def input_setting():
- print " ---------------------------------------------------------------------------------"
- print " [ Display User Inputs ]"
- print " ---------------------------------------------------------------------------------"
+ print(" ---------------------------------------------------------------------------------")
+ print(" [ Display User Inputs ]")
+ print(" ---------------------------------------------------------------------------------")
# Look elsewhere for the name instead of assigning to it locally.
# This is now gloabal var
global g_cmvc_num
if ( defect_num != "None" ) or ( feature_num != "None" ):
if not defect_num == "None":
g_cmvc_num = 'D'+defect_num #D1234
- print " [ CMVC Defect ] \t\t#Number\t = %s"%(g_cmvc_num)
+ print(" [ CMVC Defect ] \t\t#Number\t = %s"%(g_cmvc_num))
else:
g_cmvc_num = 'F'+feature_num # F1234
- print " [ CMVC Feature ] \t\t#Number\t = %s"%(g_cmvc_num)
+ print(" [ CMVC Feature ] \t\t#Number\t = %s"%(g_cmvc_num))
else:
- print " [ CMVC Defect/Feature ] Neeed CMVC number. This can't be empty "
+ print(" [ CMVC Defect/Feature ] Neeed CMVC number. This can't be empty ")
exit_main(errorcode.ERROR_EXIT)
if not release_name == "None":
- print " [ Fips Release Name ] \t#String\t = %s"%(release_name)
+ print(" [ Fips Release Name ] \t#String\t = %s"%(release_name))
else:
- print " [ Fips release ] Neeed fips release string. This can't be empty "
+ print(" [ Fips release ] Neeed fips release string. This can't be empty ")
exit_main(errorcode.ERROR_EXIT)
if not path_name == "None":
- print " [ Build Repo Path ] \t\t#String\t = %s"%(path_name)
+ print(" [ Build Repo Path ] \t\t#String\t = %s"%(path_name))
else:
- print " [ User Build Repo Path ] \t\t#String\t = %s"%(path_name)
+ print(" [ User Build Repo Path ] \t\t#String\t = %s"%(path_name))
# Optional, by default looks up predefined files
if not file_name == "None":
- print " [ Files for Check-in - User List ]"
+ print(" [ Files for Check-in - User List ]")
for files in file_name.split(","):
- print " \t\t\t\t#",files
+ print(" \t\t\t\t#",files)
else:
- print " [ Files for Check-in - Default List ]"
+ print(" [ Files for Check-in - Default List ]")
for files in errorcode.CMVC_FILE_LIST.split(","):
- print " \t\t\t\t# ",files
+ print(" \t\t\t\t# ",files)
- print " ---------------------------------------------------------------------------------"
+ print(" ---------------------------------------------------------------------------------")
#-------------------------------------------------------------
# CMVC ENV check
@@ -200,17 +201,17 @@ def main():
l_found_cmvc_conf = False
for key in os.environ.keys():
if "CMVC" in key:
- print "\t %s : %s" % (key,os.environ[key])
+ print("\t %s : %s" % (key,os.environ[key]))
l_found_cmvc_conf = True
if l_found_cmvc_conf == False:
- print "\n [ ERROR SETTING ] : The CMVC specific ENV is not set"
- print " Please add the following CMVC details in ~/.bashrc"
- print " ------------------------------------------------------"
- print " export CMVC_FAMILY=aix@<yourcmvcdomian>@<portnumber>"
- print " export CMVC_BECOME=<your cmvc id>"
- print " export CMVC_AUTH_METHOD=PWD"
- print " ------------------------------------------------------"
+ print("\n [ ERROR SETTING ] : The CMVC specific ENV is not set")
+ print(" Please add the following CMVC details in ~/.bashrc")
+ print(" ------------------------------------------------------")
+ print(" export CMVC_FAMILY=aix@<yourcmvcdomian>@<portnumber>")
+ print(" export CMVC_BECOME=<your cmvc id>")
+ print(" export CMVC_AUTH_METHOD=PWD")
+ print(" ------------------------------------------------------")
return errorcode.ERROR_SETTING
return errorcode.SUCCESS_EXIT
@@ -231,67 +232,67 @@ def main():
#------------------------------
input_setting()
- print "\n [ Checking PPE ENV Pre-req ] "
+ print("\n [ Checking PPE ENV Pre-req ] ")
# Check if User has passed the path, else get it from ENV
if path_name == "None":
# Get the PPE path
l_ppe_path = utilcode.utilppeSbENV("SBEROOT")
if l_ppe_path == "None":
- print " PPE Repo ENV Setting Path : [ ERROR CODE: %s ] " % l_ppe_path
+ print(" PPE Repo ENV Setting Path : [ ERROR CODE: %s ] " % l_ppe_path)
exit_main(errorcode.ERROR_SETTING)
else:
- print " PPE Repo path Setting : [ %s ]"% l_ppe_path
+ print(" PPE Repo path Setting : [ %s ]"% l_ppe_path)
path_name = l_ppe_path
- print "\n [ Checking CMVC user ENV Pre-req ] "
+ print("\n [ Checking CMVC user ENV Pre-req ] ")
rc_code = UserCmvcENV()
if rc_code == errorcode.SUCCESS_EXIT :
- print " CMVC Setting : [ OK ] "
+ print(" CMVC Setting : [ OK ] ")
else:
- print " CMVC Setting : [ ERORR CODE: %s ]"% rc_code
+ print(" CMVC Setting : [ ERORR CODE: %s ]"% rc_code)
#------------------------------
# 2) Check the CMVC login access
#------------------------------
- print "\n [ Checking CMVC user Login Session access ] "
+ print("\n [ Checking CMVC user Login Session access ] ")
rc_cmvc = CheckCmvcAccess()
if rc_cmvc == errorcode.ERROR_CMVC_LOGIN:
- print " CMVC Login Access : [ ERORR CODE: %s ]"% rc_cmvc
- print "\t No cmvc login was found in this session."
- print "\t Issue the cmvclog command to establish a login and re-run."
- print "\t Command : cmvclog -in <login user id>"
+ print(" CMVC Login Access : [ ERORR CODE: %s ]"% rc_cmvc)
+ print("\t No cmvc login was found in this session.")
+ print("\t Issue the cmvclog command to establish a login and re-run.")
+ print("\t Command : cmvclog -in <login user id>")
exit_main(rc_cmvc)
else:
- print " CMVC Session Login : [ OK ] "
+ print(" CMVC Session Login : [ OK ] ")
# Call API/Utility funcs def here
#------------------------------
# 3) Check track status
#------------------------------
- print "\n [ Checking CMVC track state ] "
+ print("\n [ Checking CMVC track state ] ")
l_trackFix = utilcode.utilCheckTrackState(g_cmvc_num,release_name)
if l_trackFix == errorcode.SUCCESS_TRACK_STATE :
- print " Track in fix state. Suitable to continue."
+ print(" Track in fix state. Suitable to continue.")
else :
- print " Track not in fix state. Aborting activity."
+ print(" Track not in fix state. Aborting activity.")
return errorcode.ERROR_TRACK_STATE
#------------------------------
# 4) Checkout the code
#------------------------------
- print "\n [ Creating Sandbox ]"
+ print("\n [ Creating Sandbox ]")
origDir = os.getcwd()
utilcode.utilCmvcChangeDir(g_cmvc_num)
sbDir = os.getcwd()
- print "\n [ Checkout Files from CMVC ] "
- print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ print("\n [ Checkout Files from CMVC ] ")
+ print(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
if file_name == "None":
file_name = errorcode.CMVC_FILE_LIST
for l_filename in file_name.split(","):
rc_checkout = utilcode.utilCmvcCheckout(l_filename,release_name,g_cmvc_num)
if rc_checkout == errorcode.ERROR_CMVC_CHECKOUT:
- print " [ CMVC File Checkout Failed ] [Error code : %s]\t:%s"%(rc_checkout,l_filename)
+ print(" [ CMVC File Checkout Failed ] [Error code : %s]\t:%s"%(rc_checkout,l_filename))
# Undo checkout.. dont check errors just do it
utilcode.utilRollBack("checkout",g_cmvc_num,release_name)
# Return to initial directory of operation
@@ -299,38 +300,38 @@ def main():
shutil.rmtree(sbDir)
exit_main(rc_checkout)
else:
- print " CMVC File Checkout [ OK ]"
- print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ print(" CMVC File Checkout [ OK ]")
+ print(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
#------------------------------
# 4) Copy the binaries and file
#------------------------------
# Find the files from the repo and copy to the Checkout dir
- print "\n [ Find files and Overide the checkout file ] "
- print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ print("\n [ Find files and Overide the checkout file ] ")
+ print(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
rc_copy = utilcode.utilCmvcRepoPath(path_name,g_cmvc_num,file_name)
if rc_copy == errorcode.ERROR_CMVC_FILE_COPY:
- print " [ File copy Failed ] [ Error code : %s]"%rc_copy
+ print(" [ File copy Failed ] [ Error code : %s]"%rc_copy)
# Return to initial directory of operation
os.chdir(origDir)
shutil.rmtree(sbDir)
exit_main(rc_copy)
else:
- print " Files Copied Successfully : [ OK ] "
+ print(" Files Copied Successfully : [ OK ] ")
- print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ print(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
#---------------------
# 6) Checkin the files
#---------------------
- print "\n [ Check-in Files from CMVC ] "
- print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ print("\n [ Check-in Files from CMVC ] ")
+ print(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
if file_name == "None":
file_name = errorcode.CMVC_FILE_LIST
for files in file_name.split(","):
rc_checkin = utilcode.utilCmvcCheckin(files,release_name,g_cmvc_num)
if rc_checkin == errorcode.ERROR_CMVC_CHECKIN:
- print " [ CMVC File Checkin Failed ] [Error code : %s]\t:%s"%(rc_checkin,files)
+ print(" [ CMVC File Checkin Failed ] [Error code : %s]\t:%s"%(rc_checkin,files))
# Undo checkin.. dont check errors just do it
utilcode.utilRollBack("checkin",g_cmvc_num,release_name)
# Return to initial directory of operation
@@ -338,28 +339,28 @@ def main():
shutil.rmtree(sbDir)
exit_main(rc_checkin)
else:
- print " CMVC File Checkin [ OK ]"
- print " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+ print(" CMVC File Checkin [ OK ]")
+ print(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
#---------------------------------
# 7) Fix record the defect/release
#---------------------------------
- print "\n [ Fix the Record to complete in CMVC ] "
+ print("\n [ Fix the Record to complete in CMVC ] ")
utilcode.utilCmvcFixComplete(g_cmvc_num, release_name)
#---------------------------------
# 8) Trigger Jenkins CI Job
#---------------------------------
- print "\n [ Trigering Jenkins job ] "
+ print("\n [ Trigering Jenkins job ] ")
rc_ci = utilcode.utilTriggerJenkins(g_cmvc_num, release_name, bvt)
if rc_ci == errorcode.ERROR_CI_TRIGGER :
- print " [ CI Trigger Failed ] [Error code : %s]\t"%(rc_ci)
+ print(" [ CI Trigger Failed ] [Error code : %s]\t"%(rc_ci))
# Return to initial directory of operation
os.chdir(origDir)
shutil.rmtree(sbDir)
exit_main(rc_ci)
else :
- print " CI Trigger [ OK ]"
+ print(" CI Trigger [ OK ]")
#-----------------------------------------
# Return to initial directory of operation
@@ -368,7 +369,7 @@ def main():
shutil.rmtree(sbDir)
# Clean exit
- print "\n [ Manually Integrate on CMVC post CI ] "
+ print("\n [ Manually Integrate on CMVC post CI ] ")
exit_main(errorcode.SUCCESS_EXIT)
OpenPOWER on IntegriCloud