diff mbox

[02/34] reproducibility: override locale and timezone

Message ID 1462002570-14706-2-git-send-email-gilles.chanteperdrix@xenomai.org
State Changes Requested
Headers show

Commit Message

Gilles Chanteperdrix April 30, 2016, 7:48 a.m. UTC
---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Thomas Petazzoni May 7, 2016, 1:15 p.m. UTC | #1
Hello,

On Sat, 30 Apr 2016 09:48:58 +0200, Gilles Chanteperdrix wrote:
> ---
>  Makefile | 7 +++++++
>  1 file changed, 7 insertions(+)

Missing SoB.

> diff --git a/Makefile b/Makefile
> index ec7dccb..86b2ed2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -218,6 +218,13 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
>  -include $(BR2_CONFIG)
>  endif
>  
> +export BR2_REPRODUCIBLE

Why ?

> +ifeq ($(BR2_REPRODUCIBLE),y)
> +export TZ=UTC
> +export LANG=C
> +export LC_ALL=C
> +endif

Regarding overriding TZ, LANG and LC_ALL, I'm wondering if we shouldn't
do it unconditionally, regardless of the value of BR2_REPRODUCIBLE.
What is the benefit of leaving those variable to their value from the
build environment?

Thanks!

Thomas
Arnout Vandecappelle May 7, 2016, 6:54 p.m. UTC | #2
On 05/07/16 15:15, Thomas Petazzoni wrote:
> Hello,
>
> On Sat, 30 Apr 2016 09:48:58 +0200, Gilles Chanteperdrix wrote:
>> ---
>>  Makefile | 7 +++++++
>>  1 file changed, 7 insertions(+)
>
> Missing SoB.
>
>> diff --git a/Makefile b/Makefile
>> index ec7dccb..86b2ed2 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -218,6 +218,13 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
>>  -include $(BR2_CONFIG)
>>  endif
>>
>> +export BR2_REPRODUCIBLE
>
> Why ?

  I guess because it will (or may be) be used in some helper scripts...

>
>> +ifeq ($(BR2_REPRODUCIBLE),y)
>> +export TZ=UTC
>> +export LANG=C
>> +export LC_ALL=C
>> +endif
>
> Regarding overriding TZ, LANG and LC_ALL, I'm wondering if we shouldn't
> do it unconditionally, regardless of the value of BR2_REPRODUCIBLE.
> What is the benefit of leaving those variable to their value from the
> build environment?

  For the record: I had the same comment about this entire series. Most of it 
should be done unconditionally, only the aspects that may be annoying for 
debugging (like the timestamps) should be conditional.

  Unfortunately, that will be a cause for discussion... For instance, LANG=C 
means that compiler error messages will be in English instead of in your native 
language. Do we really want that by default?

  Regards,
  Arnout
Gilles Chanteperdrix June 14, 2016, 1:53 p.m. UTC | #3
On Sat, May 07, 2016 at 03:15:50PM +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Sat, 30 Apr 2016 09:48:58 +0200, Gilles Chanteperdrix wrote:
> > ---
> >  Makefile | 7 +++++++
> >  1 file changed, 7 insertions(+)
> 
> Missing SoB.
> 
> > diff --git a/Makefile b/Makefile
> > index ec7dccb..86b2ed2 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -218,6 +218,13 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
> >  -include $(BR2_CONFIG)
> >  endif
> >  
> > +export BR2_REPRODUCIBLE
> 
> Why ?

So that it can be used in scripts. Like wrappers script. In order to
know if we should take special actions because we are targeting a
reproducible build.

> 
> > +ifeq ($(BR2_REPRODUCIBLE),y)
> > +export TZ=UTC
> > +export LANG=C
> > +export LC_ALL=C
> > +endif
> 
> Regarding overriding TZ, LANG and LC_ALL, I'm wondering if we shouldn't
> do it unconditionally, regardless of the value of BR2_REPRODUCIBLE.
> What is the benefit of leaving those variable to their value from the
> build environment?

Obviously:
- having dates printed for your local timezone (like build timestamps
if you do not want a reproducible build). I do not know about you,
but I would hate to have to convert a build timestamp from UTC to
local timezone in order to see if I am running the binary I think I
am running.
- having compiler messages printed in your locale, if you set the
locale, it is probably what you want.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index ec7dccb..86b2ed2 100644
--- a/Makefile
+++ b/Makefile
@@ -218,6 +218,13 @@  ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
 -include $(BR2_CONFIG)
 endif
 
+export BR2_REPRODUCIBLE
+ifeq ($(BR2_REPRODUCIBLE),y)
+export TZ=UTC
+export LANG=C
+export LC_ALL=C
+endif
+
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
 ifeq ("$(origin V)", "command line")