[rtems commit] build: Make tar archives reproducible

Sebastian Huber sebh at rtems.org
Fri Aug 11 05:42:59 UTC 2023


Module:    rtems
Branch:    master
Commit:    0a766a88d75205622f0d648434aa41b383339253
Changeset: http://git.rtems.org/rtems/commit/?id=0a766a88d75205622f0d648434aa41b383339253

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Aug 10 12:18:09 2023 +0200

build: Make tar archives reproducible

This helps to make the build reproducible.

---

 wscript | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/wscript b/wscript
index a8fca88dcb..a51064d764 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 make_tar_info_reproducible(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=make_tar_info_reproducible)
             tar.close()
             return 0
 



More information about the vc mailing list