summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMing Liu <ming.liu@toradex.com>2019-09-06 15:48:26 +0800
committerPeter Liu <peter.liu@se.atlascopco.com>2019-09-12 11:49:55 +0800
commita93a01d59fc88d28c97ee0eb354a9747463b79df (patch)
tree477354b87079decabe426a8c2cbd5088a3e291d5
parent325fce6e4a87c035003f0ac810072ab0594567e1 (diff)
image_type_tezi.bbclass: fix basehash changed issue
This patch mainly aims to reintroduce a old commit 1b5ef0c9: [ image_type_tezi.bbclass: drop some useless code ] which was reverted later on since it did not fix the problem, I refactor that patch to really fix it. This patch mainly aims to reintroduce a old commit d2dc3698: [ image_type_tezi.bbclass: drop some useless code ] which was reverted later on since it did not fix the problem, I refactor that patch to really fix it. I have observed this "basehash changed" issue quite often recently, it could be reproduced easily by the following steps: 1 bitbake imagename 2 change your system time by one day ahead. 3 bitbake imagename After debugging it with bitbake-diffsigs, I found it's still caused by 'DATE' variable changing, as follows: | basehash changed from ecb5b34a4997e7f037f146932728f3eca9af34d70729e4c83cdd920dc21d7677 to | 92ad5341f99ff3a56987f4ccdc34030d5aa3e3ea1365737b5a81a12e6eb83798 | Variable DATE value changed from '20190905' to '20190906' our tricky fix of introducing 'TDX_VERDATE' does not really work, actually it makes things worse, 'DATE' has been deleted when parsing IMAGE_CMD_* tasks, which was introduced by commit 4af13a48 in OE: [ image.bbclass: delete DATE variable too ] which means DATE would not be expanded during recipe parsing, but TDX_VERDATE would, so we should replace TDX_VERDATE with DATE in IMAGE_CMD_teziimg and IMAGE_CMD_teziimg-distro tasks. To fix this annoying issue, the key point is we should avoid expanding 'DATE' during recipe parsing stage, or else the vardepsexclude would not take effect since the 'DATE' has already been expanded, so we should change a DATE reference in rootfs_tezi_json function: d.getVar('DATE') -> d.getVar('DATE', False) And there is seems still some order issue when bitbake handle vardepsexclude of IMAGE_CMD_* tasks, I have to explicitly set it for do_image_teziimg and do_image_teziimg_distro. With the above changes, the error does not show up again. Signed-off-by: Ming Liu <ming.liu@toradex.com>
-rw-r--r--classes/image_type_tezi.bbclass33
1 files changed, 6 insertions, 27 deletions
diff --git a/classes/image_type_tezi.bbclass b/classes/image_type_tezi.bbclass
index 82458d2..346b4de 100644
--- a/classes/image_type_tezi.bbclass
+++ b/classes/image_type_tezi.bbclass
@@ -26,10 +26,6 @@ UBOOT_BINARY_TEZI_RAWNAND ?= "${UBOOT_BINARY}"
UBOOT_ENV_TEZI_EMMC ?= "uEnv.txt"
UBOOT_ENV_TEZI_RAWNAND ?= "uEnv.txt"
-# For generic images this is not yet defined
-TDX_VERDATE ?= "-${DATE}"
-TDX_VERDATE[vardepsexclude] = "DATE"
-
# Append tar command to store uncompressed image size to ${T}.
# If a custom rootfs type is used make sure this file is created
# before compression.
@@ -262,16 +258,13 @@ def rootfs_tezi_json(d, flash_type, flash_data, json_file, uenv_file):
deploydir = d.getVar('DEPLOY_DIR_IMAGE')
ota_credentials = d.getVar('SOTA_PACKED_CREDENTIALS')
- # Patched in IMAGE_CMD_teziimg() below
- release_date = "%release_date%"
-
data = OrderedDict({ "config_format": 2, "autoinstall": False })
# Use image recipes SUMMARY/DESCRIPTION/PV...
data["name"] = d.getVar('SUMMARY')
data["description"] = d.getVar('DESCRIPTION')
data["version"] = d.getVar('PV')
- data["release_date"] = release_date
+ data["release_date"] = datetime.strptime(d.getVar('DATE', False), '%Y%m%d').date().isoformat()
data["u_boot_env"] = uenv_file
if os.path.exists(os.path.join(deploydir, "prepare.sh")):
data["prepare_script"] = "prepare.sh"
@@ -352,14 +345,7 @@ do_image_teziimg[prefuncs] += "tezi_deploy_bootfs_files create_tezi_bootfs rootf
IMAGE_CMD_teziimg () {
bbnote "Create Toradex Easy Installer tarball"
- # Fixup release_date in image.json, convert ${TDX_VERDATE} to isoformat
- # This works around the non fatal ERRORS: "the basehash value changed" when DATE is referenced
- # in a python prefunction to do_image
- ISODATE=$(echo ${TDX_VERDATE} | sed 's/.\(....\)\(..\)\(..\).*/\1-\2-\3/')
- sed -i "s/%release_date%/$ISODATE/" ${DEPLOY_DIR_IMAGE}/image.json
-
cd ${DEPLOY_DIR_IMAGE}
-
case "${TORADEX_FLASH_TYPE}" in
rawnand)
# The first transform strips all folders from the files to tar, the
@@ -367,7 +353,7 @@ IMAGE_CMD_teziimg () {
${IMAGE_CMD_TAR} \
--transform='s/.*\///' \
--transform 's,^,${IMAGE_NAME}-Tezi_${PV}/,' \
- -chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}${TDX_VERDATE}.tar \
+ -chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}-${DATE}.tar \
image.json toradexlinux.png marketing.tar prepare.sh wrapup.sh \
${SPL_BINARY} ${UBOOT_BINARY_TEZI_RAWNAND} ${UBOOT_ENV_TEZI_RAWNAND} ${KERNEL_IMAGETYPE} ${KERNEL_DEVICETREE} \
${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${TEZI_ROOT_SUFFIX}
@@ -378,13 +364,14 @@ IMAGE_CMD_teziimg () {
${IMAGE_CMD_TAR} \
--transform='s/.*\///' \
--transform 's,^,${IMAGE_NAME}-Tezi_${PV}/,' \
- -chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}${TDX_VERDATE}.tar \
+ -chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}-${DATE}.tar \
image.json toradexlinux.png marketing.tar prepare.sh wrapup.sh \
${SPL_BINARY} ${UBOOT_BINARY_TEZI_EMMC} ${UBOOT_ENV_TEZI_EMMC} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.bootfs.tar.xz \
${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${TEZI_ROOT_SUFFIX}
;;
esac
}
+do_image_teziimg[vardepsexclude] = "DATE"
IMAGE_TYPEDEP_teziimg += "${TEZI_ROOT_SUFFIX}"
@@ -425,22 +412,14 @@ IMAGE_CMD_teziimg-distro () {
bbnote "Create Toradex Easy Installer tarball"
cd ${DEPLOY_DIR_IMAGE}
-
- # Fixup release_date in image.json, convert ${DATE} to isoformat
- # This works around the non fatal ERRORS: "the basehash value changed" when DATE is referenced
- # in a python prefunction to do_image
- ISODATE=$(echo ${DATE} | sed 's/\(....\)\(..\)\(..\)/\1-\2-\3/')
- for TEZI_IMAGE_JSON in ${TEZI_IMAGE_JSON_FILES}; do
- sed -i "s/%release_date%/$ISODATE/" ${DEPLOY_DIR_IMAGE}/${TEZI_IMAGE_JSON}
- done
-
${IMAGE_CMD_TAR} \
--transform='s/.*\///' \
--transform 's,^,${IMAGE_NAME}-Tezi_${PV}/,' \
- -chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}${TDX_VERDATE}.tar \
+ -chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}-${DATE}.tar \
${TEZI_IMAGE_JSON_FILES} toradexlinux.png marketing.tar prepare.sh wrapup.sh \
${TEZI_IMAGE_UBOOT_FILES} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.bootfs.tar.xz \
${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${TEZI_ROOT_SUFFIX} ${SOTA_PACKED_CREDENTIALS}
}
+do_image_teziimg_distro[vardepsexclude] = "DATE"
IMAGE_TYPEDEP_teziimg-distro += "${TEZI_ROOT_SUFFIX}"