summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuliano Procida <gprocida@google.com>2021-06-01 11:21:16 +0100
committerGiuliano Procida <gprocida@google.com>2021-07-08 12:09:37 +0100
commit10adbf4409699a1ad864a146143159d6cf1fb684 (patch)
tree2e49f6d573783cc81e236ea96bb97f528da9e337
parentd59958d7984fdcd4112e12be2fae264ed7633997 (diff)
downloadbuild-10adbf4409699a1ad864a146143159d6cf1fb684.tar.gz
ABI: post-process abidw output with abitidy --all
This will reduce the size of the generated ABI XML files and reduce churn when it's updated. Warnings will also be generated about untyped symbols and unresolvable duplicate type definitions. Bug: 187831743 Change-Id: Iee3b8176e2c41148069b56efdcd1ca2303a53f03 Signed-off-by: Giuliano Procida <gprocida@google.com>
-rw-r--r--abi/abitool.py53
1 files changed, 32 insertions, 21 deletions
diff --git a/abi/abitool.py b/abi/abitool.py
index c053d9bf..41b83866 100644
--- a/abi/abitool.py
+++ b/abi/abitool.py
@@ -15,9 +15,10 @@
# limitations under the License.
#
+import logging
import re
import subprocess
-import logging
+import tempfile
log = logging.getLogger(__name__)
@@ -160,26 +161,36 @@ class Libabigail(AbiTool):
"""" Concrete AbiTool implementation for libabigail """
def dump_kernel_abi(self, linux_tree, dump_path, symbol_list,
vmlinux_path=None):
- dump_abi_cmd = ['abidw',
- # omit various sources of indeterministic abidw output
- '--no-corpus-path',
- '--no-comp-dir-path',
- # use (more) stable type ids
- '--type-id-style',
- 'hash',
- # the path containing vmlinux and *.ko
- '--linux-tree',
- linux_tree,
- '--out-file',
- dump_path]
-
- if vmlinux_path is not None:
- dump_abi_cmd.extend(['--vmlinux', vmlinux_path])
-
- if symbol_list is not None:
- dump_abi_cmd.extend(['--kmi-whitelist', symbol_list])
-
- subprocess.check_call(dump_abi_cmd)
+ with tempfile.NamedTemporaryFile() as temp_file:
+ temp_path = temp_file.name
+
+ dump_abi_cmd = ['abidw',
+ # omit various sources of indeterministic abidw output
+ '--no-corpus-path',
+ '--no-comp-dir-path',
+ # use (more) stable type ids
+ '--type-id-style',
+ 'hash',
+ # the path containing vmlinux and *.ko
+ '--linux-tree',
+ linux_tree,
+ '--out-file',
+ temp_path]
+
+ if vmlinux_path is not None:
+ dump_abi_cmd.extend(['--vmlinux', vmlinux_path])
+
+ if symbol_list is not None:
+ dump_abi_cmd.extend(['--kmi-whitelist', symbol_list])
+
+ subprocess.check_call(dump_abi_cmd)
+
+ tidy_abi_command = ['abitidy',
+ '--all',
+ '--input', temp_path,
+ '--output', dump_path]
+
+ subprocess.check_call(tidy_abi_command)
def diff_abi(self, old_dump, new_dump, diff_report, short_report,
symbol_list, full_report):