From c2727146596acd76f55e56254d6df52b947609e2 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Fri, 8 Dec 2006 17:32:21 +0000 Subject: [PATCH] * debian/bin/abicheck.py: Always report all informations from a symbol. * debian/lib/python/debian_linux/abi.py: Update. svn path=/dists/trunk/linux-2.6/; revision=7952 --- debian/bin/abicheck.py | 19 ++++---- debian/lib/python/debian_linux/abi.py | 66 +++++++++------------------ 2 files changed, 32 insertions(+), 53 deletions(-) diff --git a/debian/bin/abicheck.py b/debian/bin/abicheck.py index b024b8766..80436e2dd 100755 --- a/debian/bin/abicheck.py +++ b/debian/bin/abicheck.py @@ -53,7 +53,8 @@ class checker(object): info = [] if symbol in add_ignore: info.append("ignored") - info.append("module: %s" % add_info[symbol]['module']) + for i in ('module', 'version', 'export'): + info.append("%s: %s" % (i, add_info[symbol][i])) out.write("%-48s %s\n" % (symbol, ", ".join(info))) if change: out.write("\nChanged symbols:\n") @@ -63,12 +64,13 @@ class checker(object): info = [] if symbol in change_ignore: info.append("ignored") - if change_info[symbol].has_key('module'): - info.append("module: %s -> %s" % change_info[symbol]['module']) - if change_info[symbol].has_key('version'): - info.append("version: %s -> %s" % change_info[symbol]['version']) - if change_info[symbol].has_key('export'): - info.append("export: %s -> %s" % change_info[symbol]['export']) + s = change_info[symbol] + changes = s['changes'] + for i in ('module', 'version', 'export'): + if changes.has_key(i): + info.append("%s: %s -> %s" % (i, s['ref'][i], s['new'][i])) + else: + info.append("%s: %s" % (i, new[symbol][i])) out.write("%-48s %s\n" % (symbol, ", ".join(info))) if remove: out.write("\nRemoved symbols:\n") @@ -78,7 +80,8 @@ class checker(object): info = [] if symbol in remove_ignore: info.append("ignored") - info.append("module: %s" % remove_info[symbol]['module']) + for i in ('module', 'version', 'export'): + info.append("%s: %s" % (i, add_info[symbol][i])) out.write("%-48s %s\n" % (symbol, ", ".join(info))) return ret diff --git a/debian/lib/python/debian_linux/abi.py b/debian/lib/python/debian_linux/abi.py index 930e5d143..d04ad450d 100644 --- a/debian/lib/python/debian_linux/abi.py +++ b/debian/lib/python/debian_linux/abi.py @@ -1,11 +1,12 @@ -class symbols(object): +class symbols(dict): def __init__(self, filename = None): + self.modules = {} if filename is not None: self.read(file(filename)) def cmp(self, new): - symbols_ref = set(self.symbols.keys()) - symbols_new = set(new.symbols.keys()) + symbols_ref = set(self.keys()) + symbols_new = set(new.keys()) symbols_add = {} symbols_remove = {} @@ -13,63 +14,38 @@ class symbols(object): symbols_change = {} for symbol in symbols_new - symbols_ref: - symbols_add[symbol] = {'module': new.symbols[symbol][0]} + symbols_add[symbol] = new[symbol] for symbol in symbols_ref.intersection(symbols_new): - module_ref, version_ref, export_ref = self.symbols[symbol] - module_new, version_new, export_new = new.symbols[symbol] + symbol_ref = self[symbol] + symbol_new = new[symbol] - ent = {} - if module_ref != module_new: - ent['module'] = module_ref, module_new - if version_ref != version_new: - ent['version'] = version_ref, version_new - if export_ref != export_new: - ent['export'] = export_ref, export_new - if ent: + ent = {'ref': symbol_ref, 'new': symbol_new, 'changes': {}} + for i in ('module', 'version', 'export'): + if symbol_ref[i] != symbol_new[i]: + ent['changes'][i] = {'ref': symbol_ref, 'new': symbol_new} + if ent['changes']: symbols_change[symbol] = ent for symbol in symbols_ref - symbols_new: - symbols_remove[symbol] = {'module': self.symbols[symbol][0]} + symbols_remove[symbol] = self[symbol] return symbols_add, symbols_change, symbols_remove def read(self, file): - self.modules = {} - self.symbols = {} - for line in file.readlines(): version, symbol, module, export = line.strip().split() - symbols = self.modules.get(module, {}) - symbols[symbol] = version - self.modules[module] = symbols - if self.symbols.has_key(symbol): + if self.has_key(symbol): pass - self.symbols[symbol] = module, version, export + symbols = self.modules.get(module, set()) + symbols.add(symbol) + self.modules[module] = symbols + self[symbol] = {'symbol': symbol, 'module': module, 'version': version, 'export': export} def write(self, file): - symbols = self.symbols.items() + symbols = self.items() symbols.sort() - for symbol, i in symbols: - module, version, export = i - file.write("%s %s %s %s\n" % (version, symbol, module, export)) - - def write_human(self, file): - modules = self.modules.keys() - modules.sort() - modules.remove('vmlinux') - - file.write("Symbols in vmlinux\n\n") - symbols = self.modules['vmlinux'].items() - symbols.sort() - for symbol, version, export in symbols: - file.write("%-48s %s %s\n" % (symbol, version, export)) - - for module in modules: - file.write("\n\nSymbols in module %s\n\n" % module) - symbols = self.modules[module].items() - symbols.sort() - for symbol, version, export in symbols: - file.write("%-48s %s %s\n" % (symbol, version, export)) + for symbol, info in symbols: + file.write("%(version)s %(symbol)s %(module)s %(export)s\n" % info)