Skip to content

Commit

Permalink
script: ipkg-build: honour $SOURCE_DATE_EPOCH
Browse files Browse the repository at this point in the history
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: openwrt/packages#6954
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  • Loading branch information
jow- committed Nov 8, 2018
1 parent 559635d commit d157a76
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/ipkg-build
Expand Up @@ -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
Expand Down

0 comments on commit d157a76

Please sign in to comment.