diff --git a/helpers/check-abi.py b/helpers/check-abi.py --- a/helpers/check-abi.py +++ b/helpers/check-abi.py @@ -121,39 +121,70 @@ # 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,37 +195,37 @@ 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 newLibraryPath, _ = ourArchive.retrievePackage(l.packageName) oldLibraryPath, _ = ourArchive.retrievePackage(candidate['packageName']) 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 = { 'reportPath': reportPath, 'ownCommit': scmRevision, 'otherCommit': candidate['scmRevision'], } - resultsYamlFile[libname] = yml + resultsYamlFile[cmakePackage] = yml if candidate['scmRevision'] in HASH2TAG: yml['tag'] = HASH2TAG[candidate['scmRevision']].version # check ABI and write compat reports cmd = [ "abi-compliance-checker", "-report-path", reportPath, - "-l", libname, + "-l", cmakePackage, "--old", oldLibraryPath, "--new", newLibraryPath, ] diff --git a/helpers/create-abi-dump.py b/helpers/create-abi-dump.py --- a/helpers/create-abi-dump.py +++ b/helpers/create-abi-dump.py @@ -193,18 +193,19 @@ 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.*)\.so\.(?P.*)$", 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 @@ 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,