Heya,
I've attached my patch with a changelog entry which should listen all
changes I've done. And I hope I didn't add any new bugs - the package
works fine here, though.
While working on the fix, I run into the following issue which should be
fixed in my opinion:
Adding the sys.path in the fail-* scripts is a bad bad hack imho - it'll
also mean you have to change the path with every python version - that's
not really what you want. But that's more a problem of upstream than
yours, but I think you want to poke upstream to change it.
Upstream should move the module subdirectories into one namespace and
import from there. It would look this way:
The directory structure:
.../fail2ban/__init__.py (may be empty, that's fine)
.../fail2ban/server/........
.../fail2ban/common/........
.../fail2ban/client/........
and then you do NOT
from server.foo import bar
but instead you do
from fail2ban.server.foo import bar
This will make it portable and will not need this very hackish sys.path
change anymore. I didn't have the time to find all import and patch
them, so I've decided to use the sys.path thing again, as this will work
until you want to move to python2.5 - and that should be enough time to
bring the modules in a more python like form.
If I can help you with anything, please let me know.
Cheers,
Bernd
--
Bernd Zeimetz
<[EMAIL PROTECTED]> <http://bzed.de/>
diff -uwNr fail2ban-0.8.0-sid/debian/changelog fail2ban-0.8.0/debian/changelog
--- fail2ban-0.8.0-sid/debian/changelog 2007-05-07 17:33:43.000000000 +0200
+++ fail2ban-0.8.0/debian/changelog 2007-05-07 18:02:26.000000000 +0200
@@ -1,3 +1,29 @@
+fail2ban (0.8.0-2) unstable; urgency=low
+
+ * debian/control:
+ - removing python-dev and help2man from Build-Depends-Indep as
+ they're not needed, moving python from Build-Depends-Indep
+ to Build-Depends (fixes a lintian error)
+ - adding python-support as Build-Depends instead of
+ python-central, removing X*-Python-Version fields, as they're
+ not needed anymore
+ * debian/pyversion:
+ - adding file to stop python-support from installing the modules
+ for not used python versions
+ * debian/pycompat:
+ - removing file, not needed
+ * debian/rules:
+ - installing files into the appropriate directory instead of
+ /usr/share/fail2ban
+ - making sure all *.pyc files are removed on clean
+ * debian/patches:
+ - adding 20_sys-path-edit.dpatch to change the sys.path in the
+ scripts to point to python-support's place
+ * debian/postrm:
+ - removing /etc/fail2ban instead of /etc/fail2ban.conf
+
+ -- Bernd Zeimetz <[EMAIL PROTECTED]> Mon, 07 May 2007 17:36:28 +0200
+
fail2ban (0.8.0-1) unstable; urgency=low
* New stable upstream release
diff -uwNr fail2ban-0.8.0-sid/debian/control fail2ban-0.8.0/debian/control
--- fail2ban-0.8.0-sid/debian/control 2007-05-07 17:33:43.000000000 +0200
+++ fail2ban-0.8.0/debian/control 2007-05-07 17:31:39.000000000 +0200
@@ -2,16 +2,13 @@
Section: net
Priority: optional
Maintainer: Yaroslav Halchenko <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 5.0.37.2), dpatch
-Build-Depends-Indep: python, python-dev, help2man, python-central (>= 0.5.6)
-XS-Python-Version: current, >= 2.4
+Build-Depends: debhelper (>= 5.0.37.2), dpatch, python, python-support (>= 0.6.3)
Standards-Version: 3.7.2
Package: fail2ban
Architecture: all
Depends: ${python:Depends}, iptables, lsb-base (>=2.0-7)
Suggests: python-gamin, mailx
-XB-Python-Version: ${python:Versions}
Description: bans IPs that cause multiple authentication errors
Monitors log files (e.g. /var/log/auth.log,
/var/log/apache/access.log) and temporarily or persistently bans
diff -uwNr fail2ban-0.8.0-sid/debian/patches/00list fail2ban-0.8.0/debian/patches/00list
--- fail2ban-0.8.0-sid/debian/patches/00list 2007-05-07 17:33:43.000000000 +0200
+++ fail2ban-0.8.0/debian/patches/00list 2007-05-07 17:54:58.000000000 +0200
@@ -1,2 +1,3 @@
00_mail-whois-lines
10_dbts_manpages
+20_sys-path-edit
diff -uwNr fail2ban-0.8.0-sid/debian/patches/20_sys-path-edit.dpatch fail2ban-0.8.0/debian/patches/20_sys-path-edit.dpatch
--- fail2ban-0.8.0-sid/debian/patches/20_sys-path-edit.dpatch 1970-01-01 01:00:00.000000000 +0100
+++ fail2ban-0.8.0/debian/patches/20_sys-path-edit.dpatch 2007-05-07 17:54:34.000000000 +0200
@@ -0,0 +1,43 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20_sys-path-remove.dpatch by Bernd Zeimetz <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
[EMAIL PROTECTED]@
+diff -urNad fail2ban-0.8.0~/fail2ban-client fail2ban-0.8.0/fail2ban-client
+--- fail2ban-0.8.0~/fail2ban-client 2007-05-07 17:52:50.000000000 +0200
++++ fail2ban-0.8.0/fail2ban-client 2007-05-07 17:54:16.000000000 +0200
+@@ -30,7 +30,7 @@
+
+ # Inserts our own modules path first in the list
+ # fix for bug #343821
+-sys.path.insert(1, "/usr/share/fail2ban")
++sys.path.insert(1, "/var/lib/python-support/python2.4/fail2ban")
+
+ # Now we can import our modules
+ from common.version import version
+diff -urNad fail2ban-0.8.0~/fail2ban-regex fail2ban-0.8.0/fail2ban-regex
+--- fail2ban-0.8.0~/fail2ban-regex 2007-05-07 17:52:50.000000000 +0200
++++ fail2ban-0.8.0/fail2ban-regex 2007-05-07 17:54:24.000000000 +0200
+@@ -29,7 +29,7 @@
+
+ # Inserts our own modules path first in the list
+ # fix for bug #343821
+-sys.path.insert(1, "/usr/share/fail2ban")
++sys.path.insert(1, "/var/lib/python-support/python2.4/fail2ban")
+
+ from ConfigParser import SafeConfigParser
+ from ConfigParser import NoOptionError, NoSectionError, MissingSectionHeaderError
+diff -urNad fail2ban-0.8.0~/fail2ban-server fail2ban-0.8.0/fail2ban-server
+--- fail2ban-0.8.0~/fail2ban-server 2007-05-07 17:52:50.000000000 +0200
++++ fail2ban-0.8.0/fail2ban-server 2007-05-07 17:54:32.000000000 +0200
+@@ -29,7 +29,7 @@
+
+ # Inserts our own modules path first in the list
+ # fix for bug #343821
+-sys.path.insert(1, "/usr/share/fail2ban")
++sys.path.insert(1, "/var/lib/python-support/python2.4/fail2ban")
+
+ from common.version import version
+ from server.server import Server
diff -uwNr fail2ban-0.8.0-sid/debian/postrm fail2ban-0.8.0/debian/postrm
--- fail2ban-0.8.0-sid/debian/postrm 2007-05-07 17:33:43.000000000 +0200
+++ fail2ban-0.8.0/debian/postrm 2007-05-07 18:01:40.000000000 +0200
@@ -21,7 +21,7 @@
purge|disappear)
# Remove configuration
- rm -f /etc/fail2ban.conf
+ rm -rf /etc/fail2ban
# Remove logs
rm -f /var/log/fail2ban*
diff -uwNr fail2ban-0.8.0-sid/debian/pycompat fail2ban-0.8.0/debian/pycompat
--- fail2ban-0.8.0-sid/debian/pycompat 2007-05-07 17:33:43.000000000 +0200
+++ fail2ban-0.8.0/debian/pycompat 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-2
diff -uwNr fail2ban-0.8.0-sid/debian/pyversions fail2ban-0.8.0/debian/pyversions
--- fail2ban-0.8.0-sid/debian/pyversions 1970-01-01 01:00:00.000000000 +0100
+++ fail2ban-0.8.0/debian/pyversions 2007-05-07 17:31:39.000000000 +0200
@@ -0,0 +1 @@
+2.4
diff -uwNr fail2ban-0.8.0-sid/debian/rules fail2ban-0.8.0/debian/rules
--- fail2ban-0.8.0-sid/debian/rules 2007-05-07 17:33:43.000000000 +0200
+++ fail2ban-0.8.0/debian/rules 2007-05-07 18:03:01.000000000 +0200
@@ -28,9 +28,10 @@
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
-
+ python setup.py clean
rm -rf build
- dh_clean *.pyc
+ find . -name \*.pyc -exec rm -f {} \;
+ dh_clean
install: build
dh_testdir
@@ -39,7 +40,9 @@
dh_installdirs
# Add here commands to install the package into debian/fail2ban.
- python setup.py install --root=$(DESTDIR) --no-compile
+ python setup.py install --root=$(DESTDIR) \
+ --install-purelib=/usr/share/python-support/fail2ban/fail2ban \
+ --no-compile
#X Evil - must be removed after Debian switches over to 2.4, now
# distutils.setup will override the enterpreter line to /usr/bin/python
install fail2ban-server fail2ban-client $(DESTDIR)/usr/bin
@@ -60,7 +63,7 @@
dh_installdocs
dh_installexamples config/jail.conf
dh_installlogrotate
- dh_pycentral
+ dh_pysupport
dh_installinit -- defaults 99
dh_installman man/*.1
dh_link