diff options
author | Mark Allen <[email protected]> | 2016-04-23 16:27:44 -0500 |
---|---|---|
committer | Mark Allen <[email protected]> | 2016-04-23 16:27:44 -0500 |
commit | fe5ffaec1eea70c976df0638b6ca2965af7e27eb (patch) | |
tree | 1e92b3133f04f7b187c62d4199bb505b674e7507 /kerl | |
parent | ba8557b37a25410976d8a659f12ee65a6cdc2561 (diff) | |
download | kerl-fe5ffaec1eea70c976df0638b6ca2965af7e27eb.tar.gz kerl-fe5ffaec1eea70c976df0638b6ca2965af7e27eb.tar.bz2 kerl-fe5ffaec1eea70c976df0638b6ca2965af7e27eb.zip |
Pull tags from github
Diffstat (limited to 'kerl')
-rwxr-xr-x | kerl | 45 |
1 files changed, 42 insertions, 3 deletions
@@ -1,5 +1,6 @@ #! /bin/sh +# Copyright (c) 2016 Mark Allen # Copyright (c) 2011, 2012 Spawngrid, Inc # Copyright (c) 2011 Evax Software <contact(at)evax(dot)org> # @@ -24,7 +25,8 @@ #Grep fix for mac pcre errors GREP_OPTIONS='' -ERLANG_DOWNLOAD_URL=http://www.erlang.org/download +ERLANG_DOWNLOAD_URL="http://www.erlang.org/download" +OTP_GITHUB_URL="https://github.com/erlang/otp" # Default values : ${KERL_BASE_DIR:="$HOME"/.kerl} @@ -103,6 +105,12 @@ else INSTALL_OPT=-sasl fi +if [ -z "$KERL_BUILD_BACKEND" ]; then + KERL_BUILD_BACKEND="git" +else + KERL_BUILD_BACKEND="tarball" +fi + KERL_SYSTEM=$(uname -s) case "$KERL_SYSTEM" in Darwin|FreeBSD|OpenBSD) @@ -141,16 +149,47 @@ if [ $# -eq 0 ]; then usage; fi get_releases() { + if [ "$KERL_BUILD_BACKEND" -eq "git" ] + then + get_git_releases + else + get_tarball_releases + fi +} + +get_git_releases() +{ + git ls-remote --tags "$OTP_GITHUB_URL" \ + | egrep -o 'OTP[_-][^^{}]+' \ + | sed $SED_OPT 's/OTP[_-]//' \ + | sort \ + | uniq +} + +get_tarball_releases() +{ curl -L -s $ERLANG_DOWNLOAD_URL/ | \ sed $SED_OPT -e 's/^.*<[aA] [hH][rR][eE][fF]=\"\otp_src_([-0-9A-Za-z_.]+)\.tar\.gz\">.*$/\1/' \ -e '/^R1|^[0-9]/!d' | \ sed -e "s/^R\(.*\)/\1:R\1/" | sed -e "s/^\([^\:]*\)$/\1-z:\1/" | sort | cut -d':' -f2 } +update_git_remote() +{ + cd "$KERL_GIT_BASE_SRC" + git checkout master || exit 1 + git pull origin master || exit 1 +} + update_checksum_file() { - echo "Getting the checksum file from erlang.org..." - curl -L $ERLANG_DOWNLOAD_URL/MD5 > "$KERL_DOWNLOAD_DIR"/MD5 || exit 1 + if [ "$KERL_BUILD_BACKEND" -eq "git" ]; + then + return 0 + else + echo "Getting the checksum file from erlang.org..." + curl -L $ERLANG_DOWNLOAD_URL/MD5 > "$KERL_DOWNLOAD_DIR"/MD5 || exit 1 + fi } ensure_checksum_file() |