diff options
-rw-r--r-- | meta/classes/buildhistory.bbclass | 19 |
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 | ||
10 | BUILDHISTORY_FEATURES ?= "image package" | ||
10 | BUILDHISTORY_DIR ?= "${TMPDIR}/buildhistory" | 11 | BUILDHISTORY_DIR ?= "${TMPDIR}/buildhistory" |
11 | BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" | 12 | BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" |
12 | BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" | 13 | BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" |
@@ -25,6 +26,9 @@ PACKAGEFUNCS += "buildhistory_emit_pkghistory" | |||
25 | python buildhistory_emit_pkghistory() { | 26 | python 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 | ||
319 | buildhistory_get_imageinfo() { | 327 | buildhistory_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): | |||
371 | buildhistory_commit() { | 383 | buildhistory_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 | ||
403 | addhandler buildhistory_eventhandler | 416 | addhandler buildhistory_eventhandler |