Bug#1030227: rtpengine: please use dkms packaging helpers

Andreas Beckmann anbe at debian.org
Wed Feb 1 11:19:40 GMT 2023


Package: rtpengine
Version: 10.5.3.1-1
Severity: serious
Tags: patch

Hi,

src:rtpengine is the only package in the archive the builds a -dkms
package without using the dkms packaging helpers.
Please switch to dh-sequence-dkms instead of using handcrafted code,
a patch doing this is attached.
This also enables the dkms autopkgtest for this package, s.t. building
the kernel module is tested whenever a new kernel version gets uploaded.

Andreas
-------------- next part --------------
diff -Nru rtpengine-10.5.3.3/debian/changelog rtpengine-10.5.3.3/debian/changelog
--- rtpengine-10.5.3.3/debian/changelog	2023-01-31 08:32:14.000000000 +0100
+++ rtpengine-10.5.3.3/debian/changelog	2023-01-31 23:48:05.000000000 +0100
@@ -1,3 +1,10 @@
+rtpengine (10.5.3.3-2) UNRELEASED; urgency=medium
+
+  * Use dh-sequence-dkms instead of manual dkms handling.
+  * Declare Testsuite: autopkgtest-pkg-dkms.
+
+ -- Andreas Beckmann <anbe at debian.org>  Tue, 31 Jan 2023 23:48:05 +0100
+
 rtpengine (10.5.3.3-1) unstable; urgency=medium
 
   * New upstream version 10.5.3.3
diff -Nru rtpengine-10.5.3.3/debian/control rtpengine-10.5.3.3/debian/control
--- rtpengine-10.5.3.3/debian/control	2023-01-31 08:32:14.000000000 +0100
+++ rtpengine-10.5.3.3/debian/control	2023-01-31 23:48:05.000000000 +0100
@@ -10,6 +10,7 @@
 Standards-Version: 4.6.1
 Build-Depends:
  debhelper-compat (= 13),
+ dh-sequence-dkms,
  default-libmysqlclient-dev,
  gperf,
  libavcodec-dev (>= 6:10),
@@ -48,6 +49,7 @@
  python3,
  python3-websockets,
  zlib1g-dev,
+Testsuite: autopkgtest-pkg-dkms
 
 Package: rtpengine-daemon
 Architecture: any
@@ -136,7 +138,6 @@
 Section: kernel
 Architecture: all
 Depends:
- dkms (>= 1.95),
  lsb-release,
  ${misc:Depends},
 Conflicts:
