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.

(From OE-Core rev: 200159125eb6bcfc046c45cf5160b2eb340625e3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2012-02-13 14:41:44 +00:00 committed by Richard Purdie
parent 9eab86041f
commit 7b3ea97051
1 changed files with 12 additions and 4 deletions

View File

@ -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')