summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-07-26 13:28:10 +0200
committerSean Finney <seanius@debian.org>2009-07-26 13:28:10 +0200
commit214268f80d89d279be7fb046f7fa3bde048af793 (patch)
tree1c341e3bc784ba31c1769e7541caafe12d4a6998
parent58c3470acf8a2a4709160f14540b1dd56e6f61cd (diff)
downloadpatch-tracker-214268f80d89d279be7fb046f7fa3bde048af793.tar.gz
changes to work with >> lenny versions of reprepro and python-debian
reprepro now seems to default to passching the lists files uncompressed to the hook, so we deal with that gracefully either way. python-debian seems to have slightly changed how it handles some multiline fields due to starting to use the built-in apt_pkg module, see the comments in Conf.py which should point to the bug.
-rwxr-xr-xpatchtracker/Conf.py8
-rwxr-xr-xreprepro/conf/diffsonly.py16
2 files changed, 23 insertions, 1 deletions
diff --git a/patchtracker/Conf.py b/patchtracker/Conf.py
index df6eecd..beb2b71 100755
--- a/patchtracker/Conf.py
+++ b/patchtracker/Conf.py
@@ -8,6 +8,14 @@ root_url = ''
database = 'pt.db'
sqlschema = 'db.sql'
+use_apt_pkg = None
+""" should we instruct (>= v0.1.12) python-debian to use the faster
+ apt_pkg module for parsing? apt_pkg currently doesn't work on
+ some multilined values (see #538376) so if it's available we have
+ to explicitly disable it for now. To do so set this variable
+ to False instead of None
+"""
+
try:
from localconfig import *
except ImportError:
diff --git a/reprepro/conf/diffsonly.py b/reprepro/conf/diffsonly.py
index e40e1aa..286d367 100755
--- a/reprepro/conf/diffsonly.py
+++ b/reprepro/conf/diffsonly.py
@@ -5,6 +5,8 @@ from gzip import GzipFile
from fnmatch import fnmatch
import sys
+import patchtracker.Conf as Conf
+
if __name__ == '__main__':
try:
(prog,src,dst) = sys.argv
@@ -13,7 +15,19 @@ if __name__ == '__main__':
sys.exit(1)
inf = sys.argv[1]
- slist = deb822.Sources.iter_paragraphs(GzipFile(inf))
+ fh = None
+ slist = []
+ if fnmatch(inf, "*.gz"):
+ fh = GzipFile(inf)
+ else:
+ fh = file(inf)
+
+ # temp workaround for #538376
+ if Conf.use_apt_pkg is not None:
+ slist = deb822.Sources.iter_paragraphs(fh, use_apt_pkg=Conf.use_apt_pkg)
+ else:
+ slist = deb822.Sources.iter_paragraphs(fh)
+
outf = file(sys.argv[2], "w")
print "filtering %s for .diff.gz/.dsc files..."%(inf)
for ent in slist: