summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorMarty E. Plummer <hanetzer@startmail.com>2019-05-10 00:43:56 -0500
committerRAJA DAS <rajadas2@in.ibm.com>2020-01-15 23:42:58 -0600
commite0e6c72e94c754b76b1cdd4cbc44a15762e04dee (patch)
treeceec48183120c4b20de16efd4ddcc5488f5ec203 /src/build
parent54f3205f2ce678cf8d377f4d3d5c23b3bce33096 (diff)
downloadtalos-sbe-e0e6c72e94c754b76b1cdd4cbc44a15762e04dee.tar.gz
talos-sbe-e0e6c72e94c754b76b1cdd4cbc44a15762e04dee.zip
treewide: use print function instead of statement
This enables better compat between python2.7 and python3.x Without this change, building with python3.x (python3.5 tested) as /usr/bin/python will result in the following error: File: "sbe/src/build/security/securityRegListGen.py", line 64 -v, --verbose enable verbose traces" ^ SyntaxError: Missing parentheses in call to 'print' Signed-off-by: Marty E. Plummer <hanetzer@startmail.com> Change-Id: Id617f54096fca5cc5fcd829767595a85350e343d Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/89618 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/parsAndCutElf.py9
-rwxr-xr-xsrc/build/sbeOpDistribute.py9
-rw-r--r--src/build/security/securityRegListGen.py94
-rwxr-xr-xsrc/build/updateBuildTag.py4
4 files changed, 60 insertions, 56 deletions
diff --git a/src/build/parsAndCutElf.py b/src/build/parsAndCutElf.py
index f6a71b9e..624d3261 100755
--- a/src/build/parsAndCutElf.py
+++ b/src/build/parsAndCutElf.py
@@ -23,6 +23,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+from __future__ import print_function
import os
import subprocess
import re
@@ -36,7 +37,7 @@ def parserElf(argv):
outdir = argv[2]
img = argv[3]
except:
- print "Missing argument : arg[0] ddlevel; arg[1] output directory; arg[2] img (seeprom/pibmem)"
+ print("Missing argument : arg[0] ddlevel; arg[1] output directory; arg[2] img (seeprom/pibmem)")
exit(-1)
SBE_OUT = outdir+"/sbe_"+img+"_"+ddlevel+".out"
SBE_BIN = outdir+"/sbe_"+img+"_"+ddlevel+".bin"
@@ -53,7 +54,7 @@ def parserElf(argv):
if( (line.find(firstSection) != -1) ):
tokens = line.split();
startSize = int( tokens[5], 16 )
- print startSize
+ print(startSize)
break;
# Get the location of sbe end
@@ -64,7 +65,7 @@ def parserElf(argv):
endSize = int( tokens[0], 16 );
break;
- print endSize;
+ print(endSize)
if( (startSize == 0) or (endSize == 0)):
exit(-1)
@@ -72,7 +73,7 @@ def parserElf(argv):
cmd1 = "dd skip=" + str(startSize) + " count=" + str(endSize) + " if="+SBE_OUT+" of="+SBE_BIN+" bs=1"
rc = os.system(cmd1)
if ( rc ):
- print "ERROR running %s: %d "%( cmd1, rc )
+ print("ERROR running %s: %d "%( cmd1, rc ))
exit(-1)
parserElf(sys.argv)
diff --git a/src/build/sbeOpDistribute.py b/src/build/sbeOpDistribute.py
index 98024205..cb735b73 100755
--- a/src/build/sbeOpDistribute.py
+++ b/src/build/sbeOpDistribute.py
@@ -22,24 +22,25 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+from __future__ import print_function
import os
import sys
import getopt
def usage():
- print "usage:sbeOpDistribute.py [--sbe_binary_dir] <sbe binary path> [--img_dir] <images path>"
+ print("usage:sbeOpDistribute.py [--sbe_binary_dir] <sbe binary path> [--img_dir] <images path>")
def run_system_cmd(cmd):
- print 'Cmd:<'+cmd+'>'
+ print('Cmd:<'+cmd+'>')
if(os.system(cmd)):
- print "ERROR running cmd:<"+cmd+">"
+ print("ERROR running cmd:<"+cmd+">")
exit(1)
def main(argv):
try:
opts, args = getopt.getopt(sys.argv[1:], "", ['sbe_binary_dir=', 'img_dir=', 'buildSbePart=', 'hw_ref_image=', 'sbe_binary_filename=', 'scratch_dir=', 'install', 'help'])
except getopt.GetoptError as err:
- print str(err)
+ print(str(err))
usage()
exit(1)
diff --git a/src/build/security/securityRegListGen.py b/src/build/security/securityRegListGen.py
index c4324498..78d09fea 100644
--- a/src/build/security/securityRegListGen.py
+++ b/src/build/security/securityRegListGen.py
@@ -22,6 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+from __future__ import print_function
import getopt
import sys
import os
@@ -52,29 +53,30 @@ TAG_NAME_GREYLIST = 'write_greylist'
TAG_NAME_BLACKLIST = 'read_blacklist'
def usage():
- print "usage: p9_security_list_gen.py [-h] [-f <security_list_path>] [-0 <output directory] [i] [-d] [-v]\n\
+ print(
+'''usage: p9_security_list_gen.py [-h] [-f <security_list_path>] [-0 <output directory] [i] [-d] [-v]
arguments:\n\
--h, --help show this help message and exit\n\
--f, --file path to the security list csv file\n\
--o, --output output directory\n\
--w, --whitelist print whitelist read from csv\n\
--b, --blacklist print blacklist read from csv\n\
--g, --greylist print greylist read from csv\n\
--i, --info get version info of the security list\n\
--d, --debug enable debug traces\n\
--v, --verbose enable verbose traces"
+-h, --help show this help message and exit
+-f, --file path to the security list csv file
+-o, --output output directory
+-w, --whitelist print whitelist read from csv
+-b, --blacklist print blacklist read from csv
+-g, --greylist print greylist read from csv
+-i, --info get version info of the security list
+-d, --debug enable debug traces
+-v, --verbose enable verbose traces''')
def exit(error, msg = ''):
if(error == SUCCESS):
return 0
elif(error == INVALID_USAGE):
- print msg
+ print(msg)
usage()
elif(error == PRINT_AND_EXIT):
- print msg
+ print(msg)
else:
if(DEBUG):
- print "unknown error:exiting"
+ print("unknown error:exiting")
sys.exit(1)
def remove_duplicates(xlist):
@@ -466,16 +468,16 @@ def get_tables(id, list):
# for each range and key combination in order
table3 += temp_keys
if(VERBOSE):
- print id+" table3 keys len ["+s_list_len(table3)+"]"
+ print(id+" table3 keys len ["+s_list_len(table3)+"]")
if(VERBOSE):
- print id,"table1:", ['0x%04x:0x%02x' % ele for ele in table1]
- print id,"table2:", ['0x%02x:0x%02x' % ele for ele in table2]
- print id,"table3:", ['0x%04x' % ele for ele in table3]
+ print(id,"table1:", ['0x%04x:0x%02x' % ele for ele in table1])
+ print(id,"table2:", ['0x%02x:0x%02x' % ele for ele in table2])
+ print(id,"table3:", ['0x%04x' % ele for ele in table3])
if(DEBUG):
- print id,"table1 len ["+s_list_len(table1)+"]"
- print id,"table2 len ["+s_list_len(table2)+"]"
- print id+" table3 len ["+s_list_len(table3)+"]"
+ print(id,"table1 len ["+s_list_len(table1)+"]")
+ print(id,"table2 len ["+s_list_len(table2)+"]")
+ print(id+" table3 len ["+s_list_len(table3)+"]")
return (table1, table2, table3)
@@ -491,8 +493,8 @@ def s_table1_gen(id, table):
str_table1 += '\n'
str_table1 = str_table1[:-1]
if(VERBOSE):
- print id+" generated table1"
- print str_table1
+ print(id+" generated table1")
+ print(str_table1)
return str_table1
def s_table2_gen(id, table):
@@ -505,8 +507,8 @@ def s_table2_gen(id, table):
str_table2 += '\n'
str_table2 = str_table2[:-1]
if(VERBOSE):
- print id+" generated table2"
- print str_table2
+ print(id+" generated table2")
+ print(str_table2)
return str_table2
def s_table3_gen(id, table):
@@ -519,8 +521,8 @@ def s_table3_gen(id, table):
str_table3 += '\n'
str_table3 = str_table3[:-1]
if(VERBOSE):
- print id+" generated table3"
- print str_table3
+ print(id+" generated table3")
+ print(str_table3)
return str_table3
def s_greylist_table_gen( greyList):
@@ -530,8 +532,8 @@ def s_greylist_table_gen( greyList):
str_table += '{0x%08x, 0x%016xull}, ' % (ele[0], ele[1])
str_table = str_table[:-1]
if(VERBOSE):
- print " greylist table"
- print str_table
+ print(" greylist table")
+ print(str_table)
return str_table
def main(argv):
@@ -578,8 +580,8 @@ def main(argv):
GEN_FILE = str(arg)+"/"+GEN_FILE
if(DEBUG):
- print "file ["+str(SECURITY_LIST)+"]"
- print "output ["+str(GEN_FILE)+"]"
+ print("file ["+str(SECURITY_LIST)+"]")
+ print("output ["+str(GEN_FILE)+"]")
# Read the security list file
version = 'unknown'
@@ -599,7 +601,7 @@ def main(argv):
base_addr = base_addr[len(base_addr)-8:]
base_addr = int(base_addr, 16)
if(VERBOSE):
- print "base["+'0x%08x' % base_addr + "]"
+ print("base["+'0x%08x' % base_addr + "]")
bit_mask = row[TAG_BIT_MASK].strip()
if not bit_mask:
bit_mask = 0
@@ -612,9 +614,9 @@ def main(argv):
exit(PRINT_AND_EXIT, "Missing chiplet id range")
if(chiplet_range[0].strip().lower() != '0x00'):
if(chiplet_range[0].strip().lower() != '0x%02x' % (get_chiplet(base_addr))):
- print "base_addr",hex(base_addr)
- print "get_chiplet(base_addr)",hex(get_chiplet(base_addr))
- print "chiplet_range[0]", chiplet_range[0]
+ print("base_addr",hex(base_addr))
+ print("get_chiplet(base_addr)",hex(get_chiplet(base_addr)))
+ print("chiplet_range[0]", chiplet_range[0])
exit(PRINT_AND_EXIT, "Base address is not consistent")
base_addr = base_addr & 0x00FFFFFF
chiplet_range = [int(ele, 16) for ele in chiplet_range]
@@ -625,29 +627,29 @@ def main(argv):
expanded_line = [(base_addr + ele) for ele in expanded_range]
expanded_line = get_effective_address(row[TAG_CHIPLET], expanded_line)
if(VERBOSE):
- print s_list_hex("range:", expanded_range, 8)
+ print(s_list_hex("range:", expanded_range, 8))
if(row[TAG_TYPE].strip().lower() == TAG_NAME_GREYLIST):
if(( bit_mask == 0 ) or ( bit_mask == 0xffffffffffffffff)):
exit(PRINT_AND_EXIT, "Wrong mask for Greylist")
greylist_line = expanded_line
if(VERBOSE):
- print s_list_hex("greylist_line:", greylist_line, 8)
- print "mask:", bit_mask
+ print(s_list_hex("greylist_line:", greylist_line, 8))
+ print("mask:", bit_mask)
for ele in greylist_line:
greylist.append((ele, bit_mask))
elif(row[TAG_TYPE].strip().lower() == TAG_NAME_WHITELIST):
whitelist_line = expanded_line
if(VERBOSE):
- print s_list_hex("whitelist_line:", whitelist_line, 8)
+ print(s_list_hex("whitelist_line:", whitelist_line, 8))
whitelist += whitelist_line
elif(row[TAG_TYPE].strip().lower() == TAG_NAME_BLACKLIST):
blacklist_line = expanded_line
if(VERBOSE):
- print s_list_hex("blacklist_line:", blacklist_line, 8)
+ print(s_list_hex("blacklist_line:", blacklist_line, 8))
blacklist += blacklist_line
except:
- print "Error in line ["+str(idx+2)+"]"
+ print("Error in line ["+str(idx+2)+"]")
exit(PRINT_AND_EXIT, sys.exc_info()[0])
whitelist = remove_duplicates(whitelist)
@@ -669,13 +671,13 @@ def main(argv):
exit(PRINT_AND_EXIT, greylist)
if(VERBOSE):
- print s_list_hex("whitelist:", whitelist, 8)
- print s_list_hex("blacklist:", blacklist, 8)
+ print(s_list_hex("whitelist:", whitelist, 8))
+ print(s_list_hex("blacklist:", blacklist, 8))
if(DEBUG):
- print "security list version ["+version+"]"
- print "Whitelist len ["+s_list_len(whitelist)+"]"
- print "Blacklist len ["+s_list_len(blacklist)+"]"
- print "Greylist len ["+s_list_len(greylist)+"]"
+ print("security list version ["+version+"]")
+ print("Whitelist len ["+s_list_len(whitelist)+"]")
+ print("Blacklist len ["+s_list_len(blacklist)+"]")
+ print("Greylist len ["+s_list_len(greylist)+"]")
whitelist_tables = get_tables("Whitelist", whitelist)
blacklist_tables = get_tables("Blacklist", blacklist)
diff --git a/src/build/updateBuildTag.py b/src/build/updateBuildTag.py
index 8d342d78..cedb6be9 100755
--- a/src/build/updateBuildTag.py
+++ b/src/build/updateBuildTag.py
@@ -23,7 +23,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
-
+from __future__ import print_function
import os
import sys
import subprocess
@@ -38,7 +38,7 @@ def updateBuildTag(argv):
image_dir = argv[2]
seeprom_name = argv[3]
except:
- print "Missing Xip Tool Path/Image Directory/Seeprom Binary Name"
+ print("Missing Xip Tool Path/Image Directory/Seeprom Binary Name")
exit(-1)
# Commandline cmds getting formed here
OpenPOWER on IntegriCloud