From d555e62cdde0d635ee3b5efdfb1ddb184344bc2a Mon Sep 17 00:00:00 2001 From: love_hangzhou Date: Wed, 18 Aug 2021 21:35:03 +0800 Subject: [PATCH] check-kabi support python3 and python2 --- check-kabi | 60 +++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/check-kabi b/check-kabi index a963f47..1dc05f2 100644 --- a/check-kabi +++ b/check-kabi @@ -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__":