From d75f364b2721a73b4447348bf88668335d5b6c6e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 15 Jun 2022 13:33:00 +0200 Subject: [PATCH] Update build scripts to set libnvidia-container version Signed-off-by: Evan Lezar --- scripts/build-all-components.sh | 2 +- scripts/build-packages.sh | 8 ++++---- scripts/get-component-versions.sh | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/build-all-components.sh b/scripts/build-all-components.sh index b3fe5d3c..97407a8b 100755 --- a/scripts/build-all-components.sh +++ b/scripts/build-all-components.sh @@ -25,7 +25,7 @@ function assert_usage() { exit 1 } -set -e -x +set -e SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../scripts && pwd )" PROJECT_ROOT="$( cd ${SCRIPTS_DIR}/.. && pwd )" diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh index 355d635a..ea2a9549 100755 --- a/scripts/build-packages.sh +++ b/scripts/build-packages.sh @@ -19,7 +19,7 @@ # as well as the components included in the third_party folder. # All required packages are generated in the specified dist folder. -set -e -x +set -e SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../scripts && pwd )" PROJECT_ROOT="$( cd ${SCRIPTS_DIR}/.. && pwd )" @@ -61,11 +61,11 @@ fi eval $(${SCRIPTS_DIR}/get-component-versions.sh) -if [[ "${NVIDIA_CONTAINER_TOOLKIT_VERSION}${NVIDIA_CONTAINER_TOOLKIT_TAG:+~${NVIDIA_CONTAINER_TOOLKIT_TAG}}" != "${LIBNVIDIA_CONTAINER_VERSION}" ]]; then +if [[ "${NVIDIA_CONTAINER_TOOLKIT_PACKAGE_VERSION}" != "${LIBNVIDIA_CONTAINER_PACKAGE_VERSION}" ]]; then set +x echo "The libnvidia-container and nvidia-container-toolkit versions do not match." - echo "lib: '${LIBNVIDIA_CONTAINER_VERSION}'" - echo "toolkit: '${NVIDIA_CONTAINER_TOOLKIT_VERSION}${NVIDIA_CONTAINER_TOOLKIT_TAG:+~${NVIDIA_CONTAINER_TOOLKIT_TAG}}'" + echo "lib: '${LIBNVIDIA_CONTAINER_PACKAGE_VERSION}'" + echo "toolkit: '${NVIDIA_CONTAINER_TOOLKIT_PACKAGE_VERSION}'" set -x [[ ${ALLOW_VERSION_MISMATCH} == "true" ]] || exit 1 fi diff --git a/scripts/get-component-versions.sh b/scripts/get-component-versions.sh index 80e34a51..e70f9181 100755 --- a/scripts/get-component-versions.sh +++ b/scripts/get-component-versions.sh @@ -36,6 +36,9 @@ NVIDIA_DOCKER_ROOT=${PROJECT_ROOT}/third_party/nvidia-docker # Get version for libnvidia-container libnvidia_container_version_tag=$(grep "#define NVC_VERSION" ${LIBNVIDIA_CONTAINER_ROOT}/src/nvc.h \ | sed -e 's/#define NVC_VERSION[[:space:]]"\(.*\)"/\1/') +libnvidia_container_version=${libnvidia_container_version_tag%%~*} +libnvidia_container_tag=${libnvidia_container_version_tag##${libnvidia_container_version}} +libnvidia_container_tag=${libnvidia_container_tag##~} versions_makefile=${NVIDIA_CONTAINER_TOOLKIT_ROOT}/versions.mk # Get version for nvidia-container-toolit @@ -53,7 +56,8 @@ nvidia_docker_version=$(grep -m 1 "^NVIDIA_DOCKER_VERSION := " ${versions_makefi nvidia_docker_tag=${nvidia_container_toolkit_tag} nvidia_docker_version_tag="${nvidia_docker_version}${nvidia_docker_tag:+~${nvidia_docker_tag}}" -echo "LIBNVIDIA_CONTAINER_VERSION=${libnvidia_container_version_tag}" +echo "LIBNVIDIA_CONTAINER_VERSION=${libnvidia_container_version}" +echo "LIBNVIDIA_CONTAINER_TAG=${libnvidia_container_tag}" echo "LIBNVIDIA_CONTAINER_PACKAGE_VERSION=${libnvidia_container_version_tag//\~/-}" echo "NVIDIA_CONTAINER_TOOLKIT_VERSION=${nvidia_container_toolkit_version}" echo "NVIDIA_CONTAINER_TOOLKIT_TAG=${nvidia_container_toolkit_tag}"