Changeset View
Changeset View
Standalone View
Standalone View
helpers/create-abi-dump.py
Show All 10 Lines | |||||
11 | 11 | | |||
12 | from collections import defaultdict | 12 | from collections import defaultdict | ||
13 | from typing import Dict, List, Union, Set | 13 | from typing import Dict, List, Union, Set | ||
14 | 14 | | |||
15 | from helperslib import CommonUtils, ToolingSettings | 15 | from helperslib import CommonUtils, ToolingSettings | ||
16 | from helperslib import Packages, EnvironmentHandler | 16 | from helperslib import Packages, EnvironmentHandler | ||
17 | 17 | | |||
18 | # Make sure logging is ready to go | 18 | # Make sure logging is ready to go | ||
19 | #logging.basicConfig(level=logging.DEBUG) | 19 | logging.basicConfig(level=logging.DEBUG) | ||
20 | 20 | | |||
21 | ACCXMLTMPL = """<version>{version}</version> | 21 | ACCXMLTMPL = """<version>{version}</version> | ||
22 | <headers> | 22 | <headers> | ||
23 | {headers} | 23 | {headers} | ||
24 | </headers> | 24 | </headers> | ||
25 | <libs> | 25 | <libs> | ||
26 | {libs} | 26 | {libs} | ||
27 | </libs> | 27 | </libs> | ||
▲ Show 20 Lines • Show All 238 Lines • ▼ Show 20 Line(s) | 264 | xml = ACCXMLTMPL.format(version=version, | |||
266 | libs=_(libs), | 266 | libs=_(libs), | ||
267 | additionalIncludes=_(additionalIncludes), | 267 | additionalIncludes=_(additionalIncludes), | ||
268 | skipIncludePaths=_(skipIncludePaths), | 268 | skipIncludePaths=_(skipIncludePaths), | ||
269 | gccOptions=_(gccOptions), | 269 | gccOptions=_(gccOptions), | ||
270 | ) | 270 | ) | ||
271 | 271 | | |||
272 | # Write the generated XML out to a file to pass to abi-compliance-checker | 272 | # Write the generated XML out to a file to pass to abi-compliance-checker | ||
273 | # We will give this to abi-compliance-checker using it's --dump parameter | 273 | # We will give this to abi-compliance-checker using it's --dump parameter | ||
274 | with open("{version}.xml".format(version=version),"w") as f: # replace with f-String in python 3.6 | 274 | with open("acc/{libname}-{version}.xml".format(libname=self.name, version=version),"w") as f: # replace with f-String in python 3.6 | ||
275 | f.write(xml) | 275 | f.write(xml) | ||
276 | 276 | | |||
277 | # acc is compatible for C/C++ (but --lang C++ doesn't remove the warning about C++ only settings). | 277 | # acc is compatible for C/C++ (but --lang C++ doesn't remove the warning about C++ only settings). | ||
278 | subprocess.check_call(["abi-compliance-checker", "--lang", "C++", "-l", self.name, "--dump", f.name], env=runtimeEnvironment) | 278 | cmd = ["abi-compliance-checker", "--lang", "C++", "-l", self.name, "--dump", f.name] | ||
279 | logging.debug(" ".join(cmd)) | ||||
280 | subprocess.check_call(cmd, env=runtimeEnvironment) | ||||
279 | 281 | | |||
280 | # Parse the command line arguments we've been given | 282 | # Parse the command line arguments we've been given | ||
281 | parser = argparse.ArgumentParser(description='Utility to create abi checker tarballs.') | 283 | parser = argparse.ArgumentParser(description='Utility to create abi checker tarballs.') | ||
282 | parser.add_argument('--project', type=str, required=True) | 284 | parser.add_argument('--project', type=str, required=True) | ||
283 | parser.add_argument('--branchGroup', type=str, required=True) | 285 | parser.add_argument('--branchGroup', type=str, required=True) | ||
284 | parser.add_argument('--buildLog', type=str, required=True) | 286 | parser.add_argument('--buildLog', type=str, required=True) | ||
285 | parser.add_argument('--environment', type=str, required=True) | 287 | parser.add_argument('--environment', type=str, required=True) | ||
286 | parser.add_argument('--platform', type=str, required=True) | 288 | parser.add_argument('--platform', type=str, required=True) | ||
Show All 31 Lines | |||||
318 | # GIT_COMMIT is set by Jenkins Git plugin, so we can rely on that for most of our builds | 320 | # GIT_COMMIT is set by Jenkins Git plugin, so we can rely on that for most of our builds | ||
319 | scmRevision = '' | 321 | scmRevision = '' | ||
320 | if os.getenv('GIT_COMMIT') != '': | 322 | if os.getenv('GIT_COMMIT') != '': | ||
321 | scmRevision = os.getenv('GIT_COMMIT') | 323 | scmRevision = os.getenv('GIT_COMMIT') | ||
322 | 324 | | |||
323 | if not scmRevision: | 325 | if not scmRevision: | ||
324 | scmRevision = subprocess.check_output(["git", "log", "--format=%H", "-n 1", "HEAD"]).strip().decode() | 326 | scmRevision = subprocess.check_output(["git", "log", "--format=%H", "-n 1", "HEAD"]).strip().decode() | ||
325 | 327 | | |||
328 | # Create diretory for string acc input xml | ||||
329 | try: | ||||
330 | os.mkdir("acc") | ||||
331 | except FileExistsError: | ||||
332 | pass | ||||
333 | | ||||
326 | # Check every libraries ABI and do not fail, if one is not fine. | 334 | # Check every libraries ABI and do not fail, if one is not fine. | ||
327 | # Safe the overall retval state | 335 | # Safe the overall retval state | ||
328 | retval = 0 | 336 | retval = 0 | ||
329 | 337 | | |||
330 | # Now we generate the ABI dumps for every library we have found | 338 | # Now we generate the ABI dumps for every library we have found | ||
331 | for library in foundLibraries: | 339 | for library in foundLibraries: | ||
340 | logging.info("Start building ABI dump for {name}".format(name=library.name)) | ||||
332 | try: | 341 | try: | ||
333 | #run CMake for library | 342 | #run CMake for library | ||
334 | library.runCMake( runtimeEnvironment=buildEnvironment ) | 343 | library.runCMake( runtimeEnvironment=buildEnvironment ) | ||
335 | 344 | | |||
336 | if not library.version: | 345 | if not library.version: | ||
337 | logging.warning("{name} has no version: skipping.".format(name=library.name)) | 346 | logging.warning("{name} has no version: skipping.".format(name=library.name)) | ||
338 | continue | 347 | continue | ||
339 | 348 | | |||
Show All 25 Lines |