Changeset View
Changeset View
Standalone View
Standalone View
helpers/create-abi-dump.py
1 | #!/usr/bin/python3 | 1 | #!/usr/bin/python3 | ||
---|---|---|---|---|---|
2 | import argparse | 2 | import argparse | ||
3 | import glob | ||||
4 | import itertools | ||||
3 | import logging | 5 | import logging | ||
4 | import os | 6 | import os | ||
5 | import pathlib | 7 | import pathlib | ||
6 | import re | 8 | import re | ||
7 | import subprocess | 9 | import subprocess | ||
8 | import sys | 10 | import sys | ||
9 | import tempfile | 11 | import tempfile | ||
10 | 12 | | |||
11 | from collections import defaultdict | 13 | from collections import defaultdict | ||
12 | from typing import Dict, List, Union, Set | 14 | from typing import Dict, List, Union, Set | ||
13 | 15 | | |||
14 | from helperslib import CommonUtils, ToolingSettings | 16 | from helperslib import CommonUtils, ToolingSettings | ||
15 | from helperslib import Packages, EnvironmentHandler | 17 | from helperslib import Packages, EnvironmentHandler | ||
16 | 18 | | |||
17 | # Make sure logging is ready to go | 19 | # Make sure logging is ready to go | ||
18 | logging.basicConfig(level=logging.DEBUG) | 20 | logging.basicConfig(level=logging.DEBUG) | ||
19 | logging.getLogger("paramiko.transport").setLevel(logging.WARNING) | 21 | logging.getLogger("paramiko.transport").setLevel(logging.WARNING) | ||
20 | 22 | | |||
21 | ACCXMLTMPL = """<version>{version}</version> | 23 | ACCXMLTMPL = """<version>{version}</version> | ||
22 | <headers> | 24 | <headers> | ||
23 | {headers} | 25 | {headers} | ||
24 | </headers> | 26 | </headers> | ||
25 | <libs> | 27 | <libs> | ||
26 | {libs} | 28 | {libs} | ||
27 | </libs> | 29 | </libs> | ||
28 | <skip_include_paths> | 30 | <skip_include_paths> | ||
29 | {skipIncludePaths} | 31 | {skipIncludePaths} | ||
30 | </skip_include_paths> | 32 | </skip_include_paths> | ||
31 | <add_include_paths> | 33 | <add_include_paths> | ||
32 | {additionalIncludes} | 34 | {additionalIncludes} | ||
33 | </add_include_paths> | 35 | </add_include_paths> | ||
34 | <gcc_options> | 36 | <gcc_options> | ||
35 | {gccOptions} | 37 | {gccOptions} | ||
36 | </gcc_options> | 38 | </gcc_options> | ||
37 | """ | 39 | """ | ||
38 | 40 | | |||
39 | def cmake_parser(lines: List) -> Dict: | 41 | def cmake_parser(lines: List) -> Dict: | ||
40 | """A small cmake parser, if you search for a better solution think about using | 42 | """A small cmake parser, if you search for a better solution think about using | ||
41 | a proper one based on ply. | 43 | a proper one based on ply. | ||
42 | see https://salsa.debian.org/qt-kde-team/pkg-kde-jenkins/blob/master/hooks/prepare/cmake_update_deps | 44 | see https://salsa.debian.org/qt-kde-team/pkg-kde-jenkins/blob/master/hooks/prepare/cmake_update_deps | ||
43 | 45 | | |||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Line(s) | 218 | def createABIDump(self, runtimeEnvironment=None) -> None: | |||
229 | if not self.__parser_output: | 231 | if not self.__parser_output: | ||
230 | self.runCMake(runtimeEnvironment) | 232 | self.runCMake(runtimeEnvironment) | ||
231 | 233 | | |||
232 | # Start preparations to run abi-compliance-checker | 234 | # Start preparations to run abi-compliance-checker | ||
233 | # Gather the information we'll need to write the XML configuration file it uses | 235 | # Gather the information we'll need to write the XML configuration file it uses | ||
234 | version = self.version | 236 | version = self.version | ||
235 | headers = set() # type: Set[str] | 237 | headers = set() # type: Set[str] | ||
236 | libs = set() # type: Set[str] | 238 | libs = set() # type: Set[str] | ||
237 | skipIncludePaths = set(self.accSettings['skip_include_paths']) # type: Set[str] | 239 | skipIncludePaths = set(itertools.chain.from_iterable(glob.glob(i) for i in self.accSettings['skip_include_paths'])) # type: Set[str] | ||
238 | additionalIncludes = set(self.accSettings['add_include_paths']) # type: Set[str] | 240 | additionalIncludes = set(self.accSettings['add_include_paths']) # type: Set[str] | ||
239 | gccOptions = set(self.accSettings['gcc_options']) # type: Set[str] | 241 | gccOptions = set(self.accSettings['gcc_options']) # type: Set[str] | ||
240 | 242 | | |||
241 | 243 | | |||
242 | # list of general include directories | 244 | # list of general include directories | ||
243 | prefixHeaders = [os.path.abspath(i) for i in buildEnvironment.get('CMAKE_PREFIX_PATH').split(":")] | 245 | prefixHeaders = [os.path.abspath(i) for i in buildEnvironment.get('CMAKE_PREFIX_PATH').split(":")] | ||
244 | noHeaders = set(prefixHeaders) | 246 | noHeaders = set(prefixHeaders) | ||
245 | noHeaders |= set([os.path.join(i,"include") for i in prefixHeaders]) | 247 | noHeaders |= set([os.path.join(i,"include") for i in prefixHeaders]) | ||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |