Changeset View
Changeset View
Standalone View
Standalone View
helpers/check-abi.py
Show All 13 Lines | |||||
14 | import logging | 14 | import logging | ||
15 | import argparse | 15 | import argparse | ||
16 | import decimal | 16 | import decimal | ||
17 | import re | 17 | import re | ||
18 | import subprocess | 18 | import subprocess | ||
19 | import sys | 19 | import sys | ||
20 | import yaml | 20 | import yaml | ||
21 | 21 | | |||
22 | from helperslib import CommonUtils, ToolingSettings | ||||
22 | from helperslib import Packages | 23 | from helperslib import Packages | ||
23 | from helperslib.Version import Version | 24 | from helperslib.Version import Version | ||
24 | 25 | | |||
25 | class Library: | 26 | class Library: | ||
26 | def __init__(self, packageName, library): | 27 | def __init__(self, packageName, library): | ||
27 | self.packageName = packageName | 28 | self.packageName = packageName | ||
28 | self.library = library | 29 | self.library = library | ||
29 | self.candidates = [] | 30 | self.candidates = [] | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
88 | parser.add_argument('--branchGroup', type=str, required=True) | 89 | parser.add_argument('--branchGroup', type=str, required=True) | ||
89 | parser.add_argument('--platform', type=str, required=True) | 90 | parser.add_argument('--platform', type=str, required=True) | ||
90 | parser.add_argument('--environment', type=str, required=True) | 91 | parser.add_argument('--environment', type=str, required=True) | ||
91 | arguments = parser.parse_args() | 92 | arguments = parser.parse_args() | ||
92 | 93 | | |||
93 | # Initialize the archive manager | 94 | # Initialize the archive manager | ||
94 | ourArchive = Packages.Archive(arguments.environment, 'ABIReference', usingCache = True, contentsSuffix = ".abidump") | 95 | ourArchive = Packages.Archive(arguments.environment, 'ABIReference', usingCache = True, contentsSuffix = ".abidump") | ||
95 | 96 | | |||
97 | # get acc settings | ||||
98 | localMetadataPath = os.path.join( CommonUtils.scriptsBaseDirectory(), 'local-metadata', 'abi-compliance-checker.yaml' ) | ||||
99 | | ||||
100 | accSettings = ToolingSettings.Loader( arguments.project, arguments.platform ) | ||||
101 | accSettings.loadSpecificationFile( localMetadataPath ) | ||||
102 | | ||||
96 | # Determine which SCM revision we are storing | 103 | # Determine which SCM revision we are storing | ||
97 | # This will be embedded into the package metadata which might help someone doing some debugging | 104 | # This will be embedded into the package metadata which might help someone doing some debugging | ||
98 | # GIT_COMMIT is set by Jenkins Git plugin, so we can rely on that for most of our builds | 105 | # GIT_COMMIT is set by Jenkins Git plugin, so we can rely on that for most of our builds | ||
99 | scmRevision = '' | 106 | scmRevision = '' | ||
100 | if os.getenv('GIT_COMMIT') != '': | 107 | if os.getenv('GIT_COMMIT') != '': | ||
101 | scmRevision = os.getenv('GIT_COMMIT') | 108 | scmRevision = os.getenv('GIT_COMMIT') | ||
102 | 109 | | |||
103 | if not scmRevision: | 110 | if not scmRevision: | ||
Show All 35 Lines | 145 | if entry['platform'] != arguments.platform: | |||
139 | continue | 146 | continue | ||
140 | if entry["branchGroup"] != arguments.branchGroup: | 147 | if entry["branchGroup"] != arguments.branchGroup: | ||
141 | continue | 148 | continue | ||
142 | if entry["project"] == arguments.project and entry["scmRevision"] == scmRevision: | 149 | if entry["project"] == arguments.project and entry["scmRevision"] == scmRevision: | ||
143 | libraries.append(Library(key, entry)) | 150 | libraries.append(Library(key, entry)) | ||
144 | except KeyError: | 151 | except KeyError: | ||
145 | continue | 152 | continue | ||
146 | 153 | | |||
154 | if not libraries: | ||||
155 | if accSettings['NoLibrariesFoundFail']: | ||||
156 | sys.exit("No libraries found and NoLibrariesFoundFail, so we fail hard.") | ||||
157 | else: | ||||
158 | logging.info("No libraries found.") | ||||
159 | sys.exit(0) | ||||
160 | | ||||
147 | # Find all availabe reference dumps | 161 | # Find all availabe reference dumps | ||
148 | # * same cmakePackage | 162 | # * same cmakePackage | ||
149 | # * same SONAME otherwise we have a ABI bump and than it is safe to break ABI | 163 | # * same SONAME otherwise we have a ABI bump and than it is safe to break ABI | ||
150 | 164 | | |||
151 | for l in libraries: | 165 | for l in libraries: | ||
152 | cmakePackage = l.library["cmakePackage"] | 166 | cmakePackage = l.library["cmakePackage"] | ||
153 | targets = l.library["targets"] | 167 | targets = l.library["targets"] | ||
154 | soname = max(targets.values()) | 168 | soname = max(targets.values()) | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 210 | for l in libraries: | |||
244 | else: | 258 | else: | ||
245 | logging.debug(prog.stdout.decode()) | 259 | logging.debug(prog.stdout.decode()) | ||
246 | yml.update(parseACCOutputToDict(prog.stdout)) | 260 | yml.update(parseACCOutputToDict(prog.stdout)) | ||
247 | 261 | | |||
248 | with open('abi-compatibility-results.yaml', 'w') as f: | 262 | with open('abi-compatibility-results.yaml', 'w') as f: | ||
249 | f.write(yaml.dump(resultsYamlFile, default_flow_style=False)) | 263 | f.write(yaml.dump(resultsYamlFile, default_flow_style=False)) | ||
250 | 264 | | |||
251 | # We had an issue with one of the ABIs | 265 | # We had an issue with one of the ABIs | ||
252 | if retval != 0: | 266 | if retval != 0 and accSettings['checkABIDumpFailHard']: | ||
253 | sys.exit(retval) | 267 | sys.exit("Errors detected and checkABIDumpFailHard is set, so we fail hard.") |