From fa7dc8cb31c03efea298e1dfc30e8a411bfe53de Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 23 Sep 2021 21:34:09 +0200 Subject: [PATCH] Require at least a matching libnvidia-container-tools version This change ensures that at least the same libnvidia-container-tools version is required when installing nvidia-container-toolkit. Signed-off-by: Evan Lezar --- docker/Dockerfile.amazonlinux | 1 + docker/Dockerfile.centos | 1 + docker/Dockerfile.debian | 3 ++- docker/Dockerfile.opensuse-leap | 1 + docker/Dockerfile.ubuntu | 3 ++- packaging/debian/control | 2 +- packaging/debian/prepare | 1 + packaging/rpm/SPECS/nvidia-container-toolkit.spec | 2 +- 8 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.amazonlinux b/docker/Dockerfile.amazonlinux index 12a6732f..ea5b989a 100644 --- a/docker/Dockerfile.amazonlinux +++ b/docker/Dockerfile.amazonlinux @@ -59,6 +59,7 @@ CMD arch=$(uname -m) && \ rpmbuild --clean --target=$arch -bb \ -D "_topdir $PWD" \ -D "version $VERSION" \ + -D "libnvidia_container_version ${VERSION}-${RELEASE}" \ -D "release $RELEASE" \ SPECS/nvidia-container-toolkit.spec && \ mv RPMS/$arch/*.rpm /dist diff --git a/docker/Dockerfile.centos b/docker/Dockerfile.centos index 94e46e4c..3413bfa5 100644 --- a/docker/Dockerfile.centos +++ b/docker/Dockerfile.centos @@ -57,6 +57,7 @@ CMD arch=$(uname -m) && \ rpmbuild --clean --target=$arch -bb \ -D "_topdir $PWD" \ -D "version $VERSION" \ + -D "libnvidia_container_version ${VERSION}-${RELEASE}" \ -D "release $RELEASE" \ SPECS/nvidia-container-toolkit.spec && \ mv RPMS/$arch/*.rpm /dist diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index bafa1dbb..e4855f1d 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -64,5 +64,6 @@ RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \ if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi CMD export DISTRIB="$(lsb_release -cs)" && \ - debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ + debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_VERSION="${REVISION}" \ + --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ mv /tmp/nvidia-container-toolkit_*.deb /dist diff --git a/docker/Dockerfile.opensuse-leap b/docker/Dockerfile.opensuse-leap index 6fbdab15..313290e0 100644 --- a/docker/Dockerfile.opensuse-leap +++ b/docker/Dockerfile.opensuse-leap @@ -56,6 +56,7 @@ CMD arch=$(uname -m) && \ rpmbuild --clean --target=$arch -bb \ -D "_topdir $PWD" \ -D "version $VERSION" \ + -D "libnvidia_container_version ${VERSION}-${RELEASE}" \ -D "release $RELEASE" \ SPECS/nvidia-container-toolkit.spec && \ mv RPMS/$arch/*.rpm /dist diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 7f2571af..4c8e5b92 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -57,5 +57,6 @@ RUN sed -i "s;@VERSION@;${REVISION};" debian/changelog && \ if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi CMD export DISTRIB="$(lsb_release -cs)" && \ - debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ + debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_VERSION="${REVISION}" \ + --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ mv /tmp/*.deb /dist diff --git a/packaging/debian/control b/packaging/debian/control index cdd4158a..f21c42e7 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -10,7 +10,7 @@ Build-Depends: debhelper (>= 9) Package: nvidia-container-toolkit Architecture: any -Depends: ${misc:Depends}, libnvidia-container-tools (>= 1.4.0), libnvidia-container-tools (<< 2.0.0), libseccomp2 +Depends: ${misc:Depends}, libnvidia-container-tools (>= @LIBNVIDIA_CONTAINER_VERSION@), libnvidia-container-tools (<< 2.0.0), libseccomp2 Breaks: nvidia-container-runtime (<= 3.5.0-1), nvidia-container-runtime-hook Replaces: nvidia-container-runtime (<= 3.5.0-1), nvidia-container-runtime-hook Description: NVIDIA container runtime hook diff --git a/packaging/debian/prepare b/packaging/debian/prepare index b6e05d45..edff676a 100755 --- a/packaging/debian/prepare +++ b/packaging/debian/prepare @@ -3,6 +3,7 @@ set -e sed -i "s;@SECTION@;${SECTION:+$SECTION/};g" debian/control +sed -i "s;@LIBNVIDIA_CONTAINER_VERSION@;${LIBNVIDIA_CONTAINER_VERSION:+$LIBNVIDIA_CONTAINER_VERSION};g" debian/control if [ -n "$DISTRIB" ]; then sed -i "s;UNRELEASED;$DISTRIB;" debian/changelog diff --git a/packaging/rpm/SPECS/nvidia-container-toolkit.spec b/packaging/rpm/SPECS/nvidia-container-toolkit.spec index a2289b12..dcfc1a9d 100644 --- a/packaging/rpm/SPECS/nvidia-container-toolkit.spec +++ b/packaging/rpm/SPECS/nvidia-container-toolkit.spec @@ -20,7 +20,7 @@ Source5: LICENSE Obsoletes: nvidia-container-runtime <= 3.5.0-1, nvidia-container-runtime-hook Provides: nvidia-container-runtime Provides: nvidia-container-runtime-hook -Requires: libnvidia-container-tools >= 1.4.0, libnvidia-container-tools < 2.0.0 +Requires: libnvidia-container-tools >= %{libnvidia_container_version}, libnvidia-container-tools < 2.0.0 %if 0%{?suse_version} Requires: libseccomp2