diff options
author | Thomas <[email protected]> | 2012-08-05 23:20:40 -0700 |
---|---|---|
committer | Thomas <[email protected]> | 2012-08-05 23:20:40 -0700 |
commit | 842e81e2469bf84d66c30220c7ac1674fc5bcd0b (patch) | |
tree | e0b57a1b4bb402aed58da5f6b4a011a2d8141290 | |
parent | 1712fe3e952cfea43acb798fb361f42a84cceb5f (diff) | |
parent | 767dd46c55754845dcf5ad4c4ecb5d586fd67bc1 (diff) | |
download | kerl-842e81e2469bf84d66c30220c7ac1674fc5bcd0b.tar.gz kerl-842e81e2469bf84d66c30220c7ac1674fc5bcd0b.tar.bz2 kerl-842e81e2469bf84d66c30220c7ac1674fc5bcd0b.zip |
Merge pull request #29 from norton/dev
Add cache support for building from git
-rwxr-xr-x | kerl | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -27,6 +27,7 @@ KERL_BASE_DIR="$HOME/.kerl" KERL_CONFIG="$HOME/.kerlrc" KERL_DOWNLOAD_DIR="$KERL_BASE_DIR/archives" KERL_BUILD_DIR="$KERL_BASE_DIR/builds" +KERL_GIT_DIR="$KERL_BASE_DIR/gits" if [ -n "$KERL_CONFIGURE_OPTIONS" ]; then _KCO="$KERL_CONFIGURE_OPTIONS" fi @@ -265,10 +266,32 @@ assert_build_name_unused() do_git_build() { assert_build_name_unused $3 + + GIT=`echo -n "$1" | $MD5SUM | cut -d " " -f $MD5SUM_FIELD` + mkdir -p "$KERL_GIT_DIR" + cd "$KERL_GIT_DIR" + echo "Checking Erlang/OTP git repository from $1..." + if [ ! -d "$GIT" ]; then + git clone $1 $GIT > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Error retriving git repository" + exit 1 + fi + fi + if [ ! -x "$GIT/otp_build" ]; then + echo "Not a valid Erlang/OTP repository" + rm -Rf "$KERL_GIT_DIR/$GIT" + exit 1 + fi + cd $GIT + git clean -q -dfx + git reset -q --hard + git fetch -q --tags origin + git checkout -q --detach origin/master || true + mkdir -p "$KERL_BUILD_DIR/$3" cd "$KERL_BUILD_DIR/$3" - echo "Checking Erlang/OTP git repository from $1..." - git clone $1 otp_src_git > /dev/null 2>&1 + git clone -l "$KERL_GIT_DIR/$GIT" otp_src_git > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "Error retriving git repository" exit 1 @@ -863,6 +886,7 @@ case "$1" in echo "Cleaning up compilation products for ALL builds" rm -rf $KERL_BUILD_DIR/* rm -rf $KERL_DOWNLOAD_DIR/* + rm -rf $KERL_GIT_DIR/* echo "Cleaned up all compilation products under $KERL_BUILD_DIR" ;; *) |