insane: improve package_qa_clean_path

Instead of just removing TMPDIR from the path for display, optionally allow a
package to be passed and remove PKGDEST/package too.

This means that messages that specify a package name can pass that name and the
resulting path will be absolute inside that package.

(From OE-Core rev: 55061a43926baf6ff0e17aed02efd299ebba3c24)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2016-08-18 17:33:31 +01:00
committed by Richard Purdie
parent 86164406dd
commit edec1c4e1d

View File

@@ -179,9 +179,14 @@ def package_qa_get_machine_dict(d):
return machdata
def package_qa_clean_path(path,d):
""" Remove the common prefix from the path. In this case it is the TMPDIR"""
return path.replace(d.getVar("TMPDIR", True) + "/", "")
def package_qa_clean_path(path, d, pkg=None):
"""
Remove redundant paths from the path for display. If pkg isn't set then
TMPDIR is stripped, otherwise PKGDEST/pkg is stripped.
"""
if pkg:
path = path.replace(os.path.join(d.getVar("PKGDEST", True), pkg), "/")
return path.replace(d.getVar("TMPDIR", True), "/").replace("//", "/")
def package_qa_write_error(type, error, d):
logfile = d.getVar('QA_LOGFILE', True)