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