[Pkg-dkms-maint] Bug#568589: dkms: adding dh_dkms option to insert module version in dkms.conf

Frédéric Brière fbriere at fbriere.net
Sat Feb 6 00:25:21 UTC 2010


Package: dkms
Version: 2.1.1.1-1
Severity: wishlist
Tags: patch

Here's a patch that adds a -V option to dh_dkms, so that one no longer
has to edit dkms.conf after each upstream release.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.29.6 (SMP w/1 CPU core)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dkms depends on:
ii  build-essential              11.4        Informational list of build-essent
ii  dpkg-dev                     1.15.5.6    Debian package development tools
ii  gcc                          4:4.4.2-3   The GNU C compiler
ii  make                         3.81-7      An utility for Directing compilati
ii  module-init-tools            3.12~pre1-1 tools for managing Linux kernel mo

Versions of packages dkms recommends:
ii  fakeroot           1.14.4-1              Gives a fake root environment
ii  linux-headers-2.6- 2.6.32+23             Header files for Linux 2.6-686
ii  linux-headers-2.6. 2.6.29.6-10.00.Custom Header files related to Linux kern
ii  linux-headers-2.6. 2.6.31-2              Header files for Linux 2.6.31-1-68
ii  linux-headers-2.6. 2.6.32-5              Header files for Linux 2.6.32-trun
ii  linux-image-2.6.26 2.6.26.8-10.00.Custom Linux kernel binary image for vers
ii  linux-image-2.6.29 2.6.29.6-10.00.Custom Linux kernel binary image for vers
ii  lsb-release        3.2-23                Linux Standard Base version report
ii  menu               2.1.43                generates programs menu for all me
ii  patch              2.6-2                 Apply a diff file to an original
ii  sudo               1.7.2p1-1             Provide limited super user privile

dkms suggests no packages.

-- no debconf information
-------------- next part --------------
--- /usr/bin/dh_dkms	2010-01-27 04:05:35.000000000 -0500
+++ dh_dkms	2010-02-05 19:21:03.000000000 -0500
@@ -11,7 +11,7 @@
 
 =head1 SYNOPSIS
 
-B<dh_dkms> [S<I<debhelper options>>] [S<B<-l>>] [S<B<--> I<file>>]
+B<dh_dkms> [S<I<debhelper options>>] [S<B<-l>>] [S<B<-V>[I<version>]>] [S<B<--> I<file>>]
 
 =head1 DESCRIPTION
 
@@ -48,6 +48,11 @@
 
 Add code to also support DKMS versions < 2.1.0.0.
 
+=item B<-V>, B<-V>I<version>
+
+Replace all occurences of C<#MODULE_VERSION#> in the F<dkms.conf> file with
+I<version>, which defaults to the upstream version of this package.
+
 =item B<--> I<file>
 
 Don't look for debian/I<package>.dkms or debian/dkms, but install I<file> as dkms.conf.
@@ -124,6 +129,24 @@
 		addsubstvar($package, "misc:Depends", "dkms", ">= 2.1.0.0");
 	}
 
+	if ($dh{V_FLAG_SET}) {
+		$package_version = $dh{V_FLAG};
+		if ($package_version eq '') {
+			# Call isnative because it sets $dh{VERSION}
+			# as a side effect.
+			isnative($package);
+			$package_version = $dh{VERSION};
+			# Remove the Debian revision
+			$package_version =~ s/-[^-]+$//;
+		}
+
+		my $old_name = $name;
+		my $ext = pkgext($package);
+		$name = "debian/${ext}dkms.debhelper";
+		doit("cp", "-a", $old_name, $name);
+		doit("sed", "-i", "s/#MODULE_VERSION#/$package_version/g", $name);
+	}
+
 	autoscript($package, "prerm", "prerm-dkms",
 	    "s/#MODULE_NAME#/$package_name/;s/#MODULE_VERSION#/$package_version/");
 	autoscript($package, "postinst", "postinst-dkms",


More information about the Pkg-dkms-maint mailing list