Commit 711259ce authored by Sandro Knauß's avatar Sandro Knauß Committed by Ben Cooksley

Change from using the CMake package name to using the library name instead.

This handles the case of when the library name changes but the CMake package name stays the same (as different versions of Kasten do)

The metadata is versioned to allow for older builds to continue to be used.

Differential Revision: https://phabricator.kde.org/D19222
parent 123c2a82
Pipeline #1139 skipped with stage
......@@ -121,39 +121,70 @@ if arguments.branchGroup != "kf5-qt5":
# Find all libraries, that are build with the same git commit
libraries = []
def updateAccMetadataVersion(entry):
if not 'accMetadataVersion' in entry:
updateAccMetadataVersion1(entry)
elif entry["accMetadataVersion"] == 2:
return
def updateAccMetadataVersion1(entry):
entry["accMetadataVersion"] = 1
entry["cmakePackage"] = entry["libname"]
entry["targets"] = {i:entry["SONAME"] for i in entry["targets"]}
for key, entry in ourArchive.serverManifest.items():
try:
if entry['platform'] != arguments.platform:
continue
if entry["branchGroup"] != arguments.branchGroup:
continue
if entry["project"] == arguments.project and entry["scmRevision"] == scmRevision:
libraries.append(Library(key,entry))
except KeyError:
continue
updateAccMetadataVersion(entry)
try:
if entry['platform'] != arguments.platform:
continue
if entry["branchGroup"] != arguments.branchGroup:
continue
if entry["project"] == arguments.project and entry["scmRevision"] == scmRevision:
libraries.append(Library(key, entry))
except KeyError:
continue
# Find all availabe reference dumps
# * same libname
# * same cmakePackage
# * same SONAME otherwise we have a ABI bump and than it is safe to break ABI
for l in libraries:
libname = l.library["libname"]
soname = l.library["SONAME"]
cmakePackage = l.library["cmakePackage"]
targets = l.library["targets"]
soname = max(targets.values())
for key, entry in ourArchive.serverManifest.items():
if key == l.packageName:
continue
if entry['platform'] != arguments.platform:
continue
# We want to search for the library
if entry["libname"] == libname:
# only interested, for builds with the same SONAME
if entry['SONAME'] == soname:
l.addCandidate(key, entry)
elif entry['SONAME'] > soname:
# Ignore new SONAMEs on other branchGroups.
if keepBuildGroup and entry["branchGroup"] != arguments.branchGroup:
continue
logging.warning("We searched for SONAME = %s, but found a newer SONAME = %s in the builds, that should not happen, as SONAMEs should only rise and never go lower!", soname, entry['SONAME'])
# We want to search for the cmakePackage
if entry["cmakePackage"] != cmakePackage:
continue
# Ignore builds on other branches
if keepBuildGroup and entry["branchGroup"] != arguments.branchGroup:
continue
# TODO: as we may have bundled multiple libraries in one cmakePackage,
# we properly need a smater way.
if max(entry["targets"].values()) == soname:
l.addCandidate(key, entry)
continue
sameSONAME = False
for name, target in targets.items():
try:
if entry["targets"][name] == target:
sameSONAME = True
elif entry["targets"][name] > target:
logging.warning("%s: %s has SONAME = %s, but we searched for SONAME %s", entry['scmRevision'], name, entry["targets"][name], target)
except KeyError:
if entry["accMetadataVersion"] == 2:
logging.warning("%s: %s is missing.", entry['scmRevision'], name)
if sameSONAME:
l.addCandidate(key, entry)
# Check every libraries ABI and do not fail, if one is not fine.
# Safe the overall retval state
......@@ -164,11 +195,11 @@ resultsYamlFile = {}
for l in libraries:
library = l.library
libname = library['libname']
logging.info("Do an ABI check for %s", libname)
cmakePackage = library['cmakePackage']
logging.info("Do an ABI check for %s", cmakePackage)
candidate = l.candidate()
if not candidate:
logging.info("Did not found any older build for %s, nothing to check ABI against.",libname)
logging.info("Did not found any older build for %s, nothing to check ABI against.", cmakePackage)
continue
# get the packages, we want to test against each other
......@@ -177,7 +208,7 @@ for l in libraries:
logging.info("check %s(old) -> %s(new)", candidate['scmRevision'], library['scmRevision'])
reportPath = "compat_reports/{libname}_compat_report.html".format(libname=libname)
reportPath = "compat_reports/{cmakePackage}_compat_report.html".format(cmakePackage=cmakePackage)
# Basic result yml information
yml = {
......@@ -185,7 +216,7 @@ for l in libraries:
'ownCommit': scmRevision,
'otherCommit': candidate['scmRevision'],
}
resultsYamlFile[libname] = yml
resultsYamlFile[cmakePackage] = yml
if candidate['scmRevision'] in HASH2TAG:
yml['tag'] = HASH2TAG[candidate['scmRevision']].version
......@@ -194,7 +225,7 @@ for l in libraries:
cmd = [
"abi-compliance-checker",
"-report-path", reportPath,
"-l", libname,
"-l", cmakePackage,
"--old", oldLibraryPath,
"--new", newLibraryPath,
]
......
......@@ -193,18 +193,19 @@ class Library:
return d
# Process the various targets our parser found
for t,value in self.__parser_output["targets"].items():
for t, value in self.__parser_output["targets"].items():
# Particularly, we want to extract:
# Library names (sonames)
# The path to the CMake library package
# Any include directories specified by the CMake library package
try:
relib= re.match("^(?P<name>.*)\.so\.(?P<SONAME>.*)$", value["IMPORTED_SONAME_DEBUG"][0])
target = {
"SONAME": re.search("\.([\d]*)$",value["IMPORTED_SONAME_DEBUG"][0]).group(1),
"SONAME": relib.group("SONAME"),
"path": value["IMPORTED_LOCATION_DEBUG"][0],
"include_dirs": parseIncludeDirs(value["INTERFACE_INCLUDE_DIRECTORIES"]),
}
self.targets[t]=target
self.targets[relib.group("name")]=target
except IndexError:
pass
......@@ -353,10 +354,10 @@ for library in foundLibraries:
fileName = "abi_dumps/{name}/{version}/ABI.dump".format(name=library.name,version=library.version)
extraMetadata = {
"SONAME": max([t['SONAME'] for t in library.targets.values()]), # use max because there may be more than one lib inside
"accMetadataVersion": 2,
"version": library.version,
"libname": library.name,
"targets": list(library.targets),
"cmakePackage": library.name,
"targets": {n:l["SONAME"] for n,l in library.targets.items()},
"project": arguments.project,
"branchGroup": arguments.branchGroup,
"platform": arguments.platform,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment