aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-11-08 11:52:33 +0100
committerJo-Philipp Wich <jo@mein.io>2018-11-08 11:55:45 +0100
commit55d078b249427380fe9cc3684f7657ccc2b1405c (patch)
treeef3d5e19e23692c26554209b2e82356ea6b698fb /scripts
parent2e54de4e54d8a6b4180c69da53f2eb6e80e575ea (diff)
downloadupstream-55d078b249427380fe9cc3684f7657ccc2b1405c.tar.gz
upstream-55d078b249427380fe9cc3684f7657ccc2b1405c.tar.bz2
upstream-55d078b249427380fe9cc3684f7657ccc2b1405c.zip
script: ipkg-build: honour $SOURCE_DATE_EPOCH
When the SOURCE_DATE_EPOCH environment variable is set, use it to override the timestamps of .ipk archive contents. This ensures that .ipk archives built in environments without SCM metadata (mainly the SDK) are reproducible between different runs. Ref: https://github.com/openwrt/packages/issues/6954 Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit d157a76c67bcb821d3ec8dcd4312390ef129a95a)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ipkg-build6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/ipkg-build b/scripts/ipkg-build
index 845a6ed04e..d38ba20af3 100755
--- a/scripts/ipkg-build
+++ b/scripts/ipkg-build
@@ -15,8 +15,12 @@ FIND="${FIND:-$(which gfind)}"
TAR="${TAR:-$(which tar)}"
GZIP="$(which gzip)"
+# try to use fixed source epoch
+if [ -n "$SOURCE_DATE_EPOCH" ]; then
+ TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH")
+
# look up date of last commit
-if [ -d "$TOPDIR/.git" ]; then
+elif [ -d "$TOPDIR/.git" ]; then
GIT="$(which git)"
TIMESTAMP=$(cd $TOPDIR; $GIT log -1 -s --format=%ci)
elif [ -d "$TOPDIR/.svn" ]; then