From 9480f6c70797892c35677763a6016b49bce799f4 Mon Sep 17 00:00:00 2001 From: Arnaldo Garcia Rincon Date: Wed, 21 Feb 2024 02:19:14 +0000 Subject: [PATCH] nvidia-container-runtime: fix how configurations files are created In 911775f, we changed how the configuration files for the nvidia-container-toolkit were created, and used %post install scripts to create hard links to the correspondent configuration per variant. However, the hard links weren't created since the lua scripts use relative paths instead of absolute paths and the builds didn't fail since %post install scripts fail silently. With this commit, instead of creating hard links with %post install scripts, the configuration files for the nvidia-container-toolkit are copied over with tmpfiles.d configuration files. Signed-off-by: Arnaldo Garcia Rincon --- ...nvidia-container-toolkit-tmpfiles-ecs.conf | 1 + ...nvidia-container-toolkit-tmpfiles-k8s.conf | 1 + .../nvidia-container-toolkit-tmpfiles.conf | 1 - .../nvidia-container-toolkit.spec | 25 ++++++++----------- 4 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-ecs.conf create mode 100644 packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-k8s.conf delete mode 100644 packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles.conf diff --git a/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-ecs.conf b/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-ecs.conf new file mode 100644 index 00000000000..472f348fa86 --- /dev/null +++ b/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-ecs.conf @@ -0,0 +1 @@ +C /etc/nvidia-container-runtime/config.toml - - - - /usr/share/factory/nvidia-container-runtime/nvidia-container-toolkit-config-ecs.toml diff --git a/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-k8s.conf b/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-k8s.conf new file mode 100644 index 00000000000..011192e391b --- /dev/null +++ b/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles-k8s.conf @@ -0,0 +1 @@ +C /etc/nvidia-container-runtime/config.toml - - - - /usr/share/factory/nvidia-container-runtime/nvidia-container-toolkit-config-k8s.toml diff --git a/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles.conf b/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles.conf deleted file mode 100644 index 727c0c95ccf..00000000000 --- a/packages/nvidia-container-toolkit/nvidia-container-toolkit-tmpfiles.conf +++ /dev/null @@ -1 +0,0 @@ -C /etc/nvidia-container-runtime/config.toml - - - - diff --git a/packages/nvidia-container-toolkit/nvidia-container-toolkit.spec b/packages/nvidia-container-toolkit/nvidia-container-toolkit.spec index 8dfd39491b0..915fb48c30f 100644 --- a/packages/nvidia-container-toolkit/nvidia-container-toolkit.spec +++ b/packages/nvidia-container-toolkit/nvidia-container-toolkit.spec @@ -14,10 +14,11 @@ URL: https://%{goimport} Source0: https://%{goimport}/archive/v%{gover}/nvidia-container-toolkit-%{gover}.tar.gz Source1: nvidia-container-toolkit-config-k8s.toml -Source2: nvidia-container-toolkit-tmpfiles.conf +Source2: nvidia-container-toolkit-config-ecs.toml Source3: nvidia-oci-hooks-json Source4: nvidia-gpu-devices.rules -Source5: nvidia-container-toolkit-config-ecs.toml +Source5: nvidia-container-toolkit-tmpfiles-ecs.conf +Source6: nvidia-container-toolkit-tmpfiles-k8s.conf BuildRequires: %{_cross_os}glibc-devel Requires: %{_cross_os}libnvidia-container @@ -57,21 +58,16 @@ install -d %{buildroot}%{_cross_tmpfilesdir} install -d %{buildroot}%{_cross_templatedir} install -d %{buildroot}%{_cross_udevrulesdir} install -d %{buildroot}%{_cross_datadir}/nvidia-container-toolkit -install -d %{buildroot}%{_cross_factorydir}/etc/nvidia-container-runtime +install -d %{buildroot}%{_cross_factorydir}/nvidia-container-runtime install -p -m 0755 nvidia-container-runtime-hook %{buildroot}%{_cross_bindir}/ install -p -m 0755 nvidia-ctk %{buildroot}%{_cross_bindir}/ -install -m 0644 %{S:1} %{S:5} %{buildroot}%{_cross_factorydir}/etc/nvidia-container-runtime/ -install -m 0644 %{S:2} %{buildroot}%{_cross_tmpfilesdir}/nvidia-container-toolkit.conf +install -m 0644 %{S:1} %{S:2} %{buildroot}%{_cross_factorydir}/nvidia-container-runtime/ install -m 0644 %{S:3} %{buildroot}%{_cross_templatedir}/nvidia-oci-hooks-json install -p -m 0644 %{S:4} %{buildroot}%{_cross_udevrulesdir}/90-nvidia-gpu-devices.rules +install -m 0644 %{S:5} %{buildroot}%{_cross_tmpfilesdir}/nvidia-container-toolkit-ecs.conf +install -m 0644 %{S:6} %{buildroot}%{_cross_tmpfilesdir}/nvidia-container-toolkit-k8s.conf ln -s shimpei %{buildroot}%{_cross_bindir}/nvidia-oci -%post ecs -p -posix.link("nvidia-container-toolkit-config-ecs.toml", "%{_cross_factorydir}/etc/nvidia-container-runtime/config.toml") - -%post k8s -p -posix.link("nvidia-container-toolkit-config-k8s.toml", "%{_cross_factorydir}/etc/nvidia-container-runtime/config.toml") - %files %license LICENSE %{_cross_attribution_file} @@ -79,11 +75,12 @@ posix.link("nvidia-container-toolkit-config-k8s.toml", "%{_cross_factorydir}/etc %{_cross_bindir}/nvidia-ctk %{_cross_bindir}/nvidia-oci %{_cross_templatedir}/nvidia-oci-hooks-json -%{_cross_tmpfilesdir}/nvidia-container-toolkit.conf %{_cross_udevrulesdir}/90-nvidia-gpu-devices.rules %files ecs -%{_cross_factorydir}/etc/nvidia-container-runtime/nvidia-container-toolkit-config-ecs.toml +%{_cross_factorydir}/nvidia-container-runtime/nvidia-container-toolkit-config-ecs.toml +%{_cross_tmpfilesdir}/nvidia-container-toolkit-ecs.conf %files k8s -%{_cross_factorydir}/etc/nvidia-container-runtime/nvidia-container-toolkit-config-k8s.toml \ No newline at end of file +%{_cross_factorydir}/nvidia-container-runtime/nvidia-container-toolkit-config-k8s.toml +%{_cross_tmpfilesdir}/nvidia-container-toolkit-k8s.conf