deb: DKMS packaging improvements#331
Conversation
|
|
||
| i_prefix=$(CURDIR)/debian/$(userpackage) scripts/onload_install --verbose \ | ||
| --packaged --userfiles --modprobe --modulesloadd --udev \ | ||
| $(if $(wildcard pyproject.toml),,--python-layout=deb) \ |
There was a problem hiding this comment.
How will this help if it is for older releases as this code is only for newer releases by definition? Or did we miss compat for older OSs? Bear in mind the current master branch targets Debian 12+ and Ubuntu 24.04 plus and we'd probably happily bump to Trixie if we found anything that needed it.
There was a problem hiding this comment.
The motivation is to reuse the same debian templates across multiple onload versions without maintaining a separate fork of the templates (as we are still packaging 8.1.3.40 and 9.1.0.24 dkms alongside master). I'm happy to drop them if that's not something upstream wants to carry.
|
|
||
| do-find-top() { | ||
| mytoppath=$(cd "$bin/.." && /bin/pwd) | ||
| mytoppath=$(cd "$bin/.." && /usr/bin/env pwd) |
There was a problem hiding this comment.
For compatibility with what? pwd is a POSIX API command defined to be at /bin/pwd, regardless of what the OS might do in respect to usrmerge. Is there a particular scenario you have in mind where the original path would fail? Otherwise I see no need to invoke an additional tool.
There was a problem hiding this comment.
Dropped. That was a habit from working on NixOS where /bin/pwd doesn't exist, but it's POSIX and onload doesn't need to worry about that.
Add --debian-revision flag to onload_mksrcdeb and onload_mkpackage, and replace the hard-coded "-1" in the changelog template with a This also honours the DEBIAN_REVISION environment variable as a default, and accepts extra arguments via the mksrcdeb_args env var, making it possible to drive the source-package build from external scripts without patching onload_mksrcdeb.sh.
Allow downstream packagers to customise the DKMS build without forking the debian templates: - If debian/Makefile exists, use it instead of the upstream Makefile for both the -source and -dkms packages. - If debian/dkms.append.conf exists, append it to the installed dkms.conf (useful for BUILD_DEPENDS, BUILD_EXCLUSIVE_KERNEL, etc.). - If debian/patches/series exists, apply the quilt series into the DKMS source tree at package-build time. - Pass --udev to onload_install so udev rules are shipped in the -user package.
Let debhelper's dh_dkms generate proper maintainer scripts instead of hand-rolling dkms add/build/install calls: - Add dh-sequence-dkms | dh-dkms | dkms to Build-Depends (the three-way alternative covers Ubuntu 24.04, 22.04, and 20.04). - Call dh_dkms in binary-indep to produce dkms-aware postinst/prerm. - Symlink dkms.conf for releases that ship it under scripts/onload_misc/ rather than the source root (onload 8.x). - Add libcap-dev as a runtime dependency of the -dkms package, since the DKMS build requires it.
Ensure DKMS-built modules are actually used at boot: - Install an initramfs-tools hook that copies DKMS-built sfc and xilinx_efct modules into the initramfs, replacing any in-tree copies so the DKMS versions take priority. - Ship a modules-load.d snippet so onload kernel modules are loaded automatically on boot. - Declare a dpkg trigger on xilinx-efct-dkms so that onload-dkms is rebuilt whenever the efct driver is updated. - Rework postinst to handle both configure and triggered cases, with a forced initramfs update after trigger-driven rebuilds. - Add dh_installinitramfs call in rules.
Guard the pybuild build/install calls and PYBUILD_SYSTEM export behind a pyproject.toml existence check, so the same debian templates work for both older releases (which lack pyproject.toml) and v9.2+ (which ship one). Without this, building v9.1 or earlier with these templates fails with 'Source does not appear to be a Python project'.
Releases up to v9.1 ship a setup.py and rely on onload_install's --python-layout=deb flag to place Python modules under /usr/lib/python3/dist-packages/ (the Debian convention). The previous pybuild commit removed this flag because v9.2 handles Python packaging via pybuild, but that left older releases installing to /usr/local/ instead. Use the same pyproject.toml existence check to restore the flag when pybuild is not in use.
50289c2 to
8a031c3
Compare
I've been packaging onload as .deb for internal use (Ubuntu 20.04 through 24.04) and ran into a few issues with the current debian templates that this series tries to address.
Problems I hit:
The commits are split roughly by feature:
env pwdportability fix (minor, separate concern)--debian-revision/DEBIAN_REVISIONdebian/Makefile,debian/dkms.append.conf, anddebian/patchesapplied into the DKMS source tree. dkms.append.conf lets downstream extend dkms.conf at build time without patching upstream (e.g. declaring BUILD_DEPENDS on out-of-tree drivers like xilinx-efct, or setting BUILD_EXCLUSIVE_KERNEL).--python-layout=debfor older releases that still use setup.py.Tested with onload 9.1.0.24 on Ubuntu 24.04. All five packages built successfully.
Ubuntu 26.04 support: The initramfs hook targets initramfs-tools (24.04 and earlier). Ubuntu 26.04 defaults to dracut, which handles DKMS module priority natively via updates/dkms/, so a dracut module may not be needed.