diff options
author | sanmiguel <[email protected]> | 2017-02-18 14:41:11 +0100 |
---|---|---|
committer | sanmiguel <[email protected]> | 2017-02-18 14:41:11 +0100 |
commit | 0adce8690bd703d08c4c1af6d19d67ab78ff8bd8 (patch) | |
tree | 75a317375e95a199101010d72e298552183be8c6 /kerl | |
parent | 7ec1f8e0463b99ada8cc85de098b7aa9e6ab3f04 (diff) | |
parent | 0daeaa064d20dd3f72d4df6c105deba8e24c4543 (diff) | |
download | kerl-0adce8690bd703d08c4c1af6d19d67ab78ff8bd8.tar.gz kerl-0adce8690bd703d08c4c1af6d19d67ab78ff8bd8.tar.bz2 kerl-0adce8690bd703d08c4c1af6d19d67ab78ff8bd8.zip |
Merge branch 'get_active_path-cli' into enable-travis-ci
Diffstat (limited to 'kerl')
-rwxr-xr-x | kerl | 47 |
1 files changed, 43 insertions, 4 deletions
@@ -171,7 +171,7 @@ usage() { echo "kerl: build and install Erlang/OTP" echo "usage: $0 <command> [options ...]" - printf "\n <command> Command to be executed\n\n" + echo "\n <command> Command to be executed\n\n" echo "Valid commands are:" echo " build Build specified release or git repository" echo " install Install the specified release at the given location" @@ -588,7 +588,7 @@ _do_build() # Check for a .kerl_config.md5 file if [ -e "./$KERL_CONFIG_STORAGE_FILENAME.md5" ]; then # Compare our current options to the saved ones - OLD_SUM=read -r < "./$KERL_CONFIG_STORAGE_FILENAME.md5" + OLD_SUM=$(read -r < "./$KERL_CONFIG_STORAGE_FILENAME.md5") if [ "$SUM" -ne "$OLD_SUM" ]; then echo "Configure options have changed. Reconfiguring..." rm -f configure @@ -946,8 +946,9 @@ build_plt() plt=$dialyzerd/plt build_log=$dialyzerd/build.log dialyzer=$1/bin/dialyzer - apps=`ls -1 $1/lib | cut -d- -f1 | grep -Ev 'erl_interface|jinterface' | xargs echo` - $dialyzer --output_plt $plt --build_plt --apps $apps > $build_log 2>&1 + dirs=`find $1/lib -maxdepth 2 -name ebin -type d -exec dirname {} \;` + apps=`for app in $dirs; do basename $app | cut -d- -f1 ; done | grep -Ev 'erl_interface|jinterface' | xargs echo` + $dialyzer --output_plt $plt --build_plt --apps $apps >> $build_log 2>&1 status=$? if [ $status -eq 0 -o $status -eq 2 ]; then echo "Done building $plt" @@ -1228,6 +1229,11 @@ list_has() return 1 } +path_usage() +{ + echo "usage: $0 path [<install_name>]" +} + list_usage() { echo "usage: $0 list <releases|builds|installations>" @@ -1548,6 +1554,39 @@ case "$1" in ;; esac ;; + path) + # Usage: + # kerl path + # # Print currently active installation path, else non-zero exit + # kerl path <install> + # Print path to installation with name <install>, else non-zero exit + if [ -z "$2" ]; then + activepath=$(get_active_path) + if [ -z "$activepath" ]; then + echo "No active kerl-managed erlang installation" + exit 1 + fi + echo "$activepath" + else + # There are some possible extensions to this we could + # consider, such as: + # - if 2+ matches: prefer one in a subdir from $PWD + # - prefer $KERL_DEFAULT_INSTALL_DIR + match= + for ins in $(list_print installations | cut -d' ' -f2); do + if [ "$(basename $ins)" = "$2" ]; then + if [ -z "$match" ]; then + match="$ins" + else + echo "Error: too many matching installations" >&2 + exit 2 + fi + fi + done + [ -n "$match" ] && echo "$match" && exit 0 + echo "Error: no matching installation found" >&2 && exit 1 + fi + ;; delete) if [ $# -ne 3 ]; then delete_usage |