Skip to contentSkip to conversation

buildhistory: rename build-id to build-id.txt and add more info

PATCH In review Martin Jansa 2 participants 4 messages Jul 25, 2014 – Aug 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildhistory: rename build-id to build-id.txt and add more info

* use .txt extension like other reports (e.g. image-info.txt) it's also useful when looking at the file from web server which doesn't have text/plain as default content-type
* include whole BUILDCFG_HEADER/BUILDCFG_FUNCS instead of just layer info
* this makes it easier for distro to include more fields without the need to modify buildhistory.bbclass
* currently it adds following fields:
Build Configuration:

  BB_VERSION        = "1.23.1"
  BUILD_SYS         = "x86_64-linux"
  NATIVELSBSTRING   = "Gentoo-2.2"
  TARGET_SYS        = "x86_64-oe-linux"
  MACHINE           = "qemux86-64"
  DISTRO            = "shr"
  DISTRO_VERSION    = "2013.07-next-20140725"
  TUNE_FEATURES     = "m64 core2"
  TARGET_FPU        = ""
---
 meta/classes/buildhistory.bbclass | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
meta/classes/buildhistory.bbclass +18 -8
index 20382ce..479e460 100644
@@ -461,10 +461,10 @@ END
 	echo "IMAGESIZE = $imagesize" >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt
 
 	# Add some configuration information
-	echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id
+	echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id.txt
 
-	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id <<END
-${@buildhistory_get_layers(d)}
+	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id.txt <<END
+${@buildhistory_get_build_id(d)}
 END
 }
 
@@ -498,11 +498,21 @@ POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_list_installed_sdk_host ;
 
 SDK_POSTPROCESS_COMMAND += "buildhistory_get_sdkinfo ; "
 
-def buildhistory_get_layers(d):
-    if d.getVar('BB_WORKERCONTEXT', True) != '1':
-        return ""
-    layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d))
-    return layertext
+def buildhistory_get_build_id(d):
+    localdata = bb.data.createCopy(d)
+    bb.data.update_data(localdata)
+    statuslines = []
+    for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
+        g = globals()
+        if func not in g:
+            bb.warn("Build configuration function '%s' does not exist" % func)
+        else:
+            flines = g[func](localdata)
+            if flines:
+                statuslines.extend(flines)
+
+    statusheader = d.getVar('BUILDCFG_HEADER', True)
+    return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
 
 def buildhistory_get_metadata_revs(d):
     # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
Signature · 1 line
2.0.2
#1 lore raw
Quoted 9 lines · Martin Jansa

* use .txt extension like other reports (e.g. image-info.txt) it's also useful when looking at the file from web server which doesn't have text/plain as default content-type
* include whole BUILDCFG_HEADER/BUILDCFG_FUNCS instead of just layer info
* this makes it easier for distro to include more fields without the need to modify buildhistory.bbclass
* currently it adds following fields:
Build Configuration:

Quoted 9 lines
  BB_VERSION        = "1.23.1"
  BUILD_SYS         = "x86_64-linux"
  NATIVELSBSTRING   = "Gentoo-2.2"
  TARGET_SYS        = "x86_64-oe-linux"
  MACHINE           = "qemux86-64"
  DISTRO            = "shr"
  DISTRO_VERSION    = "2013.07-next-20140725"
  TUNE_FEATURES     = "m64 core2"
  TARGET_FPU        = ""

ping

Quoted 54 lines
---
 meta/classes/buildhistory.bbclass | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
meta/classes/buildhistory.bbclass +18 -8
index 20382ce..479e460 100644
@@ -461,10 +461,10 @@ END
 	echo "IMAGESIZE = $imagesize" >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt
 
 	# Add some configuration information
-	echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id
+	echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id.txt
 
-	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id <<END
-${@buildhistory_get_layers(d)}
+	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id.txt <<END
+${@buildhistory_get_build_id(d)}
 END
 }
 
