git.iko.soy/typeable/servant
on master help sign in
Merge pull request #923 from haskell-servant/jkarni/cleanup-scripts

Remove unused scripts.

commitf8301a21e9e257d8e48f5fb4fbeaf55e8a21b020 authorJulian Arni <jkarni@gmail.com> dateTue 13 Mar 2018, 11:05 (9 years ago) parente02f29aaa612de
10 files changed−317
scripts/README.md−8 scripts/bump-versions.sh−62 scripts/ci-cron.sh−20 scripts/clear-sandbox.sh−26 scripts/generate-nix-files.sh−48 scripts/lib/common.sh−56 scripts/start-sandbox.sh−26 scripts/test-all.sh−46 scripts/test-stack.sh−11 scripts/upload.hs−14
scripts/README.mddeleted−8
@@ -1,8 +0,0 @@
1−The release process works roughly like this:
2−
3−``` bash
4−./scripts/bump-versions.sh <type-of-bump>
5−git commit
6−./scripts/upload.hs
7−git tag <version> && git push --tags
8−```
scripts/bump-versions.shdeleted−62
@@ -1,62 +0,0 @@
1−#!/usr/bin/env bash
2−#===============================================================================
3−#
4−# FILE: bump-versions.sh
5−#
6−# USAGE: ./bump-versions.sh
7−#
8−# DESCRIPTION: Bump the versions for all servant packages
9−#
10−# OPTIONS: See usage
11−# REQUIREMENTS: bumper, bash >= 4
12−# CREATED: 11.05.2015 21:36
13−# REVISION: ---
14−#===============================================================================
15−
16−set -o nounset
17−set -o errexit
18−
19−DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
20−. "${DIR}/scripts/lib/common.sh"
21−
22−usage () {
23− echo " bump-versions.sh <POSITION> [-d|--dry-run]"
24− echo " | [-h|--help]"
25− echo " Bumps the specified positional version of all servant packages."
26− echo " POSITION is a number between 0 and 3, inclusive."
27− exit 0
28−}
29−
30−if [ $# -eq 0 ] ; then
31− echo "expecting one or more arguments. Got 0"
32− usage
33−elif [ $# -gt 2 ] ; then
34− echo "expecting one or more arguments"
35− usage
36−fi
37−
38−versions_equal
39−
40−while [ "${1:-unset}" != "unset" ] ; do
41− case "$1" in
42− -h | --help) usage ;;
43− -d | --dry-run) DRY_RUN=true
44− shift ;;
45− 0) if POSITION="none" ; then POSITION=0 ; else usage ; fi
46− shift ;;
47− 1) if POSITION="none" ; then POSITION=1 ; else usage ; fi
48− shift ;;
49− 2) if POSITION="none" ; then POSITION=2 ; else usage ; fi
50− shift ;;
51− 3) if POSITION="none" ; then POSITION=3 ; else usage ; fi
52− shift ;;
53− *) usage ;;
54− esac
55−done
56−
57−if $DRY_RUN ; then
58− echo "Would have bumped position ${POSITION} on these packages:"
59− ( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , $SOURCES tutorial) )
60−else
61− ( cd "$ROOT" && bumper -"$POSITION" $(join , $SOURCES tutorial) )
62−fi
scripts/ci-cron.shdeleted−20
@@ -1,20 +0,0 @@
1−#!/usr/bin/env bash
2−
3−set -o nounset
4−set -o errexit
5−set -o verbose
6−
7−export PATH=$(stack path --bin-path):$PATH
8−
9−stack install cabal-install
10−cabal update
11−
12−for package in $(cat sources.txt) ; do
13− echo testing $package
14− pushd $package
15− tinc
16− cabal configure --enable-tests --disable-optimization --ghc-options='-Werror'
17− cabal build
18− cabal test
19− popd
20−done
scripts/clear-sandbox.shdeleted−26
@@ -1,26 +0,0 @@
1−#!/usr/bin/env bash
2−#===============================================================================
3−#
4−# FILE: clear-sandbox.sh
5−#
6−# USAGE: ./clear-sandbox.sh
7−#
8−# DESCRIPTION: Clear sandbox at top-level and at all packages
9−#
10−# REQUIREMENTS: bash >= 4
11−#===============================================================================
12−
13−set -o nounset
14−set -o errexit
15−
16−DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
17−. "$DIR"/lib/common.sh
18−
19−clear_sandbox () {
20− rm -rf .cabal-sandbox cabal.sandbox.config
21− for s in ${SOURCES[@]} ; do
22− (cd "$s" && rm -rf cabal.sandbox.config dist)
23− done
24−}
25−
26−clear_sandbox
scripts/generate-nix-files.shdeleted−48
@@ -1,48 +0,0 @@
1−#!/usr/bin/env bash
2−#===============================================================================
3−#
4−# FILE: generate-nix-files.sh
5−#
6−# USAGE: ./generate-nix-files.sh
7−#
8−# DESCRIPTION: Update nix files at top-level and add all packages
9−#
10−# REQUIREMENTS: bash >= 4, cabal2nix(nix tool)
11−#===============================================================================
12−
13−set -o nounset
14−set -o errexit
15−
16−DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
17−. "$DIR"/lib/common.sh
18−SHELLNIX="shell.nix"
19−
20−write-package-shell-nix () {
21− rm -rf $SHELLNIX
22− echo -e "let" >> $SHELLNIX
23− echo -e " pkgs = import <nixpkgs> {};" >> $SHELLNIX
24− echo -e "" >> $SHELLNIX
25− echo -e " haskellPackages = pkgs.haskellPackages.override {" >> $SHELLNIX
26− echo -e " overrides = self: super: {" >> $SHELLNIX
27− for n in ${SOURCES[@]} ; do
28− if [[ $1 != $n ]]; then
29− echo -e " $n = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.appendConfigureFlag (self.callPackage ../$n {}) \"--ghc-options=-Werror\");" >> $SHELLNIX
30− fi
31− done
32− echo -e " $1 = pkgs.haskell.lib.appendConfigureFlag (self.callPackage ./. {}) \"--ghc-options=-Werror\";" >> $SHELLNIX
33− echo -e " };" >> $SHELLNIX
34− echo -e " };" >> $SHELLNIX
35− echo -e "" >> $SHELLNIX
36− echo -e "in haskellPackages.$s.env" >> $SHELLNIX
37−}
38−
39−update-nix-files () {
40− for s in ${SOURCES[@]} ; do
41− pushd "$s" > /dev/null
42− cabal2nix . > default.nix
43− write-package-shell-nix $s
44− popd > /dev/null
45− done
46−}
47−
48−update-nix-files
scripts/lib/common.shdeleted−56
@@ -1,56 +0,0 @@
1−#!/bin/bash -
2−#===============================================================================
3−#
4−# FILE: lib/common.sh
5−#
6−# DESCRIPTION: Common functions for servant's shell scripts
7−# Meant to be sourced rather than run.
8−#
9−# REQUIREMENTS: bash >= 4
10−#===============================================================================
11−
12−
13−DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
14−ROOT=$( dirname $DIR )
15−DRY_RUN=false
16−POSITION="none"
17−SOURCES_TXT="$( dirname $DIR)/sources.txt"
18−CABAL=${CABAL:-cabal}
19−TRAVIS=${TRAVIS:-false}
20−
21−declare -a SOURCES
22−SOURCES=$(awk -F= '{print $1}' "$SOURCES_TXT")
23−
24−join () { local IFS="$1"; shift; echo "$*"; }
25−
26−versions_equal () {
27− local NUM=$(cd "$ROOT" && find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
28− if [ 1 -eq $NUM ] ; then
29− return 0
30− else
31− echo "versions of packages are not all the same!" && exit 1
32− fi
33−}
34−
35−travis_retry() {
36− # From
37− # https://github.com/travis-ci/travis-build/blob/18bd04e965b9bfaa49cd6bdcd8dcb1513b8d2fcd/lib/travis/build/templates/header.sh
38− local result=0
39− local count=1
40− while [ $count -le 3 ]; do
41− [ $result -ne 0 ] && {
42− echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2
43− }
44− "$@"
45− result=$?
46− [ $result -eq 0 ] && break
47− count=$(($count + 1))
48− sleep 1
49− done
50−
51− [ $count -gt 3 ] && {
52− echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2
53− }
54−
55− return $result
56−}
scripts/start-sandbox.shdeleted−26
@@ -1,26 +0,0 @@
1−#!/usr/bin/env bash
2−#===============================================================================
3−#
4−# FILE: start-sandbox.sh
5−#
6−# USAGE: ./start-sandbox.sh
7−#
8−# DESCRIPTION: Create sandbox at top-level and add all packages as add-source
9−#
10−# REQUIREMENTS: bash >= 4
11−#===============================================================================
12−
13−set -o nounset
14−set -o errexit
15−
16−DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
17−. "$DIR"/lib/common.sh
18−
19−prepare_sandbox () {
20− $CABAL sandbox init
21− for s in ${SOURCES[@]} ; do
22− (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox && $CABAL sandbox add-source .)
23− done
24−}
25−
26−prepare_sandbox
scripts/test-all.shdeleted−46
@@ -1,46 +0,0 @@
1−#!/usr/bin/env bash
2−#===============================================================================
3−#
4−# FILE: test-all.sh
5−#
6−# USAGE: ./test-all.sh
7−#
8−# DESCRIPTION: Run tests for all source directories listed in $SOURCES.
9−# Uses local versions of those sources.
10−#
11−# REQUIREMENTS: bash >= 4
12−#===============================================================================
13−
14−set -o nounset
15−set -o errexit
16−
17−DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
18−. "$DIR"/lib/common.sh
19−
20−GHC_FLAGS="-Werror"
21−
22−prepare_sandbox () {
23− $CABAL sandbox init
24− for s in ${SOURCES[@]} ; do
25− (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .)
26− done
27− if $TRAVIS ; then
28− travis_retry $CABAL install --enable-tests ${SOURCES[@]}
29− else
30− $CABAL install --max-backjumps -1 --reorder-goals --enable-tests ${SOURCES[@]}
31− fi
32−}
33−
34−test_each () {
35− for s in ${SOURCES[@]} ; do
36− echo "Testing $s..."
37− pushd "$s"
38− $CABAL configure --enable-tests --ghc-options="$GHC_FLAGS"
39− $CABAL build
40− $CABAL test
41− popd
42− done
43−}
44−
45−prepare_sandbox
46−test_each
scripts/test-stack.shdeleted−11
@@ -1,11 +0,0 @@
1−#!/usr/bin/env bash
2−
3−set -o nounset
4−set -o errexit
5−
6−for stack_file in stack*.yaml ; do
7− echo testing $stack_file...
8− export STACK_YAML=$stack_file
9− stack setup
10− stack test --fast --ghc-options="-Werror"
11−done
scripts/upload.hsdeleted−14
@@ -1,14 +0,0 @@
1−#!/usr/bin/env stack
2−{- stack
3−--resolver lts-3.10
4−--install-ghc runghc
5−-}
6−
7−import Data.Foldable
8−import System.Process
9−
10−main :: IO ()
11−main = do
12− sources <- words <$> readFile "sources.txt"
13− forM_ sources $ \ source -> do
14− callCommand ("stack upload --no-signature " ++ source)