summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-14 23:08:15 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-14 23:08:15 -0400
commit608915e7ed511ac38546d4c3a22b453ba638dfc1 (patch)
treeda17ecdb3858211105b7dd7efb1bd7991fb93fee
parentac02e8c43ff1fbaf1086d746a1a0a975c9218ef0 (diff)
librefetch: support SOURCE_DATE_EPOCH
fixes https://labs.parabola.nu/issues/884
-rw-r--r--src/librefetch/librefetch.8.ronn12
-rwxr-xr-xsrc/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh6
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.
* <PURGE_TARGETS> 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
+ <SOURCE_DATE_EPOCH>[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. <SOURCE_DATE_EPOCH> 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" -- {} +
}