RFC: Supporting SOURCE_DATE_EPOCH in ar

Nick Clifton nickc@redhat.com
Tue Aug 29 09:46:29 GMT 2023


Hi Guys,

  I have been looking improving our support for reproducible builds, and
  in particular how we might be able to use the SOURCE_DATE_EPOCH
  environment variable when creating and maintaining static archives.  I
  think that it can be done, and the attached patch is my proposal for
  implementing this.

  The patch makes several changes:

    * Adding files to a reproduicble archive, either one created with
      --enable-deterministic-archives or with SOURCE_DATA_EPOCH set is
      allowed.  If the update ('u') modifier is in effect it will be
      ignored and the new file(s) will always replace the old file(s).

    * Running "ar ruD" will no longer trigger an error, but instead give
      a warning message and then proceed as outlined above.

    * It adds a new function - bfd_get_current_time() - which can be
      used instead of calling time().  This will return
      SOURCE_DATE_EPOCH if it is defined.  The function can also be used
      to conditionally update the st_mtime field in a stat structure,
      changing it only if SOURCE_DATE_EPOCH is defined.

    * It adds three new tests to the binutils testsuite to check that
      the new behaviour is supported correctly.

  Any comments or suggestions ?
  
Cheers
  Nick
  
https://reproducible-builds.org/docs/source-date-epoch/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ar-SOURCE_DATE_EPOCH.patch
Type: text/x-patch
Size: 15225 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20230829/72ffcf66/attachment.bin>


More information about the Binutils mailing list