aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xkerl101
1 files changed, 81 insertions, 20 deletions
diff --git a/kerl b/kerl
index d592517..68f3750 100755
--- a/kerl
+++ b/kerl
@@ -52,11 +52,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" || exit 1
@@ -85,6 +89,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
@@ -119,6 +126,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)"
@@ -500,19 +508,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)
@@ -523,28 +524,81 @@ 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
+ 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:"
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")
+}
+
+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_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
@@ -842,6 +896,11 @@ case "$1" in
exit 1;
fi
;;
+ plt)
+ if ! do_plt; then
+ exit 1;
+ fi
+ ;;
status)
echo "Available builds:"
list_print builds
@@ -849,7 +908,9 @@ case "$1" in
echo "Available installations:"
list_print installations
echo "----------"
- do_active
+ if do_active; then
+ do_plt
+ fi
exit 0
;;
prompt)