From dafa9c5a8ac9fbd7705b2c6885f282bff6d9c9a0 Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Sun, 5 Feb 2017 23:38:08 +0100 Subject: Fix syntax for fetching old sum --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index 090021d..db17d4a 100755 --- a/kerl +++ b/kerl @@ -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 -- cgit v1.2.3 From 2bbbebed9ff8e0055a55023fbe015f1b127217cd Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Sat, 11 Feb 2017 22:03:18 +0100 Subject: Attempt a more accurate way to get apps for dialyzer PLT building --- kerl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index 090021d..06577b3 100755 --- a/kerl +++ b/kerl @@ -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" -- cgit v1.2.3 From 69579330e765ff2a97e75d04ba0a4d0ebedf23d0 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Sun, 12 Feb 2017 06:43:27 +0000 Subject: Roll 1.4.1 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b67bab8..5f7dfb1 100644 --- a/README.md +++ b/README.md @@ -598,6 +598,12 @@ will honor that instead, and will not do any automatic configuration. Changelog --------- +12 February 2017 - 1.4.1 + + - Fix reading a checksum file for compile options (#180) + - Get a little smarter about figuring out what apps to use + when building a PLT file for dialyzer (#181) + 5 February 2017 - 1.4.0 - Fix environment variable handling and a typo (#179) -- cgit v1.2.3 From 0b18d3cd64301e5be9c44b9e233fb83127c51d7f Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Thu, 16 Feb 2017 19:54:05 +0100 Subject: Add 'kerl path' subcommand Re #185 - [x] add `path` subcommad --- kerl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kerl b/kerl index 98cefb2..f6c9e88 100755 --- a/kerl +++ b/kerl @@ -1229,6 +1229,11 @@ list_has() return 1 } +path_usage() +{ + echo "usage: $0 path []" +} + list_usage() { echo "usage: $0 list " @@ -1549,6 +1554,16 @@ case "$1" in ;; esac ;; + path) + # Usage: + # kerl path + # # Print currently active installation path, else non-zero exit + # kerl path + # Print path to installation with name , else non-zero exit + if [ -z "$2" ]; then + get_active_path + fi + ;; delete) if [ $# -ne 3 ]; then delete_usage -- cgit v1.2.3 From c684e654274d65577d7133d6d22e5e7be17a6ee8 Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Fri, 17 Feb 2017 00:44:17 +0100 Subject: First pass at some of 'kerl path' WIP, lots TODO --- kerl | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/kerl b/kerl index f6c9e88..d18d532 100755 --- a/kerl +++ b/kerl @@ -171,7 +171,7 @@ usage() { echo "kerl: build and install Erlang/OTP" echo "usage: $0 [options ...]" - printf "\n Command to be executed\n\n" + echo "\n 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" @@ -1200,6 +1200,24 @@ list_print() echo "There are no $1 available" } +list_print1() +{ + # TODO Assert that there is exactly 1 match + # TODO This function is a misnomer because it's becoming + # totally specialised to finding an installation by name + # We really only want to match if a single install has a path + # such that $(basename $installpath) == $2 + # There are some possible extensions to this we could + # consider, such as: + # - match as above if there's exactly 1 match + # - if 2+ matches: prefer one in a subdir from $PWD + # - prefer $KERL_DEFAULT_INSTALL_DIR + # - probably more! + # FIXME 'grep -w' treats '-' as word boundary, so a search for + # 'foo-1' will match both '/path/foo-1' and '/path/bar-foo-1' + grep -w "$2" "$KERL_BASE_DIR/otp_$1" 2>&1 +} + list_add() { if [ -f "$KERL_BASE_DIR/otp_$1" ]; then @@ -1561,7 +1579,19 @@ case "$1" in # kerl path # Print path to installation with name , else non-zero exit if [ -z "$2" ]; then - get_active_path + # TODO Print a warning if no active path + activepath=$(get_active_path) + if [ -z "$activepath" ]; then + echo "No active kerl-managed erlang installation" + exit 1 + fi + echo "$activepath" + else + # TODO Move this inside something like assert_valid_installation + # that either prints exactly 1 match or exits non-zero + # TODO Print exactly 1 otherwise error + activepath=$(list_print1 installations "$2" | cut -d' ' -f2) + echo $activepath fi ;; delete) -- cgit v1.2.3 From 9a3205b326eda1b906c8078c11af914fec2be1fb Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Sat, 18 Feb 2017 13:40:01 +0100 Subject: Flesh out 'kerl path' --- kerl | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/kerl b/kerl index d18d532..2ea08e4 100755 --- a/kerl +++ b/kerl @@ -1200,24 +1200,6 @@ list_print() echo "There are no $1 available" } -list_print1() -{ - # TODO Assert that there is exactly 1 match - # TODO This function is a misnomer because it's becoming - # totally specialised to finding an installation by name - # We really only want to match if a single install has a path - # such that $(basename $installpath) == $2 - # There are some possible extensions to this we could - # consider, such as: - # - match as above if there's exactly 1 match - # - if 2+ matches: prefer one in a subdir from $PWD - # - prefer $KERL_DEFAULT_INSTALL_DIR - # - probably more! - # FIXME 'grep -w' treats '-' as word boundary, so a search for - # 'foo-1' will match both '/path/foo-1' and '/path/bar-foo-1' - grep -w "$2" "$KERL_BASE_DIR/otp_$1" 2>&1 -} - list_add() { if [ -f "$KERL_BASE_DIR/otp_$1" ]; then @@ -1579,7 +1561,6 @@ case "$1" in # kerl path # Print path to installation with name , else non-zero exit if [ -z "$2" ]; then - # TODO Print a warning if no active path activepath=$(get_active_path) if [ -z "$activepath" ]; then echo "No active kerl-managed erlang installation" @@ -1587,11 +1568,23 @@ case "$1" in fi echo "$activepath" else - # TODO Move this inside something like assert_valid_installation - # that either prints exactly 1 match or exits non-zero - # TODO Print exactly 1 otherwise error - activepath=$(list_print1 installations "$2" | cut -d' ' -f2) - echo $activepath + # 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) -- cgit v1.2.3 From 2793ae422651b40689f61839a9b60bbe65fb2ef9 Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Sat, 18 Feb 2017 13:59:49 +0100 Subject: Add kerl path to zsh completions --- zsh_completion/_kerl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zsh_completion/_kerl b/zsh_completion/_kerl index e58eb8b..7c9f0d6 100644 --- a/zsh_completion/_kerl +++ b/zsh_completion/_kerl @@ -30,6 +30,10 @@ _kerl_installations() { installations=(${(f)"$(_call_program installations kerl list installations 2>/dev/null | cut -f 2 -d " ")"}) } +_kerl_installnames() { + installnames=(${(f)"$(_call_program installations kerl list installations 2>/dev/null | cut -f 2 -d " " | xargs basename)"}) +} + local -a _1st_arguments _1st_arguments=( 'build:Build specified release or git repository' @@ -39,6 +43,7 @@ _1st_arguments=( 'list:List releases, builds and installations' 'delete:Delete builds and installations' 'active:Print the path of the active installation' + 'path:Print the path of any installation' 'status:Print available builds and installations' 'prompt:Print a string suitable for insertion in prompt' 'cleanup:Remove compilation artifacts (use after installation)' @@ -96,6 +101,15 @@ case "$words[1]" in # TODO: suggest starting location of "$KERLDIR/$(lowercase $build)" _directories ;; + path) + _arguments \ + '1: :->installnames' && return 0 + if [[ "$state" == installnames ]]; then + _kerl_installnames + _wanted installnames expl '' compadd -a installnames + return + fi + ;; deploy) _arguments \ '1: :->hosts' \ -- cgit v1.2.3 From 0daeaa064d20dd3f72d4df6c105deba8e24c4543 Mon Sep 17 00:00:00 2001 From: sanmiguel Date: Sat, 18 Feb 2017 14:37:43 +0100 Subject: Extend bash completion for 'kerl path' --- bash_completion/kerl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bash_completion/kerl b/bash_completion/kerl index 689463d..d620a4d 100644 --- a/bash_completion/kerl +++ b/bash_completion/kerl @@ -12,7 +12,7 @@ _kerl() case $prev in kerl) - COMPREPLY=( $( compgen -W "build install update list delete active status" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "build install update list delete active path status" -- "$cur" ) ) ;; list) COMPREPLY=( $( compgen -W "releases builds installations" -- "$cur" ) ) @@ -42,6 +42,13 @@ _kerl() fi 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") ) + ;; deploy) if [ "$COMP_CWORD" -eq 3 ]; then if [ -f "$HOME"/.kerl/otp_installations ]; then -- cgit v1.2.3