@@ -498,11 +498,21 @@ POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_list_installed_sdk_host ;
 
 SDK_POSTPROCESS_COMMAND += "buildhistory_get_sdkinfo ; "
 
-def buildhistory_get_layers(d):
-    if d.getVar('BB_WORKERCONTEXT', True) != '1':
-        return ""
-    layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d))
-    return layertext
+def buildhistory_get_build_id(d):
+    localdata = bb.data.createCopy(d)
+    bb.data.update_data(localdata)
+    statuslines = []
+    for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
+        g = globals()
+        if func not in g:
+            bb.warn("Build configuration function '%s' does not exist" % func)
+        else:
+            flines = g[func](localdata)
+            if flines:
+                statuslines.extend(flines)
+
+    statusheader = d.getVar('BUILDCFG_HEADER', True)
+    return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
 
 def buildhistory_get_metadata_revs(d):
     # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
Signature · 1 line
2.0.2
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
Acked-by
#2 lore raw
Quoted 83 lines · On Saturday 16 August 2014 20:21:09 Martin Jansa wrote:
Quoted 15 lines · Martin Jansa

* use .txt extension like other reports (e.g. image-info.txt) it's

also useful when looking at the file from web server which doesn't have text/plain as default content-type

* include whole BUILDCFG_HEADER/BUILDCFG_FUNCS instead of just layer

info

* this makes it easier for distro to include more fields without the

need to modify buildhistory.bbclass

* currently it adds following fields:
Build Configuration:

Quoted 9 lines
  BB_VERSION        = "1.23.1"
  BUILD_SYS         = "x86_64-linux"
  NATIVELSBSTRING   = "Gentoo-2.2"
  TARGET_SYS        = "x86_64-oe-linux"
  MACHINE           = "qemux86-64"
  DISTRO            = "shr"
  DISTRO_VERSION    = "2013.07-next-20140725"
  TUNE_FEATURES     = "m64 core2"
  TARGET_FPU        = ""

ping

Quoted 55 lines

---

 meta/classes/buildhistory.bbclass | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/meta/classes/buildhistory.bbclass index 20382ce..479e460 100644

meta/classes/buildhistory.bbclass +0 -1
@@ -461,10 +461,10 @@ END
 
 	echo "IMAGESIZE = $imagesize" >>
 	${BUILDHISTORY_DIR_IMAGE}/image-info.txt
 
 	# Add some configuration information
 
-	echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO}

${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id + echo
"${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id.txt

meta/classes/buildhistory.bbclass +2 -2
-	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id <<END
-${@buildhistory_get_layers(d)}
+	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id.txt <<END
+${@buildhistory_get_build_id(d)}
 
 END
 }
@@ -498,11 +498,21 @@ POPULATE_SDK_POST_HOST_COMMAND_append = "

buildhistory_list_installed_sdk_host ;>
SDK_POSTPROCESS_COMMAND += "buildhistory_get_sdkinfo ; "

meta/classes/buildhistory.bbclass +0 -4
-def buildhistory_get_layers(d):
-    if d.getVar('BB_WORKERCONTEXT', True) != '1':
-        return ""
-    layertext = "Configured metadata layers:\n%s\n" %

'\n'.join(get_layers_branch_rev(d)) - return layertext

meta/classes/buildhistory.bbclass +8 -0
+def buildhistory_get_build_id(d):
+    localdata = bb.data.createCopy(d)
+    bb.data.update_data(localdata)
+    statuslines = []
+    for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
+        g = globals()
+        if func not in g:
+            bb.warn("Build configuration function '%s' does not exist" %

func) + else:

meta/classes/buildhistory.bbclass +6 -0
+            flines = g[func](localdata)
+            if flines:
+                statuslines.extend(flines)
+
+    statusheader = d.getVar('BUILDCFG_HEADER', True)
+    return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
Quoted 3 lines
Quoted 3 lines

def buildhistory_get_metadata_revs(d):
# We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want

