Mellanox/nv_peer_memory

[RFE]: add kernel version dependency in generated RPM

kcgthb opened this issue · 4 comments

Hi!

Since the generated RPM contains a kernel-specific module, it would be great if the SPEC file could add a RPM dependency on the kernel version the module has been built for.

That would simplify kernel upgrades and make sure that the nv_peer_mem RPM is updated alongside the kernel.

Or even better, and DKMS version for RPM distributions would work well too.
Maybe something like https://github.com/NVIDIA/gdrcopy/blob/master/packages/gdrcopy.spec ?

I'm a bit of a novice when it comes to specfiles, but at least just addressing the first part should be really simple?

--- nvidia_peer_memory.spec.orig        2021-11-30 12:19:54.280706089 +0100
+++ nvidia_peer_memory.spec     2021-11-30 12:19:36.363734417 +0100
@@ -7,11 +7,12 @@
 Summary: nvidia_peer_memory
 Name: nvidia_peer_memory
 Version: 1.2
-Release: %{_release}
+Release: %{_release}_%(uname -r | sed -r s/\(.*\)\\..*/\\1/ | tr - _)
 License: GPL
 Group: System Environment/Libraries
 Source: %{name}-%{version}.tar.gz
 BuildRequires: gcc kernel-headers
+Requires: kernel = %(uname -r | sed -r s/\(.*\)\\..*/\\1/)
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 URL: http://www.mellanox.com
 Prefix: %{prefix}

(or perhaps cleaner, use kmodtool or something, but this change makes it easier for me to manage my cluster)

Well, now that this project has been deprecated and replaced by the NVIDIA GPU driver-provided nvidia-peermem module, I guess that all of this is pretty much moot.

Closing, then.

Wow I had completely missed this despite messing around with these things a lot recently. Thank you for the link