@@ -18,7 +18,8 @@ fi
18IMAGE=commercialhaskell/stackage:$TAG
18IMAGE=commercialhaskell/stackage:$TAG
20CABAL_DIR=$ROOT/cabal
20CABAL_DIR=$ROOT/cabal
21+PANTRY_DIR=$ROOT/pantry
21−STACK_DIR=$ROOT/stack
22+STACK_DIR=$ROOT/stack-$TAG
22GHC_DIR=$ROOT/ghc
23GHC_DIR=$ROOT/ghc
23DOT_STACKAGE_DIR=$ROOT/dot-stackage
24DOT_STACKAGE_DIR=$ROOT/dot-stackage
24WORKDIR=$ROOT/$TAG/work
25WORKDIR=$ROOT/$TAG/work
@@ -28,6 +29,7 @@ USERID=$(id -u)
30 "$CABAL_DIR" \
31 "$CABAL_DIR" \
31 "$STACK_DIR" \
33 "$STACK_DIR" \
32 "$GHC_DIR" \
34 "$GHC_DIR" \
33 "$DOT_STACKAGE_DIR" \
35 "$DOT_STACKAGE_DIR" \
@@ -61,7 +63,7 @@ BINDIR=$(cd $ROOT/bin ; pwd)
63rm -f stackage-curator stackage-curator-2*.bz2
65rm -f stackage-curator stackage-curator-2*.bz2
64−CURATOR2=stackage-curator-2-7e65b644121812d9a3a8b24d7130bb8865485f8f
66+CURATOR2=stackage-curator-2-7e161449fa1b63a7e41299f3f87bd6f3d7e13082
65wget "https://download.fpcomplete.com/stackage-curator-2/$CURATOR2.bz2"
67wget "https://download.fpcomplete.com/stackage-curator-2/$CURATOR2.bz2"
66bunzip2 "$CURATOR2.bz2"
68bunzip2 "$CURATOR2.bz2"
67chmod +x $CURATOR2
69chmod +x $CURATOR2
@@ -69,8 +71,10 @@ mv $CURATOR2 stackage-curator
69./stackage-curator --version
71./stackage-curator --version
72−
74+# We share pantry directory between snapshots while the other content in .stack
75+# is stored separately (because e.g. Ubuntu releases between LTS and nightly
76+# could differ). Also the order of binds is important.
73−ARGS_COMMON="--rm -v $WORKDIR:$HOME/work -w $HOME/work -v $BINDIR/stackage-curator:/usr/bin/stackage-curator:ro -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v $BINDIR/stack:/usr/bin/stack:ro -v $STACK_DIR:$HOME/.stack"
77+ARGS_COMMON="--rm -v $WORKDIR:$HOME/work -w $HOME/work -v $BINDIR/stackage-curator:/usr/bin/stackage-curator:ro -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v $BINDIR/stack:/usr/bin/stack:ro -v $STACK_DIR:$HOME/.stack -v $PANTRY_DIR:$HOME/.stack/pantry"
74ARGS_PREBUILD="$ARGS_COMMON -u $USERID -e HOME=$HOME -v $CABAL_DIR:$HOME/.cabal -v $GHC_DIR:$HOME/.ghc -v $DOT_STACKAGE_DIR:$HOME/.stackage"
78ARGS_PREBUILD="$ARGS_COMMON -u $USERID -e HOME=$HOME -v $CABAL_DIR:$HOME/.cabal -v $GHC_DIR:$HOME/.ghc -v $DOT_STACKAGE_DIR:$HOME/.stackage"
75ARGS_BUILD="$ARGS_COMMON -v $CABAL_DIR:$HOME/.cabal:ro -v $GHC_DIR:$HOME/.ghc:ro"
79ARGS_BUILD="$ARGS_COMMON -v $CABAL_DIR:$HOME/.cabal:ro -v $GHC_DIR:$HOME/.ghc:ro"
76# instance-data is an undocumented feature of S3 used by amazonka,
80# instance-data is an undocumented feature of S3 used by amazonka,
@@ -90,7 +94,7 @@ fi
92rm -f stack stack-*.bz2
96rm -f stack stack-*.bz2
93−STACK=stack-7e65b644121812d9a3a8b24d7130bb8865485f8f
97+STACK=stack-7e161449fa1b63a7e41299f3f87bd6f3d7e13082
94wget "https://download.fpcomplete.com/stackage-curator-2/$STACK.bz2"
98wget "https://download.fpcomplete.com/stackage-curator-2/$STACK.bz2"
95bunzip2 "$STACK.bz2"
99bunzip2 "$STACK.bz2"
96chmod +x $STACK
100chmod +x $STACK
@@ -128,7 +132,7 @@ esac
128# Now do the actual build. We need to first set the owner of the home directory
132# Now do the actual build. We need to first set the owner of the home directory
129# correctly, so we run the command as root, change owner, and then use sudo to
133# correctly, so we run the command as root, change owner, and then use sudo to
130# switch back to the current user
134# switch back to the current user
131−docker run $ARGS_BUILD $IMAGE nice -n 15 /bin/bash -c "chown $USER $HOME && exec sudo -E -u $USER env \"HOME=$HOME\" \"PATH=\$PATH\" stackage-curator build --jobs $JOBS"
135+docker run $ARGS_BUILD $IMAGE nice -n 15 /bin/bash -c "chown $USER $HOME && exec sudo -E -u $USER env \"HOME=$HOME\" \"PATH=\$PATH\" stackage-curator build --jobs $JOBS" 2>&1 | tee "$SHORTNAME-build.log"
133# Make sure we actually need this snapshot. We used to perform this check
137# Make sure we actually need this snapshot. We used to perform this check
134# exclusively before building. Now we perform it after as well for the case of
138# exclusively before building. Now we perform it after as well for the case of