Sorry I looked at this earlier and it looked OK to me then, I should have acked it already.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#3 lore raw
Quoted 59 lines · Paul Eggleton
Quoted 58 lines · On Saturday 16 August 2014 20:21:09 Martin Jansa wrote:
Quoted 15 lines · Martin Jansa

* use .txt extension like other reports (e.g. image-info.txt) it's

also useful when looking at the file from web server which doesn't have text/plain as default content-type

* include whole BUILDCFG_HEADER/BUILDCFG_FUNCS instead of just layer

info

* this makes it easier for distro to include more fields without the

need to modify buildhistory.bbclass

* currently it adds following fields:
Build Configuration:

Quoted 9 lines
  BB_VERSION        = "1.23.1"
  BUILD_SYS         = "x86_64-linux"
  NATIVELSBSTRING   = "Gentoo-2.2"
  TARGET_SYS        = "x86_64-oe-linux"
  MACHINE           = "qemux86-64"
  DISTRO            = "shr"
  DISTRO_VERSION    = "2013.07-next-20140725"
  TUNE_FEATURES     = "m64 core2"
  TARGET_FPU        = ""

ping

Quoted 30 lines

---

 meta/classes/buildhistory.bbclass | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/meta/classes/buildhistory.bbclass index 20382ce..479e460 100644

meta/classes/buildhistory.bbclass +0 -1
@@ -461,10 +461,10 @@ END
 
 	echo "IMAGESIZE = $imagesize" >>
 	${BUILDHISTORY_DIR_IMAGE}/image-info.txt
 
 	# Add some configuration information
 
-	echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO}

${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id + echo
"${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id.txt

meta/classes/buildhistory.bbclass +2 -2
-	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id <<END
-${@buildhistory_get_layers(d)}
+	cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id.txt <<END
+${@buildhistory_get_build_id(d)}
 
 END
 }
Quoted 7 lines
Quoted 7 lines

meta/classes/buildhistory.bbclass POPULATE_SDK_POST_HOST_COMMAND_append = " buildhistory_list_installed_sdk_host ; · line 503

Quoted 7 lines
meta/classes/buildhistory.bbclass +0 -0
@@ -498,11 +498,21 @@ POPULATE_SDK_POST_HOST_COMMAND_append = "

buildhistory_list_installed_sdk_host ;>
SDK_POSTPROCESS_COMMAND += "buildhistory_get_sdkinfo ; "

meta/classes/buildhistory.bbclass +0 -3
-def buildhistory_get_layers(d):
-    if d.getVar('BB_WORKERCONTEXT', True) != '1':
-        return ""

I've just noticed that I've unintentionally removed these 2 lines, which were added in:
commit 540a2a30be21c3eca4323efbe91e7dcfc31a4c97
Author: Paul Eggleton <[email protected]>
Date: Mon Dec 2 18:50:50 2013 +0000

classes/buildhistory: reduce parsing time

Disable several python functions if not parsing within the worker context. This avoids executing expensive operations while parsing recipes (which is unnecessary).

and I believe still useful, I'll send another commit to restore it.

Quoted 34 lines
Quoted 18 lines
Quoted 18 lines

- layertext = "Configured metadata layers:\n%s\n" %
'\n'.join(get_layers_branch_rev(d)) - return layertext

meta/classes/buildhistory.bbclass +8 -0
+def buildhistory_get_build_id(d):
+    localdata = bb.data.createCopy(d)
+    bb.data.update_data(localdata)
+    statuslines = []
+    for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
+        g = globals()
+        if func not in g:
+            bb.warn("Build configuration function '%s' does not exist" %

func) + else:

meta/classes/buildhistory.bbclass +6 -0
+            flines = g[func](localdata)
+            if flines:
+                statuslines.extend(flines)
+
+    statusheader = d.getVar('BUILDCFG_HEADER', True)
+    return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
Quoted 3 lines
Quoted 3 lines

def buildhistory_get_metadata_revs(d):
# We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want

Sorry I looked at this earlier and it looked OK to me then, I should have acked it already.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]