[PATCH] build: Create deterministic tar archives

2023-08-10 Thread Sebastian Huber
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

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] build: Create deterministic tar archives

2023-08-10 Thread Chris Johns
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
>  
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] build: Create deterministic tar archives

2023-08-10 Thread Sebastian Huber



On 11.08.23 02:22, Chris Johns wrote:

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.


The function changes also the mtime. What about reproducible_tar_info()?

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] build: Create deterministic tar archives

2023-08-10 Thread Chris Johns
On 11/8/2023 3:37 pm, Sebastian Huber wrote:
> On 11.08.23 02:22, Chris Johns wrote:
>> 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.
> 
> The function changes also the mtime. What about reproducible_tar_info()?

That is the out come and not the data itself. What about tar_metadata()?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] build: Create deterministic tar archives

2023-08-10 Thread Sebastian Huber

On 11.08.23 07:39, Chris Johns wrote:

On 11/8/2023 3:37 pm, Sebastian Huber wrote:

On 11.08.23 02:22, Chris Johns wrote:

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.

The function changes also the mtime. What about reproducible_tar_info()?

That is the out come and not the data itself. What about tar_metadata()?


What about make_tar_info_reproducible()?

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] build: Create deterministic tar archives

2023-08-10 Thread Chris Johns
On 11/8/2023 3:43 pm, Sebastian Huber wrote:
> On 11.08.23 07:39, Chris Johns wrote:
>> On 11/8/2023 3:37 pm, Sebastian Huber wrote:
>>> On 11.08.23 02:22, Chris Johns wrote:
 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.
>>> The function changes also the mtime. What about reproducible_tar_info()?
>> That is the out come and not the data itself. What about tar_metadata()?
> 
> What about make_tar_info_reproducible()?
> 

Sure

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] build: Create deterministic tar archives

2023-08-10 Thread Sebastian Huber

On 11.08.23 07:47, Chris Johns wrote:

On 11/8/2023 3:43 pm, Sebastian Huber wrote:

On 11.08.23 07:39, Chris Johns wrote:

On 11/8/2023 3:37 pm, Sebastian Huber wrote:

On 11.08.23 02:22, Chris Johns wrote:

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.

The function changes also the mtime. What about reproducible_tar_info()?

That is the out come and not the data itself. What about tar_metadata()?

What about make_tar_info_reproducible()?


Sure


Ok, I checked it in with this change.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel