From 8de95932091c0f936b268477e16a1c62afa4483e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 18 Jul 2022 14:33:04 +0200 Subject: [PATCH] Split nvidia-container-toolkit package This change splits the nvidia-container-toolkit package into the top-level package and an nvidia-container-toolkit-base package. The nvidia-container-toolkit-base package allows the NVIDIA Container Runtime and NVIDIA Container Toolkit CLI to be installed on systems without requiring that the NVIDIA Container Runtine Hook and the transitive dependencies included in the NVIDIA Container Library and NVIDIA Container CLI also be installed. This allows the runtime to be used on systems where the CSV or CDI mode of the runtime is used exclusively. Signed-off-by: Evan Lezar --- docker/Dockerfile.debian | 2 +- docker/Dockerfile.ubuntu | 2 +- packaging/debian/control | 10 +++++++- .../nvidia-container-toolkit-base.install | 3 +++ .../debian/nvidia-container-toolkit.install | 3 --- packaging/debian/prepare | 1 + .../rpm/SPECS/nvidia-container-toolkit.spec | 25 ++++++++++++++++--- 7 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 packaging/debian/nvidia-container-toolkit-base.install diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 8e0c099e..0394ab84 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -76,6 +76,6 @@ RUN dch --create --package="${PKG_NAME}" \ if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi CMD export DISTRIB="$(lsb_release -cs)" && \ - debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_TOOLS_VERSION \ + debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_TOOLS_VERSION -eVERSION="${REVISION}" \ --dpkg-buildpackage-hook='sh debian/prepare' -i -us -uc -b && \ mv /tmp/nvidia-container-toolkit_*.deb /dist diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index dcd71c21..cf340b11 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -69,6 +69,6 @@ RUN dch --create --package="${PKG_NAME}" \ if [ "$REVISION" != "$(dpkg-parsechangelog --show-field=Version)" ]; then exit 1; fi CMD export DISTRIB="$(lsb_release -cs)" && \ - debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_TOOLS_VERSION \ + debuild -eDISTRIB -eSECTION -eLIBNVIDIA_CONTAINER_TOOLS_VERSION -eVERSION="${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 e2d5b434..fe42428b 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -10,8 +10,16 @@ Build-Depends: debhelper (>= 9) Package: nvidia-container-toolkit Architecture: any -Depends: ${misc:Depends}, libnvidia-container-tools (>= @LIBNVIDIA_CONTAINER_TOOLS_VERSION@), libnvidia-container-tools (<< 2.0.0), libseccomp2 +Depends: ${misc:Depends}, nvidia-container-toolkit-base (= @VERSION@), libnvidia-container-tools (>= @LIBNVIDIA_CONTAINER_TOOLS_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 toolkit Provides tools and utilities to enable GPU support in containers. + +Package: nvidia-container-toolkit-base +Architecture: any +Depends: ${misc:Depends} +Breaks: nvidia-container-runtime (<= 3.5.0-1), nvidia-container-runtime-hook, nvidia-container-toolkit (<= 1.10.0-1) +Replaces: nvidia-container-runtime (<= 3.5.0-1), nvidia-container-runtime-hook +Description: NVIDIA Container Toolkit Base + Provides tools such as the NVIDIA Container Runtime and NVIDIA Container Toolkit CLI to enable GPU support in containers. diff --git a/packaging/debian/nvidia-container-toolkit-base.install b/packaging/debian/nvidia-container-toolkit-base.install new file mode 100644 index 00000000..3b183ed2 --- /dev/null +++ b/packaging/debian/nvidia-container-toolkit-base.install @@ -0,0 +1,3 @@ +config.toml /etc/nvidia-container-runtime +nvidia-container-runtime /usr/bin +nvidia-ctk /usr/bin diff --git a/packaging/debian/nvidia-container-toolkit.install b/packaging/debian/nvidia-container-toolkit.install index 2f2bee2a..b08e2e74 100644 --- a/packaging/debian/nvidia-container-toolkit.install +++ b/packaging/debian/nvidia-container-toolkit.install @@ -1,4 +1 @@ -config.toml /etc/nvidia-container-runtime nvidia-container-runtime-hook /usr/bin -nvidia-container-runtime /usr/bin -nvidia-ctk /usr/bin diff --git a/packaging/debian/prepare b/packaging/debian/prepare index 4dc5085d..1b15a150 100755 --- a/packaging/debian/prepare +++ b/packaging/debian/prepare @@ -4,6 +4,7 @@ set -e sed -i "s;@SECTION@;${SECTION:+$SECTION/};g" debian/control sed -i "s;@LIBNVIDIA_CONTAINER_TOOLS_VERSION@;${LIBNVIDIA_CONTAINER_TOOLS_VERSION:+$LIBNVIDIA_CONTAINER_TOOLS_VERSION};g" debian/control +sed -i "s;@VERSION@;${VERSION:+$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 73e96d30..24dd48fa 100644 --- a/packaging/rpm/SPECS/nvidia-container-toolkit.spec +++ b/packaging/rpm/SPECS/nvidia-container-toolkit.spec @@ -18,10 +18,11 @@ Source4: oci-nvidia-hook Source5: oci-nvidia-hook.json Source6: LICENSE -Obsoletes: nvidia-container-runtime <= 3.5.0-1, nvidia-container-runtime-hook +Obsoletes: nvidia-container-runtime <= 3.5.0-1, nvidia-container-runtime-hook <= 1.4.0-2 Provides: nvidia-container-runtime Provides: nvidia-container-runtime-hook Requires: libnvidia-container-tools >= %{libnvidia_container_tools_version}, libnvidia-container-tools < 2.0.0 +Requires: nvidia-container-toolkit-base == %{version}-%{release} %if 0%{?suse_version} Requires: libseccomp2 @@ -60,9 +61,6 @@ rm -f %{_bindir}/nvidia-container-toolkit %files %license LICENSE %{_bindir}/nvidia-container-runtime-hook -%{_bindir}/nvidia-container-runtime -%{_bindir}/nvidia-ctk -%config /etc/nvidia-container-runtime/config.toml /usr/libexec/oci/hooks.d/oci-nvidia-hook /usr/share/containers/oci/hooks.d/oci-nvidia-hook.json @@ -71,3 +69,22 @@ rm -f %{_bindir}/nvidia-container-toolkit * %{release_date} NVIDIA CORPORATION %{version}-%{release} - See https://gitlab.com/nvidia/container-toolkit/container-toolkit/-/blob/%{git_commit}/CHANGELOG.md - Bump libnvidia-container dependency to libnvidia-container-tools >= %{libnvidia_container_tools_version} + +# The BASE package consists of the NVIDIA Container Runtime and the NVIDIA Container Toolkit CLI. +# This allows the package to be installed on systems where no NVIDIA Container CLI is available. +%package base +Summary: NVIDIA Container Toolkit Base +Obsoletes: nvidia-container-runtime <= 3.5.0-1, nvidia-container-runtime-hook <= 1.4.0-2 +Provides: nvidia-container-runtime +# Since this package allows certain components of the NVIDIA Container Toolkit to be installed separately +# it conflicts with older versions of the nvidia-container-toolkit package that also provide these files. +Conflicts: nvidia-container-toolkit <= 1.10.0-1 + +%description base +Provides tools such as the NVIDIA Container Runtime and NVIDIA Container Toolkit CLI to enable GPU support in containers. + +%files base +%license LICENSE +%config /etc/nvidia-container-runtime/config.toml +%{_bindir}/nvidia-container-runtime +%{_bindir}/nvidia-ctk