check-kabi support python3 and python2

This commit is contained in:
love_hangzhou 2021-08-18 21:35:03 +08:00
parent e7d926d065
commit d555e62cdd

View File

@ -41,7 +41,7 @@ def load_symvers(symvers,filename):
break
if in_line == "\n":
continue
checksum,symbol,directory,type = string.split(in_line)
checksum,symbol,directory,type = in_line.split()
symvers[symbol] = in_line[0:-1]
@ -56,7 +56,7 @@ def load_kabi(kabi,filename):
break
if in_line == "\n":
continue
checksum,symbol,directory,type = string.split(in_line)
checksum,symbol,directory,type = in_line.split()
kabi[symbol] = in_line[0:-1]
@ -71,9 +71,9 @@ def check_kabi(symvers,kabi):
losted_symbols=[]
for symbol in kabi:
abi_hash,abi_sym,abi_dir,abi_type = string.split(kabi[symbol])
if symvers.has_key(symbol):
sym_hash,sym_sym,sym_dir,sym_type = string.split(symvers[symbol])
abi_hash,abi_sym,abi_dir,abi_type = kabi[symbol].split()
if symbol in symvers:
sym_hash,sym_sym,sym_dir,sym_type = symvers[symbole].split()
if abi_hash != sym_hash:
fail=1
changed_symbols.append(symbol)
@ -86,39 +86,39 @@ def check_kabi(symvers,kabi):
losted_symbols.append(symbol)
if fail:
print "*** ERROR - ABI BREAKAGE WAS DETECTED ***"
print ""
print "The following symbols have been changed (this will cause an ABI breakage):"
print "new kabi:"
print ("*** ERROR - ABI BREAKAGE WAS DETECTED ***")
print ("")
print ("The following symbols have been changed (this will cause an ABI breakage):")
print ("new kabi:")
for symbol in changed_symbols:
print symvers[symbol]
print "old kabi:"
print (symvers[symbol])
print ("old kabi:")
for symbol in changed_symbols:
print kabi[symbol]
print ""
print (kabi[symbol])
print ("")
if lost:
print "*** ERROR - ABI BREAKAGE WAS DETECTED ***"
print ""
print "The following symbols have been losted (this will cause an ABI breakage):"
print "old kabi:"
print ("*** ERROR - ABI BREAKAGE WAS DETECTED ***")
print ("")
print ("The following symbols have been losted (this will cause an ABI breakage):")
print ("old kabi:")
for symbol in losted_symbols:
print kabi[symbol]
print ""
print (kabi[symbol])
print ("")
if warn:
print "*** WARNING - ABI SYMBOLS MOVED ***"
print ""
print "The following symbols moved (typically caused by moving a symbol from being"
print "provided by the kernel vmlinux out to a loadable module):"
print "new kabi:"
print ("*** WARNING - ABI SYMBOLS MOVED ***")
print ("")
print ("The following symbols moved (typically caused by moving a symbol from being")
print ("provided by the kernel vmlinux out to a loadable module):")
print ("new kabi:")
for symbol in moved_symbols:
print symvers[symbol]
print "old kabi"
print (symvers[symbol])
print ("old kabi")
for symbol in moved_symbols:
print kabi[symbol]
print (kabi[symbol])
print ""
print ("")
"""Halt the build, if we got errors and/or warnings. In either case,
double-checkig is required to avoid introducing / concealing
@ -128,12 +128,12 @@ def check_kabi(symvers,kabi):
sys.exit(0)
def usage():
print """
print ("""
check-kabi: check Module.kabi and Module.symvers files.
check-kabi [ -k Module.kabi ] [ -s Module.symvers ]
"""
""")
if __name__ == "__main__":