aboutsummaryrefslogtreecommitdiff
path: root/contrib/guix/libexec/build.sh
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-04-20 15:44:38 -0400
committerCarl Dong <contact@carldong.me>2021-05-03 13:18:19 -0400
commitf9e2960c018103be756a7f8a506816b49d662514 (patch)
tree6e15d5618786c3267c3a3501c2a5e8e6ee0d2cdd /contrib/guix/libexec/build.sh
parent022abc85fc7e711a900fed8e5071919a151c0a63 (diff)
downloadbitcoin-f9e2960c018103be756a7f8a506816b49d662514.tar.xz
guix: Construct $OUTDIR in ${DISTSRC}/output
While files are being output to $OUTDIR, it will be under ${DISTSRC}/output, and only when everything is done, will ${DISTSRC}/output be moved to the actual $OUTDIR. This makes it so that a Ctrl-C in the middle of a build is less likely to result in a partially-constructed $OUTDIR. In fact, if I understand correctly, if $OUTDIR and $DISTSRC reside on the same filesystem, the move (rename) is likely atomic. Also, since the "working $OUTDIR" is under ${DISTSRC}/output, it will be cleaned properly by the guix-clean script.
Diffstat (limited to 'contrib/guix/libexec/build.sh')
-rw-r--r--contrib/guix/libexec/build.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index 21062751ab..1bd4fee884 100644
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -33,6 +33,9 @@ Required environment variables as seen inside the container:
OUTDIR: ${OUTDIR:?not set}
EOF
+ACTUAL_OUTDIR="${OUTDIR}"
+OUTDIR="${DISTSRC}/output"
+
#####################
# Environment Setup #
#####################
@@ -429,3 +432,5 @@ mkdir -p "$DISTSRC"
;;
esac
) # $DISTSRC
+
+mv --no-target-directory "$OUTDIR" "$ACTUAL_OUTDIR"