[PATCH cygport] Add initial support for SOURCE_DATE_EPOCH

Christian Franke Christian.Franke@t-online.de
Thu Aug 24 06:09:40 GMT 2023


Brian Inglis via Cygwin-apps wrote:
> On 2023-08-23 11:39, Christian Franke via Cygwin-apps wrote:
>> A small step towards reproducible packaging...
>>
>> Currently only tested with upcoming smartmontools package - contains 
>> only exe, man, doc files (no dll, lib, ...). Multiple cygport runs 
>> produce binary identical distribution tarballs if SOURCE_DATE_EPOCH 
>> (from the past) is specified in the cygport file.
>
> What format is this variable?

Unix epoch, see: https://reproducible-builds.org/docs/source-date-epoch/

Some tools like gcc and gropdf already support this:

$ echo '__DATE__ __TIME__' | SOURCE_DATE_EPOCH=1672531200 gcc -E -xc -
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
"Jan  1 2023" "00:00:00"

$ TZ=UTC SOURCE_DATE_EPOCH=1672531200 man -Tpdf ls | TZ=UTC pdfinfo -
Creator:        groff version 1.23.0
Producer:       gropdf version 1.23.0
CreationDate:   Sun Jan  1 00:00:00 2023 UTC
ModDate:        Sun Jan  1 00:00:00 2023 UTC
...

If binutils, gzip and tar also would support this, the patch would be 
empty :-)


> Would be best to use some ISO format e.g.
>
>     %Y-%m-%dT%H:%M:%SZ    or
>     %Y-%m-%dT%H:%M:%S    [local]
>
> that is human readable and can be used by all POSIX command options
> [e.g. see touch(1p) -d] that accept date-time stamps.


I use this in smartmontools.cygport:

SOURCE_DATE=2023-08-23
SOURCE_DATE_EPOCH=$(date -d "$SOURCE_DATE UTC" +%s)

This relies on GNU date, BSD date is very different, a POSIX-only date 
would be useless in this context.


> Could do with docs and NEWS entries for new variables, otherwise 
> packagers do not know it exists, and how to use it e.g.
>
> #****f* Information/BUILD_REQUIRES
> #  SYNOPSIS
> ...

Of course this should be documented, but I left this for a later patch.

-- 
Regards,
Christian



More information about the Cygwin-apps mailing list