From 9c615ea9cc2723cae5d0c0bf9cc9965350afebe7 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Thu, 3 May 2018 17:55:48 +0200 Subject: Testing odbc+wx on OTP 20.3 on a slim jessie (#271) * wx-20.3: seeing about kerl/kerl/issues/270 * wx-20.3: less failible test + less deps * wx-20.3: move linux tests out of TravisCI into CircleCI * wx-20.3: always use git backend (erlang.org is still down) * wx-20.3: work around fact that erlang.org is down in .travis.yml * wx-20.3: fix some things * wx-20.3: looks like skipping happens too late * Revert "wx-20.3: looks like skipping happens too late" This reverts commit e0600cefa71760e9bd74e7efc37089d5d75e764e. * wx-20.3: that should fix it * wx-20.3: run shellcheck in circle, now travis is only about osx! * wx-20.3: that did not fix it (cc @mrallen1) * wx-20.3: shellcheck stable segfaults? * wx-20.3: should fix shellcheck segfault * SC1117: Backslash is literal in "\!". Prefer explicit escaping: "\\!". Not sure about the csh one. @mcrallen1 you have a clue? * wx-20.3: SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). * wx-20.3: SC2154: words is referenced but not assigned. * wx-20.3: replace some double quotes with simple ones * wx-20.3: ps not found on debian9!? * wx-20.3: what now * wx-20.3: lets try a later vsn * wx-20.3: some cleaning up * wx-20.3: YAML fun * wx-20.3: wat --- .circleci/config.yml | 185 ++++++++++++++++++++++++++++++++++++++------------- .travis.yml | 35 ++-------- README.md | 6 +- bash_completion/kerl | 20 +++--- kerl | 44 ++++++++---- 5 files changed, 190 insertions(+), 100 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3467f2b..b555249 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,94 +3,189 @@ workflows: version: 2 test-workflow: jobs: - - debian8_R15B03-1 - - centos6_20.2 - alpine3.7_20.3 + - centos7_19.3 + - centos6_18.3 + - debian9_17.5__wx_odbc__shellcheck + - trusty_17.0 + - debian8_R15B03-1 jobs: - debian8_R15B03-1: + alpine3.7_20.3: docker: - - image: debian:8 + - image: alpine:3.7 environment: - - _KERL_VSN: R15B03-1 - - KERL_CONFIGURE_DISABLE_APPLICATIONS: 'odbc' + - _KERL_VSN: 20.3 + - KERL_BUILD_BACKEND: git + - KERL_BUILD_DOCS: 'yes' steps: - - run: apt-get update && apt-get upgrade -y - - run: apt-get install -y git curl build-essential libncurses-dev libssl-dev + - run: apk update && apk upgrade + - run: | + apk add curl ca-certificates \ + dpkg-dev dpkg \ + gcc g++ libc-dev linux-headers make autoconf ncurses-dev tar \ + openssl-dev lksctp-tools-dev lksctp-tools \ + libxslt git - checkout - run: ./kerl update releases - - run: - command: ./kerl build "$_KERL_VSN" "$_KERL_VSN" + - run: &build_on_all_cores + command: + | + export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" + ./kerl build "$_KERL_VSN" "$_KERL_VSN" | tee build.log no_output_timeout: 45m - run: ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" - run: ./kerl status + - run: &activate_then_test_for_crypto + | + source $(./kerl path install_$_KERL_VSN)/activate + erl -s crypto -s init stop + kerl_deactivate + - run: ./kerl delete installation $(./kerl path install_$_KERL_VSN) + - run: ./kerl delete build "$_KERL_VSN" + + centos7_19.3: + docker: + - image: centos:7 + environment: + - _KERL_VSN: 19.3 + - KERL_BUILD_BACKEND: git + - KERL_CONFIGURE_DISABLE_APPLICATIONS: odbc + steps: + - run: yum -y update - run: | - set -x - source $(./kerl path install_$_KERL_VSN)/activate - erl -s crypto -s init stop - kerl_deactivate + yum -y install curl git \ + make automake autoconf gcc gcc-c++ \ + gcc-java \ + ncurses-devel openssl-devel + - checkout + - run: ./kerl update releases + - run: *build_on_all_cores + - run: ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" + - run: ./kerl status + - run: *activate_then_test_for_crypto - run: ./kerl delete installation $(./kerl path install_$_KERL_VSN) - run: ./kerl delete build "$_KERL_VSN" - centos6_20.2: + centos6_18.3: docker: - image: centos:6 environment: - - _KERL_VSN: 20.2 - - KERL_CONFIGURE_DISABLE_APPLICATIONS: 'odbc' + - _KERL_VSN: 18.3 + - KERL_BUILD_BACKEND: git + - KERL_CONFIGURE_DISABLE_APPLICATIONS: odbc steps: - run: yum -y update - - run: yum -y install curl ncurses-devel openssl-devel make automake autoconf gcc gcc-c++ gcc-java + - run: | + yum -y install curl \ + make automake autoconf gcc gcc-c++ \ + gcc-java \ + ncurses-devel openssl-devel - run: | yum -y install https://centos6.iuscommunity.org/ius-release.rpm # CircleCI checkout uses -B which isn't available in CentOS6's packaged git yum -y install git2u - checkout - run: ./kerl update releases - - run: - command: ./kerl build "$_KERL_VSN" "$_KERL_VSN" - no_output_timeout: 45m + - run: *build_on_all_cores - run: ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" - run: ./kerl status - - run: | - set -x - source $(./kerl path install_$_KERL_VSN)/activate - erl -s crypto -s init stop - kerl_deactivate + - run: *activate_then_test_for_crypto - run: ./kerl delete installation $(./kerl path install_$_KERL_VSN) - run: ./kerl delete build "$_KERL_VSN" - alpine3.7_20.3: + debian9_17.5__wx_odbc__shellcheck: docker: - - image: alpine:3.7 + - image: debian:9 environment: - - _KERL_VSN: 20.3 - - KERL_CONFIGURE_DISABLE_APPLICATIONS: odbc + - _KERL_VSN: 17.5 - KERL_BUILD_BACKEND: git - - KERL_BUILD_DOCS: 'yes' + - SHELLCHECK_URL: https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz steps: - - run: apk update && apk upgrade + - run: apt update && apt upgrade -y - run: | - apk add curl ca-certificates \ - dpkg-dev dpkg \ - gcc g++ libc-dev linux-headers make autoconf ncurses-dev tar \ - openssl-dev unixodbc-dev lksctp-tools-dev \ - lksctp-tools \ - libxslt git + apt install -y --no-install-recommends \ + curl ca-certificates \ + git autoconf dpkg-dev gcc g++ make libncurses-dev \ + libssl1.0.2 libssl1.0-dev libsctp1 libsctp-dev \ + libodbc1 unixodbc-dev \ + libwxgtk3.0-dev libgl1-mesa-dev libglu1-mesa-dev libpng16-16 libpng-dev \ + procps + - run: wx-config --version - checkout + - run: | + curl -#fSLo shellcheck.tar.xz $SHELLCHECK_URL + tar --xz -xvf shellcheck.tar.xz + mv shellcheck-*/shellcheck /usr/local/bin + rm -vr shellcheck-*/ shellcheck.tar.xz + shellcheck --version + - run: | + shellcheck ./kerl + shellcheck ./bash_completion/kerl + # https://github.com/koalaman/shellcheck/issues/809 + # shellcheck ./zsh_completion/_kerl - run: ./kerl update releases - - run: - command: | - export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" - ./kerl build "$_KERL_VSN" "$_KERL_VSN" - no_output_timeout: 45m + - run: *build_on_all_cores + - run: cat build.log + - run: "! grep -F 'ODBC library' build.log" + - run: "! grep -F 'wx will NOT be usable' build.log" - run: ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" - run: ./kerl status - run: | - set -x + shellcheck $(./kerl path install_$_KERL_VSN)/activate + # shellcheck $(./kerl path install_$_KERL_VSN)/activate.csh + # shellcheck $(./kerl path install_$_KERL_VSN)/activate.fish + - run: | source $(./kerl path install_$_KERL_VSN)/activate - erl -s crypto -s init stop + for app in odbc crypto wx; do + echo TEST app $app + erl -noshell -eval "case application:ensure_all_started($app) of {ok,[_|_]} -> init:stop(); _ -> init:stop(1) end." + echo PASS app $app + done kerl_deactivate - run: ./kerl delete installation $(./kerl path install_$_KERL_VSN) - run: ./kerl delete build "$_KERL_VSN" + + trusty_17.0: + docker: + - image: ubuntu:trusty + environment: + - _KERL_VSN: '17.0' + # - KERL_BUILD_BACKEND: git ## This would cause the build to fail?! + - KERL_CONFIGURE_DISABLE_APPLICATIONS: 'wx odbc' + steps: + - run: apt update && apt upgrade -y + - run: | + apt install -y --no-install-recommends \ + curl ca-certificates \ + git autoconf automake dpkg-dev gcc g++ make libncurses-dev \ + libssl1.0.0 libssl-dev libsctp1 libsctp-dev + - checkout + - run: ./kerl update releases + - run: *build_on_all_cores + - run: ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" + - run: ./kerl status + - run: *activate_then_test_for_crypto + - run: ./kerl delete installation $(./kerl path install_$_KERL_VSN) + - run: ./kerl delete build "$_KERL_VSN" + + debian8_R15B03-1: + docker: + - image: debian:8 + environment: + - _KERL_VSN: R15B03-1 + - KERL_BUILD_BACKEND: git + - KERL_CONFIGURE_DISABLE_APPLICATIONS: odbc + steps: + - run: apt-get update && apt-get upgrade -y + - run: | + apt-get install -y git curl build-essential automake autoconf libncurses-dev libssl-dev + - checkout + - run: ./kerl update releases + - run: *build_on_all_cores + - run: ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" + - run: ./kerl status + - run: *activate_then_test_for_crypto + - run: ./kerl delete installation $(./kerl path install_$_KERL_VSN) + - run: ./kerl delete build "$_KERL_VSN" diff --git a/.travis.yml b/.travis.yml index cb42360..18fdb8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,52 +1,27 @@ language: bash sudo: false - -addons: - apt: - sources: - - debian-sid # for: shellCheck - packages: - - shellcheck - -os: - - linux - - osx +os: osx env: global: - KERL_BASE_DIR="$TMPDIR"/.kerl - - KERL_CONFIGURE_DISABLE_APPLICATIONS="odbc" + - KERL_BUILD_BACKEND=git + - KERL_CONFIGURE_DISABLE_APPLICATIONS='odbc' matrix: - _KERL_VSN=19.2 - _KERL_VSN=18.3 - _KERL_VSN=17.5 - _KERL_VSN=R16B03-1 -before_script: - - set -o pipefail - - | - if [[ "$TRAVIS_OS_NAME" == 'linux' ]] && [[ "$_KERL_VSN" == '19.2' ]]; then - set -e - export USING_SHELLCHECK=1 - shellcheck ./kerl - shellcheck ./bash_completion/kerl - # zsh_completion/_kerl # https://github.com/koalaman/shellcheck/issues/809 - set +e - fi - +before_script: set -e +after_script: set +e script: - - set -e - ./kerl update releases - travis_wait 45 ./kerl build "$_KERL_VSN" "$_KERL_VSN" - ./kerl install "$_KERL_VSN" "install_$_KERL_VSN" - ./kerl status - - | - if [[ "$USING_SHELLCHECK" == '1' ]]; then - shellcheck $(./kerl path install_$_KERL_VSN)/activate - fi - source $(./kerl path install_$_KERL_VSN)/activate - erl -s crypto -s init stop - kerl_deactivate - ./kerl delete installation $(./kerl path install_$_KERL_VSN) - ./kerl delete build "$_KERL_VSN" - - set +e diff --git a/README.md b/README.md index cde4550..9700327 100644 --- a/README.md +++ b/README.md @@ -238,17 +238,17 @@ Directory in which kerl will clone git repositories for building. ### KERL_CONFIGURE_OPTIONS -Options to pass to `configure` when building OTP. +Space-separated options to pass to `configure` when building OTP. ### KERL_CONFIGURE_APPLICATIONS -List of OTP applications which should exclusively be built. +Space-separated list of OTP applications which should exclusively be built. ### KERL_CONFIGURE_DISABLE_APPLICATIONS -List of OTP applications to disable during building. +Space-separated list of OTP applications to disable during building. ### KERL_BUILD_PLT diff --git a/bash_completion/kerl b/bash_completion/kerl index d620a4d..f9e0058 100644 --- a/bash_completion/kerl +++ b/bash_completion/kerl @@ -12,42 +12,42 @@ _kerl() case $prev in kerl) - COMPREPLY=( $( compgen -W "build install update list delete active path status" -- "$cur" ) ) + mapfile -t COMPREPLY < <( compgen -W 'build install update list delete active path status' -- "$cur" ) ;; list) - COMPREPLY=( $( compgen -W "releases builds installations" -- "$cur" ) ) + mapfile -t COMPREPLY < <( compgen -W 'releases builds installations' -- "$cur" ) ;; build) if [ "$COMP_CWORD" -eq 2 ]; then if [ -f "$HOME"/.kerl/otp_releases ]; then RELEASES=$(cat "$HOME"/.kerl/otp_releases) fi - COMPREPLY=( $( compgen -W "git $RELEASES" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W "git $RELEASES" -- "$cur") else if [ -f "$HOME"/.kerl/otp_builds ]; then BUILDS=$(cut -d ',' -f 2 "$HOME"/.kerl/otp_builds) fi - COMPREPLY=( $( compgen -W "$BUILDS" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W "$BUILDS" -- "$cur") fi ;; installation) if [ -f "$HOME"/.kerl/otp_installations ]; then PATHS=$(cut -d ' ' -f 2 "$HOME"/.kerl/otp_installations) fi - COMPREPLY=( $( compgen -W "$PATHS" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W "$PATHS" -- "$cur") ;; install) if [ -f "$HOME"/.kerl/otp_builds ]; then BUILDS=$(cut -d ',' -f 2 "$HOME"/.kerl/otp_builds) fi - COMPREPLY=( $( compgen -W "$BUILDS" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W "$BUILDS" -- "$cur") ;; path) INSTALL_LIST="$HOME"/.kerl/otp_installations if [ -f "$INSTALL_LIST" ]; then NAMES=$(cut -d ' ' -f 2 "$INSTALL_LIST" | xargs basename) fi - COMPREPLY=( $( compgen -W "$NAMES" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W "$NAMES" -- "$cur") ;; deploy) if [ "$COMP_CWORD" -eq 3 ]; then @@ -55,13 +55,13 @@ _kerl() PATHS=$(cut -d ' ' -f 2 "$HOME"/.kerl/otp_installations) fi fi - COMPREPLY=( $( compgen -W "$PATHS" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W "$PATHS" -- "$cur") ;; delete) - COMPREPLY=( $( compgen -W "build installation $words" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W 'build installation' -- "$cur") ;; update) - COMPREPLY=( $( compgen -W "releases" -- "$cur") ) + mapfile -t COMPREPLY < <( compgen -W 'releases' -- "$cur") ;; *) if [ "$COMP_CWORD" -eq 3 ]; then diff --git a/kerl b/kerl index 27906f3..91f804f 100755 --- a/kerl +++ b/kerl @@ -194,8 +194,7 @@ usage() { if [ $# -eq 0 ]; then usage; fi get_releases() { - if [ "$KERL_BUILD_BACKEND" = 'git' ] - then + if [ "$KERL_BUILD_BACKEND" = 'git' ]; then get_git_releases else get_tarball_releases @@ -227,8 +226,7 @@ get_tarball_releases() { } update_checksum_file() { - if [ "$KERL_BUILD_BACKEND" = 'git' ]; - then + if [ "$KERL_BUILD_BACKEND" = 'git' ]; then return 0 else echo 'Getting checksum file from erlang.org...' @@ -679,6 +677,28 @@ _do_build() { cd "$ERL_TOP" || exit 1 LOGFILE="$KERL_BUILD_DIR/$2/otp_build_$1.log" + # Set configuation flags given applications white/black lists + if [ -n "$KERL_CONFIGURE_APPLICATIONS" ]; then + for app in $KERL_CONFIGURE_APPLICATIONS; do + case "$KERL_CONFIGURE_OPTIONS" in + *"--with-$app"*) + echo "Option '--with-$app' in KERL_CONFIGURE_OPTIONS is superfluous" ;; + *) + KERL_CONFIGURE_OPTIONS="$KERL_CONFIGURE_OPTIONS --with-$app" ;; + esac + done + fi + if [ -n "$KERL_CONFIGURE_DISABLE_APPLICATIONS" ]; then + for app in $KERL_CONFIGURE_DISABLE_APPLICATIONS; do + case "$KERL_CONFIGURE_OPTIONS" in + *"--without-$app"*) + echo "Option '--without-$app' in KERL_CONFIGURE_OPTIONS is superfluous" ;; + *) + KERL_CONFIGURE_OPTIONS="$KERL_CONFIGURE_OPTIONS --without-$app" ;; + esac + done + fi + # Check to see if configuration options need to be stored or have changed TMPOPT="/tmp/kerloptions.$$" echo "$CFLAGS" >"$TMPOPT" @@ -735,18 +755,18 @@ _do_build() { if [ -n "$KERL_CONFIGURE_APPLICATIONS" ]; then find ./lib -maxdepth 1 -type d -exec touch -f {}/SKIP \; - for i in $KERL_CONFIGURE_APPLICATIONS; do - if ! rm ./lib/"$i"/SKIP; then - echo "Couldn't prepare '$i' application for building" + for app in $KERL_CONFIGURE_APPLICATIONS; do + if ! rm ./lib/"$app"/SKIP; then + echo "Couldn't prepare '$app' application for building" list_remove builds "$1 $2" exit 1 fi done fi if [ -n "$KERL_CONFIGURE_DISABLE_APPLICATIONS" ]; then - for i in $KERL_CONFIGURE_DISABLE_APPLICATIONS; do - if ! touch -f ./lib/"$i"/SKIP; then - echo "Couldn't disable '$i' application for building" + for app in $KERL_CONFIGURE_DISABLE_APPLICATIONS; do + if ! touch -f ./lib/"$app"/SKIP; then + echo "Couldn't disable '$app' application for building" exit 1 fi done @@ -935,7 +955,7 @@ function kerl_deactivate --description "deactivate erlang environment" # functions --copy complains about about fish_prompt already being defined # so we take a page from virtualenv's book . ( begin - printf "function fish_prompt\n\t#" + printf "function fish_prompt\\n\\t#" functions _kerl_saved_prompt end | psub ) functions --erase _kerl_saved_prompt @@ -993,7 +1013,7 @@ ACTIVATE_FISH # This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. -alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_DOCSH_USER_DEFAULT != 0 && unsetenv DOCSH_USER_DEFAULT && unset _KERL_DOCSH_USER_DEFAULT; test \$?_KERL_DOCSH_DOT_ERLANG != 0 && rm "\$HOME/.erlang" && unset _KERL_DOCSH_DOT_ERLANG; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' +alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_DOCSH_USER_DEFAULT != 0 && unsetenv DOCSH_USER_DEFAULT && unset _KERL_DOCSH_USER_DEFAULT; test \$?_KERL_DOCSH_DOT_ERLANG != 0 && rm "\$HOME/.erlang" && unset _KERL_DOCSH_DOT_ERLANG; test \$?_KERL_SAVED_PROMPT != 0 && set prompt="\$_KERL_SAVED_PROMPT" && unset _KERL_SAVED_PROMPT; test "!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. kerl_deactivate nondestructive -- cgit v1.2.3