[SLOF] [PATCH] Allow to override build date with SOURCE_DATE_EPOCH

Alexey Kardashevskiy aik at ozlabs.ru
Tue Nov 21 14:26:45 AEDT 2023


On 15/11/2023 19:14, Thomas Huth wrote:
> On 23/10/2023 11.12, Bernhard M. Wiedemann wrote:
>> in order to make builds reproducible.
>> See https://reproducible-builds.org/ for why this is good
>> and https://reproducible-builds.org/specs/source-date-epoch/
>> for the definition of this variable.
>>
>> Without this patch, openSUSE's qemu package
>> always varied between builds.
>>
>> This patch was done while working on reproducible builds for openSUSE.
>>
>> This is an alternative to
>> https://lists.ozlabs.org/pipermail/slof/2023-October/002895.html
>>
>> Signed-off-by: Bernhard M. Wiedemann <bwiedemann at suse.de>
>> Reviewed-by: Thomas Huth <thuth at redhat.com>
>> ---
>>   romfs/tools/create_crc.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/romfs/tools/create_crc.c b/romfs/tools/create_crc.c
>> index abc373b..4a30e48 100644
>> --- a/romfs/tools/create_crc.c
>> +++ b/romfs/tools/create_crc.c
>> @@ -95,7 +95,13 @@ createHeaderImage(int notime)
>>       if (!notime) {
>>           /* read time and write it into data stream */
>> -        if ((caltime = time(NULL)) == -1) {
>> +        char *source_date_epoch;
>> +        /* This assumes that (if set) the SOURCE_DATE_EPOCH 
>> environment variable
>> +           will contain a correct, positive integer in the time_t 
>> range */
>> +        if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
>> +            (caltime = (time_t)strtoll(source_date_epoch, NULL, 10)) 
>> <= 0)
>> +            caltime = time(NULL);
>> +        if (caltime == -1) {
>>               printf("time error\n");
>>           }
>>           if ((tm = localtime(&caltime)) == NULL) {
> 
> Ping! Alexey, could you pick up the patch, please?

Uff sorry for the delay. I was thinking if just this one is worth making 
  a release....

> Also, any chance that you could still submit the current SLOF version to 
> QEMU, since the current version there is already quite old...?

... as I thought I sent a pull request a few month back, 20230918, but 
apparently one of my scripts failed :-/ Doing this now...


>   Thanks,
>    Thomas
> 

-- 
Alexey




More information about the SLOF mailing list