From ed6bb6e3db518082d3a9c45d548bc1339be2c5ca Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 9 May 2013 16:57:48 +0100 Subject: classes/buildhistory: track contents of selected files in images Add a BUILDHISTORY_IMAGE_FILES variable specifying a space-separated list of files within an image to copy into buildhistory, so that changes to them can be tracked. Typically this would be used for configuration files, and by default this includes /etc/passwd and /etc/group, but the user is free to extend this list by setting the variable in local.conf. Implements [YOCTO #4154]. Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- meta/classes/buildhistory.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'meta/classes') diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 8efd41cd8e..3b6ce99413 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -12,6 +12,7 @@ BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" BUILDHISTORY_DIR_SDK = "${BUILDHISTORY_DIR}/sdk/${SDK_NAME}" +BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group" BUILDHISTORY_COMMIT ?= "0" BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory " BUILDHISTORY_PUSH_REPO ?= "" @@ -396,6 +397,15 @@ buildhistory_get_imageinfo() { buildhistory_list_files ${IMAGE_ROOTFS} ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt + # Collect files requested in BUILDHISTORY_IMAGE_FILES + rm -rf ${BUILDHISTORY_DIR_IMAGE}/image-files + for f in ${BUILDHISTORY_IMAGE_FILES}; do + if [ -f ${IMAGE_ROOTFS}/$f ] ; then + mkdir -p ${BUILDHISTORY_DIR_IMAGE}/image-files/`dirname $f` + cp ${IMAGE_ROOTFS}/$f ${BUILDHISTORY_DIR_IMAGE}/image-files/$f + fi + done + # Record some machine-readable meta-information about the image printf "" > ${BUILDHISTORY_DIR_IMAGE}/image-info.txt cat >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt <