Skip to content

Commit f9e2960

Browse files
committed
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.
1 parent 022abc8 commit f9e2960

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

contrib/guix/libexec/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Required environment variables as seen inside the container:
3333
OUTDIR: ${OUTDIR:?not set}
3434
EOF
3535

36+
ACTUAL_OUTDIR="${OUTDIR}"
37+
OUTDIR="${DISTSRC}/output"
38+
3639
#####################
3740
# Environment Setup #
3841
#####################
@@ -429,3 +432,5 @@ mkdir -p "$DISTSRC"
429432
;;
430433
esac
431434
) # $DISTSRC
435+
436+
mv --no-target-directory "$OUTDIR" "$ACTUAL_OUTDIR"

0 commit comments

Comments
 (0)