[rb-general] using SOURCE_DATE_EPOCH with date

Bernhard M. Wiedemann reproduciblebmw at lsmod.de
Wed Jan 4 18:32:05 CET 2017


what is the best way to use SOURCE_DATE_EPOCH with date?

I found
date ${SOURCE_DATE_EPOCH/#/--date=}
to be quite elegant, but it does not work with dash.

date --date=@${SOURCE_DATE_EPOCH:-$(date +%s)}
does work with dash and bash, but is not as nice.

Also there are longer variants like

that would not look nice when used in Makefiles.
Can you think of better ways than these?
And which one(s) should we recommend for patches we send upstream?

Bernhard M. Wiedemann
software engineer

More information about the rb-general mailing list