severity 517698 important
thanks
Hello,
I'm setting the severity to important, since this bug makes it
unnecessarily painful to have two kernels installed; one could argue it
should be serious, since the undeclared conflicts are a policy
violation. Anyway, I'm attaching a patch. :)
The userspace parts really should be separate from the -modules package,
so that you can have modules for multiple different kernel versions
installed. In order to ensure the correct version of the userspace
package (which I have named xtables-addons-common in this patch) is
installed for a particular set of modules, the -common package provides
"xtables-addons-common-{source:Upstream-Version}", and the -modules
packages depend on that virtual package.
Older versions of xtables-addons-modules-* will need to be removed
before the new xtables-addons-common package is installed, but future
upgrades will work automatically. (And, as long as the kernel version
hasn't changed since the last xtables-addons-modules-* package was
built, "m-a a-i xtables-addons-source" will do the right thing without
any user intervention.) You could fix this by making
xtables-addons-common provide, conflict, and replace
xtables-addons-modules, and rename the virtual package...but since this
hasn't been in any actual release, I didn't think that would be worth
it. It might warrant a note in NEWS.Debian, though.
The patch is in two separate parts, in case you want to put the upstream
changes (which allow for easily building the userspace and kernel bits
separately) into a separate patch.
Notes on the packaging changes:
- The -source package only gets the mconfig file and the extensions/
directory now, instead of the full source.
- The -source package no longer depends on pkg-config or
autotools-dev, since it gets a copy of the generated GNUmakefile.
Since this doesn't depend on any configure options or userspace
libraries or headers, I think this is safe to do.
- I added a dh_installmodules call and removed your
modules.postinst.in script, since dh_installmodules adds depmod
commands for you.
Thanks for considering the patch.
--
John Wright <[email protected]>
>From 45355e3d36dfc662c89e117b66d85efe0e3f76b6 Mon Sep 17 00:00:00 2001
From: John Wright <[email protected]>
Date: Tue, 21 Apr 2009 20:24:22 -0600
Subject: [PATCH 1/2] Changes to upstream Makefiles to uncouple userspace from kernel build
* Don't build or install modules by default
This way, "make" and "make install" only build and install the userspace
pieces. For the modules,
# Build the modules
make -C extensions modules
# Install the modules
make -C extensions modules_install
* Don't set the kbuilddir variable in extensions/GNUMakefile
We'll specify it explicitly in the binary-modules target.
* Don't run depmod -a in the Makefile
---
Makefile.am | 1 -
extensions/GNUmakefile.in | 5 ++---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index f03174a..107a473 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,6 @@ extensions/%:
${MAKE} ${AM_MAKEFLAGS} -C $(@D) $(@F)
install-exec-local:
- depmod -a || :;
config.status: extensions/GNUmakefile.in
diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in
index 83e3bc1..4e954a0 100644
--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -17,7 +17,6 @@ exec_prefix := @exec_prefix@
libdir := @libdir@
libexecdir := @libexecdir@
xtlibdir := @xtlibdir@
-kbuilddir := @kbuilddir@
CC := @CC@
CCLD := ${CC}
@@ -65,7 +64,7 @@ subdirs_list := $(filter %/,${obj-m})
.PHONY: all install clean distclean FORCE
-all: subdirs modules user matches.man targets.man
+all: subdirs user matches.man targets.man
subdirs:
@for i in ${subdirs_list}; do ${MAKE} -C $$i; done;
@@ -75,7 +74,7 @@ subdirs-install:
user: ${targets}
-install: modules_install subdirs-install ${targets_install}
+install: subdirs-install ${targets_install}
@mkdir -p "${DESTDIR}${xtlibdir}";
install -pm0755 ${targets_install} "${DESTDIR}${xtlibdir}/";
--
1.5.6.5
>From 3d4a5ebe166b38b96737776865cbf26566d457e7 Mon Sep 17 00:00:00 2001
From: John Wright <[email protected]>
Date: Tue, 21 Apr 2009 21:12:12 -0600
Subject: [PATCH 2/2] Add an xtables-addons-common binary package
This package contains all the the userspace libraries, rather than
building them into the "module" package and thus preventing modules for
multiple kernels from being installed at once.
---
debian/control | 18 ++++++++-
debian/control.modules.in | 1 +
debian/postinst.modules.in | 10 -----
debian/rules | 83 +++++++++++++++++++++++---------------------
4 files changed, 60 insertions(+), 52 deletions(-)
delete mode 100644 debian/postinst.modules.in
diff --git a/debian/control b/debian/control
index 3fe2c42..a9d4411 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,8 @@ Maintainer: Pierre Chifflier <[email protected]>
Build-Depends: debhelper (>= 5),
autotools-dev,
bzip2,
+ pkg-config,
+ iptables-dev (>= 1.4.3),
module-assistant
Standards-Version: 3.8.1
Homepage: http://xtables-addons.sourceforge.net/
@@ -14,10 +16,22 @@ Architecture: all
Depends: module-assistant,
debhelper (>= 5),
make,
- bzip2,
- iptables-dev (>= 1.4.3)
+ bzip2
Description: Source for the xtables-addons driver
This package provides the source code for the xtables-addons kernel modules.
The xtables-addons package is also required in order to make use of these
modules. Kernel source or headers are required to compile these modules.
+Package: xtables-addons-common
+Architecture: any
+Depends: ${shlibs:Depends}
+Recommends: xtables-addons-modules
+Provides: xtables-addons-common-${source:Upstream-Version}
+Description: Userspace components of xtables-addons
+ This package provides the userspace libraries for iptables to use extensions
+ in the xtables-addons-modules package.
+ .
+ Note: this package is only useful with a correspdonding xtables-addons-modules
+ package, which you may produce with module-assistant:
+ .
+ module-assistant auto-install xtables-addons-source
diff --git a/debian/control.modules.in b/debian/control.modules.in
index e42883d..743698c 100644
--- a/debian/control.modules.in
+++ b/debian/control.modules.in
@@ -13,6 +13,7 @@ Architecture: any
Provides: xtables-addons-modules
Conflicts: ipset
Replaces: ipset
+Depends: xtables-addons-common-${source:Upstream-Version}
Description: xtables-addons modules for Linux (kernel _KVERS_).
This package contains the set of loadable kernel modules for the
xtables-addons project.
diff --git a/debian/postinst.modules.in b/debian/postinst.modules.in
deleted file mode 100644
index cf09a6f..0000000
--- a/debian/postinst.modules.in
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-set -e
-
-depmod -ae ||:
-
-#DEBHELPER#
-
-exit 0
-
diff --git a/debian/rules b/debian/rules
index d5b09ad..1098d17 100755
--- a/debian/rules
+++ b/debian/rules
@@ -33,6 +33,9 @@ psource:=xtables-addons-source
# The short upstream name, used for the module source directory
sname:=xtables-addons
+# The name of the common userspace package
+cname:=xtables-addons-common
+
### KERNEL SETUP
### Setup the stuff needed for making kernel module packages
### taken from /usr/share/kernel-package/sample.module.rules
@@ -69,25 +72,21 @@ kdist_config: prep-deb-files
# the kdist_clean target is called by make-kpkg modules_clean and from
# kdist* rules. 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: clean
- $(MAKE) $(MFLAGS) -f debian/rules clean
-# rm -f driver/*.o driver/*.ko
-#
+kdist_clean:
+ dh_testdir
+ $(MAKE) -C extensions clean
+ dh_clean
### end KERNEL SETUP
config.status: configure
dh_testdir
-# # Add here commands to configure the package.
-#ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-# cp -f /usr/share/misc/config.sub config.sub
-#endif
-#ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-# cp -f /usr/share/misc/config.guess config.guess
-#endif
-# ./configure $(CROSS) --prefix=/usr \
-# --mandir=\$${prefix}/share/man \
-# --infodir=\$${prefix}/share/info \
-# --libexecdir=/lib
+ # Add here commands to configure the package.
+ cp -f /usr/share/misc/config.sub config.sub
+ cp -f /usr/share/misc/config.guess config.guess
+ ./configure $(CROSS) --prefix=/usr \
+ --mandir=\$${prefix}/share/man \
+ --infodir=\$${prefix}/share/info \
+ --libexecdir=/lib
##CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
@@ -96,8 +95,7 @@ build-arch-stamp:
dh_testdir
# # Add here command to compile/build the package.
-# $(MAKE) kbuilddir=/lib/modules/$(KERNEL_VERSION)-$(ARCH)/build
-# $(MAKE) xtables-addons.8
+ $(MAKE)
touch $@
@@ -112,21 +110,13 @@ binary-modules:
dh_installdirs lib/modules/$(KVERS)/kernel/net/netfilter
dh_installdirs lib/modules/$(KVERS)/kernel/net/netfilter/ipset
- ./configure --prefix=/usr \
- --mandir=\$${prefix}/share/man \
- --infodir=\$${prefix}/share/info \
- --libexecdir=/lib \
- --with-kbuild=$(KSRC)
-
# Build the module
- $(MAKE)
- #$(MAKE) -C extensions KERNEL_DIR=$(KSRC) KVERS=$(KVERS)
- #$(MAKE) -C extensions/ipset KERNEL_DIR=$(KSRC) KVERS=$(KVERS)
+ $(MAKE) -C extensions modules kbuilddir=$(KSRC)
# Install the module
- $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
- #cp extensions/*.ko debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel/net/netfilter
- #cp extensions/ipset/*.ko debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel/net/netfilter/ipset
+ $(MAKE) -C extensions modules_install \
+ kbuilddir=$(KSRC) \
+ DESTDIR=$(CURDIR)/debian/$(PKGNAME)
rm -f debian/$(PKGNAME)/lib/modules/2.6.*/modules.*
@@ -134,6 +124,7 @@ binary-modules:
dh_installchangelogs
dh_compress
dh_fixperms
+ dh_installmodules
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
@@ -154,9 +145,8 @@ clean:
rm -f build-arch-stamp build-indep-stamp
# Add here commands to clean up after the build process.
- #[ ! -f Makefile ] || $(MAKE) kbuilddir=/lib/modules/$(KERNEL_VERSION)-$(ARCH)/build distclean
- #rm -f config.sub config.guess
- #rm -f xtables-addons.8 extensions/matches.man extensions/targets.man
+ [ ! -f Makefile ] || $(MAKE) distclean
+ rm -f config.sub config.guess
dh_clean
@@ -167,17 +157,16 @@ install: build
dh_clean -k
dh_installdirs
+ # Install the libraries
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/$(cname)
+
# Create the directories to install the source into
dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian
# Copy only the driver source to the proper location
- for file in *; do \
- case $$file in \
- debian) ;;\
- *-stamp) ;;\
- *) cp -r $$file debian/$(psource)/usr/src/modules/$(sname)/;;\
- esac;\
- done
+ cp -r extensions debian/$(psource)/usr/src/modules/$(sname)/
+ cp mconfig debian/$(psource)/usr/src/modules/$(sname)/
+
# Copy the needed debian/ pieces to the proper location
cp debian/*modules.in* \
debian/$(psource)/usr/src/modules/$(sname)/debian
@@ -225,7 +214,21 @@ binary-indep: build install
# Build architecture-dependent files here.
binary-arch: build install
- # nothing to do here
+ dh_testdir -a
+ dh_testroot -a
+ dh_installchangelogs -a
+ dh_installdocs -a
+ dh_installexamples -a
+ dh_installman -a
+ dh_link -a
+ dh_compress -a
+ dh_fixperms -a
+ dh_installdeb -a
+# dh_makeshlibs -a
+ dh_shlibdeps -a
+ dh_gencontrol -a
+ dh_md5sums -a
+ dh_builddeb -a
binary: binary-indep binary-arch
--
1.5.6.5