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": ...@@ -121,39 +121,70 @@ if arguments.branchGroup != "kf5-qt5":
# Find all libraries, that are build with the same git commit # Find all libraries, that are build with the same git commit
libraries = [] 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(): for key, entry in ourArchive.serverManifest.items():
try: updateAccMetadataVersion(entry)
if entry['platform'] != arguments.platform: try:
continue if entry['platform'] != arguments.platform:
if entry["branchGroup"] != arguments.branchGroup: continue
continue if entry["branchGroup"] != arguments.branchGroup:
if entry["project"] == arguments.project and entry["scmRevision"] == scmRevision: continue
libraries.append(Library(key,entry)) if entry["project"] == arguments.project and entry["scmRevision"] == scmRevision:
except KeyError: libraries.append(Library(key, entry))
continue except KeyError:
continue
# Find all availabe reference dumps # 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 # * same SONAME otherwise we have a ABI bump and than it is safe to break ABI
for l in libraries: for l in libraries:
libname = l.library["libname"] cmakePackage = l.library["cmakePackage"]
soname = l.library["SONAME"] targets = l.library["targets"]
soname = max(targets.values())
for key, entry in ourArchive.serverManifest.items(): for key, entry in ourArchive.serverManifest.items():
if key == l.packageName: if key == l.packageName:
continue continue
if entry['platform'] != arguments.platform: if entry['platform'] != arguments.platform:
continue continue
# We want to search for the library
if entry["libname"] == libname: # We want to search for the cmakePackage
# only interested, for builds with the same SONAME if entry["cmakePackage"] != cmakePackage:
if entry['SONAME'] == soname: continue
l.addCandidate(key, entry)
elif entry['SONAME'] > soname: # Ignore builds on other branches
# Ignore new SONAMEs on other branchGroups. if keepBuildGroup and entry["branchGroup"] != arguments.branchGroup:
if keepBuildGroup and entry["branchGroup"] != arguments.branchGroup: continue
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']) # 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. # Check every libraries ABI and do not fail, if one is not fine.
# Safe the overall retval state # Safe the overall retval state
...@@ -164,11 +195,11 @@ resultsYamlFile = {} ...@@ -164,11 +195,11 @@ resultsYamlFile = {}
for l in libraries: for l in libraries:
library = l.library library = l.library
libname = library['libname'] cmakePackage = library['cmakePackage']
logging.info("Do an ABI check for %s", libname) logging.info("Do an ABI check for %s", cmakePackage)
candidate = l.candidate() candidate = l.candidate()
if not 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 continue
# get the packages, we want to test against each other # get the packages, we want to test against each other
...@@ -177,7 +208,7 @@ for l in libraries: ...@@ -177,7 +208,7 @@ for l in libraries:
logging.info("check %s(old) -> %s(new)", candidate['scmRevision'], library['scmRevision']) 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 # Basic result yml information
yml = { yml = {
...@@ -185,7 +216,7 @@ for l in libraries: ...@@ -185,7 +216,7 @@ for l in libraries:
'ownCommit': scmRevision, 'ownCommit': scmRevision,
'otherCommit': candidate['scmRevision'], 'otherCommit': candidate['scmRevision'],
} }
resultsYamlFile[libname] = yml resultsYamlFile[cmakePackage] = yml
if candidate['scmRevision'] in HASH2TAG: if candidate['scmRevision'] in HASH2TAG:
yml['tag'] = HASH2TAG[candidate['scmRevision']].version yml['tag'] = HASH2TAG[candidate['scmRevision']].version
...@@ -194,7 +225,7 @@ for l in libraries: ...@@ -194,7 +225,7 @@ for l in libraries:
cmd = [ cmd = [
"abi-compliance-checker", "abi-compliance-checker",
"-report-path", reportPath, "-report-path", reportPath,
"-l", libname, "-l", cmakePackage,
"--old", oldLibraryPath, "--old", oldLibraryPath,
"--new", newLibraryPath, "--new", newLibraryPath,
] ]
......
...@@ -193,18 +193,19 @@ class Library: ...@@ -193,18 +193,19 @@ class Library:
return d return d
# Process the various targets our parser found # 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: # Particularly, we want to extract:
# Library names (sonames) # Library names (sonames)
# The path to the CMake library package # The path to the CMake library package
# Any include directories specified by the CMake library package # Any include directories specified by the CMake library package
try: try:
relib= re.match("^(?P<name>.*)\.so\.(?P<SONAME>.*)$", value["IMPORTED_SONAME_DEBUG"][0])
target = { target = {
"SONAME": re.search("\.([\d]*)$",value["IMPORTED_SONAME_DEBUG"][0]).group(1), "SONAME": relib.group("SONAME"),
"path": value["IMPORTED_LOCATION_DEBUG"][0], "path": value["IMPORTED_LOCATION_DEBUG"][0],
"include_dirs": parseIncludeDirs(value["INTERFACE_INCLUDE_DIRECTORIES"]), "include_dirs": parseIncludeDirs(value["INTERFACE_INCLUDE_DIRECTORIES"]),
} }
self.targets[t]=target self.targets[relib.group("name")]=target
except IndexError: except IndexError:
pass pass
...@@ -353,10 +354,10 @@ for library in foundLibraries: ...@@ -353,10 +354,10 @@ for library in foundLibraries:
fileName = "abi_dumps/{name}/{version}/ABI.dump".format(name=library.name,version=library.version) fileName = "abi_dumps/{name}/{version}/ABI.dump".format(name=library.name,version=library.version)
extraMetadata = { 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, "version": library.version,
"libname": library.name, "cmakePackage": library.name,
"targets": list(library.targets), "targets": {n:l["SONAME"] for n,l in library.targets.items()},
"project": arguments.project, "project": arguments.project,
"branchGroup": arguments.branchGroup, "branchGroup": arguments.branchGroup,
"platform": arguments.platform, "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