From 87cd3bb022ff3cb829a07fe4e442c0284360c3e2 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 2 Jul 2015 16:53:49 +0200 Subject: Deduplicate some installation steps --- kerl | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/kerl b/kerl index 552b2fb..43e3545 100755 --- a/kerl +++ b/kerl @@ -497,19 +497,12 @@ ACTIVATE if [ "$rel" != "git" ]; then if [ -n "$KERL_INSTALL_MANPAGES" ]; then echo "Fetching and installing manpages..." - FILENAME=otp_doc_man_$rel.tar.gz - download "$FILENAME" - echo "Extracting manpages" - cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" + do_install_manpages "$rel" fi if [ -n "$KERL_INSTALL_HTMLDOCS" ]; then echo "Fetching and installing HTML docs..." - FILENAME="otp_doc_html_$rel.tar.gz" - download "$FILENAME" - echo "Extracting HTML docs" - (cd "$absdir" && mkdir -p html && \ - tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") + do_install_htmldocs "$rel" fi else rel=`get_newest_valid_release` @@ -520,19 +513,12 @@ ACTIVATE if [ -n "$KERL_INSTALL_MANPAGES" ]; then echo "CAUTION: Fetching and installing newest ($rel) manpages..." - FILENAME=otp_doc_man_$rel.tar.gz - download "$FILENAME" - echo "Extracting manpages" - cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" + do_install_manpages "$rel" fi if [ -n "$KERL_INSTALL_HTMLDOCS" ]; then - echo "CATION: Fetching and installing newest ($rel) HTML docs..." - FILENAME="otp_doc_html_$rel.tar.gz" - download "$FILENAME" - echo "Extracting HTML docs" - (cd "$absdir" && mkdir -p html && \ - tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") + echo "CAUTION: Fetching and installing newest ($rel) HTML docs..." + do_install_htmldocs "$rel" fi fi @@ -542,6 +528,23 @@ ACTIVATE echo "kerl_deactivate" } +do_install_manpages() +{ + FILENAME=otp_doc_man_$1.tar.gz + download "$FILENAME" + echo "Extracting manpages" + cd "$absdir" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" +} + +do_install_htmldocs() +{ + FILENAME="otp_doc_html_$1.tar.gz" + download "$FILENAME" + echo "Extracting HTML docs" + (cd "$absdir" && mkdir -p html && \ + tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") +} + do_deploy() { if [ -z "$1" ]; then -- cgit v1.2.3 From 7b51ebafd0039709db74bdb23e080b81b72abf18 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Thu, 2 Jul 2015 16:54:27 +0200 Subject: Build a Dialyzer PLT when installing a build --- kerl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/kerl b/kerl index 43e3545..59f191a 100755 --- a/kerl +++ b/kerl @@ -49,11 +49,15 @@ fi if [ -n "$KERL_INSTALL_MANPAGES" ]; then _KIM="$KERL_INSTALL_MANPAGES" fi +if [ -n "$KERL_BUILD_PLT" ]; then + _KBPLT="$KERL_BUILD_PLT" +fi KERL_CONFIGURE_OPTIONS= KERL_CONFIGURE_APPLICATIONS= KERL_CONFIGURE_DISABLE_APPLICATIONS= KERL_SASL_STARTUP= KERL_INSTALL_MANPAGES= +KERL_BUILD_PLT= # ensure the base dir exsists mkdir -p "$KERL_BASE_DIR" @@ -82,6 +86,9 @@ fi if [ -n "$_KIM" ]; then KERL_INSTALL_MANPAGES="$_KIM" fi +if [ -n "$_KBPLT" ]; then + KERL_BUILD_PLT="$_KBPLT" +fi if [ -z "$KERL_SASL_STARTUP" ]; then INSTALL_OPT=-minimal @@ -522,6 +529,11 @@ ACTIVATE fi fi + if [ -n "$KERL_BUILD_PLT" ]; then + echo "Building Dialyzer PLT..." + build_plt "$absdir" + fi + echo "You can activate this installation running the following command:" echo ". $absdir/activate" echo "Later on, you can leave the installation typing:" @@ -545,6 +557,25 @@ do_install_htmldocs() tar -C "$absdir/html" -xzf "$KERL_DOWNLOAD_DIR/$FILENAME") } +build_plt() +{ + dialyzerd=$1/dialyzer + mkdir -p $dialyzerd + 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 + status=$? + if [ $status -eq 0 -o $status -eq 2 ]; then + echo "Done building $plt" + return 0 + else + echo "Error building PLT, see $build_log for details" + return 1 + fi +} + do_deploy() { if [ -z "$1" ]; then -- cgit v1.2.3 From d1044e8748532643506525b337e969df3c27afd4 Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Fri, 3 Jul 2015 11:42:59 +0200 Subject: Print PLT status --- kerl | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/kerl b/kerl index 59f191a..a859d64 100755 --- a/kerl +++ b/kerl @@ -123,6 +123,7 @@ usage() echo " list List releases, builds and installations" echo " delete Delete builds and installations" echo " active Print the path of the active installation" + echo " plt Print Dialyzer PLT path for the active installation" echo " status Print available builds and installations" echo " prompt Print a string suitable for insertion in prompt" echo " cleanup Remove compilation artifacts (use after installation)" @@ -576,6 +577,25 @@ build_plt() fi } +do_plt() +{ + ACTIVE_PATH=`get_active_path` + if [ -n "$ACTIVE_PATH" ]; then + plt=$ACTIVE_PATH/dialyzer/plt + if [ -f "$plt" ]; then + echo "Dialyzer PLT for the active installation is:" + echo $plt + return 0 + else + echo "There's no Dialyzer PLT for the active installation" + return 1 + fi + else + echo "No Erlang/OTP kerl installation is currently active" + return 2 + fi +} + do_deploy() { if [ -z "$1" ]; then @@ -873,6 +893,11 @@ case "$1" in exit 1; fi ;; + plt) + if ! do_plt; then + exit 1; + fi + ;; status) echo "Available builds:" list_print builds @@ -880,7 +905,9 @@ case "$1" in echo "Available installations:" list_print installations echo "----------" - do_active + if do_active; then + do_plt + fi exit 0 ;; prompt) -- cgit v1.2.3