From 200159125eb6bcfc046c45cf5160b2eb340625e3 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 13 Feb 2012 14:41:44 +0000 Subject: classes/buildhistory: squash spaces out of image variables Values of image variables that are lists (e.g. IMAGE_INSTALL) are easier to read if there are no extraneous spaces in them, so ensure that there is only one space between each item. Signed-off-by: Paul Eggleton --- meta/classes/buildhistory.bbclass | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 1b6b2493e4..d1a9670c29 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -123,9 +123,6 @@ python buildhistory_emit_pkghistory() { except EnvironmentError: return None - def squashspaces(string): - return re.sub("\s+", " ", string) - def sortpkglist(string): pkgiter = re.finditer(r'[a-zA-Z0-9.-]+( \([><=]+ [^ )]+\))?', string, 0) pkglist = [p.group(0) for p in pkgiter] @@ -349,12 +346,23 @@ def buildhistory_get_layers(d): return layertext +def squashspaces(string): + import re + return re.sub("\s+", " ", string).strip() + + def buildhistory_get_imagevars(d): imagevars = "DISTRO DISTRO_VERSION USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS ROOTFS_POSTPROCESS_COMMAND IMAGE_POSTPROCESS_COMMAND" + listvars = "USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS" + imagevars = imagevars.split() + listvars = listvars.split() ret = "" - for var in imagevars.split(): + for var in imagevars: value = d.getVar(var, True) or "" + if var in listvars: + # Squash out spaces + value = squashspaces(value) ret += "%s = %s\n" % (var, value) return ret.rstrip('\n') -- cgit v1.2.3