diff -Nru rtpengine-10.5.3.3/debian/dkms.conf.in rtpengine-10.5.3.3/debian/dkms.conf.in
--- rtpengine-10.5.3.3/debian/dkms.conf.in	2023-01-31 08:32:14.000000000 +0100
+++ rtpengine-10.5.3.3/debian/dkms.conf.in	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-PACKAGE_NAME="rtpengine"
-PACKAGE_VERSION="__VERSION__"
-MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"__VERSION__\""
-CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
-AUTOINSTALL=yes
-BUILT_MODULE_NAME[0]="xt_RTPENGINE"
-DEST_MODULE_LOCATION[0]=/extra
diff -Nru rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.dkms rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.dkms
--- rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.dkms	1970-01-01 01:00:00.000000000 +0100
+++ rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.dkms	2023-01-31 23:48:05.000000000 +0100
@@ -0,0 +1,7 @@
+PACKAGE_NAME="rtpengine"
+PACKAGE_VERSION="#MODULE_VERSION#"
+MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build RTPENGINE_VERSION=\"${PACKAGE_VERSION}\""
+CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
+AUTOINSTALL=yes
+BUILT_MODULE_NAME[0]="xt_RTPENGINE"
+DEST_MODULE_LOCATION[0]=/extra
diff -Nru rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.install rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.install
--- rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.install	1970-01-01 01:00:00.000000000 +0100
+++ rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.install	2023-01-31 23:48:05.000000000 +0100
@@ -0,0 +1,3 @@
+kernel-module/Makefile	usr/src/rtpengine-${env:DEB_VERSION_UPSTREAM}
+kernel-module/*.c	usr/src/rtpengine-${env:DEB_VERSION_UPSTREAM}
+kernel-module/*.h	usr/src/rtpengine-${env:DEB_VERSION_UPSTREAM}
diff -Nru rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.postinst rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.postinst
--- rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.postinst	2023-01-31 08:32:14.000000000 +0100
+++ rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.postinst	2023-01-31 23:48:05.000000000 +0100
@@ -2,45 +2,21 @@
 
 set -e
 
-package=rtpengine-kernel-dkms
-name=rtpengine
-
-version=$(dpkg-query -W -f="\${Version}" "$package" \
-		|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
-
-
 if [ -x "$(command -v ngcp-virt-identify)" ]; then
 	if ngcp-virt-identify --type container; then
 		VIRT="yes"
 	fi
 fi
 
+#DEBHELPER#
+
 if [ "$VIRT" = "yes" ]; then
 	echo "Container environment detected. Skip dkms"
 else
-	isadded=$(dkms status -m "$name" -v "$version")
-	if [ -z "${isadded}" ] ; then
-		dkms add -m "$name" -v "$version"
-	fi
-
 	if [ "$1" = 'configure' ] ; then
-                KERNELS=$(ls /lib/modules/ 2>/dev/null || true)
-                for kernel in $KERNELS; do
-                        if [ ! -r "/lib/modules/$kernel/build" ]; then
-                                # cannot build modules for this kernel
-                                continue
-                        fi
-		        ( dkms build -m "$name" -v "$version" -k "$kernel" && dkms install -m "$name" -v "$version" -k "$kernel" ) || true
-                done
-
 		# try to start the daemon
 		if [ -x /etc/init.d/rtpengine-daemon ] ; then
 			invoke-rc.d rtpengine-daemon restart || true
 		fi
 	fi
 fi
-
-#DEBHELPER#
-
-exit 0
-
diff -Nru rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.prerm rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.prerm
--- rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.prerm	2023-01-31 08:32:14.000000000 +0100
+++ rtpengine-10.5.3.3/debian/rtpengine-kernel-dkms.prerm	2023-01-31 23:48:05.000000000 +0100
@@ -2,29 +2,10 @@
 
 set -e
 
-package=rtpengine-kernel-dkms
-name=rtpengine
 modname=xt_RTPENGINE
 
-version=$(dpkg-query -W -f="\${Version}" "$package" \
-        |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n")
-
-if [ -x "$(command -v ngcp-virt-identify)" ]; then
-	if ngcp-virt-identify --type container; then
-		VIRT="yes"
-	fi
-fi
-
 # make sure it's not running
 service rtpengine-daemon stop || true
 rmmod "$modname" 2>/dev/null || true
 
-if [ "$VIRT" = "yes" ]; then
-	echo "Container environment detected. Skip dkms"
-else
-	dkms remove -m "$name" -v "$version" --all || true
-fi
-
 #DEBHELPER#
-
-exit 0
diff -Nru rtpengine-10.5.3.3/debian/rules rtpengine-10.5.3.3/debian/rules
--- rtpengine-10.5.3.3/debian/rules	2023-01-31 08:32:14.000000000 +0100
+++ rtpengine-10.5.3.3/debian/rules	2023-01-31 23:48:05.000000000 +0100
@@ -6,15 +6,7 @@
 
 include /usr/share/dpkg/pkg-info.mk
 
-## kernel package specific stuff
-# Name of the dkms package
-pdkms:=rtpengine-kernel-dkms
-# short upstream name, used for module source directory
-sname:=rtpengine
-# Source version
-sversion:=$(DEB_VERSION_UPSTREAM)
-## end of kernel package specific stuff
-
+export DEB_VERSION_UPSTREAM
 export XTABLES_DIR := $(shell pkg-config xtables --variable=xtlibdir || echo /lib/xtables)
 
 ifneq (,$(filter $(DEB_BUILD_PROFILES),pkg.rtpengine.no-transcoding))
@@ -31,18 +23,12 @@
 	dh $@
 
 execute_before_dh_auto_install-indep:
-	# Create the directories to install the source into
-	dh_installdirs -p$(pdkms)    usr/src/$(sname)-$(sversion)
-
-	# Copy only the driver source to the proper locations
-	cd kernel-module && cp Makefile *.c *.h ../debian/$(pdkms)/usr/src/$(sname)-$(sversion)
-
-	# Prepare dkms.conf from the dkms.conf.in template
-	sed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf
-
 	# markdown README
 	markdown README.md | gzip -9n > debian/README.html.gz
 	gzip -9n < README.md > debian/README.md.gz
 
 execute_after_dh_installsystemd:
 	dh_installsystemd -prtpengine-recording-daemon --name=rtpengine-recording-nfs-mount
+
+override_dh_dkms:
+	dh_dkms -V $(DEB_VERSION_UPSTREAM)


More information about the Pkg-voip-maintainers mailing list