diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:06:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:06:00 +0000 |
commit | b15a952c52a6825376d3e7f6c1bf5c886c6d8b74 (patch) | |
tree | 1500f2f8f276908a36d8126cb632c0d6b1276764 /debian/lib/python/debian_linux/abi.py | |
parent | Adding upstream version 5.10.209. (diff) | |
download | linux-b15a952c52a6825376d3e7f6c1bf5c886c6d8b74.tar.xz linux-b15a952c52a6825376d3e7f6c1bf5c886c6d8b74.zip |
Adding debian version 5.10.209-2.debian/5.10.209-2
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 | 45 |
1 files changed, 45 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..abaaeeaa9 --- /dev/null +++ b/debian/lib/python/debian_linux/abi.py @@ -0,0 +1,45 @@ +class Symbol(object): + def __init__(self, name, namespace, module, version, export): + self.name, self.namespace, self.module = name, namespace, 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.namespace != other.namespace: + 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, namespace = \ + line.strip('\r\n').split('\t') + self[name] = Symbol(name, namespace, module, version, export) + + def write(self, file): + for s in sorted(self.values(), key=lambda i: i.name): + file.write("%s\t%s\t%s\t%s\t%s\n" % + (s.version, s.name, s.module, s.export, s.namespace)) |