From f1f1ba5dac1b531c346758072c798ceb511100b3 Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Mon, 20 Nov 2017 16:38:28 -0800 Subject: Refactor clone and compile functions The clone_all_* and compile_all_* functions share same instructions for performing their functionality. This change pretends to reduce the duplication of the code. Change-Id: Ief63a5a58c79af85c829602b0451637424659438 Signed-off-by: Victor Morales Issue-Id: INT-339 --- bootstrap/vagrant-onap/lib/functions | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bootstrap/vagrant-onap/lib/functions') diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index c4ed3c85f..157c910de 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -67,6 +67,19 @@ function clone_repo { fi } +# clone_repos() - Function that clones source repositories for a given project +function clone_repos { + local project=$1 + local name=${project}_repos[@] + local src_name=${project}_src_folder + local repos_list=("${!name}") + local dest_folder=${3:-${!src_name}} + + for repo in ${repos_list[@]}; do + clone_repo $repo $dest_folder${repo#*$project} + done +} + # _install_bind() - Install bind utils function _install_bind { install_packages bind9 bind9utils @@ -282,6 +295,19 @@ function compile_src { popd } +# compile_repos() - Function that compiles source repositories for a given project +function compile_repos { + local project=$1 + local name=${project}_repos[@] + local repos_list=("${!name}") + local dest_folder=${3:-$git_src_folder/$project} + + install_package unzip + for repo in ${repos_list[@]}; do + compile_src $dest_folder${repo#*$project} + done +} + # build_docker_image() - Build Docker container image from source code function build_docker_image { local src_folder=$1 -- cgit 1.2.3-korg