[Collab-qa-commits] r1536 - udd/udd
Lucas Nussbaum
lucas at alioth.debian.org
Fri Jul 24 11:00:36 UTC 2009
Author: lucas
Date: 2009-07-24 11:00:34 +0000 (Fri, 24 Jul 2009)
New Revision: 1536
Modified:
udd/udd/packages_gatherer.py
udd/udd/sources_gatherer.py
udd/udd/upload_history_gatherer.py
Log:
use lists instead of tuples (thanks zack)
Modified: udd/udd/packages_gatherer.py
===================================================================
--- udd/udd/packages_gatherer.py 2009-07-24 10:59:45 UTC (rev 1535)
+++ udd/udd/packages_gatherer.py 2009-07-24 11:00:34 UTC (rev 1536)
@@ -79,7 +79,7 @@
Sequence has to have an iterator interface, that yields a line every time
it is called.The Format of the sequence is expected to be that of a
debian packages file."""
- pkgs = ()
+ pkgs = []
query = """EXECUTE package_insert
(%(Package)s, %(Version)s, %(Architecture)s, %(Maintainer)s, %(maintainer_name)s, %(maintainer_email)s,
%(Description)s, %(Long_Description)s, %(Source)s, %(Source_Version)s, %(Essential)s,
@@ -126,7 +126,7 @@
d['Source'] = split[0]
d['Source_Version'] = split[1].strip("()")
- pkgs += (d,)
+ pkgs.append(d)
d['maintainer_name'], d['maintainer_email'] = email.Utils.parseaddr(d['Maintainer'])
try:
Modified: udd/udd/sources_gatherer.py
===================================================================
--- udd/udd/sources_gatherer.py 2009-07-24 10:59:45 UTC (rev 1535)
+++ udd/udd/sources_gatherer.py 2009-07-24 11:00:34 UTC (rev 1536)
@@ -92,7 +92,7 @@
is called.The Format of the file is expected to be that of a debian
source file."""
cur = self.cursor()
- pkgs = ()
+ pkgs = []
query = """EXECUTE source_insert
(%(Package)s, %(Version)s, %(Maintainer)s,
%(maintainer_name)s, %(maintainer_email)s, %(Format)s, %(Files)s,
@@ -104,11 +104,11 @@
%(Original-Maintainer)s, %(Dm-Upload-Allowed)s)"""
query_uploaders = """EXECUTE uploader_insert (%(Package)s, %(Version)s,
%(Uploader)s, %(Name)s, %(Email)s)"""
- uploaders = ()
+ uploaders = []
for control in debian_bundle.deb822.Packages.iter_paragraphs(file):
d = self.build_dict(control)
d['maintainer_name'], d['maintainer_email'] = email.Utils.parseaddr(d['Maintainer'])
- pkgs += (d,)
+ pkgs.append(d)
if d['Uploaders']:
for uploader in email.Utils.getaddresses([d['Uploaders']]):
@@ -118,7 +118,7 @@
ud['Uploader'] = email.Utils.formataddr(uploader)
ud['Name'] = uploader[0]
ud['Email'] = uploader[1]
- uploaders += (ud,)
+ uploaders.append(ud)
cur.executemany(query, pkgs)
cur.executemany(query_uploaders, uploaders)
Modified: udd/udd/upload_history_gatherer.py
===================================================================
--- udd/udd/upload_history_gatherer.py 2009-07-24 10:59:45 UTC (rev 1535)
+++ udd/udd/upload_history_gatherer.py 2009-07-24 11:00:34 UTC (rev 1536)
@@ -36,12 +36,12 @@
cursor.execute("PREPARE uh_insert AS INSERT INTO %s (id, package, \
version, date, changed_by, changed_by_name, changed_by_email, maintainer, maintainer_name, maintainer_email, nmu, signed_by, signed_by_name, signed_by_email, key_id, fingerprint) VALUES \
- ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)" % self.my_config['table'])
+ ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)" % self.my_config['table'])
cursor.execute("PREPARE uh_arch_insert AS INSERT INTO %s (id, \
- architecture) VALUES \
- ($1, $2)" % (self.my_config['table'] + '_architecture'))
+ architecture) VALUES \
+ ($1, $2)" % (self.my_config['table'] + '_architecture'))
cursor.execute("PREPARE uh_close_insert AS INSERT INTO %s (id, bug) \
- VALUES ($1, $2)" % (self.my_config['table'] + '_closes'))
+ VALUES ($1, $2)" % (self.my_config['table'] + '_closes'))
id = 0
query = "EXECUTE uh_insert(%(id)s, %(Source)s, %(Version)s, %(Date)s, \
@@ -51,63 +51,56 @@
%(Fingerprint)s)"
query_archs = "EXECUTE uh_arch_insert(%(id)s, %(arch)s)"
query_closes = "EXECUTE uh_close_insert(%(id)s, %(closes)s)"
- uploads = ()
- uploads_archs = ()
- uploads_closes = ()
+ uploads = []
+ uploads_archs = []
+ uploads_closes = []
for name in glob(path + '/debian-devel-changes.*'):
# print name
f = None
if name.endswith(".gz"):
- f = gzip.open(name)
+ f = gzip.open(name)
else:
- f = open(name)
+ f = open(name)
current = {'id': id}
current['Fingerprint'] = 'N/A' # hack: some entries don't have fp
last_field = None
line_count = 0
for line in f:
- line_count += 1
- line = line.strip()
- # Stupid multi-line maintainer fields *grml*
- if line == '':
+ line_count += 1
+ line = line.strip()
+ # Stupid multi-line maintainer fields *grml*
+ if line == '':
current['Changed-By_name'], current['Changed-By_email'] = email.Utils.parseaddr(current['Changed-By'])
current['Maintainer_name'], current['Maintainer_email'] = email.Utils.parseaddr(current['Maintainer'])
current['Signed-By_name'], current['Signed-By_email'] = email.Utils.parseaddr(current['Signed-By'])
- uploads += (current,)
- for arch in set(current['Architecture'].split()):
- current_arch = {'id': id}
- current_arch['arch'] = arch
- uploads_archs += (current_arch,)
- if current['Closes'] != 'N/A':
- for closes in set(current['Closes'].split()):
- current_closes = {'id': id}
- current_closes['closes'] = closes
- uploads_closes += (current_closes,)
- if len(uploads) > 100:
- cursor.executemany(query, uploads)
- cursor.executemany(query_archs, uploads_archs)
- cursor.executemany(query_closes, uploads_closes)
- uploads = ()
- uploads_archs = ()
- uploads_closes = ()
- id += 1
- current = {'id': id}
- current['Fingerprint'] = 'N/A' # hack: some entries don't have fp
- last_field = None
- continue
+ uploads.append(current)
+ for arch in set(current['Architecture'].split()):
+ current_arch = {'id': id}
+ current_arch['arch'] = arch
+ uploads_archs.append(current_arch)
+ if current['Closes'] != 'N/A':
+ for closes in set(current['Closes'].split()):
+ current_closes = {'id': id}
+ current_closes['closes'] = closes
+ uploads_closes.append(current_closes)
+ id += 1
+ current = {'id': id}
+ current['Fingerprint'] = 'N/A' # hack: some entries don't have fp
+ last_field = None
+ continue
- if line.find(':') == -1:
- if not last_field:
- raise Exception, "Format error on line " + line_count + "of file " + name
- current[last_field] += line
- continue
+ if line.find(':') == -1:
+ if not last_field:
+ raise Exception, "Format error on line " + line_count + "of file " + name
+ current[last_field] += line
+ continue
- (field, data) = line.split(':', 1)
- data = data.strip()
- current[field] = data
-
- last_field = field
+ (field, data) = line.split(':', 1)
+ data = data.strip()
+ current[field] = data
+
+ last_field = field
cursor.executemany(query, uploads)
cursor.executemany(query_archs, uploads_archs)
More information about the Collab-qa-commits
mailing list