Mellanox / nv_peer_memory

292 stars 60 forks source link

[RFE]: add kernel version dependency in generated RPM #89

Closed kcgthb closed 2 years ago

kcgthb commented 3 years ago

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.

kcgthb commented 3 years ago

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 ?

Micket commented 2 years ago

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)

kcgthb commented 2 years ago

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.

Micket commented 2 years ago

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