Skip to contentSkip to conversation

classes/package: Sort ELF file list

PATCH New Joshua Watt 1 participant 1 message Jun 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 classes/package: Sort ELF file list

Sorts the list of detected ELF files by path before processing. This ensures that when multiple files are hardlinked together the first one found is always the same. This is required to have reproducible builds.

---
 meta/classes/package.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/package.bbclass +6 -0
index 4c0a8595363..06948555042 100644
@@ -1005,6 +1005,12 @@ python split_and_strip_files () {
                 symlinks[file] = target
 
         results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d)
+
+        # Sort results by file path. This ensures that the files are always
+        # processed in the same order, which is important to make sure builds
+        # are reproducible when dealing with hardlinks
+        results.sort(key=lambda x: x[0])
+
         for (file, elf_file) in results:
             # It's a file (or hardlink), not a link
             # ...but is it ELF, and is it already stripped?
Signature · 1 line
2.21.0