Re: [PATCH] xlibmesa-drm-src: divert original kernel modules out of the way

2003-11-08 Thread Michel Dänzer
On Sat, 2003-11-08 at 18:07, Flavio Stanchina wrote:
> I'm experimenting with XFree86 4.3.0-0pre1v4 and I installed the 
> xlibmesa-drm-src package to get OpenGL working on my Radeon. There's one 
> problem though: dpkg complains loudly because the new DRM modules would 
> overwrite the old kernel modules, so either one rebuilds his kernel 
> without old DRM modules or he has to --force installation.

xlibmesa-drm-src no longer exists, the last version was 4.3.0-0pre1v1.
That being said...

> This patch solves the problem by diverting the old modules out of the 
> way, to a directory called /lib/modules/$(KVERS)_diversions. It works 
> for me, but it's really just a quick hack: for example, I preprocess the 
> preinst and postrm scripts with sed instead of m4 because I know nothing 
> about m4 and I couldn't get it to work. I hope the idea is fine though.

I'm afraid not, because the list of modules varies between
architectures. My current drm-trunk-module-src generates dpkg-divert
calls only for the actually available modules.


-- 
Earthling Michel Dänzer  | Debian (powerpc), X and DRI developer
Software libre enthusiast|   http://svcs.affero.net/rm.php?r=daenzer



Re: [PATCH] xlibmesa-drm-src: divert original kernel modules out of the way

2003-11-08 Thread Flavio Stanchina

Flavio Stanchina wrote:

--- xlibmesa-drm.orig/debian/control.m4 2003-07-31 10:24:21.0 +0200
+++ xlibmesa-drm/debian/control.m4  2003-11-06 22:00:46.0 +0100
@@ -1,3 +1,4 @@
+Source: xlibmesa-drm-module-KVERS
 Section: graphics
 Priority: extra
 Maintainer: KMAINT 


P.S. I had to add this "Source:" line to the control file, otherwise the 
package wouldn't build. I'm not sure if it's really needed or if it's me 
who was doing something wrong.


--
Ciao,
Flavio Stanchina
Trento - Italy




[PATCH] xlibmesa-drm-src: divert original kernel modules out of the way

2003-11-08 Thread Flavio Stanchina
I'm experimenting with XFree86 4.3.0-0pre1v4 and I installed the 
xlibmesa-drm-src package to get OpenGL working on my Radeon. There's one 
problem though: dpkg complains loudly because the new DRM modules would 
overwrite the old kernel modules, so either one rebuilds his kernel 
without old DRM modules or he has to --force installation.


This patch solves the problem by diverting the old modules out of the 
way, to a directory called /lib/modules/$(KVERS)_diversions. It works 
for me, but it's really just a quick hack: for example, I preprocess the 
preinst and postrm scripts with sed instead of m4 because I know nothing 
about m4 and I couldn't get it to work. I hope the idea is fine though.


--
Ciao,
Flavio Stanchina
Trento - Italy

diff -urN xlibmesa-drm.orig/debian/changelog.m4 xlibmesa-drm/debian/changelog.m4
--- xlibmesa-drm.orig/debian/changelog.m4   2003-07-31 10:24:21.0 
+0200
+++ xlibmesa-drm/debian/changelog.m42003-11-06 21:53:01.0 +0100
@@ -1,6 +1,7 @@
 xlibmesa-drm-module-KVERS (4.3.0-0pre1v1+KDREV) unstable; urgency=low
 
   * Built from xlibmesa-drm-src.
+- Patched to divert original kernel modules out of the way.
 
  -- KMAINT   DEBDATE
 
diff -urN xlibmesa-drm.orig/debian/control.m4 xlibmesa-drm/debian/control.m4
--- xlibmesa-drm.orig/debian/control.m4 2003-07-31 10:24:21.0 +0200
+++ xlibmesa-drm/debian/control.m4  2003-11-06 22:00:46.0 +0100
@@ -1,3 +1,4 @@
+Source: xlibmesa-drm-module-KVERS
 Section: graphics
 Priority: extra
 Maintainer: KMAINT 
