[med-svn] r1596 - trunk/community/infrastructure/scripts
tille at alioth.debian.org
tille at alioth.debian.org
Sat Mar 15 06:52:10 UTC 2008
Author: tille
Date: 2008-03-15 06:52:09 +0000 (Sat, 15 Mar 2008)
New Revision: 1596
Modified:
trunk/community/infrastructure/scripts/cddtasktools.py
Log:
Enable parsing bz2 files to save some time behind slow connections.
Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-14 14:07:40 UTC (rev 1595)
+++ trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-15 06:52:09 UTC (rev 1596)
@@ -18,6 +18,7 @@
import urllib
import StringIO
import gzip
+import bz2
import re
from debian_bundle import deb822
@@ -33,7 +34,10 @@
HTMLBASE = "/var/lib/gforge/chroot/home/groups"
KEYSTOIGNORE = ( 'Architecture', 'Avoid', 'Ignore', 'Leaf', 'NeedConfig', 'Note', 'Section' )
GLOBALCACHE = "/var/cache/cdd/"
+DDTPURL = "http://ddtp.debian.net/debian/dists/sid/main/i18n/Translation-"
+COMPRESSIONEXTENSION='bz2'
+
def InitTasksFiles(cddname):
# Obtain tasks files from SVN of a CDD
# cddname can be: debian-med, debian-edu, debian-science
@@ -442,9 +446,9 @@
def __init__(self, dist=None, components=(), source=None, arch=None):
- self.source = 'Packages.gz'
+ self.source = 'Packages.'+COMPRESSIONEXTENSION
if source != None:
- self.source = 'Sources.gz'
+ self.source = 'Sources.'+COMPRESSIONEXTENSION
self.binary = 'source'
if source == None:
if arch == None:
@@ -489,10 +493,14 @@
# f = urllib.urlopen(BASEURL+'/dists/'+self.dist+'/'+component+'/'+self.binary+'/'+self.source)
cachefile = cachedir+'/'+self.dist+'_'+component+'_'+self.binary+'_'+self.source
(file,info) = urllib.urlretrieve(BASEURL+'/dists/'+self.dist+'/'+component+'/'+self.binary+'/'+self.source, cachefile)
- f = open(file)
- compresseddata = f.read()
- compressedstream = StringIO.StringIO(compresseddata)
- g = gzip.GzipFile(fileobj=compressedstream)
+ if COMPRESSIONEXTENSION == 'gz':
+ g = gzip.GzipFile(file)
+ elif COMPRESSIONEXTENSION == 'bz2':
+ g = bz2.BZ2File(file)
+ else:
+ print >>stderr, "Unknown compression extension " + COMPRESSIONEXTENSION
+ return exit(-1)
+
for stanza in deb822.Sources.iter_paragraphs(g, shared_storage=False):
deppkg = DependantPackage()
(deppkg.pkgShortDesc, deppkg.pkgLongDesc) = SplitDescription(stanza['description'])
@@ -508,7 +516,7 @@
stanza['maintainer'])
deppkg.filename = BASEURL+stanza['filename']
self.packages[component][stanza['package']] = deppkg
- f.close()
+ g.close()
available = Available()
More information about the debian-med-commit
mailing list