guix: use a fixed timestamp for depends packages

This commit is contained in:
tobtoht 2024-03-12 14:29:32 +01:00
parent 948266be4e
commit c904eddb91
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
2 changed files with 12 additions and 5 deletions

View file

@ -199,7 +199,7 @@ host_to_commonname() {
esac
}
SOURCE_DATE_EPOCH="1701896000"
COMMIT_TIMESTAMP="$(git -c log.showSignature=false log --format=%at -1)"
# Precious directories are those which should not be cleaned between successive
# guix builds
@ -322,7 +322,7 @@ for host in $HOSTS; do
# shellcheck disable=SC2030
cat << EOF
INFO: Building ${VERSION:?not set} for platform triple ${HOST:?not set}:
...using reference timestamp: ${SOURCE_DATE_EPOCH:?not set}
...using commit timestamp: ${COMMIT_TIMESTAMP:?not set}
...running at most ${JOBS:?not set} jobs
...from worktree directory: '${PWD}'
...bind-mounted in container to: '/feather'
@ -434,7 +434,7 @@ EOF
-- env HOST="$HOST" \
DISTNAME="$DISTNAME" \
JOBS="$JOBS" \
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:?unable to determine value}" \
COMMIT_TIMESTAMP="${COMMIT_TIMESTAMP:?unable to determine value}" \
${V:+V=1} \
${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} \
${BASE_CACHE:+BASE_CACHE="$BASE_CACHE"} \
@ -465,7 +465,7 @@ EOF
${SUBSTITUTE_URLS:+--substitute-urls="$SUBSTITUTE_URLS"} \
${ADDITIONAL_GUIX_COMMON_FLAGS} ${ADDITIONAL_GUIX_ENVIRONMENT_FLAGS} \
-- env DISTNAME="$DISTNAME" \
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:?unable to determine value}" \
SOURCE_DATE_EPOCH="${COMMIT_TIMESTAMP:?unable to determine value}" \
VERSION="$VERSION" \
bash -c "cd /feather && \
bash contrib/flatpak/make_flatpak.sh"

View file

@ -36,7 +36,7 @@ Required environment variables as seen inside the container:
DIST_ARCHIVE_BASE: ${DIST_ARCHIVE_BASE:?not set}
DISTNAME: ${DISTNAME:?not set}
HOST: ${HOST:?not set}
SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH:?not set}
COMMIT_TIMESTAMP: ${COMMIT_TIMESTAMP:?not set}
JOBS: ${JOBS:?not set}
DISTSRC: ${DISTSRC:?not set}
OUTDIR: ${OUTDIR:?not set}
@ -46,6 +46,9 @@ EOF
ACTUAL_OUTDIR="${OUTDIR}"
OUTDIR="${DISTSRC}/output"
# Use a fixed timestamp for depends builds so hashes match across commits that don't make changes to the build system
export SOURCE_DATE_EPOCH=1397818193
#####################
# Environment Setup #
#####################
@ -230,6 +233,10 @@ make -C contrib/depends --jobs="$JOBS" HOST="$HOST" \
# Source Tarball Building #
###########################
# Use COMMIT_TIMESTAMP for the source and release binary archives
export SOURCE_DATE_EPOCH=${COMMIT_TIMESTAMP}
export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name"
GIT_ARCHIVE="${DIST_ARCHIVE_BASE}/${DISTNAME}.tar.gz"
# Create the source tarball if not already there