From aa612de2d08e93b6a5ccae3ef03ed8b0ce7c2a71 Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Tue, 13 Mar 2018 10:28:20 +0100 Subject: [PATCH] Remove unused scripts. Which are all of them. --- 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 -------- 10 files changed, 317 deletions(-) delete mode 100644 scripts/README.md delete mode 100755 scripts/bump-versions.sh delete mode 100755 scripts/ci-cron.sh delete mode 100755 scripts/clear-sandbox.sh delete mode 100755 scripts/generate-nix-files.sh delete mode 100644 scripts/lib/common.sh delete mode 100755 scripts/start-sandbox.sh delete mode 100755 scripts/test-all.sh delete mode 100755 scripts/test-stack.sh delete mode 100755 scripts/upload.hs diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index 1f3eae98..00000000 --- a/scripts/README.md +++ /dev/null @@ -1,8 +0,0 @@ -The release process works roughly like this: - -``` bash -./scripts/bump-versions.sh -git commit -./scripts/upload.hs -git tag && git push --tags -``` diff --git a/scripts/bump-versions.sh b/scripts/bump-versions.sh deleted file mode 100755 index aaa3d0c2..00000000 --- a/scripts/bump-versions.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -#=============================================================================== -# -# FILE: bump-versions.sh -# -# USAGE: ./bump-versions.sh -# -# DESCRIPTION: Bump the versions for all servant packages -# -# OPTIONS: See usage -# REQUIREMENTS: bumper, bash >= 4 -# CREATED: 11.05.2015 21:36 -# REVISION: --- -#=============================================================================== - -set -o nounset -set -o errexit - -DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )) -. "${DIR}/scripts/lib/common.sh" - -usage () { - echo " bump-versions.sh [-d|--dry-run]" - echo " | [-h|--help]" - echo " Bumps the specified positional version of all servant packages." - echo " POSITION is a number between 0 and 3, inclusive." - exit 0 -} - -if [ $# -eq 0 ] ; then - echo "expecting one or more arguments. Got 0" - usage -elif [ $# -gt 2 ] ; then - echo "expecting one or more arguments" - usage -fi - -versions_equal - -while [ "${1:-unset}" != "unset" ] ; do - case "$1" in - -h | --help) usage ;; - -d | --dry-run) DRY_RUN=true - shift ;; - 0) if POSITION="none" ; then POSITION=0 ; else usage ; fi - shift ;; - 1) if POSITION="none" ; then POSITION=1 ; else usage ; fi - shift ;; - 2) if POSITION="none" ; then POSITION=2 ; else usage ; fi - shift ;; - 3) if POSITION="none" ; then POSITION=3 ; else usage ; fi - shift ;; - *) usage ;; - esac -done - -if $DRY_RUN ; then - echo "Would have bumped position ${POSITION} on these packages:" - ( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , $SOURCES tutorial) ) -else - ( cd "$ROOT" && bumper -"$POSITION" $(join , $SOURCES tutorial) ) -fi diff --git a/scripts/ci-cron.sh b/scripts/ci-cron.sh deleted file mode 100755 index 27be3e35..00000000 --- a/scripts/ci-cron.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -o nounset -set -o errexit -set -o verbose - -export PATH=$(stack path --bin-path):$PATH - -stack install cabal-install -cabal update - -for package in $(cat sources.txt) ; do - echo testing $package - pushd $package - tinc - cabal configure --enable-tests --disable-optimization --ghc-options='-Werror' - cabal build - cabal test - popd -done diff --git a/scripts/clear-sandbox.sh b/scripts/clear-sandbox.sh deleted file mode 100755 index 5e70e14f..00000000 --- a/scripts/clear-sandbox.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -#=============================================================================== -# -# FILE: clear-sandbox.sh -# -# USAGE: ./clear-sandbox.sh -# -# DESCRIPTION: Clear sandbox at top-level and at all packages -# -# REQUIREMENTS: bash >= 4 -#=============================================================================== - -set -o nounset -set -o errexit - -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -. "$DIR"/lib/common.sh - -clear_sandbox () { - rm -rf .cabal-sandbox cabal.sandbox.config - for s in ${SOURCES[@]} ; do - (cd "$s" && rm -rf cabal.sandbox.config dist) - done -} - -clear_sandbox diff --git a/scripts/generate-nix-files.sh b/scripts/generate-nix-files.sh deleted file mode 100755 index 5865e02f..00000000 --- a/scripts/generate-nix-files.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -#=============================================================================== -# -# FILE: generate-nix-files.sh -# -# USAGE: ./generate-nix-files.sh -# -# DESCRIPTION: Update nix files at top-level and add all packages -# -# REQUIREMENTS: bash >= 4, cabal2nix(nix tool) -#=============================================================================== - -set -o nounset -set -o errexit - -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -. "$DIR"/lib/common.sh -SHELLNIX="shell.nix" - -write-package-shell-nix () { - rm -rf $SHELLNIX - echo -e "let" >> $SHELLNIX - echo -e " pkgs = import {};" >> $SHELLNIX - echo -e "" >> $SHELLNIX - echo -e " haskellPackages = pkgs.haskellPackages.override {" >> $SHELLNIX - echo -e " overrides = self: super: {" >> $SHELLNIX - for n in ${SOURCES[@]} ; do - if [[ $1 != $n ]]; then - echo -e " $n = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.appendConfigureFlag (self.callPackage ../$n {}) \"--ghc-options=-Werror\");" >> $SHELLNIX - fi - done - echo -e " $1 = pkgs.haskell.lib.appendConfigureFlag (self.callPackage ./. {}) \"--ghc-options=-Werror\";" >> $SHELLNIX - echo -e " };" >> $SHELLNIX - echo -e " };" >> $SHELLNIX - echo -e "" >> $SHELLNIX - echo -e "in haskellPackages.$s.env" >> $SHELLNIX -} - -update-nix-files () { - for s in ${SOURCES[@]} ; do - pushd "$s" > /dev/null - cabal2nix . > default.nix - write-package-shell-nix $s - popd > /dev/null - done -} - -update-nix-files diff --git a/scripts/lib/common.sh b/scripts/lib/common.sh deleted file mode 100644 index 339fe863..00000000 --- a/scripts/lib/common.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -#=============================================================================== -# -# FILE: lib/common.sh -# -# DESCRIPTION: Common functions for servant's shell scripts -# Meant to be sourced rather than run. -# -# REQUIREMENTS: bash >= 4 -#=============================================================================== - - -DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )) -ROOT=$( dirname $DIR ) -DRY_RUN=false -POSITION="none" -SOURCES_TXT="$( dirname $DIR)/sources.txt" -CABAL=${CABAL:-cabal} -TRAVIS=${TRAVIS:-false} - -declare -a SOURCES -SOURCES=$(awk -F= '{print $1}' "$SOURCES_TXT") - -join () { local IFS="$1"; shift; echo "$*"; } - -versions_equal () { - local NUM=$(cd "$ROOT" && find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l) - if [ 1 -eq $NUM ] ; then - return 0 - else - echo "versions of packages are not all the same!" && exit 1 - fi -} - -travis_retry() { - # From - # https://github.com/travis-ci/travis-build/blob/18bd04e965b9bfaa49cd6bdcd8dcb1513b8d2fcd/lib/travis/build/templates/header.sh - local result=0 - local count=1 - while [ $count -le 3 ]; do - [ $result -ne 0 ] && { - echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2 - } - "$@" - result=$? - [ $result -eq 0 ] && break - count=$(($count + 1)) - sleep 1 - done - - [ $count -gt 3 ] && { - echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2 - } - - return $result -} diff --git a/scripts/start-sandbox.sh b/scripts/start-sandbox.sh deleted file mode 100755 index 5808f072..00000000 --- a/scripts/start-sandbox.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -#=============================================================================== -# -# FILE: start-sandbox.sh -# -# USAGE: ./start-sandbox.sh -# -# DESCRIPTION: Create sandbox at top-level and add all packages as add-source -# -# REQUIREMENTS: bash >= 4 -#=============================================================================== - -set -o nounset -set -o errexit - -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -. "$DIR"/lib/common.sh - -prepare_sandbox () { - $CABAL sandbox init - for s in ${SOURCES[@]} ; do - (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox && $CABAL sandbox add-source .) - done -} - -prepare_sandbox diff --git a/scripts/test-all.sh b/scripts/test-all.sh deleted file mode 100755 index 59d24a97..00000000 --- a/scripts/test-all.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -#=============================================================================== -# -# FILE: test-all.sh -# -# USAGE: ./test-all.sh -# -# DESCRIPTION: Run tests for all source directories listed in $SOURCES. -# Uses local versions of those sources. -# -# REQUIREMENTS: bash >= 4 -#=============================================================================== - -set -o nounset -set -o errexit - -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -. "$DIR"/lib/common.sh - -GHC_FLAGS="-Werror" - -prepare_sandbox () { - $CABAL sandbox init - for s in ${SOURCES[@]} ; do - (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .) - done - if $TRAVIS ; then - travis_retry $CABAL install --enable-tests ${SOURCES[@]} - else - $CABAL install --max-backjumps -1 --reorder-goals --enable-tests ${SOURCES[@]} - fi -} - -test_each () { - for s in ${SOURCES[@]} ; do - echo "Testing $s..." - pushd "$s" - $CABAL configure --enable-tests --ghc-options="$GHC_FLAGS" - $CABAL build - $CABAL test - popd - done -} - -prepare_sandbox -test_each diff --git a/scripts/test-stack.sh b/scripts/test-stack.sh deleted file mode 100755 index b93d6107..00000000 --- a/scripts/test-stack.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -o nounset -set -o errexit - -for stack_file in stack*.yaml ; do - echo testing $stack_file... - export STACK_YAML=$stack_file - stack setup - stack test --fast --ghc-options="-Werror" -done diff --git a/scripts/upload.hs b/scripts/upload.hs deleted file mode 100755 index b03f251c..00000000 --- a/scripts/upload.hs +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env stack -{- stack ---resolver lts-3.10 ---install-ghc runghc --} - -import Data.Foldable -import System.Process - -main :: IO () -main = do - sources <- words <$> readFile "sources.txt" - forM_ sources $ \ source -> do - callCommand ("stack upload --no-signature " ++ source)