Skip to content

Commit 901f543

Browse files
committed
guix: Passthrough BASE_CACHE into container
This allows depends-built packages to be cached.
1 parent 9bbf08b commit 901f543

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

contrib/guix/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ find output/ -type f -print0 | sort -z | xargs -r0 sha256sum
114114
depends tree. Setting this to the same directory across multiple builds of the
115115
depends tree can eliminate unnecessary redownloading of package sources.
116116

117+
* _**BASE_CACHE**_
118+
119+
Set the depends tree cache for built packages. This is passed through to the
120+
depends tree. Setting this to the same directory across multiple builds of the
121+
depends tree can eliminate unnecessary building of packages.
122+
117123
* _**MAX_JOBS**_
118124

119125
Override the maximum number of jobs to run simultaneously, you might want to

contrib/guix/guix-build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ and untracked files and directories will be wiped, allowing you to start anew.
180180
EOF
181181
}
182182

183+
# Create SOURCES_PATH and BASE_CACHE if they are non-empty so that we can map
184+
# them into the container
185+
[ -z "$SOURCES_PATH" ] || mkdir -p "$SOURCES_PATH"
186+
[ -z "$BASE_CACHE" ] || mkdir -p "$BASE_CACHE"
187+
183188
# Deterministically build Bitcoin Core
184189
# shellcheck disable=SC2153
185190
for host in $HOSTS; do
@@ -274,6 +279,7 @@ EOF
274279
--share="$OUTDIR"=/outdir \
275280
--expose="$(git rev-parse --git-common-dir)" \
276281
${SOURCES_PATH:+--share="$SOURCES_PATH"} \
282+
${BASE_CACHE:+--share="$BASE_CACHE"} \
277283
--max-jobs="$MAX_JOBS" \
278284
${SUBSTITUTE_URLS:+--substitute-urls="$SUBSTITUTE_URLS"} \
279285
${ADDITIONAL_GUIX_COMMON_FLAGS} ${ADDITIONAL_GUIX_ENVIRONMENT_FLAGS} \
@@ -282,6 +288,7 @@ EOF
282288
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:?unable to determine value}" \
283289
${V:+V=1} \
284290
${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} \
291+
${BASE_CACHE:+BASE_CACHE="$BASE_CACHE"} \
285292
DISTSRC="$(DISTSRC_BASE=/distsrc-base && distsrc_for_host "$HOST")" \
286293
OUTDIR=/outdir \
287294
bash -c "cd /bitcoin && bash contrib/guix/libexec/build.sh"

contrib/guix/libexec/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ esac
167167
make -C depends --jobs="$MAX_JOBS" HOST="$HOST" \
168168
${V:+V=1} \
169169
${SOURCES_PATH+SOURCES_PATH="$SOURCES_PATH"} \
170+
${BASE_CACHE+BASE_CACHE="$BASE_CACHE"} \
170171
i686_linux_CC=i686-linux-gnu-gcc \
171172
i686_linux_CXX=i686-linux-gnu-g++ \
172173
i686_linux_AR=i686-linux-gnu-ar \

0 commit comments

Comments
 (0)