diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 01:02:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 01:02:38 +0000 |
commit | 08b74a000942a380fe028845f92cd3a0dee827d5 (patch) | |
tree | aa78b4e12607c3e1fcce8d5cc42df4330792f118 /debian/lib/python/debian_linux/abi.py | |
parent | Adding upstream version 4.19.249. (diff) | |
download | linux-debian/4.19.249-2.tar.xz linux-debian/4.19.249-2.zip |
Adding debian version 4.19.249-2.debian/4.19.249-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/lib/python/debian_linux/abi.py')
-rw-r--r-- | debian/lib/python/debian_linux/abi.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/debian/lib/python/debian_linux/abi.py b/debian/lib/python/debian_linux/abi.py new file mode 100644 index 000000000..8532db16d --- /dev/null +++ b/debian/lib/python/debian_linux/abi.py @@ -0,0 +1,42 @@ +class Symbol(object): + def __init__(self, name, module, version, export): + self.name, self.module = name, module + self.version, self.export = version, export + + def __eq__(self, other): + if not isinstance(other, Symbol): + return NotImplemented + + # Symbols are resolved to modules by depmod at installation/ + # upgrade time, not compile time, so moving a symbol between + # modules is not an ABI change. Compare everything else. + if self.name != other.name: + return False + if self.version != other.version: + return False + if self.export != other.export: + return False + + return True + + def __ne__(self, other): + ret = self.__eq__(other) + if ret is NotImplemented: + return ret + return not ret + + +class Symbols(dict): + def __init__(self, file=None): + if file: + self.read(file) + + def read(self, file): + for line in file: + version, name, module, export = line.strip().split() + self[name] = Symbol(name, module, version, export) + + def write(self, file): + for s in sorted(self.values(), key=lambda i: i.name): + file.write("%s %s %s %s\n" % + (s.version, s.name, s.module, s.export)) |