[PATCH] build: Create deterministic tar archives
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Aug 10 10:19:11 UTC 2023
This helps to make the build reproducible.
---
wscript | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/wscript b/wscript
index a8fca88dcb..4baf701c27 100755
--- a/wscript
+++ b/wscript
@@ -188,6 +188,15 @@ def process_start_files(self):
self.link_task.dep_nodes.extend(self.bld.start_files)
+def deterministic_tar_info(info):
+ info.uid = 0
+ info.gid = 0
+ info.mtime = 0
+ info.uname = "root"
+ info.gname = "root"
+ return info
+
+
class Item(object):
def __init__(self, uid, data):
@@ -479,7 +488,7 @@ class Item(object):
dst = src
for r in remove:
dst = src.replace(srcpath + r, "").replace(bldpath + r, "")
- tar.add(src, dst)
+ tar.add(src, dst, filter=deterministic_tar_info)
tar.close()
return 0
--
2.35.3
More information about the devel
mailing list