Skip to contentSkip to conversation

cml1.bbclass: Return sorted list of cfg files

PATCH In review Khem Raj 3 participants 3 messages May 3, 2021 – May 4, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 cml1.bbclass: Return sorted list of cfg files

Since these files are passed to merge_config.sh its better to use a sorted list, so we can be sure that this list is always fed in same order irrespective of python versions on host

---
 meta/classes/cml1.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/cml1.bbclass +1 -1
index d319d66ab2..1c3d70b48d 100644
@@ -6,7 +6,7 @@ def find_cfgs(d):
         if s.endswith('.cfg'):
             sources_list.append(s)
 
-    return sources_list
+    return sorted(sources_list)
 
 cml1_do_configure() {
 	set -e
Signature · 1 line
2.31.1
#1 lore raw
Quoted 14 lines · Khem Raj

Since these files are passed to merge_config.sh its better to use a sorted list, so we can be sure that this list is always fed in same order irrespective of python versions on host

---
  meta/classes/cml1.bbclass | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/cml1.bbclass +0 -0
index d319d66ab2..1c3d70b48d 100644

meta/classes/cml1.bbclass def find_cfgs(d): · line 9

Quoted 5 lines
meta/classes/cml1.bbclass +1 -1
@@ -6,7 +6,7 @@ def find_cfgs(d):
          if s.endswith('.cfg'):
              sources_list.append(s)
 
-    return sources_list
+    return sorted(sources_list)

Just as a thought, wouldn't it be better to have the ordering defined based on recipe/layer meta data?

Previously ordering was more or less based on the inode number of the files - now it's alphabetically.

I know that config fragments should be self containing, but seen enough real world examples where that isn't the case, so for them this might cause a breaking change (tbf the behavior before wasn't fully deterministic as well)

But this issue isn't limited to this particular piece of code here and might need some more general solution.

Quoted 8 lines
meta/classes/cml1.bbclass +0 -0
  cml1_do_configure() {
  	set -e
 
#2 lore raw
Quoted 23 lines · Konrad Weihmann
Quoted 14 lines · Khem Raj

Since these files are passed to merge_config.sh its better to use a sorted list, so we can be sure that this list is always fed in same order irrespective of python versions on host

---
 meta/classes/cml1.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/cml1.bbclass +0 -0
index d319d66ab2..1c3d70b48d 100644

meta/classes/cml1.bbclass def find_cfgs(d): · line 8

Quoted 4 lines
meta/classes/cml1.bbclass +1 -1
@@ -6,7 +6,7 @@ def find_cfgs(d):
         if s.endswith('.cfg'):
             sources_list.append(s)
-    return sources_list
+    return sorted(sources_list)

Just as a thought, wouldn't it be better to have the ordering defined based on recipe/layer meta data?

Quoted 7 lines

Previously ordering was more or less based on the inode number of the files - now it's alphabetically.

I know that config fragments should be self containing, but seen enough real world examples where that isn't the case, so for them this might cause a breaking change (tbf the behavior before wasn't fully deterministic as well)

Correct, config fragments can come from different places and it's quite common for latter fragments to amend some former fragments in the list. So, sorting them either way would sure enhance determinism, but surely break a lot of existing functionality out there...

Quoted 6 lines

But this issue isn't limited to this particular piece of code here and might need some more general solution.

Quoted 3 lines
meta/classes/cml1.bbclass +0 -0
 cml1_do_configure() {
 	set -e
 
Signature · 4 lines
Regards,
Denys Dmytriyenko <[email protected]>
PGP: 0x420902729A92C964 - https://denix.org/0x420902729A92C964
Fingerprint: 25FC E4A5 8A72 2F69 1186  6D76 4209 0272 9A92 C964