Skip to content

Commit

Permalink
guix: use a fixed timestamp for depends packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tobtoht committed Mar 12, 2024
1 parent 948266b commit c904edd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions contrib/guix/guix-build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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"} \
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 8 additions & 1 deletion contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 #
#####################
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c904edd

Please sign in to comment.