Skip to contentSkip to conversation

uboot-sign: Refactor do_deploy prefunc to do_deploy_prepend

PATCH New Daniel Klauer 1 participant 2 messages Jun 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 uboot-sign: Refactor do_deploy prefunc to do_deploy_prepend

When inherited by the u-boot recipe (UBOOT_PN), uboot-sign.bbclass adds a concat_dtb step, which places additional files into ${DEPLOYDIR} before do_deploy. By turning this from a prefunc into a part of the normal do_deploy function, it becomes possible to use
do_deploy[cleandirs] = "${DEPLOYDIR}"
in the future, without deleting the files produced by concat_dtb.

As before, care is taken to not interfere with the kernel's do_deploy definition, since concat_dtb was only needed for u-boot.

---
 meta/classes/uboot-sign.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/classes/uboot-sign.bbclass +6 -5
index 982ed46d01..713196df41 100644
@@ -117,15 +117,16 @@ do_install_append() {
 	fi
 }
 
+do_deploy_prepend_pn-${UBOOT_PN}() {
+	if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ]; then
+		concat_dtb
+	fi
+}
+
 python () {
     if d.getVar('UBOOT_SIGN_ENABLE') == '1' and d.getVar('PN') == d.getVar('UBOOT_PN') and d.getVar('UBOOT_DTB_BINARY'):
         kernel_pn = d.getVar('PREFERRED_PROVIDER_virtual/kernel')
 
         # Make "bitbake u-boot -cdeploy" deploys the signed u-boot.dtb
         d.appendVarFlag('do_deploy', 'depends', ' %s:do_deploy' % kernel_pn)
-
-        # kernerl's do_deploy is a litle special, so we can't use
-        # do_deploy_append, otherwise it would override
-        # kernel_do_deploy.
-        d.appendVarFlag('do_deploy', 'prefuncs', ' concat_dtb')
 }
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 deploy.bbclass: Clean DEPLOYDIR before do_deploy

do_deploy should clean up ${DEPLOYDIR} before running, just like do_install cleans up ${D} before running. This reduces the risk of DEPLOYDIR being accidentally contaminated by files from previous runs, possibly even with different config, in case of incremental builds.

It is convenient to have this in deploy.bbclass, so it doesn't have to be duplicated in every recipe, considering for example meta-freescale, which has 23 affected recipes.

All recipes using deploy.bbclass (grep -r 'inherit .*deploy') in poky, meta-openembedded and meta-freescale look like they either benefit from this or are at least not affected negatively by it. The only exception I've noticed was uboot-sign.bbclass, which was however fixed by the previous patch.

---
 meta/classes/deploy.bbclass            | 1 +
 meta/classes/kernel.bbclass            | 2 --
 meta/recipes-core/meta/signing-keys.bb | 2 --
 meta/recipes-core/ovmf/ovmf_git.bb     | 1 -
 4 files changed, 1 insertion(+), 5 deletions(-)
meta/classes/deploy.bbclass +1 -0
index 6d52908783..737c26122b 100644
@@ -8,4 +8,5 @@ python do_deploy_setscene () {
 }
 addtask do_deploy_setscene
 do_deploy[dirs] = "${DEPLOYDIR} ${B}"
+do_deploy[cleandirs] = "${DEPLOYDIR}"
 do_deploy[stamp-extra-info] = "${MACHINE_ARCH}"
meta/classes/kernel.bbclass +0 -2
index a1219f3156..301e3b86b2 100644
@@ -729,8 +729,6 @@ kernel_do_deploy() {
 		done
 	fi
 }
-do_deploy[cleandirs] = "${DEPLOYDIR}"
-do_deploy[dirs] = "${DEPLOYDIR} ${B}"
 do_deploy[prefuncs] += "package_get_auto_pr"
 
 addtask deploy after do_populate_sysroot do_packagedata
meta/recipes-core/meta/signing-keys.bb +0 -2
index 1e1c7e3459..5bab94aa36 100644
@@ -67,8 +67,6 @@ do_deploy () {
     fi
 }
 do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_RPM}"
-# cleandirs should possibly be in deploy.bbclass but we need it
-do_deploy[cleandirs] = "${DEPLOYDIR}"
 # clear stamp-extra-info since MACHINE_ARCH is normally put there by
 # deploy.bbclass
 do_deploy[stamp-extra-info] = ""
meta/recipes-core/ovmf/ovmf_git.bb +0 -1
index 7292ebbb77..84547630e8 100644
@@ -220,7 +220,6 @@ do_deploy[depends] += "${DEPLOYDEP}"
 
 do_deploy() {
 }
-do_deploy[cleandirs] = "${DEPLOYDIR}"
 do_deploy_class-target() {
     # For use with "runqemu ovmf".
     for i in \
Signature · 1 line
2.20.1