Skip to contentSkip to conversation

image.bbclass: don't expand IMAGE_CMD when setting do_image task

PATCH In review Matt Madison 3 participants 6 messages Apr 27, 2016

lore
Share & tools
lore
#0 lore raw

cover image.bbclass: don't expand IMAGE_CMD when setting do_image task

After being vexed with numerous taskhash mismatch errors on my image builds, I think I hit on the source of the problem - the value of the do_image_XXXX function reported by bitbake-dumpsig had fully-expanded values for all of the variables referenced in the function - so date and time stamps were showing up in the text of the function.

Fixed this by not expanding the value of IMAGE_CMD during the generation of the do_iamge_XXXX task. The vardeps still do their job for detecting relevant changes.

Matt Madison (1):
image.bbclass: don't expand IMAGE_CMD when setting do_image task

 meta/classes/image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 image.bbclass: don't expand IMAGE_CMD when setting do_image task

Expanding it causes the do_image_x function to include values of variables that may contain date/time stamps, rather than references to the variable names, leading to spurious taskhash mismatch errors.

---
 meta/classes/image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image.bbclass +1 -1
index 8bfd241..d695d30 100644
@@ -380,7 +380,7 @@ python () {
         localdata.delVar('DATETIME')
         localdata.delVar('TMPDIR')
 
-        image_cmd = localdata.getVar("IMAGE_CMD", True)
+        image_cmd = localdata.getVar("IMAGE_CMD", False)
         vardeps.add('IMAGE_CMD_' + realt)
         if image_cmd:
             cmds.append("\t" + image_cmd)
Signature · 1 line
2.7.4
#2 lore raw
Quoted 14 lines · Matt Madison

Expanding it causes the do_image_x function to include values of variables that may contain date/time stamps, rather than references to the variable names, leading to spurious taskhash mismatch errors.

---
 meta/classes/image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image.bbclass +0 -0
index 8bfd241..d695d30 100644

meta/classes/image.bbclass python () { · line 386

Quoted 8 lines
meta/classes/image.bbclass +1 -1
@@ -380,7 +380,7 @@ python () {
         localdata.delVar('DATETIME')
         localdata.delVar('TMPDIR')
 
-        image_cmd = localdata.getVar("IMAGE_CMD", True)
+        image_cmd = localdata.getVar("IMAGE_CMD", False)
         vardeps.add('IMAGE_CMD_' + realt)
         if image_cmd:
             cmds.append("\t" + image_cmd)

You can't do this since there are some variables that need to be expanded using the values from the current localdata copy of the data store (such as the type variable).

We'd previously tried to avoid DATETIME contanination by removing the problem bases with the delVar calls just above this.

Cheers,

Richard

#3 lore raw
Quoted 28 lines · Richard Purdie
Quoted 14 lines · Matt Madison

Expanding it causes the do_image_x function to include values of variables that may contain date/time stamps, rather than references to the variable names, leading to spurious taskhash mismatch errors.

---
 meta/classes/image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image.bbclass +0 -0
index 8bfd241..d695d30 100644

meta/classes/image.bbclass python () { · line 386

Quoted 8 lines
meta/classes/image.bbclass +1 -1
@@ -380,7 +380,7 @@ python () {
         localdata.delVar('DATETIME')
         localdata.delVar('TMPDIR')
 
-        image_cmd = localdata.getVar("IMAGE_CMD", True)
+        image_cmd = localdata.getVar("IMAGE_CMD", False)
         vardeps.add('IMAGE_CMD_' + realt)
         if image_cmd:
             cmds.append("\t" + image_cmd)

You can't do this since there are some variables that need to be expanded using the values from the current localdata copy of the data store (such as the type variable).

Quoted 2 lines

We'd previously tried to avoid DATETIME contanination by removing the problem bases with the delVar calls just above this.

Rats. That approach isn't working, at least for me - the recursive expansion is causing the values of the date/time sensitive variables to be present in the value of the IMAGE_CMD_type variable, so that variable changes with each expansion. I've hacked around the problem by avoiding direct references to any variable that depends directly or indirectly on ${DATETIME}, but I was really hoping for something cleaner.

There are other variables that can cause this, too - ${DATE} and ${TIME} by themselves, for example, which aren't deleted.

Thanks,
-Matt

Quoted 4 lines

Cheers,

Richard

#4 lore raw
Quoted 3 lines · Matt Madison

There are other variables that can cause this, too - ${DATE} and ${TIME} by themselves, for example, which aren't deleted.

If DATE and TIME were removed would the variables you're using stop changing?

Ross

#5 lore raw
Quoted 9 lines · Ross
Quoted 3 lines · Matt Madison

There are other variables that can cause this, too - ${DATE} and ${TIME} by themselves, for example, which aren't deleted.

If DATE and TIME were removed would the variables you're using stop changing?

That would fix some of the issues, but not all of them. The latest case I ran into was in building an sdcard image (from image_types_fsl.bbclass in meta-fsl-arm). The first command in IMAGE_CMD_sdcard is:

   if [ -z "${SDCARD_ROOTFS}" ]; then

SDCARD_ROOTFS is defined using ${IMAGE_NAME}, which in turn includes ${DATETIME}. When I look at the bitbake-dumpsig output for the do_image_sdcard task, the value of SDCARD_ROOTFS appears between the quotation marks, rather than the variable reference in the value of do_image_sdcard.

I've worked around it by moving the check to another function and changing IMAGE_CMD_sdcard to call that function to do the test.

Thanks,
-Matt

Quoted 2 lines

Ross