From 83ca3eb4f121606c145e5b71af89eb46282e1e8b Mon Sep 17 00:00:00 2001 From: Joseph Wayne Norton Date: Sat, 8 Dec 2012 13:36:06 +0900 Subject: Use HREF url to extract list of releases from erlang.org Kerl previously used the contents of the HTML tag for this purpose. Unfortunately, the HTML tag is not always rendered as expected. The old output from "kerl update releases": ------ Getting the available releases from erlang.org... The available releases are: R10B-0 R10B-2 R10B-3 R10B-4 R10B-5 R10B-6 R10B-7 R10B-8 R10B-9 R11B-0 R11B-1 R11B-2 R11B-3 R11B-4 R11B-5 R12B-0 R12B-1 R12B-2 R12B-3 R12B-4 R12B-5 R13A R13B R13B01 R13B02 R13B03 R13B04 R14A R14B R14B01 R14B02 R14B03 R14B04 R15B R15B01 R15B02 R15B03 ------ The new output from "kerl update releases": ------ Getting the available releases from erlang.org... The available releases are: R10B-0 R10B-10 R10B-2 R10B-3 R10B-4 R10B-5 R10B-6 R10B-7 R10B-8 R10B-9 R11B-0 R11B-1 R11B-2 R11B-3 R11B-4 R11B-5 R12B-0 R12B-1 R12B-2 R12B-3 R12B-4 R12B-5 R13A R13B R13B01 R13B02-1 R13B02 R13B03 R13B04 R14A R14B R14B01 R14B02 R14B03 R14B04 R15B R15B01 R15B02 R15B03-1 R15B03 ------ --- kerl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerl b/kerl index 43220d6..d50f7c5 100755 --- a/kerl +++ b/kerl @@ -114,7 +114,7 @@ if [ $# -eq 0 ]; then usage; fi get_releases() { curl -s $ERLANG_DOWNLOAD_URL/ | \ - sed $SED_OPT -e 's/^.*>otp_src_(R1[-1234567890ABCD]+)\.tar\.gz<.*$/\1/' \ + sed $SED_OPT -e 's/^.*<[aA] [hH][rR][eE][fF]=\"\/download\/otp_src_(R1[-1234567890ABCD]+)\.tar\.gz\">.*$/\1/' \ -e '/^R/!d' } -- cgit v1.2.3 From 58f74f316678e62d47841f3c19cdf8ad0251b01b Mon Sep 17 00:00:00 2001 From: Joseph Wayne Norton Date: Sat, 8 Dec 2012 14:47:48 +0900 Subject: Force the name of the otp_src_.* directory to match expectations The name of the otp_src_.* directory (e.g. otp_src_R15B03) may not always match with the name (e.g. otp_src_R15B03-1.tar.gz) of it's tarball file. The tar --strip-components option was purposely not used since this option might not be available all of the time. --- kerl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kerl b/kerl index d50f7c5..fa7f881 100755 --- a/kerl +++ b/kerl @@ -326,7 +326,11 @@ do_build() mkdir -p "$KERL_BUILD_DIR/$2" if [ ! -d "$KERL_BUILD_DIR/$2/otp_src_$1" ]; then echo "Extracting source code" - cd "$KERL_BUILD_DIR/$2" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" + UNTARDIRNAME="$KERL_BUILD_DIR/$2/otp_src_$1-kerluntar-$$" + rm -rf "$UNTARDIRNAME" + mkdir -p "$UNTARDIRNAME" + (cd "$UNTARDIRNAME" && tar xfz "$KERL_DOWNLOAD_DIR/$FILENAME" && mv * "$KERL_BUILD_DIR/$2/otp_src_$1") + rm -rf "$UNTARDIRNAME" fi echo "Building Erlang/OTP $1 ($2), please wait..." ERL_TOP="$KERL_BUILD_DIR/$2/otp_src_$1" -- cgit v1.2.3