diff -urN xlibmesa-drm.orig/debian/postrm.in xlibmesa-drm/debian/postrm.in
--- xlibmesa-drm.orig/debian/postrm.in  1970-01-01 01:00:00.0 +0100
+++ xlibmesa-drm/debian/postrm.in   2003-11-08 16:57:45.0 +0100
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -e
+
+PACKAGE='[EMAIL PROTECTED]@'
+MODULES='gamma.o i810.o i830.o mga.o r128.o radeon.o tdfx.o'
+MODULE_DIR='/lib/modules/@KVERS@/kernel/drivers/char/drm'
+DIVERT_DIR='/lib/modules/@[EMAIL PROTECTED]'
+
+case "$1" in
+remove)
+   for module in $MODULES; do
+   dpkg-divert --remove --package $PACKAGE \
+   --divert "$DIVERT_DIR/$module" \
+   --rename "$MODULE_DIR/$module"
+   done
+
+   if [ -d "$DIVERT_DIR" ]; then
+   rmdir "$DIVERT_DIR" || true
+   fi
+;;
+
+purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+;;
+
+*)
+echo "postrm called with unknown argument \`$1'" >&2
+exit 0
+;;
+esac
+
+#DEBHELPER#
+
diff -urN xlibmesa-drm.orig/debian/preinst.in xlibmesa-drm/debian/preinst.in
--- xlibmesa-drm.orig/debian/preinst.in 1970-01-01 01:00:00.0 +0100
+++ xlibmesa-drm/debian/preinst.in  2003-11-08 16:57:45.0 +0100
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+
+PACKAGE='[EMAIL PROTECTED]@'
+MODULES='gamma.o i810.o i830.o mga.o r128.o radeon.o tdfx.o'
+MODULE_DIR='/lib/modules/@KVERS@/kernel/drivers/char/drm'
+DIVERT_DIR='/lib/modules/@[EMAIL PROTECTED]'
+
+case "$1" in
+install)
+   if [ ! -d "$DIVERT_DIR" ]; then
+   mkdir -p "$DIVERT_DIR" || true
+   fi
+
+   for module in $MODULES; do
+   dpkg-divert --add --package $PACKAGE \
+   --divert "$DIVERT_DIR/$module" \
+   --rename "$MODULE_DIR/$module"
+   done
+;;
+
+upgrade)
+;;
+
+abort-upgrade)
+;;
+
+*)
+echo "preinst called with unknown argument \`$1'" >&2
+exit 0
+;;
+esac
+
+#DEBHELPER#
+
diff -urN xlibmesa-drm.orig/debian/rules xlibmesa-drm/debian/rules
--- xlibmesa-drm.orig/debian/rules  2003-07-31 10:24:21.0 +0200
+++ xlibmesa-drm/debian/rules   2003-11-08 17:05:01.0 +0100
@@ -10,6 +10,12 @@
 M4 = m4
 M4DEFINES = -DKVERS="$(KVERS)" -DKSRC="$(KSRC)" -DKEMAIL="$(KEMAIL)" 
-DKMAINT="$(KMAINT)" -DKDREV="$(KDREV)" -DDEBDATE="$(shell date -R)"
 
+%: %.m4
+   $(M4) $(M4DEFINES) $< > $@
+
+%: %.in
+   sed -e 's/@KVERS@/$(KVERS)/g' $< > $@
+
 # We are called from make-kpkg through one of the targets kdist,
 # kdist_configure, kdist_changes or kdist_image
 # When called from make-kpkg we have available:
@@ -22,7 +28,7 @@
 MODULE_DIR = debian/tmp/lib/modules/$(KVERS)/kernel/drivers/char/drm/
 
 configure: configure-stamp
-configure-stamp: debian/control debian/changelog
+configure-stamp: debian/control debian/changelog debian/preinst debian/postrm
touch $@
 
 build: build-stamp
@@ -60,11 +66,11 @@
 
 kdist_clean: clean
 
-debian/control: debian/control.m4
-   $(M4) $(M4DEFINES) debian/control.m4 > $@
+debian/control   : debian/control.m4
+debian/changelog : debian/changelog.m4
 
-debian/changelog: debian/changelog.m4
-   $(M4) $(M4DEFINES) debian/changelog.m4 > $@
+debian/preinst   : debian/preinst.in
+debian/postrm: debian/postrm.in
 
 .PHONY: build install configure