Skip to content
Snippets Groups Projects
Commit c5bca7e2 authored by Pavel Zhukov's avatar Pavel Zhukov
Browse files

abicheck: Add mechanism to disable abicheck of files


abidw may fail on some files causing build to fail. This is not
acceptable in CI. Adding mechanism to allow suppression of separate
files.

Signed-off-by: default avatarPavel Zhukov <pavel.zhukov@huawei.com>
parent 750713a2
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,10 @@ The ABI check can be activated by appending the `abicheck` bbclass to the bbclas ...@@ -21,6 +21,10 @@ The ABI check can be activated by appending the `abicheck` bbclass to the bbclas
The tool used for the ABI info serialization is [abidw](https://sourceware.org/libabigail/manual/abidw.html). The tool used for the ABI info serialization is [abidw](https://sourceware.org/libabigail/manual/abidw.html).
If order to skip serialization of the file modify "BINARY_AUDIT_SUPPRESSED_FILES" variable to be the filepath of that file:
`BINARY_AUDIT_SUPPRESSED_FILES:[pn-package_name]:append = " relative/path/to/D/path/to/file " `
## ABI compatibility ## ABI compatibility
The serialized ABI representation will be integrated into the build history. Saving the build history will allow to compare the current build The serialized ABI representation will be integrated into the build history. Saving the build history will allow to compare the current build
......
...@@ -35,17 +35,21 @@ def binary_audit_gather_abixml(d): ...@@ -35,17 +35,21 @@ def binary_audit_gather_abixml(d):
kv = d.getVar("KERNEL_VERSION") kv = d.getVar("KERNEL_VERSION")
artifact_dir = d.getVar("IMG_DIR") artifact_dir = d.getVar("IMG_DIR")
ltree = os.path.join(artifact_dir, "usr", "lib", "modules") ltree = os.path.join(artifact_dir, "usr", "lib", "modules")
suppressed_files = d.getVar("BINARY_AUDIT_SUPPRESSED_FILES")
topdir = d.getVar("D")
if suppressed_files is not None:
suppressed_files = [os.path.join(topdir, f.strip()) for f in suppressed_files.split(" ")]
if kv and os.path.isdir(ltree): if kv and os.path.isdir(ltree):
# XXX This vmlinux lookup method is very vague # XXX This vmlinux lookup method is very vague
ptr = os.path.join(d.getVar("WORKDIR"), "..", "..", d.getVar("PREFERRED_PROVIDER_virtual/kernel"), "*", "*", "vmlinux") ptr = os.path.join(d.getVar("WORKDIR"), "..", "..", d.getVar("PREFERRED_PROVIDER_virtual/kernel"), "*", "*", "vmlinux")
vmlinux = glob.glob(ptr)[0] vmlinux = glob.glob(ptr)[0]
whitelist = None whitelist = None
out, out_fn = abicheck.serialize_kernel_artifacts(abixml_dir, ltree, vmlinux, whitelist) out, out_fn = abicheck.serialize_kernel_artifacts(abixml_dir, ltree, vmlinux, whitelist, suppressed_files)
with open(out_fn, "w") as f: with open(out_fn, "w") as f:
f.write(out) f.write(out)
f.close() f.close()
else: else:
for out, out_fn in abicheck.serialize_artifacts(abixml_dir, artifact_dir): for out, out_fn in abicheck.serialize_artifacts(abixml_dir, artifact_dir, suppressed_files):
with open(out_fn, "w") as f: with open(out_fn, "w") as f:
f.write(out) f.write(out)
f.close() f.close()
......
...@@ -86,13 +86,15 @@ def compare(ref, cur, suppr=[]): ...@@ -86,13 +86,15 @@ def compare(ref, cur, suppr=[]):
return process.returncode, out, cmd return process.returncode, out, cmd
def serialize_artifacts(adir, id): def serialize_artifacts(adir, id, suppressed_files = None):
''' Recursively serialize binary artifacts starting at the given image directory(id), yields serialized output and filename ''' Recursively serialize binary artifacts starting at the given image directory(id), yields serialized output and filename
Parameters: Parameters:
adir (str): path to abixml directory adir (str): path to abixml directory
id (str): image directory- result of calling d.getVar("IMG_DIR") id (str): image directory- result of calling d.getVar("IMG_DIR")
''' '''
for fn in glob.iglob(id + "/**/**", recursive=True): for fn in glob.iglob(id + "/**/**", recursive=True):
if suppressed_files is not None and fn in suppressed_files:
continue
if os.path.isfile(fn) and not os.path.islink(fn): if os.path.isfile(fn) and not os.path.islink(fn):
is_elf_artifact = False is_elf_artifact = False
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment