mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 01:02:33 +00:00
kernel: build: Use local kernel version.
If the runtime repository is already cloned get version from it, else keep getting from github. Fixes: #299 Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
8a3f7cf6d3
commit
2e93dbd737
@ -145,7 +145,16 @@ get_default_kernel_config() {
|
|||||||
echo "${config}"
|
echo "${config}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_config_and_patches() {
|
||||||
|
if [ -z "${patches_path}" ]; then
|
||||||
|
info "Clone config and patches"
|
||||||
|
patches_path="${default_patches_dir}"
|
||||||
|
[ -d "${patches_path}" ] || git clone "https://${patches_repo}.git" "${patches_repo_dir}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
get_config_version() {
|
get_config_version() {
|
||||||
|
get_config_and_patches
|
||||||
config_version_file="${default_patches_dir}/../kata_config_version"
|
config_version_file="${default_patches_dir}/../kata_config_version"
|
||||||
if [ -f "${config_version_file}" ]; then
|
if [ -f "${config_version_file}" ]; then
|
||||||
cat "${config_version_file}"
|
cat "${config_version_file}"
|
||||||
@ -172,10 +181,7 @@ setup_kernel() {
|
|||||||
|
|
||||||
[ -n "$kernel_path" ] || die "failed to find kernel source path"
|
[ -n "$kernel_path" ] || die "failed to find kernel source path"
|
||||||
|
|
||||||
if [ -z "${patches_path}" ]; then
|
get_config_and_patches
|
||||||
patches_path="${default_patches_dir}"
|
|
||||||
[ -d "${patches_path}" ] || git clone "https://${patches_repo}.git" "${patches_repo_dir}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -d "${patches_path}" ] || die " patches path '${patches_path}' does not exist"
|
[ -d "${patches_path}" ] || die " patches path '${patches_path}' does not exist"
|
||||||
|
|
||||||
@ -292,6 +298,9 @@ main() {
|
|||||||
kernel_path="${PWD}/kata-linux-${kernel_version}-${config_version}"
|
kernel_path="${PWD}/kata-linux-${kernel_version}-${config_version}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
info "Kernel version: ${kernel_version}"
|
||||||
|
info "Config version: ${config_version}"
|
||||||
|
|
||||||
case "${subcmd}" in
|
case "${subcmd}" in
|
||||||
build)
|
build)
|
||||||
build_kernel "${kernel_path}"
|
build_kernel "${kernel_path}"
|
||||||
|
@ -35,12 +35,16 @@ get_from_kata_deps() {
|
|||||||
local branch="${2:-master}"
|
local branch="${2:-master}"
|
||||||
local runtime_repo="github.com/kata-containers/runtime"
|
local runtime_repo="github.com/kata-containers/runtime"
|
||||||
GOPATH=${GOPATH:-${HOME}/go}
|
GOPATH=${GOPATH:-${HOME}/go}
|
||||||
# This is needed in order to retrieve the version for qemu-lite
|
versions_file="${GOPATH}/src/github.com/kata-containers/runtime/versions.yaml"
|
||||||
install_yq >&2
|
if [ ! -e "${versions_file}" ]; then
|
||||||
yaml_url="https://raw.githubusercontent.com/kata-containers/runtime/${branch}/versions.yaml"
|
yaml_url="https://raw.githubusercontent.com/kata-containers/runtime/${branch}/versions.yaml"
|
||||||
versions_file="versions_${branch}.yaml"
|
echo "versions file (${versions_file}) does not exist" >&2
|
||||||
[ ! -e "${versions_file}" ] || download_on_new_flag="-z ${versions_file}"
|
echo "Download from ${yaml_url}" >&2
|
||||||
curl --silent -o "${versions_file}" ${download_on_new_flag:-} "$yaml_url"
|
#make sure yq is installed
|
||||||
|
install_yq >&2
|
||||||
|
versions_file="versions_${branch}.yaml"
|
||||||
|
curl --silent -o "${versions_file}" "$yaml_url"
|
||||||
|
fi
|
||||||
result=$("${GOPATH}/bin/yq" read "$versions_file" "$dependency")
|
result=$("${GOPATH}/bin/yq" read "$versions_file" "$dependency")
|
||||||
[ "$result" = "null" ] && result=""
|
[ "$result" = "null" ] && result=""
|
||||||
echo "$result"
|
echo "$result"
|
||||||
|
Loading…
Reference in New Issue
Block a user