From 608915e7ed511ac38546d4c3a22b453ba638dfc1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 14 Apr 2016 23:08:15 -0400 Subject: librefetch: support SOURCE_DATE_EPOCH fixes https://labs.parabola.nu/issues/884 --- src/librefetch/librefetch.8.ronn | 12 +++++++++--- .../librefetchdir/libmakepkg/tidy/~source_date_epoch.sh | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 5720c8d..cf009de 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -184,9 +184,10 @@ The following modifications are made to makepkg: * Don't symlink the resulting file into the current directory. * interprets an item as a directory if it ends with a slash ("/"). - * Timestamps in <$pkgdir> are reset to "1990-01-01 0:0:0 +0", so that - the resulting tarball will be the same, regardless of when it was - created. + * Timestamps in <$pkgdir> are reset to the date specified in + [1], or "1990-01-01 0:0:0 +0" if it's not set, so + that the resulting tarball will be the same, regardless of when it + was created. * Sort the files included in the tarball; normally the order of files in a tarball is essentially random (even if it tends to be the same when re-created on the same machine). @@ -206,3 +207,8 @@ the `librefetch.conf` file. ## SEE ALSO librefetch.conf(5), makepkg(8), PKGBUILD(5), SRCBUILD(5) + +## NOTES + + 1. specification for build systems + https://reproducible-builds.org/specs/source-date-epoch/ diff --git a/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh b/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh index 562820b..fec7686 100755 --- a/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh +++ b/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh @@ -27,5 +27,9 @@ LIBMAKEPKG_TIDY_SOURCE_DATE_EPOCH_SH=1 tidy_modify+=('tidy_source_date_epoch') tidy_source_date_epoch() { - find . -exec touch --no-dereference --date="1990-01-01 0:0:0 +0" -- {} + + local date='1990-01-01 0:0:0 +0' + if [[ -n "$SOURCE_DATE_EPOCH" ]]; then + date="@$SOURCE_DATE_EPOCH" + fi + find . -exec touch --no-dereference --date="$date" -- {} + } -- cgit v1.2.3