The SOURCE_DATE_EPOCH variable is used to make builds reproducible even
if rebuild at different times. Instead of using the current timestamp,
the time of the last source change is used.
Created packages are `touch`ed with a specific timestamp so resulting
packages have the same checksums.
The `get_source_date_epoch.sh` script tries multiple ways (file, git,
hg) to determine the correct timestamp.
Until now the script would only consider the $TOPDIR instead of package
specific changes. Resulting in packages with same versions but different
timestamps, as $TOPDIR (openwrt.git) received changes not affecting
package versions. This results in warning/erros in `opkg` as the package
versions stay the same but checksums changed.
This commit adds an optional argument to get the `SOURCE_DATE_EPOCH` of
a specific path (e.g. package SOURCE) rather than the $TOPDIR. As a
consequence this allows granular but still reproducible timestamps.
As packages might be distributed over multiple repositories the check
for `.git/` becomes unfeasible. Instead tell `git` and `hg` to change
their working directories and automatically traverse the repo folder.
Signed-off-by: Paul Spooren <mail@aparcar.org>
If a `cd` to `TOPDIR` fails the script should quit.
Also unify `try_mtime` function by storing it in a variable.
Signed-off-by: Paul Spooren <mail@aparcar.org>
Add a fallback case to get_source_date_epoch.sh which reports the modification
time of the script itself in case there is no SCM information available, e.g.
when downloading .tar.gz or .zip tarballs produced by Github.
Also fix the mercurial case while we're at it.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
SOURCE_DATE_EPOCH is the date of the last modified file using git/svn
as date source.
See https://reproducible-builds.org/specs/source-date-epoch/
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 48584