From e97975d6113ca1ffa6cbe9b005bd518bd146fd9c Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Tue, 20 Nov 2018 09:03:25 +0100 Subject: image_types_ostree/ota.bbclass: refactor ostree task There are several flaws with ostree tasks, as follows: - ${IMAGE_NAME}.rootfs.ostree.tar.bz2 is generated, but it's not being used during ostree commit, so it should be removed if it's just a intermittent artifact. Or if we intend to deploy this tar.bz2 file, it should be tracked by sstate cache, that is to day, it should be generated in ${IMGDEPLOYDIR} rather than in ${DEPLOY_DIR_IMAGE}. - There are quite a few redundant code like mktemp/cd/rm a directory, which can be replaced by setting 'dirs', 'cleandirs' varflags. - There are some redundant variable check logic in image_types_ostree and image_types_ota bbclass. To fix the above, we make the following changes: - Introduce a new conversion image type 'tar', it could convert ostree and ota to ostree.tar, ota.tar, hence we can drop the code generating ostree.tar.bz2 in image_types_ostree.bbclass, and also drop the do_image_ota-tar task. To let this conversion type take effect, the otasetup task needs to be changed to ota. - Introduce BUILD_OSTREE_TARBALL variable, when being set to 1, a ostree.tar.bz2 tarball would be built, BUILD_OSTREE_TARBALL defaults to be 1, to be consistent with original behavior. - Replace 'ota-tar ota-tar.xz' with ota.tar.xz in IMAGE_FSTYPES. - Add a sanity check bbclass sota_sanity.bbclass, to ensure ostree or ota is not in OVERRIDES, this is to prevent potential naming pollution with other meta layers, and also check the required variables are not empty. This sota_sanity.bbclass is a common class that could be extended easily in furture, and one of its most advantages is that all the check are done in bb.event.SanityCheck event handler, so the end users could get the error message at very beginning of the recipe parsing time. Signed-off-by: Ming Liu --- classes/sota.bbclass | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'classes/sota.bbclass') diff --git a/classes/sota.bbclass b/classes/sota.bbclass index e654071..7118807 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -16,7 +16,8 @@ IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PRO IMAGE_CLASSES += " image_types_ostree image_types_ota" IMAGE_FSTYPES += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'ostreepush garagesign garagecheck ota-ext4 wic', ' ', d)}" -IMAGE_FSTYPES += "${@bb.utils.contains('BUILD_OTA_TARBALL', '1', 'ota-tar ota-tar.xz', ' ', d)}" +IMAGE_FSTYPES += "${@bb.utils.contains('BUILD_OSTREE_TARBALL', '1', 'ostree.tar.bz2', ' ', d)}" +IMAGE_FSTYPES += "${@bb.utils.contains('BUILD_OTA_TARBALL', '1', 'ota.tar.xz', ' ', d)}" PACKAGECONFIG_append_pn-curl = " ssl" PACKAGECONFIG_remove_pn-curl = "gnutls" @@ -50,6 +51,7 @@ SOTA_MACHINE_intel-corei7-64 ?= "minnowboard" SOTA_MACHINE_qemux86-64 ?= "qemux86-64" SOTA_MACHINE_am335x-evm ?= "am335x-evm-wifi" -inherit sota_${SOTA_MACHINE} +SOTA_OVERRIDES_BLACKLIST = "ostree ota" +SOTA_REQUIRED_VARIABLES = "OSTREE_REPO OSTREE_BRANCHNAME OSTREE_OSNAME OSTREE_BOOTLOADER OSTREE_BOOT_PARTITION GARAGE_SIGN_REPO GARAGE_TARGET_NAME" -inherit image_repo_manifest +inherit sota_sanity sota_${SOTA_MACHINE} image_repo_manifest -- cgit v1.2.3-54-g00ecf