summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-03-16 11:37:22 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-19 14:37:41 +0000
commitee8153e114c6136b7880b886c011dca06e3cee2b (patch)
treeaa208b69b5bee176924d59f4f1dd6665c07cb82c /meta/classes/buildhistory.bbclass
parent32483f05628b179ef286828cd336ab8c0a73a3d9 (diff)
downloadpoky-ee8153e114c6136b7880b886c011dca06e3cee2b.tar.gz
buildhistory: allow disabling image and/or package history
Add a BUILDHISTORY_FEATURES variable which can be set to "" to disable buildhistory with the class still inherited. BUILDHISTORY_FEATURES by default contains two items - image and package. You can use these to disable the image and package history functions individually - this is particularly useful if you want to get the image contents and dependency graphs but don't need the package history. Additionally, ensure we quit shell procedures gracefully by using return instead of exit. (From OE-Core rev: dd6a521045d5538a8ebf6775899d5e1319bea427) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass19
1 files changed, 16 insertions, 3 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 6c2d4e9653..3a68d8d6f5 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -7,6 +7,7 @@
7# Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org> 7# Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org>
8# 8#
9 9
10BUILDHISTORY_FEATURES ?= "image package"
10BUILDHISTORY_DIR ?= "${TMPDIR}/buildhistory" 11BUILDHISTORY_DIR ?= "${TMPDIR}/buildhistory"
11BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" 12BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}"
12BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" 13BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}"
@@ -25,6 +26,9 @@ PACKAGEFUNCS += "buildhistory_emit_pkghistory"
25python buildhistory_emit_pkghistory() { 26python buildhistory_emit_pkghistory() {
26 import re 27 import re
27 28
29 if not "package" in (d.getVar('BUILDHISTORY_FEATURES', True) or "").split():
30 return 0
31
28 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 32 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
29 33
30 class RecipeInfo: 34 class RecipeInfo:
@@ -269,6 +273,10 @@ buildhistory_get_image_installed() {
269 # Anything requiring the use of the packaging system should be done in here 273 # Anything requiring the use of the packaging system should be done in here
270 # in case the packaging files are going to be removed for this image 274 # in case the packaging files are going to be removed for this image
271 275
276 if [ "${@base_contains('BUILDHISTORY_FEATURES', 'image', '1', '0', d)}" = "0" ] ; then
277 return
278 fi
279
272 mkdir -p ${BUILDHISTORY_DIR_IMAGE} 280 mkdir -p ${BUILDHISTORY_DIR_IMAGE}
273 281
274 # Get list of installed packages 282 # Get list of installed packages
@@ -317,6 +325,10 @@ buildhistory_get_image_installed() {
317} 325}
318 326
319buildhistory_get_imageinfo() { 327buildhistory_get_imageinfo() {
328 if [ "${@base_contains('BUILDHISTORY_FEATURES', 'image', '1', '0', d)}" = "0" ] ; then
329 return
330 fi
331
320 # List the files in the image, but exclude date/time etc. 332 # List the files in the image, but exclude date/time etc.
321 # This awk script is somewhat messy, but handles where the size is not printed for device files under pseudo 333 # This awk script is somewhat messy, but handles where the size is not printed for device files under pseudo
322 ( cd ${IMAGE_ROOTFS} && find . -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' | sort -k5 > ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt ) 334 ( cd ${IMAGE_ROOTFS} && find . -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' | sort -k5 > ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt )
@@ -371,7 +383,7 @@ def buildhistory_get_imagevars(d):
371buildhistory_commit() { 383buildhistory_commit() {
372 if [ ! -d ${BUILDHISTORY_DIR} ] ; then 384 if [ ! -d ${BUILDHISTORY_DIR} ] ; then
373 # Code above that creates this dir never executed, so there can't be anything to commit 385 # Code above that creates this dir never executed, so there can't be anything to commit
374 exit 386 return
375 fi 387 fi
376 388
377 ( cd ${BUILDHISTORY_DIR}/ 389 ( cd ${BUILDHISTORY_DIR}/
@@ -396,8 +408,9 @@ python buildhistory_eventhandler() {
396 import bb.event 408 import bb.event
397 409
398 if isinstance(e, bb.event.BuildCompleted): 410 if isinstance(e, bb.event.BuildCompleted):
399 if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1": 411 if e.data.getVar('BUILDHISTORY_FEATURES', True).strip():
400 bb.build.exec_func("buildhistory_commit", e.data) 412 if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1":
413 bb.build.exec_func("buildhistory_commit", e.data)
401} 414}
402 415
403addhandler buildhistory_eventhandler 416addhandler buildhistory_eventhandler