From c9cc652e88ddedddf8a2f23fb9b8c024616526d7 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Wed, 5 Nov 2014 13:21:58 -0600 Subject: image-buildinfo.bbclass: new class, writes build information to image Writes build information to target filesystem on /etc/build such as enabled layers, their current status and commit. squashspaces was moved to oe/utils.py to make it available to different classes and avoid code duplication. [YOCTO #6770] Signed-off-by: Alejandro Hernandez Signed-off-by: Ross Burton --- meta/classes/buildhistory.bbclass | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'meta/classes/buildhistory.bbclass') diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 8b5d5c214c..2b5f84a87a 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -155,7 +155,7 @@ python buildhistory_emit_pkghistory() { with open(os.path.join(pkgdata_dir, pn)) as f: for line in f.readlines(): if line.startswith('PACKAGES: '): - packages = squashspaces(line.split(': ', 1)[1]) + packages = oe.utils.squashspaces(line.split(': ', 1)[1]) break except IOError as e: if e.errno == errno.ENOENT: @@ -181,7 +181,7 @@ python buildhistory_emit_pkghistory() { rcpinfo.pe = pe rcpinfo.pv = pv rcpinfo.pr = pr - rcpinfo.depends = sortlist(squashspaces(d.getVar('DEPENDS', True) or "")) + rcpinfo.depends = sortlist(oe.utils.squashspaces(d.getVar('DEPENDS', True) or "")) rcpinfo.packages = packages write_recipehistory(rcpinfo, d) @@ -222,13 +222,13 @@ python buildhistory_emit_pkghistory() { pkginfo.pkge = pkge pkginfo.pkgv = pkgv pkginfo.pkgr = pkgr - pkginfo.rprovides = sortpkglist(squashspaces(pkgdata.get('RPROVIDES', ""))) - pkginfo.rdepends = sortpkglist(squashspaces(pkgdata.get('RDEPENDS', ""))) - pkginfo.rrecommends = sortpkglist(squashspaces(pkgdata.get('RRECOMMENDS', ""))) - pkginfo.rsuggests = sortpkglist(squashspaces(pkgdata.get('RSUGGESTS', ""))) - pkginfo.rreplaces = sortpkglist(squashspaces(pkgdata.get('RREPLACES', ""))) - pkginfo.rconflicts = sortpkglist(squashspaces(pkgdata.get('RCONFLICTS', ""))) - pkginfo.files = squashspaces(pkgdata.get('FILES', "")) + pkginfo.rprovides = sortpkglist(oe.utils.squashspaces(pkgdata.get('RPROVIDES', ""))) + pkginfo.rdepends = sortpkglist(oe.utils.squashspaces(pkgdata.get('RDEPENDS', ""))) + pkginfo.rrecommends = sortpkglist(oe.utils.squashspaces(pkgdata.get('RRECOMMENDS', ""))) + pkginfo.rsuggests = sortpkglist(oe.utils.squashspaces(pkgdata.get('RSUGGESTS', ""))) + pkginfo.rreplaces = sortpkglist(oe.utils.squashspaces(pkgdata.get('RREPLACES', ""))) + pkginfo.rconflicts = sortpkglist(oe.utils.squashspaces(pkgdata.get('RCONFLICTS', ""))) + pkginfo.files = oe.utils.squashspaces(pkgdata.get('FILES', "")) for filevar in pkginfo.filevars: pkginfo.filevars[filevar] = pkgdata.get(filevar, "") @@ -525,11 +525,6 @@ def buildhistory_get_metadata_revs(d): for i in layers] return '\n'.join(medadata_revs) - -def squashspaces(string): - import re - return re.sub("\s+", " ", string).strip() - def outputvars(vars, listvars, d): vars = vars.split() listvars = listvars.split() @@ -538,7 +533,7 @@ def outputvars(vars, listvars, d): value = d.getVar(var, True) or "" if var in listvars: # Squash out spaces - value = squashspaces(value) + value = oe.utils.squashspaces(value) ret += "%s = %s\n" % (var, value) return ret.rstrip('\n') -- cgit v1.2.3