[PATCH] build: Create deterministic tar archives

Chris Johns chrisj at rtems.org
Fri Aug 11 00:22:48 UTC 2023


On 10/8/2023 8:19 pm, Sebastian Huber wrote:
> 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):

I suggest `tar_user_info` as the name.

Chris

> +    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
>  


More information about the devel mailing list