summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/vm_dev_setup
diff options
context:
space:
mode:
authorQiLiang <liangqi1@huawei.com>2016-01-16 09:58:05 +0000
committerQiLiang <liangqi1@huawei.com>2016-01-16 13:49:38 +0000
commitd519fff9ff4adaece9e3cc221800169602f58fec (patch)
tree06360a01df80f26ce8f640a79ccd897620ddae25 /utils/infra_setup/vm_dev_setup
parent44fa06d65eafdcfce9671bdc09f2c8a6d7115982 (diff)
Scripts update to run rubbos on compass4nfv env 2
Enable stable branch checkout JIRA: - Change-Id: Ibe16adc4a6a1810a75b60ef9198ce7ea239d79c3 Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'utils/infra_setup/vm_dev_setup')
-rwxr-xr-xutils/infra_setup/vm_dev_setup/setup_env.sh35
1 files changed, 18 insertions, 17 deletions
diff --git a/utils/infra_setup/vm_dev_setup/setup_env.sh b/utils/infra_setup/vm_dev_setup/setup_env.sh
index cef76f8e..1ddab5de 100755
--- a/utils/infra_setup/vm_dev_setup/setup_env.sh
+++ b/utils/infra_setup/vm_dev_setup/setup_env.sh
@@ -51,29 +51,30 @@ bottlenecks_prepare_env()
done
}
+git_checkout()
+{
+ if git cat-file -e $1^{commit} 2>/dev/null; then
+ # branch, tag or sha1 object
+ git checkout $1
+ else
+ # refspec / changeset
+ git fetch --tags --progress $2 $1
+ git checkout FETCH_HEAD
+ fi
+}
+
bottlenecks_download_repo()
{
echo "Bottlenecks: download bottlenecks repo"
sudo git config --global http.sslVerify false
- if [ -d $BOTTLENECKS_REPO_DIR/.git ]; then
- cd $BOTTLENECKS_REPO_DIR
- sudo git pull origin master
- if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
- sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && sudo git checkout FETCH_HEAD
- fi
- cd -
- else
- sudo rm -rf $BOTTLENECKS_REPO_DIR
- sudo git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
- if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
- cd $BOTTLENECKS_REPO_DIR
- echo "fetch $GERRIT_REFSPEC_DEBUG"
- sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && sudo git checkout FETCH_HEAD
- cd -
- fi
-
+ if [ ! -d $BOTTLENECKS_REPO_DIR ]; then
+ git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
fi
+ cd $BOTTLENECKS_REPO_DIR
+ git checkout master && git pull
+ git_checkout $BOTTLENECKS_BRANCH $BOTTLENECKS_REPO
+ cd -
}
bottlenecks_config_hosts_ip()