Skip to contentSkip to conversation

classes/buildhistory: avoid git diff churn by sorting more dictionaries

PATCH In review Jacob Kroon 2 participants 2 messages Dec 21, 2018 – Jan 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 classes/buildhistory: avoid git diff churn by sorting more dictionaries

Sort 'srcrevs' and 'tag_srcrevs' before iterating over them in order to avoid unnecessary changes in the build history.

---
 meta/classes/buildhistory.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/buildhistory.bbclass +2 -2
index 40b292b139..d1f3e6aa82 100644
@@ -896,7 +896,7 @@ def write_latest_srcrev(d, pkghistdir):
             if orig_srcrev != 'INVALID':
                 f.write('# SRCREV = "%s"\n' % orig_srcrev)
             if len(srcrevs) > 1:
-                for name, srcrev in srcrevs.items():
+                for name, srcrev in sorted(srcrevs.items()):
                     orig_srcrev = d.getVar('SRCREV_%s' % name, False)
                     if orig_srcrev:
                         f.write('# SRCREV_%s = "%s"\n' % (name, orig_srcrev))
@@ -904,7 +904,7 @@ def write_latest_srcrev(d, pkghistdir):
             else:
                 f.write('SRCREV = "%s"\n' % next(iter(srcrevs.values())))
             if len(tag_srcrevs) > 0:
-                for name, srcrev in tag_srcrevs.items():
+                for name, srcrev in sorted(tag_srcrevs.items()):
                     f.write('# tag_%s = "%s"\n' % (name, srcrev))
                     if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev:
                         pkg = d.getVar('PN')
Signature · 1 line
2.11.0
#1 lore raw
Quoted 23 lines · NZDT Jacob Kroon

Sort 'srcrevs' and 'tag_srcrevs' before iterating over them in order to avoid unnecessary changes in the build history.

---
 meta/classes/buildhistory.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/buildhistory.bbclass +1 -1
index 40b292b139..d1f3e6aa82 100644
@@ -896,7 +896,7 @@ def write_latest_srcrev(d, pkghistdir):
             if orig_srcrev != 'INVALID':
                 f.write('# SRCREV = "%s"\n' % orig_srcrev)
             if len(srcrevs) > 1:
-                for name, srcrev in srcrevs.items():
+                for name, srcrev in sorted(srcrevs.items()):
                     orig_srcrev = d.getVar('SRCREV_%s' % name, False)
                     if orig_srcrev:
                         f.write('# SRCREV_%s = "%s"\n' % (name, orig_srcrev))

meta/classes/buildhistory.bbclass def write_latest_srcrev(d, pkghistdir): · line 910

Quoted 8 lines
meta/classes/buildhistory.bbclass +1 -1
@@ -904,7 +904,7 @@ def write_latest_srcrev(d, pkghistdir):
             else:
                 f.write('SRCREV = "%s"\n' % next(iter(srcrevs.values())))
             if len(tag_srcrevs) > 0:
-                for name, srcrev in tag_srcrevs.items():
+                for name, srcrev in sorted(tag_srcrevs.items()):
                     f.write('# tag_%s = "%s"\n' % (name, srcrev))
                     if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev:
                         pkg = d.getVar('PN')

This is OK. An alternative would be to create the original dictionaries as OrderedDicts, but on the other hand I'm not sure if the original order (i.e. as specified in SRC_URI) is particularly important in this context. Any other opinions?

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre