From 4e26f8f61aa1089a2679c05b2c90bfc22ad6581d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 10 Jul 2019 19:41:29 +0200 Subject: [PATCH] chore(build): lock .stack-work during builds --- .gitignore | 1 + build.sh | 2 ++ clean.sh | 4 ++++ db.sh | 3 +++ deploy.sh | 21 --------------------- ghci.sh | 4 ++++ haddock.sh | 4 ++++ hlint.sh | 4 ++++ start.sh | 4 ++++ test.sh | 4 ++++ 10 files changed, 30 insertions(+), 21 deletions(-) delete mode 100755 deploy.sh diff --git a/.gitignore b/.gitignore index 0fb3c32c0..d12d7e6eb 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ src/Handler/Course.SnapCustom.hs tags test.log *.dump-splices +/.stack-work.lock diff --git a/build.sh b/build.sh index f2958c7de..f35d369b2 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,8 @@ set -e +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + echo "Building..." stack build --fast --flag uniworx:-library-only --flag uniworx:dev $@ echo "Done." diff --git a/clean.sh b/clean.sh index 2c9c71212..2b9f5bfc7 100755 --- a/clean.sh +++ b/clean.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +set -e + +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + case $1 in "") exec -- stack clean diff --git a/db.sh b/db.sh index 3d80bf68f..a66af88ba 100755 --- a/db.sh +++ b/db.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # Options: see /test/Database.hs (Main) + set -e +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + stack build --fast --flag uniworx:-library-only --flag uniworx:dev stack exec uniworxdb -- $@ diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 56f0d5164..000000000 --- a/deploy.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env sh - -configFile="" - -case "$1" in - test) - ln -svf "keter_testworx.yml" config/keter.yml - - yesod keter - ;; - production) - ln -svf "keter_uni2work.yml" config/keter.yml - - yesod keter && git tag -f live && git push origin live - ;; - *) - echo "Usage: $0 (test|production)" >&2 - exit 2 - ;; -esac - diff --git a/ghci.sh b/ghci.sh index 77391583f..ab5cf41bd 100755 --- a/ghci.sh +++ b/ghci.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +set -e + +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + unset HOST export DETAILED_LOGGING=true export LOG_ALL=true diff --git a/haddock.sh b/haddock.sh index 7414e60e8..13bb626e0 100755 --- a/haddock.sh +++ b/haddock.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +set -e + +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + move-back() { mv -v .stack-work .stack-work-doc [[ -d .stack-work-build ]] && mv -v .stack-work-build .stack-work diff --git a/hlint.sh b/hlint.sh index 74a2a9fb7..c6772fda7 100755 --- a/hlint.sh +++ b/hlint.sh @@ -1,3 +1,7 @@ #!/usr/bin/env bash +set -e + +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + exec -- stack build --test --fast --flag uniworx:dev --flag uniworx:library-only uniworx:test:hlint diff --git a/start.sh b/start.sh index cdad4b731..a9ef7cb8d 100755 --- a/start.sh +++ b/start.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +set -e + +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + unset HOST export DETAILED_LOGGING=${DETAILED_LOGGIN:-true} export LOG_ALL=${LOG_ALL:-false} diff --git a/test.sh b/test.sh index 16840a25e..4d2eca141 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +set -e + +[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || : + move-back() { mv -v .stack-work .stack-work-test [[ -d .stack-work-build ]] && mv -v .stack-work-build .stack-work