Merge pull request #7220 from phadej/backport-to-3.4-20201230
[cabal.git] / travis-bootstrap.sh
blob7ba368f644802f99c87a960fb973445d8959ab43
1 #!/bin/sh
3 . ./travis-common.sh
5 # ---------------------------------------------------------------------
6 # Bootstrap cabal, to verify bootstrap.sh script works.
7 # ---------------------------------------------------------------------
9 bootstrap_jobs="-j"
11 (cd cabal-install && timed env EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh $bootstrap_jobs --no-doc)
12 timed $HOME/.cabal/bin/cabal --version
13 PATH=$HOME/.cabal/bin:$PATH
15 # ---------------------------------------------------------------------
16 # Verify that installation from tarball works.
17 # ---------------------------------------------------------------------
19 # The following scriptlet checks that the resulting source distribution can be
20 # built & installed.
21 install_from_tarball() {
22 SRC_NAME=$(cabal info . | awk '{print $2;exit}') ;
23 SRC_TGZ="$SRC_NAME.tar.gz"
24 SRC_PATH="$TRAVIS_BUILD_DIR/dist-newstyle/sdist/$SRC_TGZ"
25 export SRC_TGZ
26 if [ -f "$SRC_PATH" ]; then
27 tar xzf $SRC_PATH -C /tmp;
28 cd /tmp/$SRC_NAME;
29 cabal build --force-reinstalls $jobs all -v2;
30 else
31 echo "expected '$TRAVIS_BUILD_DIR/dist-newstyle/sdist/$SRC_TGZ' not found";
32 exit 1;
36 timed cabal update
38 # NB: The cabal cleans here hack around an sdist bug where
39 # the bootstrapped Cabal/cabal-install may be built
40 # without a Paths_* module available. Under some situations
41 # which I have not been able to reproduce except on Travis,
42 # cabal sdist will incorrectly pick up the left over dist
43 # directory from the bootstrap and then try to package
44 # up the Paths module, but to no avail because it is not
45 # available. I ran out of patience trying to debug this
46 # issue, and it is easy enough to work around: clean first.
48 echo Cabal
49 (cd Cabal && timed cabal clean) || exit $?
50 (cd Cabal && timed cabal sdist) || exit $?
51 (cd Cabal && timed install_from_tarball) || exit $?
53 echo cabal-install
54 (cd cabal-install && timed cabal clean) || exit $?
55 (cd cabal-install && timed cabal sdist) || exit $?
56 # I don't know how to fix this exactly right now.
57 #(cd cabal-install && timed install_from_tarball) || exit $?