Skip to content

Commit

Permalink
lib: get deps based in a branch.
Browse files Browse the repository at this point in the history
We want to create pacakges based in different branches modify
function to get the yaml version needed to to that.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
  • Loading branch information
jcvenegas committed Aug 14, 2018
1 parent 764ce02 commit 8c223e8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ install_yq() {
}

get_from_kata_deps(){
dependency="$1"
local dependency="$1"
local branch="${2:-master}"
local runtime_repo="github.com/kata-containers/runtime"
GOPATH=${GOPATH:-${HOME}/go}
# This is needed in order to retrieve the version for qemu-lite
install_yq >&2
runtime_repo="github.com/kata-containers/runtime"
runtime_repo_dir="$GOPATH/src/${runtime_repo}"
versions_file="${runtime_repo_dir}/versions.yaml"
mkdir -p $(dirname "${runtime_repo_dir}")
[ -d "${runtime_repo_dir}" ] || git clone --quiet https://${runtime_repo}.git "${runtime_repo_dir}"
[ ! -f "$versions_file" ] && { echo >&2 "ERROR: cannot find $versions_file"; exit 1; }
yaml_url="https://raw.githubusercontent.com/kata-containers/runtime/${branch}/versions.yaml"
versions_file="versions_${branch}.yaml"
[ ! -e "${versions_file}" ] || download_on_new_flag="-z ${versions_file}"
curl --silent -o "${versions_file}" ${download_on_new_flag:-} "$yaml_url"
result=$("${GOPATH}/bin/yq" read "$versions_file" "$dependency")
[ "$result" = "null" ] && result=""
echo "$result"
Expand Down

0 comments on commit 8c223e8

Please sign in to comment.