Skip to contentSkip to conversation

image.bbclass: Sorted ctypes to avoid basehash error

PATCH In review Gerson Fernando Budke 3 participants 3 messages Sep 19, 2017 – Sep 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image.bbclass: Sorted ctypes to avoid basehash error

When selected multiple subimages a similar error could happend:
Variable do_image_cpio[subimages] value changed \
from 'cpio.gz.u-boot cpio.gz' to 'cpio.gz cpio.gz.u-boot'
To avoid this, 'ctypes' should be sorted at 'gen_conversion_cmds'.

This garantee that 'CONVERSION_CMD_xxx' are always written in tha same order and consequently 'do_image_cpio' have the same hash.

---
 meta/classes/image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image.bbclass +1 -1
index 3639aa4..bef634b 100644
@@ -452,7 +452,7 @@ python () {
 
         rm_tmp_images = set()
         def gen_conversion_cmds(bt):
-            for ctype in ctypes:
+            for ctype in sorted(ctypes):
                 if bt.endswith("." + ctype):
                     type = bt[0:-len(ctype) - 1]
                     if type.startswith("debugfs_"):
Signature · 1 line
2.7.4
Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Gerson Fernando Budke

When selected multiple subimages a similar error could happend:
Variable do_image_cpio[subimages] value changed \
from 'cpio.gz.u-boot cpio.gz' to 'cpio.gz cpio.gz.u-boot'
To avoid this, 'ctypes' should be sorted at 'gen_conversion_cmds'.

This garantee that 'CONVERSION_CMD_xxx' are always written in tha same order and consequently 'do_image_cpio' have the same hash.

Quoted 18 lines
---
  meta/classes/image.bbclass | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/image.bbclass +1 -1
index 3639aa4..bef634b 100644
@@ -452,7 +452,7 @@ python () {
 
          rm_tmp_images = set()
          def gen_conversion_cmds(bt):
-            for ctype in ctypes:
+            for ctype in sorted(ctypes):
                  if bt.endswith("." + ctype):
                      type = bt[0:-len(ctype) - 1]
                      if type.startswith("debugfs_"):
Reviewed-by
#2 lore raw
Quoted 8 lines · Martin Hundebøll
Quoted 5 lines · Gerson Fernando Budke

When selected multiple subimages a similar error could happend:
Variable do_image_cpio[subimages] value changed \
from 'cpio.gz.u-boot cpio.gz' to 'cpio.gz cpio.gz.u-boot'
To avoid this, 'ctypes' should be sorted at 'gen_conversion_cmds'.

Quoted 6 lines
Quoted 4 lines

This garantee that 'CONVERSION_CMD_xxx' are always written in tha same order and consequently 'do_image_cpio' have the same hash.

Signature · 1 line
Tom