[pkg-nvidia-devel] r867 - in /packages/nvidia-graphics-drivers/trunk/debian: changelog control module/debian/control.template.in module/debian/genchanges module/debian/kernel-version module/debian/prep-modules module/debian/rules

rra at users.alioth.debian.org rra at users.alioth.debian.org
Sat May 8 06:50:39 UTC 2010


Author: rra
Date: Sat May  8 06:50:33 2010
New Revision: 867

URL: http://svn.debian.org/wsvn/pkg-nvidia/?sc=1&rev=867
Log:
Overhaul nvidia-kernel-source build system

* Overhaul the build system in nvidia-kernel-source to not require
  module-assistant, be more robust in its derivation of the kernel
  version, and embed the kernel package version in the module package
  version.  Recommend nvidia-kernel-common since it's a dependency of
  the generated module package.  Remove the unnecessary recommendation
  of devscripts.  (Closes: #254859, #279182, #303521, #368669, #473378)
  (Closes: #523879, #534535)

Added:
    packages/nvidia-graphics-drivers/trunk/debian/module/debian/genchanges   (with props)
    packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version   (with props)
    packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules   (with props)
Modified:
    packages/nvidia-graphics-drivers/trunk/debian/changelog
    packages/nvidia-graphics-drivers/trunk/debian/control
    packages/nvidia-graphics-drivers/trunk/debian/module/debian/control.template.in
    packages/nvidia-graphics-drivers/trunk/debian/module/debian/rules   (contents, props changed)

Modified: packages/nvidia-graphics-drivers/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/changelog?rev=867&op=diff
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/changelog (original)
+++ packages/nvidia-graphics-drivers/trunk/debian/changelog Sat May  8 06:50:33 2010
@@ -5,6 +5,13 @@
   * Add an nvidia-kernel-dkms package which builds the kernel module using
     DKMS and hence automatically does the right thing with kernel upgrades
     (provided the module builds).  (Closes: #334848, #528758)
+  * Overhaul the build system in nvidia-kernel-source to not require
+    module-assistant, be more robust in its derivation of the kernel
+    version, and embed the kernel package version in the module package
+    version.  Recommend nvidia-kernel-common since it's a dependency of
+    the generated module package.  Remove the unnecessary recommendation
+    of devscripts.  (Closes: #254859, #279182, #303521, #368669, #473378)
+    (Closes: #523879, #534535)
 
   [ Andreas Beckmann ]
   * do not ship empty directory in module package

Modified: packages/nvidia-graphics-drivers/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/control?rev=867&op=diff
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/control (original)
+++ packages/nvidia-graphics-drivers/trunk/debian/control Sat May  8 06:50:33 2010
@@ -98,18 +98,26 @@
 Package: nvidia-kernel-source
 Section: non-free/kernel
 Architecture: i386 amd64
-Depends: debhelper (>= 7.2.3~), make, quilt (>= 0.46-7~),
- module-assistant, ${misc:Depends}
-Recommends: nvidia-glx (>= ${nvidia:Version}), kernel-package, devscripts
+Depends: ${misc:Depends}, debhelper (>= 7.2.3~), make, quilt (>= 0.46-7~)
+Recommends: module-assistant | kernel-package,
+ nvidia-glx (>= ${nvidia:Version}), nvidia-kernel-common
 Description: NVIDIA binary kernel module source
- This package builds the NVIDIA Xorg binary kernel module
- needed by nvidia-glx.
- The binary drivers provide optimized hardware acceleration of
- OpenGL applications via a direct-rendering X Server.
- AGP, PCIe, SLI, TV-out and flat panel displays are also supported.
- .
- PLEASE read /usr/share/doc/nvidia-kernel-source/README.Debian.gz for building
- information.
+ This package provides the source for the NVIDIA Xorg binary kernel module
+ needed by nvidia-glx in a form suitable for use by module-assistant or
+ kernel-package.
+ .
+ The NVIDIA binary drivers provide optimized hardware acceleration of
+ OpenGL applications via a direct-rendering X Server for graphics cards
+ using NVIDIA chip sets.  AGP, PCIe, SLI, TV-out and flat panel displays
+ are also supported.
+ .
+ This version only supports GeForce 6xxx and higher of the Geforce GPUs
+ plus complimentary Quadros and nforce.  Look at the legacy packages for
+ older cards.
+ .
+ PLEASE read /usr/share/doc/nvidia-kernel-source/README.Debian.gz for
+ building information.  If you want the kernel module to be automatically
+ installed via DKMS, install nvidia-kernel-dkms instead.
 
 Package: nvidia-libvdpau1
 Section: non-free/libs

Modified: packages/nvidia-graphics-drivers/trunk/debian/module/debian/control.template.in
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/control.template.in?rev=867&op=diff
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/module/debian/control.template.in (original)
+++ packages/nvidia-graphics-drivers/trunk/debian/module/debian/control.template.in Sat May  8 06:50:33 2010
@@ -3,14 +3,15 @@
 Priority: optional
 Maintainer: Debian NVIDIA Maintainers <pkg-nvidia-devel at lists.alioth.debian.org>
 Uploaders: Russ Allbery <rra at debian.org>
-Build-Depends: debhelper (>= 7.2.3~), quilt (>= 0.46-7~), module-assistant
+Build-Depends: debhelper (>= 7.2.3~), quilt (>= 0.46-7~)
 Standards-Version: 3.8.4
 Homepage: http://www.nvidia.com/
 
 Package: nvidia-kernel-#KVERS#
 Architecture: i386 amd64
 Provides: nvidia-kernel-#VERSION#
-Depends: nvidia-kernel-common, linux-image-#KVERS#
+Depends: nvidia-kernel-common
+Recommends: linux-image-#KVERS#
 Description: NVIDIA binary kernel module for Linux #KVERS#
  This package provides the non-free NVIDIA binary kernel module built for
  the Debian Linux kernel package.  This kernel module is required by the

Added: packages/nvidia-graphics-drivers/trunk/debian/module/debian/genchanges
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/genchanges?rev=867&op=file
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/module/debian/genchanges (added)
+++ packages/nvidia-graphics-drivers/trunk/debian/module/debian/genchanges Sat May  8 06:50:33 2010
@@ -1,0 +1,21 @@
+#!/bin/sh
+#
+# Generate a changes file for a *.deb package generated via the make-kpkg
+# utility.  debsign is not called automatically since that would require a
+# dependency on devscripts and since the build is often not done by the same
+# user as would do the package signing.
+#
+# KPKG_DEST_DIR, KSRC, KVERS, KMAINT, and KEMAIL are expected to be passed
+# through the environment.
+
+set -e
+
+PREFIX=`grep Package: debian/control.module | cut -d' ' -f 2 | cut -d\# -f 1`
+VERSION="${KVERS}${INT_SUBARCH}"
+MODVERS=`cat debian/VERSION | sed s/:/\+/`
+ARCH=`dpkg --print-architecture`
+
+chfile="${KPKG_DEST_DIR}/${PREFIX}${VERSION}_${MODVERS}_${ARCH}.changes"
+
+dpkg-genchanges -b ${KMAINT:+-m"$KMAINT <$KEMAIL>"} -u"$KPKG_DEST_DIR" \
+    -cdebian/control > "$chfile"

Propchange: packages/nvidia-graphics-drivers/trunk/debian/module/debian/genchanges
------------------------------------------------------------------------------
    svn:executable = *

Added: packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version?rev=867&op=file
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version (added)
+++ packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version Sat May  8 06:50:33 2010
@@ -1,0 +1,24 @@
+#!/usr/bin/perl
+#
+# Extract the kernel version from the kernel version header file.  Takes the
+# kernel source path as its only argument.  If the version header couldn't be
+# found, print nothing and exit quietly.
+
+my $ksrc = shift;
+unless ($ksrc && open (VERSION, "$ksrc/include/linux/version.h")) {
+    exit 0;
+}
+my $found;
+my $line = <VERSION>;
+if ($line =~ /"(.+)"/) {
+    print "$1\n";
+    $found = 1;
+}
+exit 0 if $found;
+unless (open (VERSION, "$ksrc/include/config/kernel.release")) {
+    exit 0;
+}
+if ($line = <VERSION>) {
+    print "$line";
+}
+exit 0;

Propchange: packages/nvidia-graphics-drivers/trunk/debian/module/debian/kernel-version
------------------------------------------------------------------------------
    svn:executable = *

Added: packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules?rev=867&op=file
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules (added)
+++ packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules Sat May  8 06:50:33 2010
@@ -1,0 +1,93 @@
+#! /bin/sh
+#
+# Prepares to build kernel modules.  This script figures out and munges
+# version strings.  The goal is:
+#
+#  * Set the package name to nvidia-kernel-$(KVERS) where $(KVERS) is the
+#    major kernel revision plus the debian subrevision and whatever
+#    architecture string is appropriate if building against the stock Debian
+#    kernels.  $(KVERS) should be identical to the version component contained
+#    in the Debian kernel package names (in other words, the ABI version, not
+#    the package version).
+#
+#  * Make the package recommend linux-image-$(KVERS) as appropriate for the
+#    kernel version that we're building against.  Use recommend rather than
+#    depends since the user may have built their own kernel outside of the
+#    Debian package infrastructure.
+#
+#  * Save the version number of the binary package in debian/VERSION for later
+#    use by dh_gencontrol.  This will be the version number of the source
+#    package followed by a + and the version number of the kernel package that
+#    we're building against.  If the kernel package version contains an epoch,
+#    try to hack our way into doing the right thing by using that epoch number
+#    as our own.  This isn't quite the right thing, but seems reasonably good.
+#
+# This script generates debian/control from debian/control.template using sed.
+# Unfortunately, substvars cannot be used since the name of the package is
+# modified and substvars happens too late.  It also outputs debian/VERSION,
+# containing the version of the binary package.
+
+set -e
+
+if [ "$#" -ne 1 ]; then
+    echo "Usage: $0 <kernel-source-location>"
+    exit 1
+fi
+
+# We can get the kernel version from one of three places.  If KVERS and KDREV
+# are both already set in the environment (which will be the case when invoked
+# by make-kpkg or module-assistant), use them.  Otherwise, if we have a kernel
+# source directory that contains debian/changelog (generated by make-kpkg),
+# parse that file to find the version information.  Finally, if neither works,
+# extract the kernel version from the kernel headers, append INT_SUBARCH to
+# that version if it's available, and assume a kernel package revision of -0
+# if none is provided.
+#
+# Set the variables $nvidia_kvers, which will hold the revision of the kernel,
+# and $nvidia_kdrev, which will hold the version of the kernel package that
+# we're building against.
+
+changelog="$1/debian/changelog"
+if [ -n "$KVERS" ] && [ -n "$KDREV" ]; then
+    nvidia_kvers="${KVERS}${INT_SUBARCH}"
+    nvidia_kdrev="${KDREV}"
+elif [ ! -f "$changelog" ] ; then
+    if [ -n "$KVERS" ] ; then
+        nvidia_kvers="$KVERS"
+    else
+        nvidia_kvers=`perl debian/kernel-version "$1"`
+    fi
+    if [ -z "$KDREV" ] ; then
+        nvidia_kdrev="${nvidia_kvers}-0"
+    else
+        nvidia_kvers="${nvidia_kvers}${INT_SUBARCH}"
+        nvidia_kdrev="${KDREV}"
+    fi
+else
+    if [ -n "$KVERS" ] ; then
+        nvidia_kvers="$KVERS"
+    else
+        nvidia_kvers=`head -1 "$changelog" \
+            | sed -e 's/.*source-\([^ ]*\) (\([^)]*\)).*/\1/'`
+    fi
+    nvidia_kdrev=`head -1 "$changelog" \
+        | sed -e 's/.*source-\([^ ]*\) (\([^)]*\)).*/\2/'`
+fi
+
+# Generate the control file from the template.
+
+sed "s/#KVERS#/${nvidia_kvers}/g" debian/control.template > debian/control
+
+# Now, calcuate the binary package version.  Extract the epoch from the kernel
+# package revision and add it to the beginning of the binary package version
+# if present.  Then, concatenate the source version, '+', and the kernel
+# package revision without the epoch.
+
+nvidia_version=`head -1 debian/changelog | sed -e 's/.*(\([^)]*\)).*/\1/'`
+nvidia_epoch=`echo ${nvidia_kdrev} | sed -n -e 's/^\([0-9]*\):.*/\1/p'`
+nvidia_version="${nvidia_version}+`echo ${nvidia_kdrev} | sed 's/^[0-9]*://'`"
+if [ -n "$nvidia_epoch" ] ; then
+    nvidia_version="${nvidia_epoch}:${nvidia_version}"
+fi
+
+echo "$nvidia_version" > debian/VERSION

Propchange: packages/nvidia-graphics-drivers/trunk/debian/module/debian/prep-modules
------------------------------------------------------------------------------
    svn:executable = *

Modified: packages/nvidia-graphics-drivers/trunk/debian/module/debian/rules
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/module/debian/rules?rev=867&op=diff
==============================================================================
--- packages/nvidia-graphics-drivers/trunk/debian/module/debian/rules (original)
+++ packages/nvidia-graphics-drivers/trunk/debian/module/debian/rules Sat May  8 06:50:33 2010
@@ -1,47 +1,57 @@
 #!/usr/bin/make -f
-
 
 CFLAGS = -Wall -g
 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
+    CFLAGS += -O0
 else
-	CFLAGS += -O2
+    CFLAGS += -O2
 endif
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-	MAKEFLAGS += -j$(NUMJOBS)
+    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+    MAKEFLAGS += -j$(NUMJOBS)
 endif
 
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+# Find kernel build information.
+ifndef KSRC
+    KSRC = /usr/src/linux
+endif
+ifndef KPKG_DEST_DIR
+    KPKG_DEST_DIR = ..
+endif
+KVERS := $(shell perl debian/kernel-version $(KSRC))
+export KSRC 
+export KVERS
+export KPKG_DEST_DIR
 
-
-# Prefix of the target package name
-PACKAGE		= nvidia-kernel
-
-include /usr/share/modass/include/generic.make
-include /usr/share/modass/include/common-rules.make
-
-configure:
-	sed 's/#KVERS#/$(KVERS)/g' debian/control.template > debian/control
-	sed 's/#KVERS#/$(KVERS)/g' debian/install.template > debian/install
-
-binary-modules: configure
-	dh_testroot
-	dh_quilt_patch
-
-	dh_prep
-
+configure: configure-stamp
+configure-stamp:
+	@if [ x"$(KVERS)" = x ] ; then \
+	    echo 'No version in $(KSRC)/include/linux/version.h' >&2; \
+	    exit 1; \
+	fi
 ifneq (,$(wildcard makefile))
-	@echo "ERROR: unclean build directory from older version found, please clean first:"
-	@echo "    module-assistant clean nvidia"
+	@echo "ERROR: unclean build directory from older version found"
+	@echo "   Please run: module-assistant clean nvidia"
 	@exit 1
 endif
+	sh debian/prep-modules $(KSRC)
+	sed 's/#KVERS#/$(KVERS)/g' debian/install.template > debian/install
+	touch $@
 
-	# Build the modules
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep:
+build-stamp: configure-stamp
+	dh_prep
+	dh_quilt_patch
 	$(MAKE) -C . LINUXDIR=$(KSRC) KVERREL=$(KVERS)
+	touch $@
 
-	# Install the modules
+binary: binary-arch binary-indep
+binary-indep:
+binary-arch: build-stamp
+	dh_testdir
+	dh_testroot
 	dh_installdirs
 	dh_install
 	dh_installdocs $(wildcard debian/changelog.nvidia-kernel-source*)
@@ -52,43 +62,47 @@
 	dh_compress
 	dh_fixperms
 	dh_installdeb
-	dh_gencontrol -- -v$(VERSION)
+	dh_gencontrol -- -v`cat debian/VERSION`
 	dh_md5sums
-	dh_builddeb  --destdir=$(KPKG_DEST_DIR)
-	dh_prep
+	dh_builddeb --destdir=$(KPKG_DEST_DIR)
 
 clean:
 	test -f debian/control || cp debian/control.template debian/control
 	dh_testdir
 	dh_testroot
-	rm -f build-stamp configure-stamp
-
 	$(MAKE) -C . -f Makefile SYSSRC=$(KSRC) $(KPKG_EXTRAV_ARG) clean
-        
-	dh_quilt_unpatch
-	dh_clean
-
-	rm -f debian/install
-	rm -f debian/control
-
-
-binary_modules: binary-modules	
-	   
+	dh_quilt_unpatch || quilt --quiltrc /dev/null pop -af
+	dh_clean configure-stamp build-stamp debian/control debian/install
 
 # The kdist_configure target is called by make-kpkg modules_config. It
-# should configure the module so it is ready for compilation (mostly
-# useful for calling configure)
-kdist_config kdist_configure:
-	$(MAKE) $(MFLAGS) -f debian/rules configure
+# should configure the module so it is ready for compilation (mostly useful
+# for calling configure).
+kdist_configure: configure-stamp
 
-# the kdist_clean target is called by make-kpkg modules_clean. It is
-# responsible for cleaning up any changes that have been made by the
-# other kdist_commands (except for the .deb files created).
+# The kdist_image target is called by make-kpkg modules_image.  It is
+# responsible for building the module, but doesn't generate a *.changes
+# file.
+kdist_image: build-stamp
+	$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
+	$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
+
+# The kdist target is called by make-kpkg modules.  It is responsible for
+# building the module and a *.changes file.  Normally it should also sign
+# the *.changes file, but we don't do that to avoid a dependency on
+# devscripts.
+kdist: build-stamp
+	$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
+	KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" sh -v debian/genchanges
+	$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
+
+# The kdist_clean target is called by make-kpkg modules_clean.  It is
+# responsible for cleaning up any changes that have been made by the other
+# kdist_commands (except for the .deb files created).
 kdist_clean:
-	test -f debian/control || cp debian/control.template debian/control
-	dh_testdir
-	$(MAKE) -C . LINUXDIR=$(KSRC) KVERREL=$(KVERS) clean
-	dh_quilt_unpatch || quilt --quiltrc /dev/null pop -af
-	dh_clean
+	$(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
 
-.PHONY: clean binary-modules
+# Legacy targets supported for backward compatibility.
+binary-modules binary_modules: binary-arch
+
+.PHONY: binary binary-arch binary-indep build build-arch build-indep clean
+.PHONY: configure kdist kdist_clean kdist_configure kdist_image

Propchange: packages/nvidia-graphics-drivers/trunk/debian/module/debian/rules
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-nvidia-devel mailing list