diff mbox series

[meta-swupdate,dunfell+,v2,2/6] swupdate-image: replace custom fetch

Message ID 20210907132240.2987302-3-adrian.freihofer@siemens.com
State Changes Requested
Headers show
Series swupdate-common: get do_swuimage vardeps | expand

Commit Message

Adrian Freihofer Sept. 7, 2021, 1:22 p.m. UTC
The image class has the do_fetch task disabled. Just re-enabling this
task should lead to the required handling of the sw-description file.
---
 classes/swupdate-image.bbclass | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

Comments

Stefano Babic Sept. 7, 2021, 2:28 p.m. UTC | #1
Hi Adrian,

On 07.09.21 15:22, Adrian Freihofer wrote:
> The image class has the do_fetch task disabled. Just re-enabling this
> task should lead to the required handling of the sw-description file.

This is true until I found a case where it did not work, at least for me.

do_fetch() will run (I explicitely enable it in the common class), but 
it runs depending on its sstate. This breaks if you add

INHERIT += "rm_work"

to local.conf. Everything is fine after a cleanall, but a second run 
failed on my test because do_fetch() does not run and sw-description is 
not found at all.

Does it work on your side with rm_work active ?

Setting nostamp for fetch is worse, because it runs again, but all 
depending tasks will run again.

The task do_swupdate_copy_swdescription() is like a work-around to the 
problem - fully open if there is a better way to solve it.

> ---
>   classes/swupdate-image.bbclass | 19 ++-----------------
>   1 file changed, 2 insertions(+), 17 deletions(-)
> 
> diff --git a/classes/swupdate-image.bbclass b/classes/swupdate-image.bbclass
> index f25f1f0..6df444a 100644
> --- a/classes/swupdate-image.bbclass
> +++ b/classes/swupdate-image.bbclass
> @@ -14,24 +14,9 @@ S = "${WORKDIR}/${PN}"
>   
>   SRC_URI += "file://sw-description"
>   SWUPDATE_IMAGES += "${IMAGE_BASENAME}"
> +do_unpack[noexec] = "0"
>   
> -python do_swupdate_copy_swdescription() {
> -
> -    import shutil
> -
> -    workdir = d.getVar('S', True)
> -    image = d.getVar('IMAGE_BASENAME', True)
> -    filespath = d.getVar('FILESPATH')
> -    sw_desc_path = bb.utils.which(filespath, "sw-description")
> -    shutil.copyfile(sw_desc_path, os.path.join(workdir, "sw-description"))
> -
> -    if d.getVarFlag("SWUPDATE_IMAGES_FSTYPES", image) is None:
> -       bb.fatal("SWUPDATE_IMAGES_FSTYPES[%s] is not set !" % image)
> -}
> -
> -do_swupdate_copy_swdescription[nostamp] = "1"
> -addtask swupdate_copy_swdescription before do_image_complete after do_unpack
> -addtask swuimage after do_swupdate_copy_swdescription do_image_complete before do_build
> +addtask swuimage after do_image_complete before do_build

yes, do_image_complete is enough for swuimage

>   
>   # Read all variables from sw-description file and add them to the vardeps of the do_swuimage task. Bitbake
>   # cannot know that the do_swuimage task which evaluates the templated sw-description file needs to be executed
> 

Regards,
Stefano
diff mbox series

Patch

diff --git a/classes/swupdate-image.bbclass b/classes/swupdate-image.bbclass
index f25f1f0..6df444a 100644
--- a/classes/swupdate-image.bbclass
+++ b/classes/swupdate-image.bbclass
@@ -14,24 +14,9 @@  S = "${WORKDIR}/${PN}"
 
 SRC_URI += "file://sw-description"
 SWUPDATE_IMAGES += "${IMAGE_BASENAME}"
+do_unpack[noexec] = "0"
 
-python do_swupdate_copy_swdescription() {
-
-    import shutil
-
-    workdir = d.getVar('S', True)
-    image = d.getVar('IMAGE_BASENAME', True)
-    filespath = d.getVar('FILESPATH')
-    sw_desc_path = bb.utils.which(filespath, "sw-description")
-    shutil.copyfile(sw_desc_path, os.path.join(workdir, "sw-description"))
-
-    if d.getVarFlag("SWUPDATE_IMAGES_FSTYPES", image) is None:
-       bb.fatal("SWUPDATE_IMAGES_FSTYPES[%s] is not set !" % image)
-}
-
-do_swupdate_copy_swdescription[nostamp] = "1"
-addtask swupdate_copy_swdescription before do_image_complete after do_unpack
-addtask swuimage after do_swupdate_copy_swdescription do_image_complete before do_build
+addtask swuimage after do_image_complete before do_build
 
 # Read all variables from sw-description file and add them to the vardeps of the do_swuimage task. Bitbake
 # cannot know that the do_swuimage task which evaluates the templated sw-description file needs to be executed