From 20803bd7d7578706ad55b56cf1a4d8865b5c1285 Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 11 Mar 2020 20:44:24 +0100 Subject: Restructure CI spellchecking --- .travis-ci.sh | 80 +++++++++++++++++++++-------------------------------------- 1 file changed, 28 insertions(+), 52 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index 8008026..e9e3df3 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -1,66 +1,42 @@ #!/bin/bash -# This script is triggered from the script section of .travis.yml -# It runs the appropriate commands depending on the task requested. +if [ "$TASK" = "spellcheck" ]; then + result=0 + # Create list of files to be spellchecked + spellcheck_files=$(find -type f | grep -v ".git/") -set -e + # Run spellintian to find spelling errors + sl_results=$(spellintian $spellcheck_files 2>&1) -SPELLINGBLACKLIST=$(cat <<-BLACKLIST --wholename "./.git/*" -BLACKLIST -) + sl_errors=$(wc -l <<< "$sl_results") + sl_errors_dups=$((grep "\(duplicate word\)" | wc -l) <<< "$sl_results") + sl_errors_nodups=$((grep -v "\(duplicate word\)" | wc -l) <<< "$sl_results") -if [[ $TASK = 'spellintian' ]]; then - # run spellintian only if it is the requested task, ignoring duplicate words - spellingfiles=$(eval "find ./ -type f -and ! \( \ - $SPELLINGBLACKLIST \ - \) | xargs") - # count the number of spellintian errors, ignoring duplicate words - spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | grep -v "\(duplicate word\)" | wc -l) - if [[ $spellingerrors -ne 0 ]]; then - # print the output for info - zrun spellintian $spellingfiles | grep -v "\(duplicate word\)" - echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates" - exit 1; + if [ "$sl_errors" -ne 0 ]; then + printf "Spellintian found %s errors (%s spelling, %s duplicate words):\n\n" "$sl_errors" "$sl_errors_nodups" "$sl_errors_dups" + printf "%s\n\n" "$sl_results" + result=1 else - echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates" - fi; -elif [[ $TASK = 'spellintian-duplicates' ]]; then - # run spellintian only if it is the requested task - spellingfiles=$(eval "find ./ -type f -and ! \( \ - $SPELLINGBLACKLIST \ - \) | xargs") - # count the number of spellintian errors - spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | wc -l) - if [[ $spellingerrors -ne 0 ]]; then - # print the output for info - zrun spellintian $spellingfiles - echo "Found $spellingerrors spelling errors via spellintian" - exit 1; - else - echo "Found $spellingerrors spelling errors via spellintian" - fi; -elif [[ $TASK = 'codespell' ]]; then - # run codespell only if it is the requested task - spellingfiles=$(eval "find ./ -type f -and ! \( \ - $SPELLINGBLACKLIST \ - \) | xargs") - # count the number of codespell errors - spellingerrors=$(zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles 2>&1 | wc -l) - if [[ $spellingerrors -ne 0 ]]; then - # print the output for info - zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles - echo "Found $spellingerrors spelling errors via codespell" - exit 1; + printf "Spellintian reports no errors\n" + fi + + # Run codespell to find some more + cs_results=$(codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellcheck_files 2>&1) + cs_errors=$(wc -l <<< "$cs_results") + if [ "$cs_errors" -ne 0 ]; then + printf "Codespell found %s errors:\n\n" "$cs_errors" + printf "%s\n\n" "$cs_results" + result=1 else - echo "Found $spellingerrors spelling errors via codespell" - fi; -elif [[ $TASK = 'sanitize' ]]; then + printf "Codespell reports no errors\n" + fi + exit "$result" +elif [ "$TASK" = 'sanitize' ]; then # Run sanitized compile travis_fold start "make_sanitize" make sanitize; travis_fold end "make_sanitize" -elif [[ $TASK = 'windows' ]]; then +elif [ "$TASK" = 'windows' ]; then travis_fold start "make_windows" make windows; make -C backends lua.dll -- cgit v1.2.3 From abb1ffd367f4046d77ac62b0b017b407997bc43b Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 11 Mar 2020 21:53:14 +0100 Subject: Add codesmell statistics to CI --- .travis-ci.sh | 34 +++++++++++++++++++++++++++++++--- .travis.yml | 12 ++++++++++-- midimonster.h | 6 ++++-- 3 files changed, 45 insertions(+), 7 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index e9e3df3..763e558 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -21,7 +21,7 @@ if [ "$TASK" = "spellcheck" ]; then fi # Run codespell to find some more - cs_results=$(codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellcheck_files 2>&1) + cs_results=$(codespell --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellcheck_files 2>&1) cs_errors=$(wc -l <<< "$cs_results") if [ "$cs_errors" -ne 0 ]; then printf "Codespell found %s errors:\n\n" "$cs_errors" @@ -31,12 +31,40 @@ if [ "$TASK" = "spellcheck" ]; then printf "Codespell reports no errors\n" fi exit "$result" -elif [ "$TASK" = 'sanitize' ]; then +elif [ "$TASK" = "codesmell" ]; then + result=0 + + if [ -z "$(which lizard)" ]; then + printf "Installing lizard...\n" + pip3 install lizard + fi + + # Run shellcheck for all shell scripts + printf "Running shellcheck...\n" + shell_files="$(find . -type f -iname \*.sh)" + xargs shellcheck -Cnever -s bash <<< "$shell_files" + if [ "$?" -ne "0" ]; then + result=1 + fi + + # Run cloc for some stats + printf "Code statistics:\n\n" + cloc ./ + + # Run lizard for the project + printf "Running lizard for code complexity analysis\n" + lizard ./ + if [ "$?" -ne "0" ]; then + result=1 + fi + + exit "$result" +elif [ "$TASK" = "sanitize" ]; then # Run sanitized compile travis_fold start "make_sanitize" make sanitize; travis_fold end "make_sanitize" -elif [ "$TASK" = 'windows' ]; then +elif [ "$TASK" = "windows" ]; then travis_fold start "make_windows" make windows; make -C backends lua.dll diff --git a/.travis.yml b/.travis.yml index 48b4b71..a5de2f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ before_script: - export -f travis_fold script: - - "bash -ex .travis-ci.sh" + - "bash .travis-ci.sh" addons: apt: @@ -35,6 +35,8 @@ addons: - *core_build - mingw-w64 packages: &linters + - python3 + - python3-pip - lintian - codespell - shellcheck @@ -92,7 +94,6 @@ jobs: compiler: clang env: - TASK='sanitize' - allow_failures: - os: linux dist: bionic env: TASK='codesmell' @@ -107,6 +108,13 @@ jobs: apt: packages: - *linters + allow_failures: + - os: linux + dist: bionic + env: TASK='codesmell' + - os: linux + dist: bionic + env: TASK='spellcheck' env: global: diff --git a/midimonster.h b/midimonster.h index bad83c7..dc0e255 100644 --- a/midimonster.h +++ b/midimonster.h @@ -234,10 +234,12 @@ MM_API instance* mm_instance_find(char* backend, uint64_t ident); * matching `ident`, a pointer to it is returned. * This API is just a convenience function. The array of channels is * only used for mapping internally, creating and managing your own - * channel store is possible. + * channel store is possible. When returning pointers from a + * backend-local channel store, the returned pointers must stay + * valid over the lifetime of the instance. * For each channel with a non-NULL `impl` field registered using * this function, the backend will receive a call to its channel_free - * function. + * function (if it exists). */ MM_API channel* mm_channel(instance* i, uint64_t ident, uint8_t create); -- cgit v1.2.3 From 9ec65119e11941d81a641f6387cdb542b4e8070e Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 11 Mar 2020 22:23:55 +0100 Subject: Refactor installer --- .travis-ci.sh | 8 +- installer.sh | 356 +++++++++++++++++++++++++--------------------------------- 2 files changed, 160 insertions(+), 204 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index 763e558..3b7d7f5 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -3,10 +3,10 @@ if [ "$TASK" = "spellcheck" ]; then result=0 # Create list of files to be spellchecked - spellcheck_files=$(find -type f | grep -v ".git/") + spellcheck_files=$(find . -type f | grep -v ".git/") # Run spellintian to find spelling errors - sl_results=$(spellintian $spellcheck_files 2>&1) + sl_results=$(xargs spellintian 2>&1 <<< "$spellcheck_files") sl_errors=$(wc -l <<< "$sl_results") sl_errors_dups=$((grep "\(duplicate word\)" | wc -l) <<< "$sl_results") @@ -21,7 +21,7 @@ if [ "$TASK" = "spellcheck" ]; then fi # Run codespell to find some more - cs_results=$(codespell --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellcheck_files 2>&1) + cs_results=$(xargs codespell --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" <<< "$spellcheck_files" 2>&1) cs_errors=$(wc -l <<< "$cs_results") if [ "$cs_errors" -ne 0 ]; then printf "Codespell found %s errors:\n\n" "$cs_errors" @@ -100,7 +100,7 @@ else cp ./backends/*.md ./deployment/docs/ cp -r ./configs ./deployment/ cd ./deployment - tar czf "midimonster-$(git describe)-$TRAVIS_OS_NAME.tgz" * + tar czf "midimonster-$(git describe)-$TRAVIS_OS_NAME.tgz" ./ find . ! -iname '*.tgz' -delete travis_fold end "deploy_unix" fi diff --git a/installer.sh b/installer.sh index f8fad18..b2ca958 100755 --- a/installer.sh +++ b/installer.sh @@ -1,16 +1,30 @@ #!/bin/bash ################################################ SETUP ################################################ -deps=(libasound2-dev libevdev-dev liblua5.3-dev libjack-jackd2-dev pkg-config libssl-dev gcc make wget git) -user=$(whoami) # for bypassing user check replace "$(whoami)" with "root". - -tmp_path=$(mktemp -d) # Repo download path -updater_dir=/etc/midimonster-updater # Updater download + config path -updater_file=$updater_dir/updater.conf - -latest_version=$(curl --silent "https://api.github.com/repos/cbdevnet/midimonster/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - -makeargs=all # Build args +deps=( + libasound2-dev + libevdev-dev + liblua5.3-dev + libjack-jackd2-dev + pkg-config + libssl-dev + python3-dev + gcc + make + wget + git +) +# Replace this with 'root' to bypass the user check +user="$(whoami)" +# Temporary directory used for repository clone +tmp_path="$(mktemp -d)" +# Installer/updater install directory +updater_dir="/etc/midimonster-updater" + +latest_version="$(curl --silent "https://api.github.com/repos/cbdevnet/midimonster/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')" + +# make invocation arguments +makeargs="all" normal=$(tput sgr0) dim=$(tput dim) @@ -20,66 +34,56 @@ c_red=$(tput setaf 1) c_green=$(tput setaf 2) c_mag=$(tput setaf 5) -VAR_DESTDIR="" # Unused -VAR_PREFIX="/usr" -VAR_PLUGINS="$VAR_PREFIX/lib/midimonster" # Reassigned in func. ARGS to update "$VAR_PREFIX" when an argument is set. -VAR_DEFAULT_CFG="/etc/midimonster/midimonster.cfg" -VAR_EXAMPLE_CFGS="$VAR_PREFIX/share/midimonster" # Reassigned in func. ARGS to update "$VAR_PREFIX" when an argument is set. - - -################################################ SETUP ################################################ +DEFAULT_PREFIX="/usr" +DEFAULT_PLUGINPATH="/lib/midimonster" +DEFAULT_CFGPATH="/etc/midimonster/midimonster.cfg" +DEFAULT_EXAMPLES="/share/midimonster" ############################################## FUNCTIONS ############################################## +assign_defaults(){ + VAR_PREFIX="${VAR_PREFIX:-$DEFAULT_PREFIX}" + VAR_PLUGINS="${VAR_PLUGINS:-$VAR_PREFIX$DEFAULT_PLUGINPATH}" + VAR_DEFAULT_CFG="${VAR_DEFAULT_CFG:-$DEFAULT_CFGPATH}" + VAR_EXAMPLE_CFGS="${VAR_EXAMPLE_CFGS:-$VAR_PREFIX$DEFAULT_EXAMPLES}" +} -ARGS () { - for i in "$@" - do +ARGS(){ + for i in "$@"; do case $i in --prefix=*) VAR_PREFIX="${i#*=}" - VAR_PREFIX_I="1" - VAR_PLUGINS="$VAR_PREFIX/lib/midimonster" - VAR_EXAMPLE_CFGS="$VAR_PREFIX/share/midimonster" - VAR_EXAMPLE_CFGS="$VAR_PREFIX/share/midimonster" ;; --plugins=*) VAR_PLUGINS="${i#*=}" - VAR_PLUGINS_I="1" ;; --defcfg=*) VAR_DEFAULT_CFG="${i#*=}" - VAR_DEFAULT_CFG_I="1" ;; --examples=*) VAR_EXAMPLE_CFGS="${i#*=}" - VAR_EXAMPLE_CFGS_I="1" ;; --dev) NIGHTLY=1 - NIGHTLY_I="1" ;; -d|--default) - VAR_PREFIX_I="1" - VAR_PLUGINS_I="1" - VAR_DEFAULT_CFG_I="1" - VAR_EXAMPLE_CFGS_I="1" - NIGHTLY_I="1" - NIGHTLY=1 + assign_defaults ;; -fu|--forceupdate) UPDATER_FORCE="1" - ;; - -h|--help|*) # Help messages + ;; + -h|--help|*) + assign_defaults printf "${bold}Usage:${normal} ${0} ${c_green}[OPTIONS]${normal}" - printf "\n ${c_green}--prefix${normal} ${c_red}${normal} Sets the prefix ${c_mag}Default:${normal} ${dim}%s ${normal}" "$VAR_PREFIX" - printf "\n ${c_green}--plugins${normal} ${c_red}${normal} Sets the plugin path ${c_mag}Default:${normal} ${dim}%s ${normal}" "$VAR_PLUGINS" - printf "\n ${c_green}--defcfg${normal} ${c_red}${normal} Sets the config path ${c_mag}Default:${normal} ${dim}%s ${normal}" "$VAR_DEFAULT_CFG" - printf "\n ${c_green}--examples${normal} ${c_red}${normal} Sets the example configs path ${c_mag}Default:${normal} ${dim}%s ${normal}\n" "$VAR_EXAMPLE_CFGS" - printf "\n ${c_green}--dev${normal} Install nightly version" - printf "\n ${c_green}-d, --default${normal} Use default values to install" - printf "\n ${c_green}-fu, --forceupdate${normal} Force the updater to update without a version check" - printf "\n ${c_green}-h, --help${normal} Show this message" - printf "\n ${uline}${bold}${c_mag}Each argument can be overwritten by another, the last one is used!${normal}\n" + printf "\n\t${c_green}--prefix${normal} ${c_red}${normal}\t\tSet the installation prefix\t\t${c_mag}Default:${normal} ${dim}%s${normal}" "$VAR_PREFIX" + printf "\n\t${c_green}--plugins${normal} ${c_red}${normal}\tSet the plugin install path\t\t${c_mag}Default:${normal} ${dim}%s${normal}" "$VAR_PLUGINS" + printf "\n\t${c_green}--defcfg${normal} ${c_red}${normal}\t\tSet the default configuration path\t${c_mag}Default:${normal} ${dim}%s${normal}" "$VAR_DEFAULT_CFG" + printf "\n\t${c_green}--examples${normal} ${c_red}${normal}\tSet the path for example configurations\t${c_mag}Default:${normal} ${dim}%s${normal}\n" "$VAR_EXAMPLE_CFGS" + printf "\n\t${c_green}--dev${normal}\t\t\tInstall nightly version" + printf "\n\t${c_green}-d, --default${normal}\t\tUse default values to install" + printf "\n\t${c_green}-h, --help${normal}\t\tShow this message" + printf "\n\t${c_green}-fu, --forceupdate${normal}\tForce the updater to update without a version check" + printf "\n\t${uline}${bold}${c_mag}Each argument can be overwritten by another, the last one is used!${normal}\n" + rmdir "$tmp_path" exit 1 ;; esac @@ -87,21 +91,49 @@ ARGS () { done } -INSTALL-DEPS () { # Install deps from array "$deps" - for t in ${deps[@]}; do - if [ $(dpkg-query -W -f='${Status}' $t 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - printf "Installing %s\n" "$t" - apt-get install $t; - printf "Done.\n"; - else - printf "%s already installed!\n" "$t" - fi +# Install unmatched dependencies +install_dependencies(){ + for dependency in ${deps[@]}; do + if [ "$(dpkg-query -W -f='${Status}' "$dependency" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then + printf "Installing %s\n" "$dependency" + apt-get install $dependency + else + printf "%s already installed!\n" "$dependency" + fi done printf "\n" } -NIGHTLY_CHECK () { # Asks for nightly version - if [ -z "$NIGHTLY_I" ]; then +ask_questions(){ + printf "${bold}If you don't know what you're doing, just hit enter a few times.${normal}\n\n" + if [ -z "$VAR_PREFIX" ]; then + read -e -i "$DEFAULT_PREFIX" -p "PREFIX (Install root directory): " input + VAR_PREFIX="${input:-$VAR_PREFIX}" + fi + + if [ -z "$VAR_PLUGINS" ]; then + read -e -i "$VAR_PREFIX$DEFAULT_PLUGINPATH" -p "PLUGINS (Plugin directory): " input + VAR_PLUGINS="${input:-$VAR_PLUGINS}" + fi + + if [ -z "$VAR_DEFAULT_CFG" ]; then + read -e -i "$DEFAULT_CFGPATH" -p "Default config path: " input + VAR_DEFAULT_CFG="${input:-$VAR_DEFAULT_CFG}" + fi + + if [ -z "$VAR_EXAMPLE_CFGS" ]; then + read -e -i "$VAR_PREFIX$DEFAULT_EXAMPLES" -p "Example config directory: " input + VAR_EXAMPLE_CFGS="${input:-$VAR_EXAMPLE_CFGS}" + fi +} + +# Clone the repository and select the correct version +prepare_repo(){ + printf "Cloning the repository\n" + git clone "https://github.com/cbdevnet/midimonster.git" "$tmp_path" + + # If not set via argument, ask whether to install development build + if [ -z "$NIGHTLY" ]; then read -p "Do you want to install the latest development version? (y/n)? " magic case "$magic" in y|Y) @@ -119,182 +151,106 @@ NIGHTLY_CHECK () { # Asks for nightly version esac fi - # Roll back to last tag if we're not on a nightly build + # Roll back to last tag if a stable version was requested if [ "$NIGHTLY" != 1 ]; then cd "$tmp_path" printf "Finding latest stable version...\n" - Iversion=$(git describe --abbrev=0) - printf "Starting Git checkout to %s...\n" "$Iversion" - git checkout -f -q $Iversion + last_tag=$(git describe --abbrev=0) + printf "Checking out %s...\n" "$last_tag" + git checkout -f -q $last_tag fi } -INSTALL-PREP () { - ( - printf "Starting download...\n" - git clone https://github.com/cbdevnet/midimonster.git "$tmp_path" # Gets Midimonster - printf "\nInitializing repository...\n" - cd $tmp_path - git init $tmp_path - printf "\n" - ) - NIGHTLY_CHECK - printf "Preparation done.\n\n" - printf "${bold}If you don't know what you're doing, just hit enter a few times.${normal}\n\n" - if [ -z "$VAR_PREFIX_I" ]; then - read -e -i "$VAR_PREFIX" -p "PREFIX (Install root directory): " input # Reads VAR_PREFIX then update containing vars - VAR_PREFIX="${input:-$VAR_PREFIX}" - VAR_PLUGINS="$VAR_PREFIX/lib/midimonster" # Update prefix-containing variables. - VAR_EXAMPLE_CFGS="$VAR_PREFIX/share/midimonster" # Update prefix-containing variables. - fi +# Build and install the software +build(){ + # Export variables for make + export PREFIX="$VAR_PREFIX" + export PLUGINS="$VAR_PLUGINS" + export DEFAULT_CFG="$VAR_DEFAULT_CFG" + export EXAMPLES="$VAR_EXAMPLE_CFGS" - if [ -z "$VAR_PLUGINS_I" ]; then - read -e -i "$VAR_PLUGINS" -p "PLUGINS (Plugin directory): " input # Reads VAR_PLUGINS - VAR_PLUGINS="${input:-$VAR_PLUGINS}" - fi - - if [ -z "$VAR_DEFAULT_CFG_I" ]; then - read -e -i "$VAR_DEFAULT_CFG" -p "Default config path: " input # Reads VAR_DEFAULT_CFG - VAR_DEFAULT_CFG="${input:-$VAR_DEFAULT_CFG}" - fi - - if [ -z "$VAR_EXAMPLE_CFGS_I" ]; then - read -e -i "$VAR_EXAMPLE_CFGS" -p "Example config directory: " input # Reads VAR_EXAMPLE_CFGS - VAR_EXAMPLE_CFGS="${input:-$VAR_EXAMPLE_CFGS}" - fi - - UPDATER_SAVE - - export PREFIX=$VAR_PREFIX - export PLUGINS=$VAR_PLUGINS - export DEFAULT_CFG=$VAR_DEFAULT_CFG - export DESTDIR=$VAR_DESTDIR - export EXAMPLES=$VAR_EXAMPLE_CFGS -} - -UPDATER-PREP () { - ( - printf "Starting download...\n" - git clone https://github.com/cbdevnet/midimonster.git "$tmp_path" # Gets Midimonster - printf "\nInitializing repository...\n" - cd $tmp_path - git init $tmp_path - ) - NIGHTLY_CHECK - printf "Preparation done.\n\n" - rm -rf "$VAR_PLUGINS/" - - UPDATER_SAVE - - export PREFIX=$VAR_PREFIX - export PLUGINS=$VAR_PLUGINS - export DEFAULT_CFG=$VAR_DEFAULT_CFG - export DESTDIR=$VAR_DESTDIR - export EXAMPLES=$VAR_EXAMPLE_CFGS -} - -UPDATER () { - installed_version="$(midimonster --version)" - #installed_version="MIDIMonster v0.3-40-gafed325" # FOR TESTING ONLY! - if [[ "$installed_version" =~ "$latest_version" ]]; then - printf "Newest Version is already installed! ${bold}($installed_version)${normal}\n\n" - ERROR - else - printf "The installed Version ${bold}´$installed_version´${normal} equals not the newest stable version ${bold}´$latest_version´${normal} (Maybe you are running a development(NIGHTLY) version?)\n\n" - fi - - UPDATER-PREP - INSTALL-RUN - DONE -} - -INSTALL-RUN () { # Build cd "$tmp_path" make clean - make $makeargs + make "$makeargs" make install } -UPDATER_SAVE () { # Saves file for the auto updater in this script +# Save data for the updater +save_config(){ rm -rf $updater_dir - printf "Saving updater to %s/updater.sh\n" "$update_dir" + printf "Copying updater to %s/updater.sh\n" "$updater_dir" mkdir -p "$updater_dir" - wget https://raw.githubusercontent.com/cbdevnet/midimonster/master/installer.sh -O $updater_dir/updater.sh - printf "Creating symlink to updater in /usr/bin/midimonster-updater\n" + cp "$0" "$updater_dir/updater.sh" + printf "Creating symlin /usr/bin/midimonster-updater\n" ln -s "$updater_dir/updater.sh" "/usr/bin/midimonster-updater" chmod +x "$updater_dir/updater.sh" - printf "Exporting updater config to %s\n" "$updater_file" - printf "VAR_PREFIX=%s\nVAR_PLUGINS=%s\nVAR_DEFAULT_CFG=%s\nVAR_DESTDIR=%s\nVAR_EXAMPLE_CFGS=%s\n" "$VAR_PREFIX" "$VAR_PLUGINS" "$VAR_DEFAULT_CFG" "$VAR_DESTDIR" "$VAR_EXAMPLE_CFGS" > $updater_file + printf "Exporting updater config\n" + printf "VAR_PREFIX=%s\nVAR_PLUGINS=%s\nVAR_DEFAULT_CFG=%s\nVAR_DESTDIR=%s\nVAR_EXAMPLE_CFGS=%s\n" "$VAR_PREFIX" "$VAR_PLUGINS" "$VAR_DEFAULT_CFG" "$VAR_DESTDIR" "$VAR_EXAMPLE_CFGS" > "$updater_dir/updater.conf" } -ERROR () { - printf "\nAborting...\n" - CLEAN - printf "Exiting...\n" +error_handler(){ + printf "\nAborting\n" exit 1 } -DONE () { - printf "\nDone.\n" - CLEAN - exit 0 -} - -CLEAN () { - printf "\nCleaning...\n" - rm -rf $tmp_path +cleanup() { + if [ -d "$tmp_path" ]; then + printf "Cleaning up temporary files...\n" + rm -rf "$tmp_path" + fi } -############################################## FUNCTIONS ############################################## - - ################################################ Main ################################################# -trap ERROR SIGINT SIGTERM SIGKILL -ARGS "$@" # Parse arguments +trap error_handler SIGINT SIGTERM +trap cleanup EXIT + +# Parse arguments +ARGS "$@" clear -# Check if $user = root! +# Check whether we have the privileges to install stuff if [ "$user" != "root" ]; then - printf "Installer must be run as root\n" - ERROR + printf "The installer requires root privileges to install the midimonster system-wide\n" + exit 1 fi -if [ $(wget -q --spider http://github.com) $? -eq 1 ]; then - printf "You need a connection to the internet\n" - ERROR +# Check if we can download the sources +if [ "$(wget -q --spider http://github.com)" ]; then + printf "The installer requires internet connectivity to download the midimonster sources\n" + exit 1 fi -# Forceupdate # Now only with default config because source imports all and overwrites the args.. [WIP!] -if [ "$UPDATER_FORCE" = "1" ]; then - printf "Forcing the updater to start...\n\n" - if [ -f $updater_file ]; then - . $updater_file - ARGS "$@" # Parse arguments again to compensate overwrite from source /\ - printf "Successfully imported settings from %s\n" "$updater_file" +# Check whether the updater needs to run +if [ -f "$updater_dir/updater.conf" ] || [ "$UPDATER_FORCE" = "1" ]; then + if [ -f "$updater_dir/updater.conf" ]; then + . "$updater_dir/updater.conf" + # Parse arguments again to compensate overwrite from source + ARGS "$@" + printf "Imported settings from %s/updater.conf\n" "$updater_dir" fi - UPDATER-PREP - INSTALL-RUN - DONE -fi - -# Check if updater config file exist and import it (overwrites default values!) -if [ -f $updater_file ]; then - printf "Starting updater...\n\n" - . $updater_file - ARGS "$@" # Parse arguments again to compensate overwrite from source /\ - printf "Successfully imported settings from %s\n" "$updater_file" - - # Check if binary $VAR_PREFIX/bin/midimonster exist. If yes start updater else skip. - if [ -x "$VAR_PREFIX/bin/midimonster" ]; then - UPDATER - else - printf "MIDIMonster binary not found, skipping updater.\nYou can force an update with --forceupdate\n" + if [ -n "$UPDATER_FORCE" ]; then + printf "Forcing the updater to start...\n\n" + elif [ -x "$VAR_PREFIX/bin/midimonster" ]; then + installed_version="$(midimonster --version)" + if [[ "$installed_version" =~ "$latest_version" ]]; then + printf "The installed version ${bold}$installed_version${normal} seems to be up to date\nDoing nothing\n\n" + exit 0 + else + printf "The installed version ${bold}$installed_version${normal} does not match the latest version ${bold}$latest_version${normal}\nMaybe you are running a development version?\n\n" + fi fi + + # Run updater steps + prepare_repo + build +else + # Run installer steps + install_dependencies + prepare_repo + ask_questions + save_config + build fi +exit 0 -#Normal install -INSTALL-DEPS -INSTALL-PREP -INSTALL-RUN -DONE -- cgit v1.2.3 From 6da00154f7745a4705047fc73ce42b7036b0bbdc Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 15 Mar 2020 12:19:50 +0100 Subject: Fix build and CI exits --- .travis-ci.sh | 14 ++++++++++---- backend.c | 4 +++- midimonster.c | 4 ---- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index 3b7d7f5..c832f2c 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -21,7 +21,7 @@ if [ "$TASK" = "spellcheck" ]; then fi # Run codespell to find some more - cs_results=$(xargs codespell --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" <<< "$spellcheck_files" 2>&1) + cs_results=$(xargs codespell --quiet 2 <<< "$spellcheck_files" 2>&1) cs_errors=$(wc -l <<< "$cs_results") if [ "$cs_errors" -ne 0 ]; then printf "Codespell found %s errors:\n\n" "$cs_errors" @@ -62,11 +62,15 @@ elif [ "$TASK" = "codesmell" ]; then elif [ "$TASK" = "sanitize" ]; then # Run sanitized compile travis_fold start "make_sanitize" - make sanitize; + if make sanitize; then + exit "$?" + fi travis_fold end "make_sanitize" elif [ "$TASK" = "windows" ]; then travis_fold start "make_windows" - make windows; + if make windows; then + exit "$?" + fi make -C backends lua.dll travis_fold end "make_windows" if [ "$(git describe)" == "$(git describe --abbrev=0)" ]; then @@ -87,7 +91,9 @@ elif [ "$TASK" = "windows" ]; then else # Otherwise compile as normal travis_fold start "make" - make full; + if make full; then + exit "$?" + fi travis_fold end "make" if [ "$(git describe)" == "$(git describe --abbrev=0)" ]; then travis_fold start "deploy_unix" diff --git a/backend.c b/backend.c index 65cbd7d..cb8bf3f 100644 --- a/backend.c +++ b/backend.c @@ -311,6 +311,9 @@ int backends_stop(){ size_t u, n; instance** inst = NULL; + //channels before instances to support proper shutdown procedures + channels_free(); + //shut down the registry for(u = 0; u < registry.n; u++){ //fetch list of instances @@ -335,7 +338,6 @@ int backends_stop(){ registry.instances[u] = NULL; } - channels_free(); free(registry.backends); free(registry.instances); registry.n = 0; diff --git a/midimonster.c b/midimonster.c index 2b0b7a0..8e217e7 100644 --- a/midimonster.c +++ b/midimonster.c @@ -466,8 +466,6 @@ int main(int argc, char** argv){ if(config_read(cfg_file)){ fprintf(stderr, "Failed to read configuration file %s\n", cfg_file); backends_stop(); - channels_free(); - instances_free(); map_free(); fds_free(); plugins_close(); @@ -497,8 +495,6 @@ int main(int argc, char** argv){ bail: //free all data backends_stop(); - channels_free(); - instances_free(); map_free(); fds_free(); event_free(); -- cgit v1.2.3 From bc275e10defe27e6d288ccf9125fe9b915168240 Mon Sep 17 00:00:00 2001 From: cbdev Date: Tue, 21 Apr 2020 00:20:23 +0200 Subject: Do not load lua backend automatically on Windows --- .travis-ci.sh | 3 +++ .travis.yml | 2 +- backends/Makefile | 2 +- backends/libmmbackend.c | 7 +++++++ backends/lua.md | 5 ++--- backends/rtpmidi.c | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index c832f2c..5272fde 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -71,7 +71,9 @@ elif [ "$TASK" = "windows" ]; then if make windows; then exit "$?" fi + # Build the lua backend but disable it by default to avoid scary error messages make -C backends lua.dll + mv backends/lua.dll backends/lua.dll.disabled travis_fold end "make_windows" if [ "$(git describe)" == "$(git describe --abbrev=0)" ]; then travis_fold start "deploy_windows" @@ -80,6 +82,7 @@ elif [ "$TASK" = "windows" ]; then mkdir ./deployment/docs cp ./midimonster.exe ./deployment/ cp ./backends/*.dll ./deployment/backends/ + cp ./backends/*.dll.disabled ./deployment/backends/ cp ./monster.cfg ./deployment/monster.cfg cp ./backends/*.md ./deployment/docs/ cp -r ./configs ./deployment/ diff --git a/.travis.yml b/.travis.yml index d7c25b6..8cf9e82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -152,7 +152,7 @@ before_install: #OS X uses something other than $CXX variable - if [ "$TRAVIS_OS_NAME" == "linux" -a \( "$TASK" = "compile" -o "$TASK" = "sanitize" \) ]; then $CXX --version; fi # Download libraries to link with on Windows - - if [ "$TASK" == "windows" ]; then mkdir libs; wget "https://downloads.sourceforge.net/project/luabinaries/5.3.5/Windows%20Libraries/Dynamic/lua-5.3.5_Win64_dllw6_lib.zip" -O lua53.zip; unzip lua53.zip lua53.dll; mv lua53.dll libs; fi + - if [ "$TASK" == "windows" ]; then wget "https://downloads.sourceforge.net/project/luabinaries/5.3.5/Windows%20Libraries/Dynamic/lua-5.3.5_Win64_dllw6_lib.zip" -O lua53.zip; unzip lua53.zip lua53.dll; fi notifications: irc: diff --git a/backends/Makefile b/backends/Makefile index 1e66995..700c9b3 100644 --- a/backends/Makefile +++ b/backends/Makefile @@ -65,7 +65,7 @@ ola.so: CPPFLAGS += -Wno-write-strings lua.so: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") lua.so: LDLIBS += $(shell pkg-config --libs lua53 || pkg-config --libs lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") lua.dll: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") -lua.dll: LDLIBS += -L../libs -llua53 +lua.dll: LDLIBS += -L../ -llua53 python.so: CFLAGS += $(shell pkg-config --cflags python3 || pkg-config --cflags python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") python.so: CFLAGS += $(shell pkg-config --libs python3 || pkg-config --libs python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") diff --git a/backends/libmmbackend.c b/backends/libmmbackend.c index 2bbc226..92adc3c 100644 --- a/backends/libmmbackend.c +++ b/backends/libmmbackend.c @@ -20,8 +20,15 @@ int mmbackend_strdup(char** dest, char* src){ char* mmbackend_socket_strerror(int err_no){ #ifdef _WIN32 static char error[2048] = ""; + ssize_t u; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, WSAGetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), error, sizeof(error), NULL); + //remove trailing newline that for some reason is included in most of these... + for(u = strlen(error) - 1; u > 0; u--){ + if(!isprint(error[u])){ + error[u] = 0; + } + } return error; #else return strerror(err_no); diff --git a/backends/lua.md b/backends/lua.md index e59e513..0a31dce 100644 --- a/backends/lua.md +++ b/backends/lua.md @@ -101,7 +101,6 @@ the MIDIMonster project can not provide this file within this repository. You will need to acquire a copy of `lua53.dll`, for example by downloading it from the [luabinaries project](http://luabinaries.sourceforge.net/download.html). -To build the `lua` backend for Windows, place `lua53.dll` in a subdirectory `libs/` in the project root -and run `make lua.dll` inside the `backends/` directory. - +Place this file in the project root directory and run `make lua.dll` inside the `backends/` directory +to build the backend. At runtime, Windows searches for the file in the same directory as `midimonster.exe`. diff --git a/backends/rtpmidi.c b/backends/rtpmidi.c index 52cb0c5..7df8563 100644 --- a/backends/rtpmidi.c +++ b/backends/rtpmidi.c @@ -525,7 +525,7 @@ static int rtpmidi_applecommand(instance* inst, struct sockaddr* dest, socklen_t //FIXME should we match sending/receiving ports? if the reference does this, it should be documented bytes = sendto(control ? data->control_fd : data->fd, frame, sizeof(apple_command) + strlen(inst->name) + 1, 0, dest, dest_len); if(bytes != sizeof(apple_command) + strlen(inst->name) + 1){ - LOGPF("Failed to transmit session command on %s", inst->name); + LOGPF("Failed to transmit session command on %s: %s", inst->name, mmbackend_socket_strerror(errno)); return 1; } return 0; -- cgit v1.2.3 From 6503d83dee9c2c7dd30572b84f11b95f832e9309 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 26 Apr 2020 21:50:00 +0200 Subject: Disable stop-the-world windows error messages --- .travis-ci.sh | 1 - midimonster.c | 3 +++ plugin.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index 5272fde..39652a1 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -73,7 +73,6 @@ elif [ "$TASK" = "windows" ]; then fi # Build the lua backend but disable it by default to avoid scary error messages make -C backends lua.dll - mv backends/lua.dll backends/lua.dll.disabled travis_fold end "make_windows" if [ "$(git describe)" == "$(git describe --abbrev=0)" ]; then travis_fold start "deploy_windows" diff --git a/midimonster.c b/midimonster.c index 1065e5c..b418711 100644 --- a/midimonster.c +++ b/midimonster.c @@ -284,6 +284,9 @@ static int platform_initialize(){ if(WSAStartup(version, &wsa)){ return 1; } + + unsigned error_mode = SetErrorMode(0); + SetErrorMode(error_mode | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); #endif return 0; } diff --git a/plugin.c b/plugin.c index 56d6651..e7d8eba 100644 --- a/plugin.c +++ b/plugin.c @@ -51,7 +51,7 @@ static int plugin_attach(char* path, char* file){ char* error = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &error, 0, NULL); - fprintf(stderr, "Failed to load plugin %s: %s\n", lib, error); + fprintf(stderr, "Failed to load plugin %s, check that all supporting libraries are present: %s\n", lib, error); LocalFree(error); #else fprintf(stderr, "Failed to load plugin %s: %s\n", lib, dlerror()); -- cgit v1.2.3 From 929026130c7866d9b70be7a6cc820f103ae241b4 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 26 Apr 2020 22:54:17 +0200 Subject: Periodically retry connecting remotes for maweb --- .travis-ci.sh | 1 - backends/maweb.c | 50 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 19 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index 39652a1..40beec6 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -71,7 +71,6 @@ elif [ "$TASK" = "windows" ]; then if make windows; then exit "$?" fi - # Build the lua backend but disable it by default to avoid scary error messages make -C backends lua.dll travis_fold end "make_windows" if [ "$(git describe)" == "$(git describe --abbrev=0)" ]; then diff --git a/backends/maweb.c b/backends/maweb.c index 192c69e..5242f36 100644 --- a/backends/maweb.c +++ b/backends/maweb.c @@ -232,6 +232,7 @@ static int maweb_instance(instance* inst){ } data->fd = -1; + data->state = ws_closed; data->buffer = calloc(MAWEB_RECV_CHUNK, sizeof(uint8_t)); if(!data->buffer){ LOG("Failed to allocate memory"); @@ -350,6 +351,9 @@ static int maweb_send_frame(instance* inst, maweb_operation op, uint8_t* payload if(mmbackend_send(data->fd, frame_header, header_bytes) || mmbackend_send(data->fd, payload, len)){ + LOGPF("Failed to send on instance %s, assuming connection failure", inst->name); + data->state = ws_closed; + data->login = 0; return 1; } @@ -649,7 +653,11 @@ static int maweb_connect(instance* inst){ //unregister old fd from core if(data->fd >= 0){ mm_manage_fd(data->fd, BACKEND_NAME, 0, NULL); + close(data->fd); + data->fd = -1; } + data->state = ws_closed; + data->login = 0; LOGPF("Connecting to host %" PRIsize_t " of %" PRIsize_t " on %s", data->next_host + 1, data->hosts, inst->name); @@ -717,17 +725,15 @@ static ssize_t maweb_handle_lines(instance* inst, ssize_t bytes_read){ static int maweb_establish(instance* inst){ maweb_instance_data* data = (maweb_instance_data*) inst->impl; - uint8_t connected = 0; size_t start = data->next_host; do{ if(!maweb_connect(inst)){ - connected = 1; break; } } while(data->next_host != start); - return connected ? 0 : 1; + return data->state != ws_closed ? 0 : 1; } static ssize_t maweb_handle_ws(instance* inst, ssize_t bytes_read){ @@ -803,7 +809,7 @@ static int maweb_handle_fd(instance* inst){ data->buffer = realloc(data->buffer, (data->allocated + MAWEB_RECV_CHUNK) * sizeof(uint8_t)); if(!data->buffer){ LOG("Failed to allocate memory"); - return 1; + return -1; } data->allocated += MAWEB_RECV_CHUNK; bytes_left += MAWEB_RECV_CHUNK; @@ -812,19 +818,11 @@ static int maweb_handle_fd(instance* inst){ bytes_read = recv(data->fd, data->buffer + data->offset, bytes_left - 1, 0); if(bytes_read < 0){ LOGPF("Failed to receive on %s: %s", inst->name, mmbackend_socket_strerror(errno)); - if(maweb_establish(inst)){ - LOGPF("Failed to reconnect with any configured host on instance %s", inst->name); - return 1; - } - return 0; + return 1; } else if(bytes_read == 0){ //client closed connection, try to reopen the connection - if(maweb_establish(inst)){ - LOGPF("Failed to reconnect with any configured host on instance %s", inst->name); - return 1; - } - return 0; + return 1; } do{ @@ -844,7 +842,6 @@ static int maweb_handle_fd(instance* inst){ if(bytes_handled < 0){ bytes_handled = data->offset + bytes_read; data->offset = 0; - //TODO close, reopen LOG("Failed to handle incoming data"); return 1; } @@ -990,6 +987,12 @@ static int maweb_keepalive(){ snprintf(xmit_buffer, sizeof(xmit_buffer), "{\"session\":%" PRIu64 "}", data->session); maweb_send_frame(inst[u], ws_text, (uint8_t*) xmit_buffer, strlen(xmit_buffer)); } + else if(data->state == ws_closed){ + //try to reconnect to any remote + if(maweb_establish(inst[u])){ + LOGPF("Failed to reconnect to any host on %s, will retry in %d seconds", inst[u]->name, MAWEB_CONNECTION_KEEPALIVE / 1000); + } + } } free(inst); @@ -1024,7 +1027,18 @@ static int maweb_handle(size_t num, managed_fd* fds){ int rv = 0; for(n = 0; n < num; n++){ - rv |= maweb_handle_fd((instance*) fds[n].impl); + rv = maweb_handle_fd((instance*) fds[n].impl); + //try to reconnect soft failures + if(rv == 1 && maweb_establish((instance*) fds[n].impl)){ + //keepalive will retry periodically + LOGPF("Failed to reconnect with any configured host on instance %s", ((instance*) fds[n].impl)->name); + } + else if(rv){ + //propagate critical failures + return rv; + } + //errors handled + rv = 0; } //FIXME all keepalive processing allocates temporary buffers, this might an optimization target @@ -1062,8 +1076,8 @@ static int maweb_start(size_t n, instance** inst){ //try to connect to any available host if(maweb_establish(inst[u])){ + //do not return failure here, keepalive will periodically try to reconnect LOGPF("Failed to connect to any host configured on instance %s", inst[u]->name); - return 1; } } @@ -1107,7 +1121,7 @@ static int maweb_shutdown(size_t n, instance** inst){ data->buffer = NULL; data->offset = data->allocated = 0; - data->state = ws_new; + data->state = ws_closed; free(data->channel); data->channel = NULL; -- cgit v1.2.3 From c0bb55ff08faf2f89af947090d1c9bc412927d9f Mon Sep 17 00:00:00 2001 From: cbdev Date: Mon, 27 Apr 2020 22:20:19 +0200 Subject: Fix CI script --- .travis-ci.sh | 6 +++--- .travis.yml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) (limited to '.travis-ci.sh') diff --git a/.travis-ci.sh b/.travis-ci.sh index 40beec6..8f6a5ca 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -62,13 +62,13 @@ elif [ "$TASK" = "codesmell" ]; then elif [ "$TASK" = "sanitize" ]; then # Run sanitized compile travis_fold start "make_sanitize" - if make sanitize; then + if ! make sanitize; then exit "$?" fi travis_fold end "make_sanitize" elif [ "$TASK" = "windows" ]; then travis_fold start "make_windows" - if make windows; then + if ! make windows; then exit "$?" fi make -C backends lua.dll @@ -92,7 +92,7 @@ elif [ "$TASK" = "windows" ]; then else # Otherwise compile as normal travis_fold start "make" - if make full; then + if ! make full; then exit "$?" fi travis_fold end "make" diff --git a/.travis.yml b/.travis.yml index 8cf9e82..4e14339 100644 --- a/.travis.yml +++ b/.travis.yml @@ -134,6 +134,7 @@ before_cache: before_install: # Travis clones with --branch, which omits tags. Since we use them for the version string at build time, fetch them - git pull --tags + - printf "This is %s on %s\n" "$(git describe)" "$TRAVIS_OS_NAME" - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi # 'brew install' sometimes returns non-zero for some arcane reason. Executing 'true' resets the exit code and allows Travis to continue building... # Travis seems to have Python 2.7 installed by default, which for some reason prevents pkg-config from reading python3.pc -- cgit v1.2.3