Changeset View
Changeset View
Standalone View
Standalone View
helpers/create-abi-dump.py
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Line(s) | 183 | def createABIDump(self, runtimeEnvironment=None) -> None: | |||
---|---|---|---|---|---|
196 | if not self.__parser_output: | 196 | if not self.__parser_output: | ||
197 | self.runCMake(runtimeEnvironment) | 197 | self.runCMake(runtimeEnvironment) | ||
198 | 198 | | |||
199 | # Start preparations to run abi-compliance-checker | 199 | # Start preparations to run abi-compliance-checker | ||
200 | # Gather the information we'll need to write the XML configuration file it uses | 200 | # Gather the information we'll need to write the XML configuration file it uses | ||
201 | version = self.version | 201 | version = self.version | ||
202 | headers = [] # type: List[str] | 202 | headers = [] # type: List[str] | ||
203 | libs = [] # type: List[str] | 203 | libs = [] # type: List[str] | ||
204 | additionalIncludes = [] # type: List[str] | ||||
204 | 205 | | |||
205 | # From the target information we previously collected... | 206 | # From the target information we previously collected... | ||
206 | # Grab the list of libraries and include headers for abi-compliance-checker | 207 | # Grab the list of libraries and include headers for abi-compliance-checker | ||
207 | for target in self.targets.values(): | 208 | for target in self.targets.values(): | ||
208 | # Check each include directory to see if we need to add it.... | 209 | # Check each include directory to see if we need to add it.... | ||
209 | for i in target['include_dirs']: | 210 | for i in target['include_dirs']: | ||
210 | # ignore general folders, as there are no lib specific headers are placed | 211 | # ignore general folders, as there are no lib specific headers are placed | ||
211 | if i == '/usr/include' or i.endswith("/KF5"): | 212 | if i == '/usr/include' or i.endswith("/KF5"): | ||
213 | if not i in additionalIncludes: | ||||
214 | additionalIncludes.append(i) | ||||
212 | continue | 215 | continue | ||
213 | 216 | | |||
214 | # Otherwise, if we don't already have it - add it to the list! | 217 | # Otherwise, if we don't already have it - add it to the list! | ||
215 | if not i in headers: | 218 | if not i in headers: | ||
216 | headers.append(i) | 219 | headers.append(i) | ||
217 | 220 | | |||
218 | # If the library path isn't in the list, then we should add it to the list | 221 | # If the library path isn't in the list, then we should add it to the list | ||
219 | if not target['path'] in libs: | 222 | if not target['path'] in libs: | ||
220 | libs.append(target['path']) | 223 | libs.append(target['path']) | ||
221 | 224 | | |||
222 | # Now we can go ahead and generate the XML file for abi-compliance-checker | 225 | # Now we can go ahead and generate the XML file for abi-compliance-checker | ||
223 | xml = """ | 226 | xml = """ | ||
224 | <version>{version}</version> | 227 | <version>{version}</version> | ||
225 | <headers> | 228 | <headers> | ||
226 | {headers} | 229 | {headers} | ||
227 | </headers> | 230 | </headers> | ||
228 | <libs> | 231 | <libs> | ||
229 | {libs} | 232 | {libs} | ||
230 | </libs> | 233 | </libs> | ||
231 | <skip_include_paths> | 234 | <skip_include_paths> | ||
232 | /usr/lib/python3.6/site-packages/utils/fake_libc_include | 235 | /usr/lib/python3.6/site-packages/utils/fake_libc_include | ||
233 | /usr/include/clang/AST | 236 | /usr/include/clang/AST | ||
234 | /usr/lib64/clang/6.0.1/include | 237 | /usr/lib64/clang/6.0.1/include | ||
235 | </skip_include_paths> | 238 | </skip_include_paths> | ||
236 | """.format(version=version, headers="\n".join(headers), libs="\n".join(libs)) # replace with f-String in Python 3.6 | 239 | <add_include_paths> | ||
240 | {additionalIncludes} | ||||
241 | </add_include_paths> | ||||
242 | """.format(version=version, headers="\n".join(headers), libs="\n".join(libs), additionalIncludes="\n".join(additionalIncludes)) # replace with f-String in Python 3.6 | ||||
237 | 243 | | |||
238 | # Write the generated XML out to a file to pass to abi-compliance-checker | 244 | # Write the generated XML out to a file to pass to abi-compliance-checker | ||
239 | # We will give this to abi-compliance-checker using it's --dump parameter | 245 | # We will give this to abi-compliance-checker using it's --dump parameter | ||
240 | with open("{version}.xml".format(version=version),"w") as f: # replace with f-String in python 3.6 | 246 | with open("{version}.xml".format(version=version),"w") as f: # replace with f-String in python 3.6 | ||
241 | f.write(xml) | 247 | f.write(xml) | ||
242 | 248 | | |||
243 | # acc is compatible for C/C++ as Qt using C++11 and -fPic we need to set the gcc settings explitly | 249 | # acc is compatible for C/C++ as Qt using C++11 and -fPic we need to set the gcc settings explitly | ||
244 | subprocess.check_call(["abi-compliance-checker", "-gcc-options", "-std=c++11 -fPIC", "-l", self.name, "--dump", f.name], env=runtimeEnvironment) | 250 | subprocess.check_call(["abi-compliance-checker", "-gcc-options", "-std=c++11 -fPIC", "-l", self.name, "--dump", f.name], env=runtimeEnvironment) | ||
Show All 33 Lines | 279 | for library in foundLibraries: | |||
278 | # This location is controlled by abi-compliance-checker, but follows a predictable pattern | 284 | # This location is controlled by abi-compliance-checker, but follows a predictable pattern | ||
279 | fileName = "abi_dumps/{name}/{version}/ABI.dump".format(name=library.name,version=library.version) | 285 | fileName = "abi_dumps/{name}/{version}/ABI.dump".format(name=library.name,version=library.version) | ||
280 | 286 | | |||
281 | # Determine the internal version of the library we have found | 287 | # Determine the internal version of the library we have found | ||
282 | # This is based off the CMake package metadata we read in above | 288 | # This is based off the CMake package metadata we read in above | ||
283 | scmRevision = max([t['SONAME'] for t in library.targets.values()]) # a more hackish way, to save the SONAME in the metadata | 289 | scmRevision = max([t['SONAME'] for t in library.targets.values()]) # a more hackish way, to save the SONAME in the metadata | ||
284 | 290 | | |||
285 | # Create a name for this entry in the Package archive and store it there | 291 | # Create a name for this entry in the Package archive and store it there | ||
286 | packageName = "{name}_{scmRevision}".format(name=lib.name, scmRevision=scmRevision) | 292 | packageName = "{name}_{scmRevision}".format(name=library.name, scmRevision=scmRevision) | ||
287 | ourArchive.storePackage(packageName, fileName, scmRevision) | 293 | ourArchive.storePackage(packageName, fileName, scmRevision) |