Commit 5f962445 authored by Sandro Knauß's avatar Sandro Knauß Committed by Ben Cooksley

Switch to the new syntax (spaces -> tabs).

Differential Revision: https://phabricator.kde.org/D17769
parent 1d0f3ed4
......@@ -20,41 +20,41 @@ from helperslib import Packages
from helperslib.Version import Version
class Library:
def __init__(self, packageName, library):
self.packageName = packageName
self.library = library
self.candidates = []
def __init__(self, packageName, library):
self.packageName = packageName
self.library = library
self.candidates = []
def addCandidate(self, key, entry):
entry['packageName'] = key
self.candidates.append(entry)
def addCandidate(self, key, entry):
entry['packageName'] = key
self.candidates.append(entry)
def candidate(self):
"""Find the best candidate to check the ABI against."""
candidate = None
timestamp = self.library["timestamp"]
def candidate(self):
"""Find the best candidate to check the ABI against."""
candidate = None
timestamp = self.library["timestamp"]
if not self.candidates:
return None
if not self.candidates:
return None
# get a list of tagged candidates
released = list(filter(lambda i: i['scmRevision'] in HASH2TAG, self.candidates))
if released:
# get the first released version, that is available
candidate = min(released, key=lambda i: HASH2TAG[i['scmRevision']])
logging.info("Found tag %s(%s) to check against.", HASH2TAG[candidate['scmRevision']].version, candidate['scmRevision'])
else:
#TODO: we may want to return None, as the library was never released so far.
# get a list of tagged candidates
released = list(filter(lambda i: i['scmRevision'] in HASH2TAG, self.candidates))
if released:
# get the first released version, that is available
candidate = min(released, key=lambda i: HASH2TAG[i['scmRevision']])
logging.info("Found tag %s(%s) to check against.", HASH2TAG[candidate['scmRevision']].version, candidate['scmRevision'])
else:
#TODO: we may want to return None, as the library was never released so far.
# get oldest candidate.
candidate = min(self.candidates, key=lambda e:e['timestamp'])
logging.warning("No released version was found, just use the oldest commit.")
# get oldest candidate.
candidate = min(self.candidates, key=lambda e:e['timestamp'])
logging.warning("No released version was found, just use the oldest commit.")
# the candidate needs to be older than the current build.
if timestamp < candidate['timestamp']:
return None
# the candidate needs to be older than the current build.
if timestamp < candidate['timestamp']:
return None
return candidate
return candidate
# Make sure logging is ready to go
......@@ -76,10 +76,10 @@ ourArchive = Packages.Archive(arguments.environment, 'ABIReference', usingCache
# GIT_COMMIT is set by Jenkins Git plugin, so we can rely on that for most of our builds
scmRevision = ''
if os.getenv('GIT_COMMIT') != '':
scmRevision = os.getenv('GIT_COMMIT')
scmRevision = os.getenv('GIT_COMMIT')
if not scmRevision:
scmRevision = subprocess.check_output(["git", "log", "--format=%H", "-n 1", "HEAD"]).strip().decode()
scmRevision = subprocess.check_output(["git", "log", "--format=%H", "-n 1", "HEAD"]).strip().decode()
# get all tags that are in the current commit
tags = subprocess.check_output(["git", "tag", "--merged", scmRevision]).strip().decode().splitlines()
......@@ -115,55 +115,55 @@ for key, entry in ourArchive.serverManifest.items():
# * 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"]
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'])
libname = l.library["libname"]
soname = l.library["SONAME"]
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'])
# Check every libraries ABI and do not fail, if one is not fine.
# Safe the overall retval state
retval = 0
for l in libraries:
library = l.library
libname = library['libname']
logging.info("Do an ABI check for %s", libname)
candidate = l.candidate()
if not candidate:
logging.info("Did not found any older build for %s, nothing to check ABI against.",libname)
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'])
# check ABI and write compat reports
cmd = ["abi-compliance-checker",
"-report-path", "compat_reports/{libname}_compat_report.html".format(libname=libname),
"-l", libname,
"--old", oldLibraryPath,
"--new", newLibraryPath]
ret = subprocess.call(cmd)
if ret != 0:
logging.error("abi-compliance-checker exited with %s", ret)
retval = ret
library = l.library
libname = library['libname']
logging.info("Do an ABI check for %s", libname)
candidate = l.candidate()
if not candidate:
logging.info("Did not found any older build for %s, nothing to check ABI against.",libname)
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'])
# check ABI and write compat reports
cmd = ["abi-compliance-checker",
"-report-path", "compat_reports/{libname}_compat_report.html".format(libname=libname),
"-l", libname,
"--old", oldLibraryPath,
"--new", newLibraryPath]
ret = subprocess.call(cmd)
if ret != 0:
logging.error("abi-compliance-checker exited with %s", ret)
retval = ret
# We had an issue with one of the ABIs
if retval != 0:
sys.exit(retval)
sys.exit(retval)
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