Patchwork [1/7] classes/buildhistory: squash spaces out of image variables

login
register
mail settings
Submitter Paul Eggleton
Date Feb. 14, 2012, 1:40 p.m.
Message ID <015c5eb8f18fbe93b5d3551b824ef9961d87fb51.1329226672.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/21249/
State Accepted
Commit 200159125eb6bcfc046c45cf5160b2eb340625e3
Headers show

Comments

Paul Eggleton - Feb. 14, 2012, 1:40 p.m.
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 <paul.eggleton@linux.intel.com>
---
 meta/classes/buildhistory.bbclass |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 1b6b249..d1a9670 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')