aboutsummaryrefslogtreecommitdiffstats
path: root/kerl
diff options
context:
space:
mode:
authorJoseph Wayne Norton <[email protected]>2012-08-04 21:25:28 +0900
committerJoseph Wayne Norton <[email protected]>2012-08-04 21:53:11 +0900
commit767dd46c55754845dcf5ad4c4ecb5d586fd67bc1 (patch)
treee0b57a1b4bb402aed58da5f6b4a011a2d8141290 /kerl
parent1712fe3e952cfea43acb798fb361f42a84cceb5f (diff)
downloadkerl-767dd46c55754845dcf5ad4c4ecb5d586fd67bc1.tar.gz
kerl-767dd46c55754845dcf5ad4c4ecb5d586fd67bc1.tar.bz2
kerl-767dd46c55754845dcf5ad4c4ecb5d586fd67bc1.zip
Add cache support for building from git
Clone and re-use Erlang/OTP git repositories. Ensure the locally cached git repository is ready to use before each build by performing a git clean, git reset, git fetch, and git detach.
Diffstat (limited to 'kerl')
-rwxr-xr-xkerl28
1 files changed, 26 insertions, 2 deletions
diff --git a/kerl b/kerl
index c4485e4..e19a491 100755
--- a/kerl
+++ b/kerl
@@ -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"
;;
*)